--- a/src/wifi/model/aarf-wifi-manager.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/aarf-wifi-manager.cc Tue Nov 26 11:54:48 2013 -0500 @@ -31,6 +31,12 @@ namespace ns3 { +/** + * \brief hold per-remote-station state for AARF Wifi manager. + * + * This struct extends from WifiRemoteStation struct to hold additional + * information required by the AARF Wifi manager + */ struct AarfWifiRemoteStation : public WifiRemoteStation { uint32_t m_timer; @@ -123,6 +129,8 @@ * is the initial transmission of a packet or the retransmission of a packet. * The fundamental reason for this is that there is a backoff between each data * transmission, be it an initial transmission or a retransmission. + * + * \param st the station that we failed to send DATA */ void AarfWifiManager::DoReportDataFailed (WifiRemoteStation *st) --- a/src/wifi/model/aarfcd-wifi-manager.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/aarfcd-wifi-manager.cc Tue Nov 26 11:54:48 2013 -0500 @@ -34,6 +34,12 @@ namespace ns3 { +/** + * \brief hold per-remote-station state for AARF-CD Wifi manager. + * + * This struct extends from WifiRemoteStation struct to hold additional + * information required by the AARF-CD Wifi manager + */ struct AarfcdWifiRemoteStation : public WifiRemoteStation { uint32_t m_timer; @@ -149,15 +155,7 @@ { NS_LOG_FUNCTION (this << station); } -/** - * It is important to realize that "recovery" mode starts after failure of - * the first transmission after a rate increase and ends at the first successful - * transmission. Specifically, recovery mode transcends retransmissions boundaries. - * Fundamentally, ARF handles each data transmission independently, whether it - * is the initial transmission of a packet or the retransmission of a packet. - * The fundamental reason for this is that there is a backoff between each data - * transmission, be it an initial transmission or a retransmission. - */ + void AarfcdWifiManager::DoReportDataFailed (WifiRemoteStation *st) { --- a/src/wifi/model/aarfcd-wifi-manager.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/aarfcd-wifi-manager.h Tue Nov 26 11:54:48 2013 -0500 @@ -47,7 +47,19 @@ virtual WifiRemoteStation * DoCreateStation (void) const; virtual void DoReportRxOk (WifiRemoteStation *station, double rxSnr, WifiMode txMode); + virtual void DoReportRtsFailed (WifiRemoteStation *station); + /** + * It is important to realize that "recovery" mode starts after failure of + * the first transmission after a rate increase and ends at the first successful + * transmission. Specifically, recovery mode transcends retransmissions boundaries. + * Fundamentally, ARF handles each data transmission independently, whether it + * is the initial transmission of a packet or the retransmission of a packet. + * The fundamental reason for this is that there is a backoff between each data + * transmission, be it an initial transmission or a retransmission. + * + * \param station the station that we failed to send DATA + */ virtual void DoReportDataFailed (WifiRemoteStation *station); virtual void DoReportRtsOk (WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr); @@ -61,10 +73,35 @@ Ptr packet, bool normally); virtual bool IsLowLatency (void) const; + /** + * Check if the use of RTS for the given station can be turned off. + * + * \param station the station that we are checking + */ void CheckRts (AarfcdWifiRemoteStation *station); + /** + * Increase the RTS window size of the given station. + * + * \param station the station to increase RTS window + */ void IncreaseRtsWnd (AarfcdWifiRemoteStation *station); + /** + * Reset the RTS window of the given station. + * + * \param station the station to reset RTS window + */ void ResetRtsWnd (AarfcdWifiRemoteStation *station); + /** + * Turn off RTS for the given station. + * + * \param station the station to turn RTS off + */ void TurnOffRts (AarfcdWifiRemoteStation *station); + /** + * Turn on RTS for the given station. + * + * \param station the station to turn RTS on + */ void TurnOnRts (AarfcdWifiRemoteStation *station); // aarf fields below --- a/src/wifi/model/amrr-wifi-manager.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/amrr-wifi-manager.cc Tue Nov 26 11:54:48 2013 -0500 @@ -30,6 +30,12 @@ namespace ns3 { +/** + * \brief hold per-remote-station state for AMRR Wifi manager. + * + * This struct extends from WifiRemoteStation struct to hold additional + * information required by the AMRR Wifi manager + */ struct AmrrWifiRemoteStation : public WifiRemoteStation { Time m_nextModeUpdate; --- a/src/wifi/model/arf-wifi-manager.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/arf-wifi-manager.cc Tue Nov 26 11:54:48 2013 -0500 @@ -30,6 +30,12 @@ namespace ns3 { +/** + * \brief hold per-remote-station state for ARF Wifi manager. + * + * This struct extends from WifiRemoteStation struct to hold additional + * information required by the ARF Wifi manager + */ struct ArfWifiRemoteStation : public WifiRemoteStation { uint32_t m_timer; @@ -105,6 +111,8 @@ * is the initial transmission of a packet or the retransmission of a packet. * The fundamental reason for this is that there is a backoff between each data * transmission, be it an initial transmission or a retransmission. + * + * \param st the station that we failed to send DATA */ void ArfWifiManager::DoReportDataFailed (WifiRemoteStation *st) --- a/src/wifi/model/block-ack-agreement.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/block-ack-agreement.h Tue Nov 26 11:54:48 2013 -0500 @@ -33,22 +33,96 @@ friend class MacLow; public: BlockAckAgreement (); + /** + * Constructor for BlockAckAgreement with given peer and TID. + * + * \param peer + * \param tid + */ BlockAckAgreement (Mac48Address peer, uint8_t tid); ~BlockAckAgreement (); + /** + * Set buffer size. + * + * \param bufferSize + */ void SetBufferSize (uint16_t bufferSize); + /** + * Set timeout. + * + * \param timeout + */ void SetTimeout (uint16_t timeout); + /** + * Set starting sequence number. + * + * \param seq the starting sequence number + */ void SetStartingSequence (uint16_t seq); + /** + * Set Block ACK policy to immediate ACK. + */ void SetImmediateBlockAck (void); + /** + * Set Block ACK policy to delayed ACK. + */ void SetDelayedBlockAck (void); + /** + * Enable or disable A-MSDU support. + * + * \param supported enable or disable A-MSDU support + */ void SetAmsduSupport (bool supported); + /** + * Return the Traffic ID (TID). + * + * \return TID + */ uint8_t GetTid (void) const; + /** + * Return the peer address. + * + * \return Mac48Address + */ Mac48Address GetPeer (void) const; + /** + * Return the buffer size. + * + * \return buffer size + */ uint16_t GetBufferSize (void) const; + /** + * Return the timeout. + * + * \return timeout + */ uint16_t GetTimeout (void) const; + /** + * Return the starting squence number. + * + * \return starting sequence number + */ uint16_t GetStartingSequence (void) const; + /** + * Return the starting squence control + * + * \return starting sequence control + */ uint16_t GetStartingSequenceControl (void) const; + /** + * Check whether the current ACK policy is immediate block ACK. + * + * \return true if the current ACK policy is immediate block ACK, + * false otherwise + */ bool IsImmediateBlockAck (void) const; + /** + * Check whether A-MSDU is supported + * + * \return true if A-MSDU is supported, + * false otherwise + */ bool IsAmsduSupported (void) const; protected: --- a/src/wifi/model/block-ack-manager.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/block-ack-manager.h Tue Nov 26 11:54:48 2013 -0500 @@ -47,6 +47,15 @@ struct Bar { Bar (); + /** + * Construct Block ACK request for a given packet, + * receiver address, Traffic ID, and ACK policy. + * + * \param packet + * \param recipient + * \param tid + * \param immediate + */ Bar (Ptr packet, Mac48Address recipient, uint8_t tid, @@ -73,6 +82,7 @@ /** * \param recipient Address of peer station involved in block ack mechanism. * \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 * recipient for tid tid. @@ -82,7 +92,8 @@ * \param recipient Address of peer station involved in block ack mechanism. * \param tid Traffic ID. * \param state The state for block ack agreement - + * \return true if a block ack agreement exists, false otherwise + * * Checks if a block ack agreement with a state equals to state exists with * station addressed by recipient for tid tid. */ @@ -122,6 +133,7 @@ void StorePacket (Ptr packet, const WifiMacHeader &hdr, Time tStamp); /** * \param hdr 802.11 header of returned packet (if exists). + * \return the packet * * This methods returns a packet (if exists) indicated as not received in * corresponding block ack bitmap. @@ -131,6 +143,9 @@ /** * Returns true if there are packets that need of retransmission or at least a * BAR is scheduled. Returns false otherwise. + * + * \return true if there are packets that need of retransmission or at least a + * BAR is scheduled, false otherwise */ bool HasPackets (void) const; /** @@ -146,6 +161,7 @@ /** * \param 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. This methods doesn't return * number of buffered MPDUs but number of buffered MSDUs. @@ -154,6 +170,7 @@ /** * \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. * This method doesn't return number of MPDUs that need retransmission but number of MSDUs. @@ -216,12 +233,16 @@ /** * \param sequenceNumber Sequence number of the packet which fragment is * part of. + * \return true if another fragment with the given sequence number is scheduled + * for retransmission. * * Returns true if another fragment with sequence number sequenceNumber is scheduled * for retransmission. */ bool HasOtherFragments (uint16_t sequenceNumber) const; /** + * \return the size of the next packet that needs retransmission + * * Returns size of the next packet that needs retransmission. */ uint32_t GetNextPacketSize (void) const; @@ -238,6 +259,12 @@ void SetBlockDestinationCallback (Callback callback); void SetUnblockDestinationCallback (Callback callback); /** + * \param recipient + * \param tid + * \param startingSeq + * \return true if there are packets in the queue that could be sent under block ACK, + * false otherwise + * * Checks if there are in the queue other packets that could be send under block ack. * If yes adds these packets in current block ack exchange. * However, number of packets exchanged in the current block ack, will not exceed @@ -245,6 +272,10 @@ */ bool SwitchToBlockAckIfNeeded (Mac48Address recipient, uint8_t tid, uint16_t startingSeq); /** + * \param recipient + * \param tid + * \return the sequence number of the next retry packet for a specific agreement + * * Returns the sequence number of the next retry packet for a specific agreement. * If there are no packets that need retransmission for the specified agreement or * the agreement doesn't exist the function returns 4096; @@ -252,6 +283,10 @@ uint16_t GetSeqNumOfNextRetryPacket (Mac48Address recipient, uint8_t tid) const; private: /** + * \param recipient + * \param tid + * \return a packet + * * Checks if all packets, for which a block ack agreement was established or refreshed, * have been transmitted. If yes, adds a pair in m_bAckReqs to indicate that * at next channel access a block ack request (for established agreement @@ -265,17 +300,39 @@ void InactivityTimeout (Mac48Address, uint8_t); struct Item; + /** + * typedef for a list of Item struct. + */ typedef std::list PacketQueue; + /** + * typedef for an iterator for PacketQueue. + */ typedef std::list::iterator PacketQueueI; + /** + * typedef for a const iterator for PacketQueue. + */ typedef std::list::const_iterator PacketQueueCI; + /** + * typedef for a map between MAC address and block ACK agreement. + */ typedef std::map, std::pair > Agreements; + /** + * typedef for an iterator for Agreements. + */ typedef std::map, std::pair >::iterator AgreementsI; + /** + * typedef for a const iterator for Agreements. + */ typedef std::map, std::pair >::const_iterator AgreementsCI; + /** + * A struct for packet, Wifi header, and timestamp. + * Used in queue by block ACK manager. + */ struct Item { Item (); --- a/src/wifi/model/capability-information.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/capability-information.h Tue Nov 26 11:54:48 2013 -0500 @@ -28,25 +28,84 @@ /** * \ingroup wifi * - * + * Capability information */ class CapabilityInformation { public: CapabilityInformation (); + /** + * Set the Extended Service Set (ESS) bit + * in the capability information field. + */ void SetEss (void); + /** + * Set the Independent BSS (IBSS) bit + * in the capability information field. + */ void SetIbss (void); + /** + * Check if the Extended Service Set (ESS) bit + * in the capability information field is set to 1. + * + * \return ESS bit in the capability information + * field is set to 1 + */ bool IsEss (void) const; + /** + * Check if the Independent BSS (IBSS) bit + * in the capability information field is set to 1. + * + * \return IBSS bit in the capability information + * field is set to 1 + */ bool IsIbss (void) const; + /** + * Return the serialized size of capability + * information. + * + * \return the serialized size + */ uint32_t GetSerializedSize (void) const; + /** + * Serialize capability information to the given buffer. + * + * \param start an iterator to a buffer + * \return an iterator to a buffer after capability information + * was serialized + */ Buffer::Iterator Serialize (Buffer::Iterator start) const; + /** + * Deserialize capability information from the given buffer. + * + * \param start an iterator to a buffer + * \return an iterator to a buffer after capability information + * was deserialized + */ Buffer::Iterator Deserialize (Buffer::Iterator start); private: + /** + * Check if bit n is set to 1. + * + * \param n the bit position + * \return true if bit n is set to 1, + * false otherwise + */ bool Is (uint8_t n) const; + /** + * Set bit n to 1. + * + * \param n the bit position + */ void Set (uint8_t n); + /** + * Set bit n to 0. + * + * \param n the bit position + */ void Clear (uint8_t n); uint16_t m_capability; }; --- a/src/wifi/model/cara-wifi-manager.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/cara-wifi-manager.cc Tue Nov 26 11:54:48 2013 -0500 @@ -32,6 +32,12 @@ namespace ns3 { +/** + * \brief hold per-remote-station state for CARA Wifi manager. + * + * This struct extends from WifiRemoteStation struct to hold additional + * information required by the CARA Wifi manager + */ struct CaraWifiRemoteStation : public WifiRemoteStation { uint32_t m_timer; --- a/src/wifi/model/dca-txop.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/dca-txop.cc Tue Nov 26 11:54:48 2013 -0500 @@ -69,9 +69,17 @@ DcaTxop *m_txop; }; +/** + * Listener for MacLow events. Forwards to DcaTxop. + */ class DcaTxop::TransmissionListener : public MacLowTransmissionListener { public: + /** + * Create a TransmissionListener for the given DcaTxop. + * + * \param txop + */ TransmissionListener (DcaTxop * txop) : MacLowTransmissionListener (), m_txop (txop) { --- a/src/wifi/model/dca-txop.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/dca-txop.h Tue Nov 26 11:54:48 2013 -0500 @@ -75,8 +75,23 @@ DcaTxop (); ~DcaTxop (); + /** + * Set MacLow associated with this DcaTxop. + * + * \param low MacLow + */ void SetLow (Ptr low); + /** + * Set DcfManager this DcaTxop is associated to. + * + * \param manager DcfManager + */ void SetManager (DcfManager *manager); + /** + * Set WifiRemoteStationsManager this DcaTxop is associated to. + * + * \param remoteManager WifiRemoteStationManager + */ void SetWifiRemoteStationManager (Ptr remoteManager); /** @@ -90,6 +105,11 @@ */ void SetTxFailedCallback (TxFailed callback); + /** + * Return the packet queue associated with this DcaTxop. + * + * \return WifiMacQueue + */ Ptr GetQueue () const; virtual void SetMinCw (uint32_t minCw); virtual void SetMaxCw (uint32_t maxCw); @@ -129,6 +149,11 @@ DcaTxop (const DcaTxop &o); // Inherited from ns3::Object + /** + * Return the MacLow associated with this DcaTxop. + * + * \return MacLow + */ Ptr Low (void); void DoInitialize (); /* dcf notifications forwarded here */ @@ -137,16 +162,39 @@ void NotifyInternalCollision (void); void NotifyCollision (void); /** - * When a channel switching occurs, enqueued packets are removed. - */ + * When a channel switching occurs, enqueued packets are removed. + */ void NotifyChannelSwitching (void); - /* event handlers */ + + /* Event handlers */ + /** + * Event handler when a CTS is received. + * + * \param snr + * \param txMode + */ void GotCts (double snr, WifiMode txMode); + /** + * Event handler when a CTS timeout has occurred. + */ void MissedCts (void); + /** + * Event handler when an ACK is received. + * + * \param snr + * \param txMode + */ void GotAck (double snr, WifiMode txMode); + /** + * Event handler when an ACK is received. + */ void MissedAck (void); void StartNext (void); void Cancel (void); + /** + * Event handler when a transmission that + * does not require an ACK has completed. + */ void EndTxNoAck (void); void RestartAccessIfNeeded (void); @@ -155,11 +203,44 @@ bool NeedRtsRetransmission (void); bool NeedDataRetransmission (void); bool NeedFragmentation (void); + /** + * Calculate the size of the next fragment. + * + * \return the size of the next fragment + */ uint32_t GetNextFragmentSize (void); + /** + * Calculate the size of the current fragment. + * + * \return the size of the current fragment + */ uint32_t GetFragmentSize (void); + /** + * Calculate the offset for the current fragment. + * + * \return the offset for the current fragment + */ uint32_t GetFragmentOffset (void); + /** + * Check if the curren fragment is the last fragment. + * + * \return true if the curren fragment is the last fragment, + * false otherwise + */ bool IsLastFragment (void); + /** + * Continue to the next fragment. This method simply + * increments the internal variable that keep track + * of the current fragment number. + */ void NextFragment (void); + /** + * Get the next fragment from the packet with + * appropriate Wifi header for the fragment. + * + * \param hdr + * \return the fragment with the current fragment number + */ Ptr GetFragmentPacket (WifiMacHeader *hdr); virtual void DoDispose (void); --- a/src/wifi/model/dcf-manager.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/dcf-manager.cc Tue Nov 26 11:54:48 2013 -0500 @@ -163,13 +163,17 @@ } -/*************************************************************** - * Listener for Nav events. Forwards to DcfManager - ***************************************************************/ - +/** + * Listener for NAV events. Forwards to DcfManager + */ class LowDcfListener : public ns3::MacLowDcfListener { public: + /** + * Create a LowDcfListener for the given DcfManager. + * + * \param dcf + */ LowDcfListener (ns3::DcfManager *dcf) : m_dcf (dcf) { @@ -205,13 +209,17 @@ ns3::DcfManager *m_dcf; }; -/*************************************************************** - * Listener for PHY events. Forwards to DcfManager - ***************************************************************/ - +/** + * Listener for PHY events. Forwards to DcfManager + */ class PhyListener : public ns3::WifiPhyListener { public: + /** + * Create a PhyListener for the given DcfManager. + * + * \param dcf + */ PhyListener (ns3::DcfManager *dcf) : m_dcf (dcf) { --- a/src/wifi/model/dcf-manager.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/dcf-manager.h Tue Nov 26 11:54:48 2013 -0500 @@ -57,10 +57,35 @@ * Calling this method after DcfManager::Add has been called is not recommended. */ void SetAifsn (uint32_t aifsn); + /** + * Set the minimum congestion window size. + * + * \param minCw the minimum congestion window size + */ void SetCwMin (uint32_t minCw); + /** + * Set the maximum congestion window size. + * + * \param maxCw the maximum congestion window size + */ void SetCwMax (uint32_t maxCw); + /** + * Return the number of slots that make up an AIFS. + * + * \return the number of slots that make up an AIFS + */ uint32_t GetAifsn (void) const; + /** + * Return the minimum congestion window size. + * + * \return the minimum congestion window size + */ uint32_t GetCwMin (void) const; + /** + * Return the maximum congestion window size. + * + * \return the maximum congestion window size + */ uint32_t GetCwMax (void) const; /** * Update the value of the CW variable to take into account @@ -286,10 +311,57 @@ void NotifyCtsTimeoutResetNow (); private: void UpdateBackoff (void); + /** + * Return the most recent time. + * + * \param a + * \param b + * \return the most recent time + */ Time MostRecent (Time a, Time b) const; + /** + * Return the most recent time. + * + * \param a + * \param b + * \param c + * \return the most recent time + */ Time MostRecent (Time a, Time b, Time c) const; + /** + * Return the most recent time. + * + * \param a + * \param b + * \param c + * \param d + * \return the most recent time + */ Time MostRecent (Time a, Time b, Time c, Time d) const; + /** + * Return the most recent time. + * + * \param a + * \param b + * \param c + * \param d + * \param e + * \param f + * \return the most recent time + */ Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const; + /** + * Return the most recent time. + * + * \param a + * \param b + * \param c + * \param d + * \param e + * \param f + * \param g + * \return the most recent time + */ Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const; /** * Access will never be granted to the medium _before_ --- a/src/wifi/model/dcf.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/dcf.h Tue Nov 26 11:54:48 2013 -0500 @@ -34,11 +34,42 @@ public: static TypeId GetTypeId (void); + /** + * Set the minimum congestion window size. + * + * \param minCw the minimum congestion window size + */ virtual void SetMinCw (uint32_t minCw) = 0; + /** + * Set the maximum congestion window size. + * + * \param maxCw the maximum congestion window size + */ virtual void SetMaxCw (uint32_t maxCw) = 0; + /** + * \param aifsn the number of slots which make up an AIFS for a specific DCF. + * a DIFS corresponds to an AIFSN = 2. + * + * Calling this method after DcfManager::Add has been called is not recommended. + */ virtual void SetAifsn (uint32_t aifsn) = 0; + /** + * Return the minimum congestion window size. + * + * \return the minimum congestion window size + */ virtual uint32_t GetMinCw (void) const = 0; + /** + * Return the maximum congestion window size. + * + * \return the maximum congestion window size + */ virtual uint32_t GetMaxCw (void) const = 0; + /** + * Return the number of slots that make up an AIFS. + * + * \return the number of slots that make up an AIFS + */ virtual uint32_t GetAifsn (void) const = 0; }; --- a/src/wifi/model/edca-txop-n.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/edca-txop-n.h Tue Nov 26 11:54:48 2013 -0500 @@ -88,15 +88,35 @@ virtual ~EdcaTxopN (); void DoDispose (); + /** + * Set MacLow associated with this EdcaTxopN. + * + * \param low MacLow + */ void SetLow (Ptr low); void SetTxMiddle (MacTxMiddle *txMiddle); + /** + * Set DcfManager this EdcaTxopN is associated to. + * + * \param manager DcfManager + */ void SetManager (DcfManager *manager); void SetTxOkCallback (TxOk callback); void SetTxFailedCallback (TxFailed callback); + /** + * Set WifiRemoteStationsManager this EdcaTxopN is associated to. + * + * \param remoteManager WifiRemoteStationManager + */ void SetWifiRemoteStationManager (Ptr remoteManager); void SetTypeOfStation (enum TypeOfStation type); enum TypeOfStation GetTypeOfStation (void) const; + /** + * Return the packet queue associated with this EdcaTxopN. + * + * \return WifiMacQueue + */ Ptr GetQueue () const; virtual void SetMinCw (uint32_t minCw); virtual void SetMaxCw (uint32_t maxCw); @@ -105,6 +125,11 @@ virtual uint32_t GetMaxCw (void) const; virtual uint32_t GetAifsn (void) const; + /** + * Return the MacLow associated with this EdcaTxopN. + * + * \return MacLow + */ Ptr Low (void); Ptr GetMsduAggregator (void) const; @@ -114,21 +139,52 @@ void NotifyInternalCollision (void); void NotifyCollision (void); /** - * When a channel switching occurs, enqueued packets are removed. - */ + * When a channel switching occurs, enqueued packets are removed. + */ void NotifyChannelSwitching (void); - /*event handlers*/ + /* Event handlers */ + /** + * Event handler when a CTS is received. + * + * \param snr + * \param txMode + */ void GotCts (double snr, WifiMode txMode); + /** + * Event handler when a CTS timeout has occurred. + */ void MissedCts (void); + /** + * Event handler when an ACK is received. + * + * \param snr + * \param txMode + */ void GotAck (double snr, WifiMode txMode); + /** + * Event handler when a Block ACK is received. + * + * \param blockAck + * \param recipient + */ void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient); + /** + * Event handler when a Block ACK timeout has occurred. + */ void MissedBlockAck (void); void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient); void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient); + /** + * Event handler when an ACK is received. + */ void MissedAck (void); void StartNext (void); void Cancel (void); + /** + * Event handler when a transmission that + * does not require an ACK has completed. + */ void EndTxNoAck (void); void RestartAccessIfNeeded (void); @@ -137,19 +193,80 @@ bool NeedRtsRetransmission (void); bool NeedDataRetransmission (void); bool NeedFragmentation (void) const; + /** + * Calculate the size of the next fragment. + * + * \return the size of the next fragment + */ uint32_t GetNextFragmentSize (void); + /** + * Calculate the size of the current fragment. + * + * \return the size of the current fragment + */ uint32_t GetFragmentSize (void); + /** + * Calculate the offset for the current fragment. + * + * \return the offset for the current fragment + */ uint32_t GetFragmentOffset (void); + /** + * Check if the curren fragment is the last fragment. + * + * \return true if the curren fragment is the last fragment, + * false otherwise + */ bool IsLastFragment (void) const; + /** + * Continue to the next fragment. This method simply + * increments the internal variable that keep track + * of the current fragment number. + */ void NextFragment (void); + /** + * Get the next fragment from the packet with + * appropriate Wifi header for the fragment. + * + * \param hdr + * \return the fragment with the current fragment number + */ Ptr GetFragmentPacket (WifiMacHeader *hdr); void SetAccessCategory (enum AcIndex ac); + /** + * \param packet packet to send + * \param hdr header of packet to send. + * + * Store the packet in the internal queue until it + * can be sent safely. + */ void Queue (Ptr packet, const WifiMacHeader &hdr); void SetMsduAggregator (Ptr 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 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 + */ 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; void SetBlockAckInactivityTimeout (uint16_t timeout); void SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator); @@ -174,6 +291,9 @@ * If aggregating sta is an AP * SA = Address3 * DA = Address1 + * + * \param hdr + * \return Mac48Address */ Mac48Address MapSrcAddressForAggregation (const WifiMacHeader &hdr); Mac48Address MapDestAddressForAggregation (const WifiMacHeader &hdr); --- a/src/wifi/model/error-rate-model.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/error-rate-model.h Tue Nov 26 11:54:48 2013 -0500 @@ -55,6 +55,7 @@ * \param mode the Wi-Fi mode the chunk is sent * \param snr the SNR of the chunk * \param nbits the number of bits in this chunk + * \return probability of successfully receiving the chunk */ virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const = 0; }; --- a/src/wifi/model/ht-capabilities.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/ht-capabilities.h Tue Nov 26 11:54:48 2013 -0500 @@ -72,13 +72,23 @@ void SerializeInformationField (Buffer::Iterator start) const; uint8_t DeserializeInformationField (Buffer::Iterator start, uint8_t length); - /* + /** * This information element is a bit special in that it is only * included if the STA is an HT STA. To support this we * override the Serialize and GetSerializedSize methods of * WifiInformationElement. + * + * \param start + * \return an iterator */ Buffer::Iterator Serialize (Buffer::Iterator start) const; + /** + * Return the serialized size of this HT capability + * information element. + * + * \return the serialized size of this HT capability + * information element + */ uint16_t GetSerializedSize () const; private: --- a/src/wifi/model/ideal-wifi-manager.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/ideal-wifi-manager.cc Tue Nov 26 11:54:48 2013 -0500 @@ -27,6 +27,12 @@ namespace ns3 { +/** + * \brief hold per-remote-station state for Ideal Wifi manager. + * + * This struct extends from WifiRemoteStation struct to hold additional + * information required by the Ideal Wifi manager + */ struct IdealWifiRemoteStation : public WifiRemoteStation { double m_lastSnr; --- a/src/wifi/model/mac-low.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/mac-low.cc Tue Nov 26 11:54:48 2013 -0500 @@ -243,14 +243,17 @@ } -/*************************************************************** - * Listener for PHY events. Forwards to MacLow - ***************************************************************/ - - +/** + * Listener for PHY events. Forwards to MacLow + */ class PhyMacLowListener : public ns3::WifiPhyListener { public: + /** + * Create a PhyMacLowListener for the given MacLow. + * + * \param macLow + */ PhyMacLowListener (ns3::MacLow *macLow) : m_macLow (macLow) { --- a/src/wifi/model/mac-low.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/mac-low.h Tue Nov 26 11:54:48 2013 -0500 @@ -150,16 +150,36 @@ MacLowDcfListener (); virtual ~MacLowDcfListener (); /** + * Norify that NAV has started for the given duration. + * * \param duration duration of NAV timer */ virtual void NavStart (Time duration) = 0; /** + * Notify that NAV has resetted. + * * \param duration duration of NAV timer */ virtual void NavReset (Time duration) = 0; + /** + * Notify that ACK timeout has started for a given duration. + * + * \param duration duration of ACK timeout + */ virtual void AckTimeoutStart (Time duration) = 0; + /** + * Notify that ACK timeout has resetted. + */ virtual void AckTimeoutReset () = 0; + /** + * Notify that CTS timeout has started for a given duration. + * + * \param duration duration of CTS timeout + */ virtual void CtsTimeoutStart (Time duration) = 0; + /** + * Notify that CTS timeout has resetted. + */ virtual void CtsTimeoutReset () = 0; }; @@ -180,6 +200,9 @@ * agreement. Timer is reset when a frame with ack policy block ack * or a block ack request are received. When this timer reaches zero * this method is called and a delba frame is scheduled for transmission. + * + * \param originator MAC address of the data originator + * \param tid */ virtual void BlockAckInactivityTimeout (Mac48Address originator, uint8_t tid) = 0; }; @@ -385,31 +408,154 @@ MacLow (); virtual ~MacLow (); + /** + * Set up WifiPhy associated with this MacLow. + * + * \param phy WifiPhy associated with this MacLow + */ void SetPhy (Ptr phy); + /** + * Set up WifiRemoteStationManager associated with this MacLow. + * + * \param manager WifiRemoteStationManager associated with this MacLow + */ void SetWifiRemoteStationManager (Ptr manager); + /** + * Set MAC address of this MacLow. + * + * \param ad Mac48Address of this MacLow + */ void SetAddress (Mac48Address ad); + /** + * Set ACK timeout of this MacLow. + * + * \param ackTimeout ACK timeout of this MacLow + */ void SetAckTimeout (Time ackTimeout); + /** + * Set Basic Block ACK timeout of this MacLow. + * + * \param blockAckTimeout Basic Block ACK timeout of this MacLow + */ void SetBasicBlockAckTimeout (Time blockAckTimeout); + /** + * Set Compressed Block ACK timeout of this MacLow. + * + * \param blockAckTimeout Compressed Block ACK timeout of this MacLow + */ void SetCompressedBlockAckTimeout (Time blockAckTimeout); + /** + * Enable or disable CTS-to-self capability. + * + * \param enable Enable or disable CTS-to-self capability + */ void SetCtsToSelfSupported (bool enable); + /** + * Set CTS timeout of this MacLow. + * + * \param ctsTimeout CTS timeout of this MacLow + */ void SetCtsTimeout (Time ctsTimeout); + /** + * Set Short Interframe Space (SIFS) of this MacLow. + * + * \param sifs SIFS of this MacLow + */ void SetSifs (Time sifs); + /** + * Set Reduced Interframe Space (RIFS) of this MacLow. + * + * \param rifs RIFS of this MacLow + */ void SetRifs (Time rifs); + /** + * Set slot duration of this MacLow. + * + * \param slotTime slot duration of this MacLow + */ void SetSlotTime (Time slotTime); + /** + * Set PCF Interframe Space (PIFS) of this MacLow. + * + * \param pifs PIFS of this MacLow + */ void SetPifs (Time pifs); + /** + * Set the Basic Service Set Identification. + * + * \param ad the BSSID + */ void SetBssid (Mac48Address ad); + /** + * Enable promiscuous mode. + */ void SetPromisc (void); + /** + * Return whether CTS-to-self capability is supported. + * + * \return true if CTS-to-self is supported, false otherwise + */ bool GetCtsToSelfSupported () const; + /** + * Return the MAC address of this MacLow. + * + * \return Mac48Address of this MacLow + */ Mac48Address GetAddress (void) const; + /** + * Return ACK timeout of this MacLow. + * + * \return ACK timeout + */ Time GetAckTimeout (void) const; + /** + * Return Basic Block ACK timeout of this MacLow. + * + * \return Basic Block ACK timeout + */ Time GetBasicBlockAckTimeout () const; + /** + * Return Compressed Block ACK timeout of this MacLow. + * + * \return Compressed Block ACK timeout + */ Time GetCompressedBlockAckTimeout () const; + /** + * Return CTS timeout of this MacLow. + * + * \return CTS timeout + */ Time GetCtsTimeout (void) const; + /** + * Return Short Interframe Space (SIFS) of this MacLow. + * + * \return SIFS + */ Time GetSifs (void) const; + /** + * Return slot duration of this MacLow. + * + * \return slot duration + */ Time GetSlotTime (void) const; + /** + * Return PCF Interframe Space (PIFS) of this MacLow. + * + * \return PIFS + */ Time GetPifs (void) const; + /** + * Return Reduced Interframe Space (RIFS) of this MacLow. + * + * \return RIFS + */ Time GetRifs (void) const; + /** + * Return the Basic Service Set Identification. + * + * \return BSSID + */ Mac48Address GetBssid (void) const; /** @@ -429,6 +575,7 @@ * \param packet to send (does not include the 802.11 MAC header and checksum) * \param hdr header associated to the packet to send. * \param parameters transmission parameters of packet. + * \return the transmission time that includes the time for the next packet transmission * * This transmission time includes the time required for * the next packet transmission if one was selected. @@ -513,61 +660,324 @@ */ void RegisterBlockAckListenerForAc (enum AcIndex ac, MacLowBlockAckEventListener *listener); private: + /** + * Cancel all scheduled events. Called before beginning a transmission + * or switching channel. + */ void CancelAllEvents (void); + /** + * Return the total ACK size (including FCS trailer). + * + * \return the total ACK size + */ uint32_t GetAckSize (void) const; + /** + * Return the total Block ACK size (including FCS trailer). + * + * \param type the Block ACK type + * \return the total Block ACK size + */ uint32_t GetBlockAckSize (enum BlockAckType type) const; + /** + * Return the total RTS size (including FCS trailer). + * + * \return the total RTS size + */ uint32_t GetRtsSize (void) const; + /** + * Return the total CTS size (including FCS trailer). + * + * \return the total CTS size + */ uint32_t GetCtsSize (void) const; + /** + * Return the total size of the packet after WifiMacHeader and FCS trailer + * have been added. + * + * \param packet the packet to be encapsulated with WifiMacHeader and FCS trailer + * \param hdr the WifiMacHeader + * \return the total packet size + */ uint32_t GetSize (Ptr packet, const WifiMacHeader *hdr) const; + /** + * Forward the packet down to WifiPhy for transmission. + * + * \param packet + * \param hdr + * \param txVector + * \param preamble + */ void ForwardDown (Ptr packet, const WifiMacHeader *hdr, WifiTxVector txVector, WifiPreamble preamble); + /** + * Return a TXVECTOR for the RTS frame given the destination. + * The function consults WifiRemoteStationManager, which controls the rate + * to different destinations. + * + * \param packet the packet being asked for RTS TXVECTOR + * \param hdr the WifiMacHeader + * \return TXVECTOR for the RTS of the given packet + */ WifiTxVector GetRtsTxVector (Ptr packet, const WifiMacHeader *hdr) const; + /** + * Return a TXVECTOR for the DATA frame given the destination. + * The function consults WifiRemoteStationManager, which controls the rate + * to different destinations. + * + * \param packet the packet being asked for TXVECTOR + * \param hdr the WifiMacHeader + * \return TXVECTOR for the given packet + */ WifiTxVector GetDataTxVector (Ptr packet, const WifiMacHeader *hdr) const; + /** + * Return a TXVECTOR for the CTS frame given the destination and the mode of the RTS + * used by the sender. + * The function consults WifiRemoteStationManager, which controls the rate + * to different destinations. + * + * \param to the MAC address of the CTS receiver + * \param rtsTxMode the mode of the RTS used by the sender + * \return TXVECTOR for the CTS + */ WifiTxVector GetCtsTxVector (Mac48Address to, WifiMode rtsTxMode) const; + /** + * Return a TXVECTOR for the ACK frame given the destination and the mode of the DATA + * used by the sender. + * The function consults WifiRemoteStationManager, which controls the rate + * to different destinations. + * + * \param to the MAC address of the ACK receiver + * \param dataTxMode the mode of the DATA used by the sender + * \return TXVECTOR for the ACK + */ WifiTxVector GetAckTxVector (Mac48Address to, WifiMode dataTxMode) const; + /** + * Return a TXVECTOR for the Block ACK frame given the destination and the mode of the DATA + * used by the sender. + * The function consults WifiRemoteStationManager, which controls the rate + * to different destinations. + * + * \param to the MAC address of the Block ACK receiver + * \param dataTxMode the mode of the DATA used by the sender + * \return TXVECTOR for the Block ACK + */ WifiTxVector GetBlockAckTxVector (Mac48Address to, WifiMode dataTxMode) const; + /** + * Return a TXVECTOR for the CTS-to-self frame. + * The function consults WifiRemoteStationManager, which controls the rate + * to different destinations. + * + * \param packet the packet that requires CTS-to-self + * \param hdr the Wifi header of the packet + * \return TXVECTOR for the CTS-to-self operation + */ WifiTxVector GetCtsToSelfTxVector (Ptr packet, const WifiMacHeader *hdr) const; + /** + * Return a TXVECTOR for the CTS frame given the destination and the mode of the RTS + * used by the sender. + * The function consults WifiRemoteStationManager, which controls the rate + * to different destinations. + * + * \param to the MAC address of the CTS receiver + * \param rtsTxMode the mode of the RTS used by the sender + * \return TXVECTOR for the CTS + */ WifiTxVector GetCtsTxVectorForRts (Mac48Address to, WifiMode rtsTxMode) const; + /** + * Return a TXVECTOR for the Block ACK frame given the destination and the mode of the DATA + * used by the sender. + * The function consults WifiRemoteStationManager, which controls the rate + * to different destinations. + * + * \param to the MAC address of the Block ACK receiver + * \param dataTxMode the mode of the DATA used by the sender + * \return TXVECTOR for the Block ACK + */ WifiTxVector GetAckTxVectorForData (Mac48Address to, WifiMode dataTxMode) const; + /** + * Return the time required to transmit the CTS (including preamble and FCS). + * + * \param ctsTxVector + * \return the time required to transmit the CTS (including preamble and FCS) + */ Time GetCtsDuration (WifiTxVector ctsTxVector) const; + /** + * Return the time required to transmit the CTS to the specified address + * given the TXVECTOR of the RTS (including preamble and FCS). + * + * \param to + * \param rtsTxVector + * \return the time required to transmit the CTS (including preamble and FCS) + */ Time GetCtsDuration (Mac48Address to, WifiTxVector rtsTxVector) const; + /** + * Return the time required to transmit the ACK (including preamble and FCS). + * + * \param ackTxVector + * \return the time required to transmit the ACK (including preamble and FCS) + */ Time GetAckDuration (WifiTxVector ackTxVector) const; + /** + * Return the time required to transmit the ACK to the specified address + * given the TXVECTOR of the DATA (including preamble and FCS). + * + * \param to + * \param dataTxVector + * \return the time required to transmit the ACK (including preamble and FCS) + */ Time GetAckDuration (Mac48Address to, WifiTxVector dataTxVector) const; Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const; + /** + * Check if CTS-to-self mechanism should be used for the current packet. + * + * \return true if CTS-to-self mechanism should be used for the current packet, + * false otherwise + */ bool NeedCtsToSelf (void); Time CalculateOverallTxTime (Ptr packet, const WifiMacHeader* hdr, const MacLowTransmissionParameters ¶ms) const; void NotifyNav (Ptr packet,const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble); + /** + * Reset NAV with the given duration. + * + * \param duration + */ void DoNavResetNow (Time duration); + /** + * Start NAV with the given duration. + * + * \param duration + * \return true if NAV is resetted + */ bool DoNavStartNow (Time duration); + /** + * Check if NAV is zero. + * + * \return true if NAV is zero, + * false otherwise + */ bool IsNavZero (void) const; + /** + * Notify DcfManager (via DcfListener) that + * ACK timer should be started for the given + * duration. + * + * \param duration + */ void NotifyAckTimeoutStartNow (Time duration); + /** + * Notify DcfManager (via DcfListener) that + * ACK timer should be resetted. + */ void NotifyAckTimeoutResetNow (); + /** + * Notify DcfManager (via DcfListener) that + * CTS timer should be started for the given + * duration. + * + * \param duration + */ void NotifyCtsTimeoutStartNow (Time duration); + /** + * Notify DcfManager (via DcfListener) that + * CTS timer should be resetted. + */ void NotifyCtsTimeoutResetNow (); + /** + * Reset NAV after CTS was missed when the NAV was + * setted with RTS. + * + * \param rtsEndRxTime + */ void NavCounterResetCtsMissed (Time rtsEndRxTime); + + /* Event handlers */ + /** + * Event handler when normal ACK timeout occurs. + */ void NormalAckTimeout (void); + /** + * Event handler when fast ACK timeout occurs (idle). + */ void FastAckTimeout (void); + /** + * Event handler when super fast ACK timeout occurs. + */ void SuperFastAckTimeout (void); + /** + * Event handler when fast ACK timeout occurs (busy). + */ void FastAckFailedTimeout (void); + /** + * Event handler when block ACK timeout occurs. + */ void BlockAckTimeout (void); + /** + * Event handler when CTS timeout occurs. + */ void CtsTimeout (void); + /** + * Send CTS for a CTS-to-self mechanism. + */ void SendCtsToSelf (void); + /** + * Send CTS after receiving RTS. + * + * \param source + * \param duration + * \param txMode + * \param rtsSnr + */ void SendCtsAfterRts (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr); - void SendAckAfterData (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr); + /** + * Send ACK after receiving DATA. + * + * \param source + * \param duration + * \param dataTxMode + * \param dataSnr + */ + void SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr); + /** + * Send DATA after receiving CTS. + * + * \param source + * \param duration + * \param txMode + */ void SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode); + /** + * Event handler that is usually scheduled to fired at the appropriate time + * after completing transmissions. + */ void WaitSifsAfterEndTx (void); + /** + * A transmission that does not require an ACK has completed. + */ void EndTxNoAck (void); + /** + * Send RTS to begin RTS-CTS-DATA-ACK transaction. + */ void SendRtsForPacket (void); + /** + * Send DATA packet, which can be DATA-ACK or + * RTS-CTS-DATA-ACK transaction. + */ void SendDataPacket (void); + /** + * Start a DATA timer by scheduling appropriate + * ACK timeout. + * + * \param dataTxVector + */ void StartDataTxTimers (WifiTxVector dataTxVector); virtual void DoDispose (void); /** @@ -599,31 +1009,55 @@ * circularly modulo 2^12. */ bool StoreMpduIfNeeded (Ptr packet, WifiMacHeader hdr); - /* + /** * Invoked after that a block ack request has been received. Looks for corresponding * block ack agreement and creates block ack bitmap on a received packets basis. + * + * \param reqHdr + * \param originator + * \param duration + * \param blockAckReqTxMode */ void SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Mac48Address originator, Time duration, WifiMode blockAckReqTxMode); - /* + /** * This method creates block ack frame with header equals to blockAck and start its transmission. + * + * \param blockAck + * \param originator + * \param immediate + * \param duration + * \param blockAckReqTxMode */ void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate, Time duration, WifiMode blockAckReqTxMode); - /* + /** * Every time that a block ack request or a packet with ack policy equals to block ack * are received, if a relative block ack agreement exists and the value of inactivity timeout * is not 0, the timer is reset. * see section 11.5.3 in IEEE802.11e for more details. + * + * \param agreement */ void ResetBlockAckInactivityTimerIfNeeded (BlockAckAgreement &agreement); + /** + * Set up WifiPhy listener for this MacLow. + * + * \param phy the WifiPhy this MacLow is connected to + */ void SetupPhyMacLowListener (Ptr phy); Ptr m_phy; Ptr m_stationManager; MacLowRxCallback m_rxCallback; + /** + * typedef for an iterator for a list of MacLowDcfListener. + */ typedef std::vector::const_iterator DcfListenersCI; + /** + * typedef for a list of MacLowDcfListener. + */ typedef std::vector DcfListeners; DcfListeners m_dcfListeners; --- a/src/wifi/model/mgt-headers.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/mgt-headers.h Tue Nov 26 11:54:48 2013 -0500 @@ -43,13 +43,43 @@ MgtAssocRequestHeader (); ~MgtAssocRequestHeader (); + /** + * Set the Service Set Identifier (SSID). + * + * \param ssid SSID + */ void SetSsid (Ssid ssid); + /** + * Set the supported rates. + * + * \param rates the supported rates + */ void SetSupportedRates (SupportedRates rates); void SetListenInterval (uint16_t interval); + /** + * Set the HT capabilities. + * + * \param htcapabilities HT capabilities + */ void SetHtCapabilities(HtCapabilities htcapabilities); + /** + * Return the HT capabilities. + * + * \return HT capabilities + */ HtCapabilities GetHtCapabilities (void) const; + /** + * Return the Service Set Identifier (SSID). + * + * \return SSID + */ Ssid GetSsid (void) const; + /** + * Return the supported rates. + * + * \return the supported rates + */ SupportedRates GetSupportedRates (void) const; uint16_t GetListenInterval (void) const; @@ -79,12 +109,42 @@ MgtAssocResponseHeader (); ~MgtAssocResponseHeader (); + /** + * Return the status code. + * + * \return the status code + */ StatusCode GetStatusCode (void); + /** + * Return the supported rates. + * + * \return the supported rates + */ SupportedRates GetSupportedRates (void); + /** + * Return the HT capabilities. + * + * \return HT capabilities + */ HtCapabilities GetHtCapabilities (void) const; + /** + * Set the HT capabilities. + * + * \param htcapabilities HT capabilities + */ void SetHtCapabilities(HtCapabilities htcapabilities); + /** + * Set the supported rates. + * + * \param rates the supported rates + */ void SetSupportedRates (SupportedRates rates); + /** + * Set the status code. + * + * \param code the status code + */ void SetStatusCode (StatusCode code); static TypeId GetTypeId (void); @@ -112,12 +172,42 @@ public: ~MgtProbeRequestHeader (); + /** + * Set the Service Set Identifier (SSID). + * + * \param ssid SSID + */ void SetSsid (Ssid ssid); + /** + * Set the supported rates. + * + * \param rates the supported rates + */ void SetSupportedRates (SupportedRates rates); + /** + * Return the Service Set Identifier (SSID). + * + * \return SSID + */ Ssid GetSsid (void) const; + /** + * Return the supported rates. + * + * \return the supported rates + */ SupportedRates GetSupportedRates (void) const; - HtCapabilities GetHtCapabilities (void) const; + /** + * Return the HT capabilities. + * + * \return HT capabilities + */ + HtCapabilities GetHtCapabilities (void) const; + /** + * Set the HT capabilities. + * + * \param htcapabilities HT capabilities + */ void SetHtCapabilities(HtCapabilities htcapabilities); static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; @@ -142,15 +232,60 @@ MgtProbeResponseHeader (); ~MgtProbeResponseHeader (); + /** + * Return the Service Set Identifier (SSID). + * + * \return SSID + */ Ssid GetSsid (void) const; + /** + * Return the beacon interval in microseconds unit. + * + * \return beacon interval in microseconds unit + */ uint64_t GetBeaconIntervalUs (void) const; + /** + * Return the supported rates. + * + * \return the supported rates + */ SupportedRates GetSupportedRates (void) const; - HtCapabilities GetHtCapabilities (void) const; + /** + * Return the HT capabilities. + * + * \return HT capabilities + */ + HtCapabilities GetHtCapabilities (void) const; + /** + * Set the HT capabilities. + * + * \param htcapabilities HT capabilities + */ void SetHtCapabilities(HtCapabilities htcapabilities); + /** + * Set the Service Set Identifier (SSID). + * + * \param ssid SSID + */ void SetSsid (Ssid ssid); + /** + * Set the beacon interval in microseconds unit. + * + * \param us beacon interval in microseconds unit + */ void SetBeaconIntervalUs (uint64_t us); + /** + * Set the supported rates. + * + * \param rates the supported rates + */ void SetSupportedRates (SupportedRates rates); + /** + * Return the time stamp. + * + * \return time stamp + */ uint64_t GetTimestamp (); static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; @@ -285,19 +420,60 @@ virtual void Serialize (Buffer::Iterator start) const; virtual uint32_t Deserialize (Buffer::Iterator start); + /** + * Enable delayed Block ACK. + */ void SetDelayedBlockAck (); + /** + * Enable immediate Block ACK + */ void SetImmediateBlockAck (); + /** + * Set Traffic ID (TID). + * + * \param tid traffic ID + */ void SetTid (uint8_t tid); + /** + * Set timeout. + * + * \param timeout timeout + */ void SetTimeout (uint16_t timeout); void SetBufferSize (uint16_t size); void SetStartingSequence (uint16_t seq); + /** + * Enable or disable A-MSDU support. + * + * supported enable or disable A-MSDU support + */ void SetAmsduSupport (bool supported); uint16_t GetStartingSequence (void) const; + /** + * Return the Traffic ID (TID). + * + * \return TID + */ uint8_t GetTid (void) const; + /** + * Return whether the Block ACK policy is immediate Block ACK. + * + * \return true if immediate Block ACK is being used, false otherwise + */ bool IsImmediateBlockAck (void) const; + /** + * Return the timeout. + * + * \return timeout + */ uint16_t GetTimeout (void) const; uint16_t GetBufferSize (void) const; + /** + * Return whether A-MSDU capability is supported. + * + * \return true is A-MSDU is supported, false otherwise + */ bool IsAmsduSupported (void) const; private: @@ -332,19 +508,70 @@ virtual void Serialize (Buffer::Iterator start) const; virtual uint32_t Deserialize (Buffer::Iterator start); + /** + * Enable delayed Block ACK. + */ void SetDelayedBlockAck (); + /** + * Enable immediate Block ACK + */ void SetImmediateBlockAck (); + /** + * Set Traffic ID (TID). + * + * \param tid traffic ID + */ void SetTid (uint8_t tid); + /** + * Set timeout. + * + * \param timeout timeout + */ void SetTimeout (uint16_t timeout); void SetBufferSize (uint16_t size); + /** + * Set the status code. + * + * \param code the status code + */ void SetStatusCode (StatusCode code); + /** + * Enable or disable A-MSDU support. + * + * supported enable or disable A-MSDU support + */ void SetAmsduSupport (bool supported); + /** + * Return the status code. + * + * \return the status code + */ StatusCode GetStatusCode (void) const; + /** + * Return the Traffic ID (TID). + * + * \return TID + */ uint8_t GetTid (void) const; + /** + * Return whether the Block ACK policy is immediate Block ACK. + * + * \return true if immediate Block ACK is being used, false otherwise + */ bool IsImmediateBlockAck (void) const; + /** + * Return the timeout. + * + * \return timeout + */ uint16_t GetTimeout (void) const; uint16_t GetBufferSize (void) const; + /** + * Return whether A-MSDU capability is supported. + * + * \return true is A-MSDU is supported, false otherwise + */ bool IsAmsduSupported (void) const; private: @@ -378,7 +605,17 @@ virtual uint32_t Deserialize (Buffer::Iterator start); bool IsByOriginator (void) const; + /** + * Return the Traffic ID (TID). + * + * \return TID + */ uint8_t GetTid (void) const; + /** + * Set Traffic ID (TID). + * + * \param tid traffic ID + */ void SetTid (uint8_t); void SetByOriginator (void); void SetByRecipient (void); --- a/src/wifi/model/msdu-standard-aggregator.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/msdu-standard-aggregator.h Tue Nov 26 11:54:48 2013 -0500 @@ -40,6 +40,7 @@ * \param aggregatedPacket Packet that will contain packet, if aggregation is possible, * \param src Source address of packet. * \param dest Destination address of packet. + * \return true if the packet can be aggregated, false otherwise * * This method performs an MSDU aggregation. * Returns true if packet can be aggregated to aggregatedPacket, false otherwise. @@ -47,9 +48,13 @@ virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket, Mac48Address src, Mac48Address dest); private: - /* Calculates how much padding must be added to the end of aggregated packet, - after that a new packet is added. - Each A-MSDU subframe is padded so that its length is multiple of 4 octets. + /** + * Calculates how much padding must be added to the end of aggregated packet, + * after that a new packet is added. + * Each A-MSDU subframe is padded so that its length is multiple of 4 octets. + * + * \param packet + * \return the number of octets required for padding */ uint32_t CalculatePadding (Ptr packet); --- a/src/wifi/model/nist-error-rate-model.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/nist-error-rate-model.h Tue Nov 26 11:54:48 2013 -0500 @@ -45,6 +45,13 @@ virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const; private: + /** + * Return the coded BER for the given p and b. + * + * \param p + * \param bValue + * \return BER + */ double CalculatePe (double p, uint32_t bValue) const; /** * Return BER of BPSK at the given SNR. --- a/src/wifi/model/onoe-wifi-manager.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/onoe-wifi-manager.cc Tue Nov 26 11:54:48 2013 -0500 @@ -29,6 +29,12 @@ namespace ns3 { +/** + * \brief hold per-remote-station state for ONOE Wifi manager. + * + * This struct extends from WifiRemoteStation struct to hold additional + * information required by the ONOE Wifi manager + */ struct OnoeWifiRemoteStation : public WifiRemoteStation { Time m_nextModeUpdate; --- a/src/wifi/model/originator-block-ack-agreement.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/originator-block-ack-agreement.h Tue Nov 26 11:54:48 2013 -0500 @@ -105,6 +105,9 @@ /** * Returns true if all packets for which a block ack was negotiated have been transmitted so * a block ack request is needed in order to acknowledge them. + * + * \return true if all packets for which a block ack was negotiated have been transmitted, + * false otherwise */ bool IsBlockAckRequestNeeded (void) const; void CompleteExchange (void); --- a/src/wifi/model/qos-utils.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/qos-utils.h Tue Nov 26 11:54:48 2013 -0500 @@ -54,6 +54,7 @@ * For more details see table 9-1 of IEEE802.11 standard. * * \param tid the Traffic ID to be mapped to Access class + * \return the access class for the given TID */ AcIndex QosUtilsMapTidToAc (uint8_t tid); @@ -74,8 +75,9 @@ * When an BAR is received from originator station, completed "old" * (see section 9.10.3 in IEEE802.11e) packets must be forwarded up before "new" packets. * - * \param seqConrol the sequence control field + * \param seqControl the sequence control field * \param endSequence + * \return a unique integer for the given sequence control and end sequence */ uint32_t QosUtilsMapSeqControlToUniqueInteger (uint16_t seqControl, uint16_t endSequence); @@ -113,6 +115,7 @@ * * \param startingSeq the starting sequence number * \param seqNumber the sequence number to be checked + * \return true if the packet is old, false otherwise */ bool QosUtilsIsOldPacket (uint16_t startingSeq, uint16_t seqNumber); --- a/src/wifi/model/rraa-wifi-manager.cc Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/rraa-wifi-manager.cc Tue Nov 26 11:54:48 2013 -0500 @@ -32,6 +32,12 @@ namespace ns3 { +/** + * \brief hold per-remote-station state for RRAA Wifi manager. + * + * This struct extends from WifiRemoteStation struct to hold additional + * information required by the RRAA Wifi manager + */ struct RraaWifiRemoteStation : public WifiRemoteStation { uint32_t m_counter; --- a/src/wifi/model/ssid.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/ssid.h Tue Nov 26 11:54:48 2013 -0500 @@ -37,12 +37,41 @@ public: // broadcast ssid Ssid (); + /** + * Create SSID from a given string + * + * \param s SSID in string + */ Ssid (std::string s); + /** + * Create SSID from a given array of char and given length. + * + * \param ssid + * \param length + */ Ssid (char const ssid[32], uint8_t length); + /** + * Check if the two SSIDs are equal. + * + * \param o SSID to compare to + * \return true if the two SSIDs are equal, + * false otherwise + */ bool IsEqual (const Ssid& o) const; + /** + * Check if the SSID is broadcast. + * + * \return true if the SSID is broadcast, + * false otherwise + */ bool IsBroadcast (void) const; + /** + * Peek the SSID. + * + * \return a pointer to SSID string + */ char* PeekString (void) const; WifiInformationElementId ElementId () const; --- a/src/wifi/model/status-code.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/status-code.h Tue Nov 26 11:54:48 2013 -0500 @@ -30,13 +30,47 @@ { public: StatusCode (); + /** + * Set success bit to 0 (success). + */ void SetSuccess (void); + /** + * Set success bit to 1 (failure. + */ void SetFailure (void); + /** + * Return whether the status code is success. + * + * \return true if success, false otherwise + */ bool IsSuccess (void) const; + /** + * \returns the expected size of the status code. + * + * This method should return the number of bytes which are needed to store + * the status code data by Serialize. + */ uint32_t GetSerializedSize (void) const; + /** + * \param start an iterator which points to where the status code should + * be written. + * \return Buffer::Iterator + * + * This method is used to store a status code into the byte buffer. + * The data written is expected to match bit-for-bit the representation of this + * header in a real network. + */ Buffer::Iterator Serialize (Buffer::Iterator start) const; + /** + * \param start an iterator which points to where the status code should be read. + * \returns the number of bytes read. + * + * This method is used to re-create a status code from the byte buffer. + * The data read is expected to match bit-for-bit the representation of this + * header in real networks. + */ Buffer::Iterator Deserialize (Buffer::Iterator start); private: uint16_t m_code; --- a/src/wifi/model/supported-rates.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/supported-rates.h Tue Nov 26 11:54:48 2013 -0500 @@ -53,6 +53,12 @@ { public: ExtendedSupportedRatesIE (); + /** + * Create an extended supported rates information element + * from the given rates. + * + * \param rates + */ ExtendedSupportedRatesIE (SupportedRates *rates); WifiInformationElementId ElementId () const; @@ -61,13 +67,23 @@ uint8_t DeserializeInformationField (Buffer::Iterator start, uint8_t length); - /* + /** * This information element is a bit special in that it is only * included if there are more than 8 rates. To support this we * override the Serialize and GetSerializedSize methods of * WifiInformationElement. + * + * \param start + * \return an iterator */ Buffer::Iterator Serialize (Buffer::Iterator start) const; + /** + * Return the serialized size of this supported rates + * information element. + * + * \return the serialized size of this supported rates + * information element + */ uint16_t GetSerializedSize () const; private: /** @@ -94,13 +110,46 @@ public: SupportedRates (); + /** + * Add the given rate to the supported rates. + * + * \param bs the rate to be added + */ void AddSupportedRate (uint32_t bs); + /** + * Set the given rate to basic rates. + * + * \param bs the rate to be set + */ void SetBasicRate (uint32_t bs); + /** + * Check if the given rate is supported. + * + * \param bs the rate to be checked + * \return true if the rate is supported, false otherwise + */ bool IsSupportedRate (uint32_t bs) const; + /** + * Check if the given rate is a basic rate. + * + * \param bs the rate to be checked + * \return true if the rate is a basic rate, false otherwise + */ bool IsBasicRate (uint32_t bs) const; + /** + * Return the number of supported rates. + * + * \return the number of supported rates + */ uint8_t GetNRates (void) const; + /** + * Return the rate at the given index. + * + * \param i the given index + * \return the rate + */ uint32_t GetRate (uint8_t i) const; WifiInformationElementId ElementId () const; --- a/src/wifi/model/wifi-information-element-vector.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/wifi-information-element-vector.h Tue Nov 26 11:54:48 2013 -0500 @@ -45,8 +45,7 @@ public: WifiInformationElementVector (); ~WifiInformationElementVector (); - ///\name Inherited from Header - // \{ + static TypeId GetTypeId (); TypeId GetInstanceTypeId () const; virtual uint32_t GetSerializedSize () const; @@ -59,7 +58,7 @@ */ virtual uint32_t Deserialize (Buffer::Iterator start); virtual void Print (std::ostream &os) const; - //\} + /** * \brief Needed when you try to deserialize a lonely IE inside other header * \param start is the start of the buffer --- a/src/wifi/model/wifi-information-element.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/wifi-information-element.h Tue Nov 26 11:54:48 2013 -0500 @@ -131,48 +131,98 @@ { public: virtual ~WifiInformationElement (); - /// Serialize entire IE including Element ID and length fields + /** + * Serialize entire IE including Element ID and length fields + * + * \param i an iterator which points to where the IE should + * be written. + * \return an iterator + */ Buffer::Iterator Serialize (Buffer::Iterator i) const; - /// Deserialize entire IE, which must be present. The iterator - /// passed in must be pointing at the Element ID (i.e., the very - /// first octet) of the correct type of information element, - /// otherwise this method will generate a fatal error. + /** + * Deserialize entire IE, which must be present. The iterator + * passed in must be pointing at the Element ID (i.e., the very + * first octet) of the correct type of information element, + * otherwise this method will generate a fatal error. + * + * \param i an iterator which points to where the IE should be read. + * \return an iterator + */ Buffer::Iterator Deserialize (Buffer::Iterator i); - /// Deserialize entire IE if it is present. The iterator passed in - /// must be pointing at the Element ID of an information element. If - /// the Element ID is not the one that the given class is interested - /// in then it will return the same iterator. + /** + * Deserialize entire IE if it is present. The iterator passed in + * must be pointing at the Element ID of an information element. If + * the Element ID is not the one that the given class is interested + * in then it will return the same iterator. + * + * \param i an iterator which points to where the IE should be read. + * \return an iterator + */ Buffer::Iterator DeserializeIfPresent (Buffer::Iterator i); - /// Get the size of the serialized IE including Element ID and - /// length fields. + /** + * Get the size of the serialized IE including Element ID and + * length fields. + * + * \return the size of the serialized IE + */ uint16_t GetSerializedSize () const; ///\name Each subclass must implement //\{ /// Own unique Element ID virtual WifiInformationElementId ElementId () const = 0; - /// Length of serialized information (i.e., the length of the body - /// of the IE, not including the Element ID and length octets. This - /// is the value that will appear in the second octet of the entire - /// IE - the length field) + /** + * Length of serialized information (i.e., the length of the body + * of the IE, not including the Element ID and length octets. This + * is the value that will appear in the second octet of the entire + * IE - the length field) + * + * \return the length of serialized information + */ virtual uint8_t GetInformationFieldSize () const = 0; - /// Serialize information (i.e., the body of the IE, not including - /// the Element ID and length octets) + /** + * Serialize information (i.e., the body of the IE, not including + * the Element ID and length octets) + * + * \param start an iterator which points to where the information should + * be written. + */ virtual void SerializeInformationField (Buffer::Iterator start) const = 0; - /// Deserialize information (i.e., the body of the IE, not including - /// the Element ID and length octets) + /** + * Deserialize information (i.e., the body of the IE, not including + * the Element ID and length octets) + * + * \param start an iterator which points to where the information should + * be written. + * \param length + * \return the number of bytes read + */ virtual uint8_t DeserializeInformationField (Buffer::Iterator start, uint8_t length) = 0; //\} /// In addition, a subclass may optionally override the following... //\{ - /// Generate human-readable form of IE + /** + * Generate human-readable form of IE + * + * \param os output stream + */ virtual void Print (std::ostream &os) const; - /// Compare information elements using Element ID + /** + * Compare information elements using Element ID + * + * \param a another information element to compare with + * \return true if the Element ID is less than the other IE Element ID, + * false otherwise + */ virtual bool operator< (WifiInformationElement const & a) const; - /// Compare two IEs for equality by ID & Length, and then through - /// memcmp of serialised version + /** + * Compare two IEs for equality by ID & Length, and then through + * memcmp of serialised version + * + * \return true if the two IEs are equal, false otherwise + */ virtual bool operator== (WifiInformationElement const & a) const; //\} }; --- a/src/wifi/model/wifi-mac-header.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/wifi-mac-header.h Tue Nov 26 11:54:48 2013 -0500 @@ -29,6 +29,9 @@ namespace ns3 { +/** + * Combination of valid MAC header type/subtype. + */ enum WifiMacType { WIFI_MAC_CTL_RTS = 0, @@ -77,6 +80,9 @@ class WifiMacHeader : public Header { public: + /** + * ACK policy for QoS frames. + */ enum QosAckPolicy { NORMAL_ACK = 0, @@ -85,6 +91,9 @@ BLOCK_ACK = 3, }; + /** + * Address types. + */ enum AddressType { ADDR1, @@ -140,6 +149,9 @@ * Set Type/Subtype values for a Block Ack header. */ void SetBlockAck (void); + /** + * Set Type/Subtype values for a multihop action header. + */ void SetMultihopAction (); /** * Set the From DS bit in the Frame Control field. @@ -251,8 +263,10 @@ void SetQosNoEosp (); /** * Set the QoS ACK policy in the QoS control field. + * + * \param policy */ - void SetQosAckPolicy (enum QosAckPolicy); + void SetQosAckPolicy (enum QosAckPolicy policy); /** * Set the QoS ACK policy in the QoS control field to normal ACK. */ @@ -265,10 +279,27 @@ * Set the QoS ACK policy in the QoS control field to no ACK. */ void SetQosNoAck (void); + /** + * Set that A-MSDU is present. + */ void SetQosAmsdu (void); + /** + * Set that A-MSDU is not present. + */ void SetQosNoAmsdu (void); + /** + * Set TXOP limit in the QoS control field. + * + * \param txop + */ void SetQosTxopLimit (uint8_t txop); + /** + * Set order bit in the frame control field. + */ void SetOrder (void); + /** + * Unset order bit in the frame control field. + */ void SetNoOrder (void); /** @@ -438,6 +469,12 @@ * \return true if the header is an Action header, false otherwise */ bool IsAction () const; + /** + * Check if the header is a Multihop action header. + * + * \return true if the header is a Multihop action header, + * false otherwise + */ bool IsMultihopAction () const; /** * Return the raw duration from the Duration/ID field. @@ -505,6 +542,12 @@ * \return true if the end of service period (EOSP) is set, false otherwise */ bool IsQosEosp (void) const; + /** + * Check if the A-MSDU present bit is set in the QoS control field. + * + * \return true if the A-MSDU present bit is set, + * false otherwise + */ bool IsQosAmsdu (void) const; /** * Return the Traffic ID of a QoS header. @@ -518,8 +561,19 @@ * \return the QoS ACK Policy of a QoS header */ enum QosAckPolicy GetQosAckPolicy (void) const; + /** + * Return the TXOP limit. + * + * \return the TXOP limit + */ uint8_t GetQosTxopLimit (void) const; + /** + * Return the size of the WifiMacHeader in octets. + * GetSerializedSize calls this function. + * + * \return the size of the WifiMacHeader in octets + */ uint32_t GetSize (void) const; /** * Return a string corresponds to the header type. --- a/src/wifi/model/wifi-mac-queue.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/wifi-mac-queue.h Tue Nov 26 11:54:48 2013 -0500 @@ -56,14 +56,58 @@ WifiMacQueue (); ~WifiMacQueue (); + /** + * Set the maximum queue size. + * + * \param maxSize the maximum queue size + */ void SetMaxSize (uint32_t maxSize); + /** + * Set the maximum delay before the packet is discarded. + * + * \param delay the maximum delay + */ void SetMaxDelay (Time delay); + /** + * Return the maximum queue size. + * + * \return the maximum queue size + */ uint32_t GetMaxSize (void) const; + /** + * Return the maximum delay before the packet is discarded. + * + * \return the maximum delay + */ Time GetMaxDelay (void) const; + /** + * Enqueue the given packet and its corresponding WifiMacHeader at the end of the queue. + * + * \param packet the packet to be euqueued at the end + * \param hdr the header of the given packet + */ void Enqueue (Ptr packet, const WifiMacHeader &hdr); + /** + * Enqueue the given packet and its corresponding WifiMacHeader at the front of the queue. + * + * \param packet the packet to be euqueued at the end + * \param hdr the header of the given packet + */ void PushFront (Ptr packet, const WifiMacHeader &hdr); + /** + * Dequeue the packet in the front of the queue. + * + * \param hdr the WifiMacHeader of the packet + * \return the packet + */ Ptr Dequeue (WifiMacHeader *hdr); + /** + * Peek the packet in the front of the queue. The packet is not removed. + * + * \param hdr the WifiMacHeader of the packet + * \return the packet + */ Ptr Peek (WifiMacHeader *hdr); /** * Searchs and returns, if is present in this queue, first packet having @@ -71,6 +115,12 @@ * equals to tid. This method removes the packet from this queue. * Is typically used by ns3::EdcaTxopN in order to perform correct MSDU * aggregation (A-MSDU). + * + * \param hdr the header of the dequeued packet + * \param tid the given TID + * \param type the given address type + * \param addr the given destination + * \return packet */ Ptr DequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, @@ -82,6 +132,12 @@ * equals to tid. This method doesn't remove the packet from this queue. * Is typically used by ns3::EdcaTxopN in order to perform correct MSDU * aggregation (A-MSDU). + * + * \param hdr the header of the dequeued packet + * \param tid the given TID + * \param type the given address type + * \param addr the given destination + * \return packet */ Ptr PeekByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, @@ -91,11 +147,19 @@ * If exists, removes packet from queue and returns true. Otherwise it * takes no effects and return false. Deletion of the packet is * performed in linear time (O(n)). + * + * \param packet the packet to be removed + * \return true if the packet was removed, false otherwise */ bool Remove (Ptr packet); /** * Returns number of QoS packets having tid equals to tid and address * specified by type equals to addr. + * + * \param tid the given TID + * \param type the given address type + * \param addr the given destination + * \return the number of QoS packets */ uint32_t GetNPacketsByTidAndAddress (uint8_t tid, WifiMacHeader::AddressType type, @@ -106,32 +170,84 @@ * respectively that index a pending agreement in the BlockAckManager object. * So that packet must not be transmitted until reception of an ADDBA response frame from station * addressed by addr. This method removes the packet from queue. + * + * \param hdr the header of the dequeued packet + * \param tStamp + * \param blockedPackets + * \return packet */ Ptr DequeueFirstAvailable (WifiMacHeader *hdr, Time &tStamp, const QosBlockedDestinations *blockedPackets); /** - * Returns first available packet for transmission. The packet isn't removed from queue. + * Returns first available packet for transmission. The packet isn't removed from queue. + * + * \param hdr the header of the dequeued packet + * \param tStamp + * \param blockedPackets + * \return packet */ Ptr PeekFirstAvailable (WifiMacHeader *hdr, Time &tStamp, const QosBlockedDestinations *blockedPackets); + /** + * Flush the queue. + */ void Flush (void); + /** + * Return if the queue is empty. + * + * \return true if the queue is empty, false otherwise + */ bool IsEmpty (void); + /** + * Return the current queue size. + * + * \return the current queue size + */ uint32_t GetSize (void); private: struct Item; + /** + * typedef for packet (struct Item) queue. + */ typedef std::list PacketQueue; + /** + * typedef for packet (struct Item) queue reverse iterator. + */ typedef std::list::reverse_iterator PacketQueueRI; + /** + * typedef for packet (struct Item) queue iterator. + */ typedef std::list::iterator PacketQueueI; + /** + * Clean up the queue by removing packets that exceeded the maximum delay. + */ + void Cleanup (void); + /** + * Return the appropriate address for the given packet (given by PacketQueue iterator). + * + * \param type + * \param it + * \return the address + */ + Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI it); - void Cleanup (void); - Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI); - + /** + * A struct that holds information about a packet for putting + * in a packet queue. + */ struct Item { + /** + * Create a struct with the given parameters. + * + * \param packet + * \param hdr + * \param tstamp + */ Item (Ptr packet, const WifiMacHeader &hdr, Time tstamp); --- a/src/wifi/model/wifi-mode.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/wifi-mode.h Tue Nov 26 11:54:48 2013 -0500 @@ -198,11 +198,12 @@ * associated WifiMode is used. * \param dataRate the rate (bits/second) at which the user data is transmitted * \param codingRate if convolutional coding is used for this rate - * then this parameter specifies the convolutional coding rate - * used. If there is no explicit convolutional coding step (e.g., - * for DSSS rates) then the caller should set this parameter to - * WIFI_CODE_RATE_UNCODED. + * then this parameter specifies the convolutional coding rate + * used. If there is no explicit convolutional coding step (e.g., + * for DSSS rates) then the caller should set this parameter to + * WIFI_CODE_RATE_UNCODED. * \param constellationSize the order of the constellation used. + * \return WifiMode * * Create a WifiMode. */ --- a/src/wifi/model/wifi-phy-state-helper.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/wifi-phy-state-helper.h Tue Nov 26 11:54:48 2013 -0500 @@ -42,22 +42,110 @@ void SetReceiveOkCallback (WifiPhy::RxOkCallback callback); void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback); void RegisterListener (WifiPhyListener *listener); + /** + * Return the current state of WifiPhy. + * + * \return the current state of WifiPhy + */ enum WifiPhy::State GetState (void); + /** + * Check whether the current state is CCA busy. + * + * \return true if the current state is CCA busy, false otherwise + */ bool IsStateCcaBusy (void); + /** + * Check whether the current state is IDLE. + * + * \return true if the current state is IDLE, false otherwise + */ bool IsStateIdle (void); + /** + * Check whether the current state is not IDLE. + * + * \return true if the current state is not IDLE, false otherwise + */ bool IsStateBusy (void); + /** + * Check whether the current state is RX. + * + * \return true if the current state is RX, false otherwise + */ bool IsStateRx (void); + /** + * Check whether the current state is TX. + * + * \return true if the current state is TX, false otherwise + */ bool IsStateTx (void); + /** + * Check whether the current state is SWITCHING. + * + * \return true if the current state is SWITCHING, false otherwise + */ bool IsStateSwitching (void); + /** + * Return the elapsed time of the current state. + * + * \return the elapsed time of the current state + */ Time GetStateDuration (void); + /** + * Return the time before the state is back to IDLE. + * + * \return the delay before the state is back to IDLE + */ Time GetDelayUntilIdle (void); + /** + * Return the time the last RX start. + * + * \return the time the last RX start. + */ Time GetLastRxStartTime (void) const; + /** + * Switch state to TX for the given duration. + * + * \param txDuration the duration of the TX + * \param packet the packet + * \param txMode the transmission mode of the packet + * \param preamble the preamble of the packet + * \param txPower the transmission power + */ void SwitchToTx (Time txDuration, Ptr packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower); + /** + * Switch state to RX for the given duration. + * + * \param rxDuration the duration of the RX + */ void SwitchToRx (Time rxDuration); + /** + * Switch state to channel switching for the given duration. + * + * \param switchingDuration the duration of required to switch the channel + */ void SwitchToChannelSwitching (Time switchingDuration); + /** + * Switch from RX after the reception was successful. + * + * \param packet the successfully received packet + * \param snr the SNR of the received packet + * \param mode the transmission mode of the packet + * \param preamble the preamble of the received packet + */ void SwitchFromRxEndOk (Ptr packet, double snr, WifiMode mode, enum WifiPreamble preamble); + /** + * Switch from RX after the reception failed. + * + * \param packet the packet that we failed to received + * \param snr the SNR of the received packet + */ void SwitchFromRxEndError (Ptr packet, double snr); + /** + * Switch to CCA busy. + * + * \param duration the duration of CCA busy state + */ void SwitchMaybeToCcaBusy (Time duration); TracedCallback m_stateLogger; @@ -66,13 +154,43 @@ void LogPreviousIdleAndCcaBusyStates (void); + /** + * Notify all WifiPhyListener that the transmission has started for the given duration. + * + * \param duration the duration of the transmission + */ void NotifyTxStart (Time duration); void NotifyWakeup (void); + /** + * Notify all WifiPhyListener that the reception has started for the given duration. + * + * \param duration the duration of the reception + */ void NotifyRxStart (Time duration); + /** + * Notify all WifiPhyListener that the reception was successful. + */ void NotifyRxEndOk (void); + /** + * Notify all WifiPhyListener that the reception was not successful. + */ void NotifyRxEndError (void); + /** + * Notify all WifiPhyListener that the CCA has started for the given duration. + * + * \param duration the duration of the CCA state + */ void NotifyMaybeCcaBusyStart (Time duration); + /** + * Notify all WifiPhyListener that we are switching channel with the given channel + * switching delay. + * + * \param duration the delay to switch the channel + */ void NotifySwitchingStart (Time duration); + /** + * Switch the state from RX. + */ void DoSwitchFromRx (void); bool m_rxing; --- a/src/wifi/model/wifi-phy.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/wifi-phy.h Tue Nov 26 11:54:48 2013 -0500 @@ -400,7 +400,7 @@ * * This was introduced with 11n * - * \param Mcs index in array of supported Mcs + * \param mcs index in array of supported Mcs * \return the Mcs index whose index is specified. * * \sa WifiPhy::GetNMcs() @@ -445,74 +445,416 @@ */ virtual Ptr GetChannel (void) const = 0; + /** + * Return a WifiMode for DSSS at 1Mbps. + * + * \return a WifiMode for DSSS at 1Mbps + */ static WifiMode GetDsssRate1Mbps (); + /** + * Return a WifiMode for DSSS at 2Mbps. + * + * \return a WifiMode for DSSS at 2Mbps + */ static WifiMode GetDsssRate2Mbps (); + /** + * Return a WifiMode for DSSS at 5.5Mbps. + * + * \return a WifiMode for DSSS at 5.5Mbps + */ static WifiMode GetDsssRate5_5Mbps (); + /** + * Return a WifiMode for DSSS at 11Mbps. + * + * \return a WifiMode for DSSS at 11Mbps + */ static WifiMode GetDsssRate11Mbps (); + /** + * Return a WifiMode for ERP-ODFM at 6Mbps. + * + * \return a WifiMode for ERP-OFDM at 6Mbps + */ static WifiMode GetErpOfdmRate6Mbps (); + /** + * Return a WifiMode for ERP-ODFM at 9Mbps. + * + * \return a WifiMode for ERP-OFDM at 9Mbps + */ static WifiMode GetErpOfdmRate9Mbps (); + /** + * Return a WifiMode for ERP-ODFM at 12Mbps. + * + * \return a WifiMode for ERP-OFDM at 12Mbps + */ static WifiMode GetErpOfdmRate12Mbps (); + /** + * Return a WifiMode for ERP-ODFM at 18Mbps. + * + * \return a WifiMode for ERP-OFDM at 18Mbps + */ static WifiMode GetErpOfdmRate18Mbps (); + /** + * Return a WifiMode for ERP-ODFM at 24Mbps. + * + * \return a WifiMode for ERP-OFDM at 24Mbps + */ static WifiMode GetErpOfdmRate24Mbps (); + /** + * Return a WifiMode for ERP-ODFM at 36Mbps. + * + * \return a WifiMode for ERP-OFDM at 36Mbps + */ static WifiMode GetErpOfdmRate36Mbps (); + /** + * Return a WifiMode for ERP-ODFM at 48Mbps. + * + * \return a WifiMode for ERP-OFDM at 48Mbps + */ static WifiMode GetErpOfdmRate48Mbps (); + /** + * Return a WifiMode for ERP-ODFM at 54Mbps. + * + * \return a WifiMode for ERP-OFDM at 54Mbps + */ static WifiMode GetErpOfdmRate54Mbps (); + /** + * Return a WifiMode for ODFM at 6Mbps. + * + * \return a WifiMode for OFDM at 6Mbps + */ static WifiMode GetOfdmRate6Mbps (); + /** + * Return a WifiMode for ODFM at 9Mbps. + * + * \return a WifiMode for OFDM at 9Mbps + */ static WifiMode GetOfdmRate9Mbps (); + /** + * Return a WifiMode for ODFM at 12Mbps. + * + * \return a WifiMode for OFDM at 12Mbps + */ static WifiMode GetOfdmRate12Mbps (); + /** + * Return a WifiMode for ODFM at 18Mbps. + * + * \return a WifiMode for OFDM at 18Mbps + */ static WifiMode GetOfdmRate18Mbps (); + /** + * Return a WifiMode for ODFM at 24Mbps. + * + * \return a WifiMode for OFDM at 24Mbps + */ static WifiMode GetOfdmRate24Mbps (); + /** + * Return a WifiMode for ODFM at 36Mbps. + * + * \return a WifiMode for OFDM at 36Mbps + */ static WifiMode GetOfdmRate36Mbps (); + /** + * Return a WifiMode for ODFM at 48Mbps. + * + * \return a WifiMode for OFDM at 48Mbps + */ static WifiMode GetOfdmRate48Mbps (); + /** + * Return a WifiMode for ODFM at 54Mbps. + * + * \return a WifiMode for OFDM at 54Mbps + */ static WifiMode GetOfdmRate54Mbps (); + /** + * Return a WifiMode for ODFM at 3Mbps with 10MHz channel spacing. + * + * \return a WifiMode for OFDM at 3Mbps with 10MHz channel spacing + */ static WifiMode GetOfdmRate3MbpsBW10MHz (); + /** + * Return a WifiMode for ODFM at 4.5Mbps with 10MHz channel spacing. + * + * \return a WifiMode for OFDM at 4.5Mbps with 10MHz channel spacing + */ static WifiMode GetOfdmRate4_5MbpsBW10MHz (); + /** + * Return a WifiMode for ODFM at 6Mbps with 10MHz channel spacing. + * + * \return a WifiMode for OFDM at 6Mbps with 10MHz channel spacing + */ static WifiMode GetOfdmRate6MbpsBW10MHz (); + /** + * Return a WifiMode for ODFM at 9Mbps with 10MHz channel spacing. + * + * \return a WifiMode for OFDM at 9Mbps with 10MHz channel spacing + */ static WifiMode GetOfdmRate9MbpsBW10MHz (); + /** + * Return a WifiMode for ODFM at 12Mbps with 10MHz channel spacing. + * + * \return a WifiMode for OFDM at 12Mbps with 10MHz channel spacing + */ static WifiMode GetOfdmRate12MbpsBW10MHz (); + /** + * Return a WifiMode for ODFM at 18Mbps with 10MHz channel spacing. + * + * \return a WifiMode for OFDM at 18Mbps with 10MHz channel spacing + */ static WifiMode GetOfdmRate18MbpsBW10MHz (); + /** + * Return a WifiMode for ODFM at 24Mbps with 10MHz channel spacing. + * + * \return a WifiMode for OFDM at 24Mbps with 10MHz channel spacing + */ static WifiMode GetOfdmRate24MbpsBW10MHz (); + /** + * Return a WifiMode for ODFM at 27Mbps with 10MHz channel spacing. + * + * \return a WifiMode for OFDM at 27Mbps with 10MHz channel spacing + */ static WifiMode GetOfdmRate27MbpsBW10MHz (); + /** + * Return a WifiMode for ODFM at 1.5Mbps with 5MHz channel spacing. + * + * \return a WifiMode for OFDM at 1.5Mbps with 5MHz channel spacing + */ static WifiMode GetOfdmRate1_5MbpsBW5MHz (); + /** + * Return a WifiMode for ODFM at 2.25Mbps with 5MHz channel spacing. + * + * \return a WifiMode for OFDM at 2.25Mbps with 5MHz channel spacing + */ static WifiMode GetOfdmRate2_25MbpsBW5MHz (); + /** + * Return a WifiMode for ODFM at 3Mbps with 5MHz channel spacing. + * + * \return a WifiMode for OFDM at 3Mbps with 5MHz channel spacing + */ static WifiMode GetOfdmRate3MbpsBW5MHz (); + /** + * Return a WifiMode for ODFM at 4.5Mbps with 5MHz channel spacing. + * + * \return a WifiMode for OFDM at 4.5Mbps with 5MHz channel spacing + */ static WifiMode GetOfdmRate4_5MbpsBW5MHz (); + /** + * Return a WifiMode for ODFM at 6Mbps with 5MHz channel spacing. + * + * \return a WifiMode for OFDM at 6Mbps with 5MHz channel spacing + */ static WifiMode GetOfdmRate6MbpsBW5MHz (); + /** + * Return a WifiMode for ODFM at 9Mbps with 5MHz channel spacing. + * + * \return a WifiMode for OFDM at 9Mbps with 5MHz channel spacing + */ static WifiMode GetOfdmRate9MbpsBW5MHz (); + /** + * Return a WifiMode for ODFM at 12Mbps with 5MHz channel spacing. + * + * \return a WifiMode for OFDM at 12Mbps with 5MHz channel spacing + */ static WifiMode GetOfdmRate12MbpsBW5MHz (); + /** + * Return a WifiMode for ODFM at 13.5Mbps with 5MHz channel spacing. + * + * \return a WifiMode for OFDM at 13.5Mbps with 5MHz channel spacing + */ static WifiMode GetOfdmRate13_5MbpsBW5MHz (); + /** + * Return a WifiMode for ODFM at 6.5Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 6.5Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate6_5MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 13Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 13Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate13MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 19.5Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 19.5Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate19_5MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 26Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 26Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate26MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 39Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 39Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate39MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 52Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 52Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate52MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 58.5Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 58.5Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate58_5MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 65Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 65Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate65MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 13.5Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 13.5Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate13_5MbpsBW40MHz (); - static WifiMode GetOfdmRate27MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 27Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 27Mbps with 40MHz channel spacing + */ + static WifiMode GetOfdmRate27MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 40.5Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 40.5Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate40_5MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 54Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 54Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate54MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 81Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 81Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate81MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 108Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 108Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate108MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 121.5Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 121.5Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate121_5MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 135Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 135Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate135MbpsBW40MHz (); //Rates for clause 20 with short guard interval + /** + * Return a WifiMode for ODFM at 7.2Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 7.2Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate7_2MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 14.4Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 14.4Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate14_4MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 21.7Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 21.7Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate21_7MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 28.9Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 28.9Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate28_9MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 43.3Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 43.3Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate43_3MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 57.8Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 57.8Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate57_8MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 65Mbps with 20MHz channel spacing. + * The rate supports short guard interval. + * + * \return a WifiMode for OFDM at 65Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate65MbpsBW20MHzShGi (); + /** + * Return a WifiMode for ODFM at 72.2Mbps with 20MHz channel spacing. + * + * \return a WifiMode for OFDM at 72.2Mbps with 20MHz channel spacing + */ static WifiMode GetOfdmRate72_2MbpsBW20MHz (); + /** + * Return a WifiMode for ODFM at 15Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 15Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate15MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 30Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 30Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate30MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 45Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 45Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate45MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 60Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 60Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate60MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 90Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 90Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate90MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 120Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 120Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate120MbpsBW40MHz (); + /** + * Return a WifiMode for ODFM at 135Mbps with 40MHz channel spacing. + * The rate supports short guard interval. + * + * \return a WifiMode for OFDM at 135Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate135MbpsBW40MHzShGi (); + /** + * Return a WifiMode for ODFM at 150Mbps with 40MHz channel spacing. + * + * \return a WifiMode for OFDM at 150Mbps with 40MHz channel spacing + */ static WifiMode GetOfdmRate150MbpsBW40MHz (); --- a/src/wifi/model/wifi-remote-station-manager.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/wifi-remote-station-manager.h Tue Nov 26 11:54:48 2013 -0500 @@ -125,19 +125,19 @@ /** * Sets the maximum STA short retry count (SSRC). * - * \param the maximum SSRC + * \param maxSsrc the maximum SSRC */ void SetMaxSsrc (uint32_t maxSsrc); /** * Sets the maximum STA long retry count (SLRC). * - * \param the maximum SLRC + * \param maxSlrc the maximum SLRC */ void SetMaxSlrc (uint32_t maxSlrc); /** * Sets the RTS threshold. * - * \param the RTS threshold + * \param threshold the RTS threshold */ void SetRtsCtsThreshold (uint32_t threshold); /** @@ -148,7 +148,7 @@ */ void SetFragmentationThreshold (uint32_t threshold); /** - * Records HT capabilities of remote station. + * Records HT capabilities of the remote station. * * \param from the address of the station being recorded * \param htcapabilities the HT capabilities of the station @@ -207,11 +207,39 @@ * false otherwise */ bool GetGreenfieldSupported (Mac48Address address) const; + /** + * Add a given Modulation and Coding Scheme (MCS) index to + * the set of basic MCS. + * + * \param mcs the MCS index + */ void AddBasicMcs (uint8_t mcs); + /** + * Return the default Modulation and Coding Scheme (MCS) index. + * + * \return the default MCS index + */ uint8_t GetDefaultMcs (void) const; + /** + * Return the number of basic MCS index. + * + * \return the number of basic MCS index + */ uint32_t GetNBasicMcs (void) const; + /** + * Return the MCS at the given list index. + * + * \param i the position in the list + * \return the MCS at the given list index + */ uint8_t GetBasicMcs (uint32_t i) const; + /** + * Record the MCS index supported by the station. + * + * \param address the address of the station + * \param mcs the MCS index + */ void AddSupportedMcs (Mac48Address address, uint8_t mcs); /** @@ -342,6 +370,9 @@ /** * Since CTS-to-self parameters are not dependent on the station, * it is implemented in wifiremote station manager + * + * \return the transmission mode to use to send the CTS-to-self prior to the + * transmission of the data packet itself. */ WifiTxVector DoGetCtsToSelfTxVector (void); @@ -427,6 +458,7 @@ /** * Return if we need to do Cts-to-self before sending a DATA. * + * \param txVector the TXVECTOR of the packet to be sent * \return true if Cts-to-self is needed, false otherwise */ bool NeedCtsToSelf (WifiTxVector txVector); @@ -519,7 +551,7 @@ /** * Set the default transmission power level * - * \param the default transmission power level + * \param txPower the default transmission power level */ void SetDefaultTxPowerLevel (uint8_t txPower); /** @@ -544,7 +576,20 @@ * \return the number of modes supported by the given station */ uint32_t GetNSupported (const WifiRemoteStation *station) const; + /** + * Return the MCS index supported by the specified station at the specified index. + * + * \param station the station being queried + * \param i the index + * \return the MCS index at the given index of the specified station + */ uint8_t GetMcsSupported (const WifiRemoteStation *station, uint32_t i) const; + /** + * Return the number of MCS supported by the given station. + * + * \param station the station being queried + * \return the number of MCS supported by the given station + */ uint32_t GetNMcsSupported (const WifiRemoteStation *station) const; /** @@ -555,6 +600,12 @@ * false otherwise */ bool GetShortGuardInterval (const WifiRemoteStation *station) const; + /** + * Return whether the given station supports space-time block coding (STBC). + * + * \param station the station being queried + * \return true if the station supports STBC, false otherwise + */ bool GetStbc (const WifiRemoteStation *station) const; /** * Return whether the station supports Greenfield or not. @@ -594,7 +645,7 @@ uint32_t GetShortRetryCount (const WifiRemoteStation *station) const; private: /** - * \param station the station with which we need to communicate + * \param station the station that we need to communicate * \param packet the packet to send * \param normally indicates whether the normal 802.11 rts enable mechanism would * request that the rts is sent or not. @@ -606,7 +657,7 @@ virtual bool DoNeedRts (WifiRemoteStation *station, Ptr packet, bool normally); /** - * \param station the station with which we need to communicate + * \param station the station that we need to communicate * \param packet the packet to send * \param normally indicates whether the normal 802.11 rts enable mechanism would * request that the rts is retransmitted or not. @@ -619,7 +670,7 @@ virtual bool DoNeedRtsRetransmission (WifiRemoteStation *station, Ptr packet, bool normally); /** - * \param station the station with which we need to communicate + * \param station the station that we need to communicate * \param packet the packet to send * \param normally indicates whether the normal 802.11 data retransmission mechanism * would request that the data is retransmitted or not. @@ -633,7 +684,7 @@ Ptr packet, bool normally); /** - * \param station the station with which we need to communicate + * \param station the station that we need to communicate * \param packet the packet to send * \param normally indicates whether the normal 802.11 data fragmentation mechanism * would request that the data packet is fragmented or not. @@ -656,7 +707,7 @@ */ virtual WifiRemoteStation* DoCreateStation (void) const = 0; /** - * \param station the station with which we need to communicate + * \param station the station that we need to communicate * \param size size of the packet or fragment we want to send * \return the transmission mode to use to send a packet to the station * @@ -666,7 +717,7 @@ virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size) = 0; /** - * \param station the station with which we need to communicate + * \param station the station that we need to communicate * \return the transmission mode to use to send an rts to the station * * Note: This method is called before sending an rts to a station @@ -717,21 +768,21 @@ * This method is a pure virtual method that must be implemented by the sub-class. * This allows different types of WifiRemoteStationManager to respond differently, * - * \param station the station with which we failed to send RTS + * \param station the station that we failed to send RTS */ virtual void DoReportRtsFailed (WifiRemoteStation *station) = 0; /** * This method is a pure virtual method that must be implemented by the sub-class. * This allows different types of WifiRemoteStationManager to respond differently, * - * \param station the station with which we failed to send DATA + * \param station the station that we failed to send DATA */ virtual void DoReportDataFailed (WifiRemoteStation *station) = 0; /** * This method is a pure virtual method that must be implemented by the sub-class. * This allows different types of WifiRemoteStationManager to respond differently, * - * \param station the station with which we successfully sent RTS + * \param station the station that we successfully sent RTS * \param ctsSnr the SNR of the CTS we received * \param ctsMode the WifiMode the receiver used to send the CTS * \param rtsSnr the SNR of the RTS we sent @@ -742,7 +793,7 @@ * This method is a pure virtual method that must be implemented by the sub-class. * This allows different types of WifiRemoteStationManager to respond differently, * - * \param station the station with which we successfully sent RTS + * \param station the station that we successfully sent RTS * \param ackSnr the SNR of the ACK we received * \param ackMode the WifiMode the receiver used to send the ACK * \param dataSnr the SNR of the DATA we sent @@ -753,14 +804,14 @@ * This method is a pure virtual method that must be implemented by the sub-class. * This allows different types of WifiRemoteStationManager to respond differently, * - * \param station the station with which we failed to send RTS + * \param station the station that we failed to send RTS */ virtual void DoReportFinalRtsFailed (WifiRemoteStation *station) = 0; /** * This method is a pure virtual method that must be implemented by the sub-class. * This allows different types of WifiRemoteStationManager to respond differently, * - * \param station the station with which we failed to send DATA + * \param station the station that we failed to send DATA */ virtual void DoReportFinalDataFailed (WifiRemoteStation *station) = 0; /** --- a/src/wifi/model/wifi-tx-vector.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/wifi-tx-vector.h Tue Nov 26 11:54:48 2013 -0500 @@ -53,8 +53,10 @@ * \returns the txvector payload mode */ WifiMode GetMode (void) const; - /** + /** * Sets the selected payload transmission mode + * + * \param mode */ void SetMode (WifiMode mode); /** @@ -63,14 +65,18 @@ uint8_t GetTxPowerLevel (void) const; /** * Sets the selected transmission power level + * + * \param powerlevel */ void SetTxPowerLevel (uint8_t powerlevel); /** * \returns the number of retries */ uint8_t GetRetries (void) const; - /** + /** * Sets the number of retries + * + * \param retries */ void SetRetries (uint8_t retries); /** @@ -79,22 +85,28 @@ bool IsShortGuardInterval (void) const; /** * Sets if short gurad interval is being used + * + * \param guardinterval enable or disable short guard interval */ void SetShortGuardInterval (bool guardinterval); - /** + /** * \returns the number of Nss */ uint8_t GetNss (void) const; - /** + /** * Sets the number of Nss refer to IEEE802.11n Table 20-28 for explanation and range + * + * \param nss */ void SetNss (uint8_t nss); /** * \returns the number of Ness */ uint8_t GetNess (void) const; - /** + /** * Sets the Ness number refer to IEEE802.11n Table 20-6 for explanation + * + * \param ness */ void SetNess (uint8_t ness); /** @@ -103,8 +115,10 @@ bool IsStbc (void) const; /** * Sets if STBC is being used + * + * \param stbc enable or disable STBC */ - void SetStbc (bool stbcsatuts); + void SetStbc (bool stbc); private: --- a/src/wifi/model/yans-error-rate-model.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/yans-error-rate-model.h Tue Nov 26 11:54:48 2013 -0500 @@ -103,12 +103,47 @@ * \return a Binomial distribution */ double Binomial (uint32_t k, double p, uint32_t n) const; + /** + * \param ber + * \param d + * \return double + */ double CalculatePdOdd (double ber, unsigned int d) const; + /** + * \param ber + * \param d + * \return double + */ double CalculatePdEven (double ber, unsigned int d) const; + /** + * \param ber + * \param d + * \return double + */ double CalculatePd (double ber, unsigned int d) const; + /** + * \param snr + * \param nbits + * \param signalSpread + * \param phyRate + * \param dFree + * \param adFree + * \return double + */ double GetFecBpskBer (double snr, double nbits, uint32_t signalSpread, uint32_t phyRate, uint32_t dFree, uint32_t adFree) const; + /** + * \param snr + * \param nbits + * \param signalSpread + * \param phyRate + * \param m + * \param dfree + * \param adFree + * \param adFreePlusOne + * \return double + */ double GetFecQamBer (double snr, uint32_t nbits, uint32_t signalSpread, uint32_t phyRate, --- a/src/wifi/model/yans-wifi-phy.h Tue Nov 26 10:21:36 2013 -0500 +++ a/src/wifi/model/yans-wifi-phy.h Tue Nov 26 11:54:48 2013 -0500 @@ -69,9 +69,24 @@ YansWifiPhy (); virtual ~YansWifiPhy (); + /** + * Set the YansWifiChannel this YansWifiPhy is to be connected to. + * + * \param channel the YansWifiChannel this YansWifiPhy is to be connected to + */ void SetChannel (Ptr channel); + /** + * Set the current channel number. + * + * \param id the channel number + */ void SetChannelNumber (uint16_t id); + /** + * Return the current channel number. + * + * \return the current channel number + */ uint16_t GetChannelNumber () const; /** * Return current center channel frequency in MHz. @@ -80,6 +95,14 @@ */ double GetChannelFrequencyMhz () const; + /** + * Starting receiving the packet (i.e. the first bit of the preamble has arrived). + * + * \param packet the arriving packet + * \param rxPowerDbm the receive power in dBm + * \param txVector the TXVECTOR of the arriving packet + * \param preamble the preamble of the arriving packet + */ void StartReceivePacket (Ptr packet, double rxPowerDbm, WifiTxVector txVector, @@ -206,7 +229,15 @@ */ Ptr GetMobility (void); + /** + * Return the minimum available transmission power level (dBm). + * \return the minimum available transmission power level (dBm) + */ virtual double GetTxPowerStart (void) const; + /** + * Return the maximum available transmission power level (dBm). + * \return the maximum available transmission power level (dBm) + */ virtual double GetTxPowerEnd (void) const; /** * Return the number of available transmission power levels. @@ -321,7 +352,7 @@ /** * Enable or disable channel bonding support. * - * \param channelBonding Enable or disable channel bonding + * \param channelbonding Enable or disable channel bonding */ virtual void SetChannelBonding (bool channelbonding) ; @@ -353,19 +384,85 @@ private: YansWifiPhy (const YansWifiPhy &o); virtual void DoDispose (void); + /** + * Configure YansWifiPhy with appropriate channel frequency and + * supported rates for 802.11a standard. + */ void Configure80211a (void); + /** + * Configure YansWifiPhy with appropriate channel frequency and + * supported rates for 802.11b standard. + */ void Configure80211b (void); + /** + * Configure YansWifiPhy with appropriate channel frequency and + * supported rates for 802.11g standard. + */ void Configure80211g (void); + /** + * Configure YansWifiPhy with appropriate channel frequency and + * supported rates for 802.11a standard with 10MHz channel spacing. + */ void Configure80211_10Mhz (void); + /** + * Configure YansWifiPhy with appropriate channel frequency and + * supported rates for 802.11a standard with 5MHz channel spacing. + */ void Configure80211_5Mhz (); void ConfigureHolland (void); + /** + * Configure YansWifiPhy with appropriate channel frequency and + * supported rates for 802.11n standard. + */ void Configure80211n (void); + /** + * Return the energy detection threshold. + * + * \return the energy detection threshold. + */ double GetEdThresholdW (void) const; + /** + * Convert from dBm to Watts. + * + * \param dbm the power in dBm + * \return the equivalent Watts for the given dBm + */ double DbmToW (double dbm) const; + /** + * Convert from dB to ratio. + * + * \param db + * \return ratio + */ double DbToRatio (double db) const; + /** + * Convert from Watts to dBm. + * + * \param w the power in Watts + * \return the equivalent dBm for the given Watts + */ double WToDbm (double w) const; + /** + * Convert from ratio to dB. + * + * \param ratio + * \return dB + */ double RatioToDb (double ratio) const; + /** + * Get the power of the given power level in dBm. + * In YansWifiPhy implementation, the power levels are equally spaced (in dBm). + * + * \param power the power level + * \return the transmission power in dBm at the given power level + */ double GetPowerDbm (uint8_t power) const; + /** + * The last bit of the packet has arrived. + * + * \param packet the packet that the last bit has arrived + * \param event the corresponding event of the first time the packet arrives + */ void EndReceive (Ptr packet, Ptr event); private: