diff -r b22e9f50a0da src/wifi/model/ap-wifi-mac.h --- a/src/wifi/model/ap-wifi-mac.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/ap-wifi-mac.h Fri Nov 15 19:13:28 2013 -0500 @@ -88,7 +88,7 @@ */ void SetBeaconInterval (Time interval); /** - * \returns the interval between two beacon transmissions. + * \return the interval between two beacon transmissions. */ Time GetBeaconInterval (void) const; /** @@ -108,7 +108,23 @@ private: virtual void Receive (Ptr packet, const WifiMacHeader *hdr); + /** + * The packet we sent was successfully received by the receiver + * (i.e. we received an ACK from the receiver). If the packet + * was an association response to the receiver, we record that + * the receiver is now associated with us. + * + * \param hdr the header of the packet that we successfully sent + */ virtual void TxOk (const WifiMacHeader &hdr); + /** + * The packet we sent was successfully received by the receiver + * (i.e. we did not receive an ACK from the receiver). If the packet + * was an association response to the receiver, we record that + * the receiver is not associated with us yet. + * + * \param hdr the header of the packet that we failed to sent + */ virtual void TxFailed (const WifiMacHeader &hdr); /** @@ -123,14 +139,67 @@ virtual void DeaggregateAmsduAndForward (Ptr aggregatedPacket, const WifiMacHeader *hdr); + /** + * Forward the packet down to DCF/EDCAF (enqueue the packet). This method + * is a wrapper for ForwardDown with traffic id. + * + * \param packet the packet we are forwarding to DCF/EDCAF + * \param from the address to be used for Address 3 field in the header + * \param to the address to be used for Address 1 field in the header + */ void ForwardDown (Ptr packet, Mac48Address from, Mac48Address to); + /** + * Forward the packet down to DCF/EDCAF (enqueue the packet). + * + * \param packet the packet we are forwarding to DCF/EDCAF + * \param from the address to be used for Address 3 field in the header + * \param to the address to be used for Address 1 field in the header + * \param tid the traffic id for the packet + */ void ForwardDown (Ptr packet, Mac48Address from, Mac48Address to, uint8_t tid); + /** + * Forward a probe response packet to the DCF. The standard is not clear on the correct + * queue for management frames if QoS is supported. We always use the DCF. + * + * \param to the address of the STA we are sending a probe response to + */ void SendProbeResp (Mac48Address to); + /** + * Forward an association response packet to the DCF. The standard is not clear on the correct + * queue for management frames if QoS is supported. We always use the DCF. + * + * \param to the address of the STA we are sending an association response to + * \param success indicates whether the association was successful or not + */ void SendAssocResp (Mac48Address to, bool success); + /** + * Forward a beacon packet to the beacon special DCF. + */ void SendOneBeacon (void); + /** + * Return the HT capability of the current AP. + * + * \return the HT capability that we support + */ HtCapabilities GetHtCapabilities (void) const; + /** + * Return an instance of SupportedRates that contains all rates that we support + * including HT rates. + * + * \return SupportedRates all rates that we support + */ SupportedRates GetSupportedRates (void) const; + /** + * Enable or disable beacon generation of the AP. + * + * \param enable enable or disable beacon generation + */ void SetBeaconGeneration (bool enable); + /** + * Return whether the AP is generating beacons. + * + * \return true if beacons are periodically generated, false otherwise + */ bool GetBeaconGeneration (void) const; virtual void DoDispose (void); virtual void DoInitialize (void); diff -r b22e9f50a0da src/wifi/model/dsss-error-rate-model.h --- a/src/wifi/model/dsss-error-rate-model.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/dsss-error-rate-model.h Fri Nov 15 19:13:28 2013 -0500 @@ -67,10 +67,46 @@ class DsssErrorRateModel { public: + /** + * A function DQPSK + * + * \param x x + * \return DQPSK(x) + */ static double DqpskFunction (double x); + /** + * Return the chunk success rate of the differential BPSK. + * + * \param sinr the SINR of the chunk + * \param nbits the size of the chunk + * \return the chunk success rate of the differential BPSK + */ static double GetDsssDbpskSuccessRate (double sinr, uint32_t nbits); + /** + * Return the chunk success rate of the differential encoded QPSK. + * + * \param sinr the SINR of the chunk + * \param nbits the size of the chunk + * \return the chunk success rate of the differential encoded QPSK. + */ static double GetDsssDqpskSuccessRate (double sinr,uint32_t nbits); + /** + * Return the chunk success rate of the differential encoded QPSK for + * 5.5Mbps data rate. + * + * \param sinr the SINR of the chunk + * \param nbits the size of the chunk + * \return the chunk success rate of the differential encoded QPSK for + */ static double GetDsssDqpskCck5_5SuccessRate (double sinr,uint32_t nbits); + /** + * Return the chunk success rate of the differential encoded QPSK for + * 11Mbps data rate. + * + * \param sinr the SINR of the chunk + * \param nbits the size of the chunk + * \return the chunk success rate of the differential encoded QPSK for + */ static double GetDsssDqpskCck11SuccessRate (double sinr,uint32_t nbits); #ifdef ENABLE_GSL static double SymbolErrorProb16Cck (double e2); /// equation (18) in Pursley's paper diff -r b22e9f50a0da src/wifi/model/error-rate-model.h --- a/src/wifi/model/error-rate-model.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/error-rate-model.h Fri Nov 15 19:13:28 2013 -0500 @@ -43,6 +43,19 @@ */ double CalculateSnr (WifiMode txMode, double ber) const; + /** + * A pure virtual method that must be implemented in the subclass. + * This method returns the probability that the given 'chuck' of the + * packet will be successfully received by the PHY. + * + * A chuck can be viewed as a part of a packet with equal SNR. + * The probability of successfully receiving the chunk depends on + * the mode, the SNR, and the size of the chunk. + * + * \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 + */ virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const = 0; }; diff -r b22e9f50a0da src/wifi/model/ideal-wifi-manager.h --- a/src/wifi/model/ideal-wifi-manager.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/ideal-wifi-manager.h Fri Nov 15 19:13:28 2013 -0500 @@ -68,11 +68,26 @@ virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station); virtual bool IsLowLatency (void) const; - // return the min snr needed to successfully transmit - // data with this mode at the specified ber. + /** + * Return the minimum SNR needed to successfully transmit + * data with this mode at the specified BER. + * + * \param mode WifiMode + * \return the minimum SNR for the given mode + */ double GetSnrThreshold (WifiMode mode) const; - void AddModeSnrThreshold (WifiMode mode, double ber); + /** + * Adds a pair of WifiMode and the minimum SNR for that given mode + * to the list. + * + * \param mode WifiMode + * \param snr the minimum SNR for the given mode + */ + void AddModeSnrThreshold (WifiMode mode, double snr); + /** + * A vector of pair that holds the minimum SNR for different mode + */ typedef std::vector > Thresholds; double m_ber; diff -r b22e9f50a0da src/wifi/model/nist-error-rate-model.h --- a/src/wifi/model/nist-error-rate-model.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/nist-error-rate-model.h Fri Nov 15 19:13:28 2013 -0500 @@ -46,16 +46,72 @@ private: double CalculatePe (double p, uint32_t bValue) const; + /** + * Return BER of BPSK at the given SNR. + * + * \param snr snr value + * \return BER of BPSK at the given SNR + */ double GetBpskBer (double snr) const; + /** + * Return BER of QPSK at the given SNR. + * + * \param snr snr value + * \return BER of QPSK at the given SNR + */ double GetQpskBer (double snr) const; + /** + * Return BER of QAM16 at the given SNR. + * + * \param snr snr value + * \return BER of QAM16 at the given SNR + */ double Get16QamBer (double snr) const; + /** + * Return BER of QAM64 at the given SNR. + * + * \param snr snr value + * \return BER of QAM64 at the given SNR + */ double Get64QamBer (double snr) const; + /** + * Return BER of BPSK at the given SNR after applying FEC. + * + * \param snr snr value + * \param nbits the number of bits in the chunk + * \param bValue + * \return BER of BPSK at the given SNR after applying FEC + */ double GetFecBpskBer (double snr, double nbits, uint32_t bValue) const; + /** + * Return BER of QPSK at the given SNR after applying FEC. + * + * \param snr snr value + * \param nbits the number of bits in the chunk + * \param bValue + * \return BER of QPSK at the given SNR after applying FEC + */ double GetFecQpskBer (double snr, double nbits, uint32_t bValue) const; + /** + * Return BER of QAM16 at the given SNR after applying FEC. + * + * \param snr snr value + * \param nbits the number of bits in the chunk + * \param bValue + * \return BER of QAM16 at the given SNR after applying FEC + */ double GetFec16QamBer (double snr, uint32_t nbits, uint32_t bValue) const; + /** + * Return BER of QAM64 at the given SNR after applying FEC. + * + * \param snr snr value + * \param nbits the number of bits in the chunk + * \param bValue + * \return BER of QAM64 at the given SNR after applying FEC + */ double GetFec64QamBer (double snr, uint32_t nbits, uint32_t bValue) const; }; diff -r b22e9f50a0da src/wifi/model/qos-tag.h --- a/src/wifi/model/qos-tag.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/qos-tag.h Fri Nov 15 19:13:28 2013 -0500 @@ -70,7 +70,9 @@ QosTag (); /** - * Create a QosTag with the given TID + * Create a QosTag with the given Traffic ID + * + * \param tid the given Traffic ID */ QosTag (uint8_t tid); @@ -100,6 +102,11 @@ virtual uint32_t GetSerializedSize () const; virtual void Print (std::ostream &os) const; + /** + * Return the Type ID. + * + * \return type ID + */ uint8_t GetTid (void) const; private: diff -r b22e9f50a0da src/wifi/model/qos-utils.h --- a/src/wifi/model/qos-utils.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/qos-utils.h Fri Nov 15 19:13:28 2013 -0500 @@ -52,6 +52,8 @@ * \ingroup wifi * Maps TID (Traffic ID) to Access classes. * For more details see table 9-1 of IEEE802.11 standard. + * + * \param tid the Traffic ID to be mapped to Access class */ AcIndex QosUtilsMapTidToAc (uint8_t tid); @@ -59,6 +61,10 @@ * \ingroup wifi * If a qos tag is attached to the packet, returns a value < 8. * A value >= 8 is returned otherwise. + * + * \param packet the packet to checked for a QoS tag + * \return a value less than 8 if QoS tag was present, a value >= 8 + * is returned if no QoS tag was present */ uint8_t QosUtilsGetTidForPacket (Ptr packet); @@ -67,6 +73,9 @@ * Next function is useful to correctly sort buffered packets under block ack. * 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 endSequence */ uint32_t QosUtilsMapSeqControlToUniqueInteger (uint16_t seqControl, uint16_t endSequence); @@ -102,7 +111,8 @@ * if that packet (with sequence number numberSeq)) belongs to the section of the * sequence number space marked with '-' characters. The function returns false otherwise. * - * + * \param startingSeq the starting sequence number + * \param seqNumber the sequence number to be checked */ bool QosUtilsIsOldPacket (uint16_t startingSeq, uint16_t seqNumber); diff -r b22e9f50a0da src/wifi/model/regular-wifi-mac.h --- a/src/wifi/model/regular-wifi-mac.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/regular-wifi-mac.h Fri Nov 15 19:13:28 2013 -0500 @@ -87,39 +87,51 @@ Time GetRifs (void) const; /** - * \returns the current PIFS duration. + * \return the current PIFS duration. */ Time GetPifs (void) const; /** - * \returns the current SIFS duration. + * \return the current SIFS duration. */ Time GetSifs (void) const; /** - * \returns the current slot duration. + * \return the current slot duration. */ Time GetSlot (void) const; /** - * \returns the current EIFS minus DIFS duration + * \return the current EIFS minus DIFS duration */ Time GetEifsNoDifs (void) const; /** - * \returns the current CTS timeout duration. + * \return the current CTS timeout duration. */ Time GetCtsTimeout (void) const; /** - * \returns the current ACK timeout duration. + * \return the current ACK timeout duration. */ Time GetAckTimeout (void) const; + /** + * Enable or disable CTS-to-self feature. + * + * \param enable true if CTS-to-self is to be supported, + * false otherwise + */ void SetCtsToSelfSupported (bool enable); + /** + * Return whether the device supports CTS-to-self + * capability. + * + * \return true if CTS-to-self is supported, false otherwise. + */ bool GetCtsToSelfSupported () const; /** - * \returns the MAC address associated to this MAC layer. + * \return the MAC address associated to this MAC layer. */ virtual Mac48Address GetAddress (void) const; /** - * \returns the ssid which this MAC layer is going to try to stay in. + * \return the ssid which this MAC layer is going to try to stay in. */ virtual Ssid GetSsid (void) const; /** @@ -135,7 +147,7 @@ */ virtual void SetBssid (Mac48Address bssid); /** - * \returns the bssid of the network this device belongs to. + * \return the bssid of the network this device belongs to. */ virtual Mac48Address GetBssid (void) const; /** @@ -175,7 +187,7 @@ */ virtual void SetWifiPhy (Ptr phy); /** - * \returns the physical layer attached to this MAC. + * \return the physical layer attached to this MAC. */ virtual Ptr GetWifiPhy () const; /** @@ -183,7 +195,7 @@ */ virtual void SetWifiRemoteStationManager (Ptr stationManager); /** - * \returns the station manager attached to this MAC. + * \return the station manager attached to this MAC. */ virtual Ptr GetWifiRemoteStationManager () const; @@ -286,9 +298,28 @@ * \param hdr a pointer to the MAC header of the received frame. */ virtual void Receive (Ptr packet, const WifiMacHeader *hdr); + /** + * The packet we sent was successfully received by the receiver + * (i.e. we received an ACK from the receiver). + * + * \param hdr the header of the packet that we successfully sent + */ virtual void TxOk (const WifiMacHeader &hdr); + /** + * The packet we sent was successfully received by the receiver + * (i.e. we did not receive an ACK from the receiver). + * + * \param hdr the header of the packet that we failed to sent + */ virtual void TxFailed (const WifiMacHeader &hdr); + /** + * Forward the packet up to the device. + * + * \param packet the packet that we are forwarding up to the device + * \param from the address of the source + * \param to the address of the destination + */ void ForwardUp (Ptr packet, Mac48Address from, Mac48Address to); /** @@ -325,9 +356,17 @@ * however. */ bool m_qosSupported; - /** Set accessor for the \c m_qosSupported member */ + /** + * Enable or disable QoS support for the device. + * + * \param enable whether QoS is supported + */ void SetQosSupported (bool enable); - /** Get accessor for the \c m_qosSupported member */ + /** + * Return whether the device supports QoS. + * + * \return true if QoS is supported, false otherwise + */ bool GetQosSupported () const; /** @@ -344,9 +383,17 @@ * however. */ bool m_htSupported; - /** Set accessor for the \c m_htSupported member */ + /** + * Enable or disable HT support for the device. + * + * \param enable whether HT is supported + */ void SetHtSupported (bool enable); - /** Get accessor for the \c m_htSupported member */ + /** + * Return whether the device supports QoS. + * + * \return true if HT is supported, false otherwise + */ bool GetHtSupported () const; private: @@ -361,16 +408,36 @@ */ void SetupEdcaQueue (enum AcIndex ac); - /** Accessor for the DCF object */ + /** + * Return the DCF. + * + * \return a DCF instance + */ Ptr GetDcaTxop (void) const; - /** Accessor for the AC_VO channel access function */ + /** + * Return the EDCAF instance for the voice access class. + * + * \return a AC_VO EDCAF instance + */ Ptr GetVOQueue (void) const; - /** Accessor for the AC_VI channel access function */ + /** + * Return the EDCAF instance for the video access class. + * + * \return a AC_VI EDCAF instance + */ Ptr GetVIQueue (void) const; - /** Accessor for the AC_BE channel access function */ + /** + * Return the EDCAF instance for the best effort access class. + * + * \return a AC_BE EDCAF instance + */ Ptr GetBEQueue (void) const; - /** Accessor for the AC_BK channel access function */ + /** + * Return the EDCAF instance for the background access class. + * + * \return a AC_BK EDCAF instance + */ Ptr GetBKQueue (void) const; TracedCallback m_txOkCallback; diff -r b22e9f50a0da src/wifi/model/snr-tag.h --- a/src/wifi/model/snr-tag.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/snr-tag.h Fri Nov 15 19:13:28 2013 -0500 @@ -44,6 +44,7 @@ /** * Create a SnrTag with the given snr value + * \param snr the given SNR value */ SnrTag(double snr); @@ -55,9 +56,14 @@ /** * Set the SNR to the given value. * - * @param snr the value of the snr to set + * \param snr the value of the snr to set */ void Set (double snr); + /** + * Return the SNR value. + * + * \return the SNR value + */ double Get (void) const; private: double m_snr; diff -r b22e9f50a0da src/wifi/model/sta-wifi-mac.h --- a/src/wifi/model/sta-wifi-mac.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/sta-wifi-mac.h Fri Nov 15 19:13:28 2013 -0500 @@ -84,6 +84,9 @@ void StartActiveAssociation (void); private: + /** + * The current MAC state of the STA. + */ enum MacState { ASSOCIATED, @@ -93,21 +96,86 @@ REFUSED }; + /** + * Enable or disable active probing. + * + * \param enable enable or disable active probing + */ void SetActiveProbing (bool enable); + /** + * Return whether active probing is enabled. + * + * \return true if active probing is enabled, false otherwise + */ bool GetActiveProbing (void) const; virtual void Receive (Ptr packet, const WifiMacHeader *hdr); + + /** + * Forward a probe request packet to the DCF. The standard is not clear on the correct + * queue for management frames if QoS is supported. We always use the DCF. + */ void SendProbeRequest (void); + /** + * Forward an association request packet to the DCF. The standard is not clear on the correct + * queue for management frames if QoS is supported. We always use the DCF. + */ void SendAssociationRequest (void); + /** + * Try to ensure that we are associated with an AP by taking an appropriate action + * depending on the current association status. + */ void TryToEnsureAssociated (void); + /** + * This method is called after the association timeout occurred. We switch the state to + * WAIT_ASSOC_RESP and re-send an association request. + */ void AssocRequestTimeout (void); + /** + * This method is called after the probe request timeout occurred. We switch the state to + * WAIT_PROBE_RESP and re-send a probe request. + */ void ProbeRequestTimeout (void); + /** + * Return whether we are associated with an AP. + * + * \return true if we are associated with an AP, false otherwise + */ bool IsAssociated (void) const; + /** + * Return whether we are waiting for an association response from an AP. + * + * \return true if we are waiting for an association response from an AP, false otherwise + */ bool IsWaitAssocResp (void) const; + /** + * This method is called after we have not received a beacon from the AP + */ void MissedBeacons (void); + /** + * Restarts the beacon timer. + * + * \param delay the delay before the watchdog fires + */ void RestartBeaconWatchdog (Time delay); + /** + * Return an instance of SupportedRates that contains all rates that we support + * including HT rates. + * + * \return SupportedRates all rates that we support + */ SupportedRates GetSupportedRates (void) const; + /** + * Set the current MAC state. + * + * \param value the new state + */ void SetState (enum MacState value); + /** + * Return the HT capability of the current AP. + * + * \return the HT capability that we support + */ HtCapabilities GetHtCapabilities (void) const; diff -r b22e9f50a0da src/wifi/model/wifi-mac-header.h --- a/src/wifi/model/wifi-mac-header.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/wifi-mac-header.h Fri Nov 15 19:13:28 2013 -0500 @@ -103,41 +103,167 @@ virtual void Serialize (Buffer::Iterator start) const; virtual uint32_t Deserialize (Buffer::Iterator start); - + /** + * Set Type/Subtype values for an association request header. + */ void SetAssocReq (void); + /** + * Set Type/Subtype values for an association response header. + */ void SetAssocResp (void); + /** + * Set Type/Subtype values for a probe request header. + */ void SetProbeReq (void); + /** + * Set Type/Subtype values for a probe response header. + */ void SetProbeResp (void); + /** + * Set Type/Subtype values for a beacon header. + */ void SetBeacon (void); + /** + * Set Type/Subtype values for a data packet with + * no subtype equal to 0. + */ void SetTypeData (void); + /** + * Set Type/Subtype values for an action header. + */ void SetAction (); + /** + * Set Type/Subtype values for a Block Ack Request header. + */ void SetBlockAckReq (void); + /** + * Set Type/Subtype values for a Block Ack header. + */ void SetBlockAck (void); void SetMultihopAction (); + /** + * Set the From DS bit in the Frame Control field. + */ void SetDsFrom (void); + /** + * Un-set the From DS bit in the Frame Control field. + */ void SetDsNotFrom (void); + /** + * Set the To DS bit in the Frame Control field. + */ void SetDsTo (void); + /** + * Un-set the To DS bit in the Frame Control field. + */ void SetDsNotTo (void); + /** + * Fill the Address 1 field with the given address. + * + * \param address the address to be used in the Address 1 field + */ void SetAddr1 (Mac48Address address); + /** + * Fill the Address 2 field with the given address. + * + * \param address the address to be used in the Address 2 field + */ void SetAddr2 (Mac48Address address); + /** + * Fill the Address 3 field with the given address. + * + * \param address the address to be used in the Address 3 field + */ void SetAddr3 (Mac48Address address); + /** + * Fill the Address 4 field with the given address. + * + * \param address the address to be used in the Address 4 field + */ void SetAddr4 (Mac48Address address); + /** + * Set Type/Subtype values with the correct values depending + * on the given type. + * + * \param type the WifiMacType for the header + */ void SetType (enum WifiMacType type); + /** + * Set the Duration/ID field with the given raw uint16_t value. + * + * \param duration the raw duration in uint16_t + */ void SetRawDuration (uint16_t duration); + /** + * Set the Duration/ID field with the given duration (Time object). + * The method converts the given time to microseconds. + * + * \param duration the duration (Time object) + */ void SetDuration (Time duration); + /** + * Set the Duration/ID field with the given ID. + * + * \param id the ID + */ void SetId (uint16_t id); + /** + * Set the sequence number of the header. + * + * \param seq the given sequence number + */ void SetSequenceNumber (uint16_t seq); + /** + * Set the fragment number of the header. + * + * \param frag the given fragment number + */ void SetFragmentNumber (uint8_t frag); + /** + * Un-set the More Fragment bit in the Frame Control Field + */ void SetNoMoreFragments (void); + /** + * Set the More Fragment bit in the Frame Control field + */ void SetMoreFragments (void); + /** + * Set the Retry bit in the Frame Control field. + */ void SetRetry (void); + /** + * Un-set the Retry bit in the Frame Control field. + */ void SetNoRetry (void); + /** + * Set the TID for the QoS header. + * + * \param tid the TID for the QoS header + */ void SetQosTid (uint8_t tid); + /** + * Set the end of service period (EOSP) bit in the QoS control field. + */ void SetQosEosp (); + /** + * Un-set the end of service period (EOSP) bit in the QoS control field. + */ void SetQosNoEosp (); + /** + * Set the QoS ACK policy in the QoS control field. + */ void SetQosAckPolicy (enum QosAckPolicy); + /** + * Set the QoS ACK policy in the QoS control field to normal ACK. + */ void SetQosNormalAck (void); + /** + * Set the QoS ACK policy in the QoS control field to block ACK. + */ void SetQosBlockAck (void); + /** + * Set the QoS ACK policy in the QoS control field to no ACK. + */ void SetQosNoAck (void); void SetQosAmsdu (void); void SetQosNoAmsdu (void); @@ -145,61 +271,300 @@ void SetOrder (void); void SetNoOrder (void); + /** + * Return the address in the Address 1 field. + * + * \return the address in the Address 1 field + */ Mac48Address GetAddr1 (void) const; + /** + * Return the address in the Address 2 field. + * + * \return the address in the Address 2 field + */ Mac48Address GetAddr2 (void) const; + /** + * Return the address in the Address 3 field. + * + * \return the address in the Address 3 field + */ Mac48Address GetAddr3 (void) const; + /** + * Return the address in the Address 4 field. + * + * \return the address in the Address 4 field + */ Mac48Address GetAddr4 (void) const; + /** + * Return the type (enum WifiMacType) + * + * \return the type (enum WifiMacType) + */ enum WifiMacType GetType (void) const; + /** + * \return true if From DS bit is set, false otherwise + */ bool IsFromDs (void) const; + /** + * \return true if To DS bit is set, false otherwise + */ bool IsToDs (void) const; + /** + * Return true if the Type is DATA. The method does + * not check the Subtype field. (e.g. the header may be + * DATA with QoS) + * + * \return true if Type is DATA, false otherwise + */ bool IsData (void) const; + /** + * Return true if the Type is DATA and Subtype is one of the + * possible values for QoS DATA. + * + * \return true if Type is QoS DATA, false otherwise + */ bool IsQosData (void) const; + /** + * Return true if the Type is Control. + * + * \return true if Type is Control, false otherwise + */ bool IsCtl (void) const; + /** + * Return true if the Type is Management. + * + * \return true if Type is Management, false otherwise + */ bool IsMgt (void) const; + /** + * Return true if the Type/Subtype is one of the possible CF-Poll headers. + * + * \return true if the Type/Subtype is one of the possible CF-Poll headers, false otherwise + */ bool IsCfpoll (void) const; + /** + * Return true if the header is a RTS header. + * + * \return true if the header is a RTS header, false otherwise + */ bool IsRts (void) const; + /** + * Return true if the header is a CTS header. + * + * \return true if the header is a CTS header, false otherwise + */ bool IsCts (void) const; + /** + * Return true if the header is an ACK header. + * + * \return true if the header is an ACK header, false otherwise + */ bool IsAck (void) const; + /** + * Return true if the header is a Block ACK Request header. + * + * \return true if the header is a Block ACK Request header, false otherwise + */ bool IsBlockAckReq (void) const; + /** + * Return true if the header is a Block ACK header. + * + * \return true if the header is a Block ACK header, false otherwise + */ bool IsBlockAck (void) const; + /** + * Return true if the header is an Association Request header. + * + * \return true if the header is an Association Request header, false otherwise + */ bool IsAssocReq (void) const; + /** + * Return true if the header is an Association Response header. + * + * \return true if the header is an Association Response header, false otherwise + */ bool IsAssocResp (void) const; + /** + * Return true if the header is a Reassociation Request header. + * + * \return true if the header is a Reassociation Request header, false otherwise + */ bool IsReassocReq (void) const; + /** + * Return true if the header is a Reassociation Response header. + * + * \return true if the header is a Reassociation Response header, false otherwise + */ bool IsReassocResp (void) const; + /** + * Return true if the header is a Probe Request header. + * + * \return true if the header is a Probe Request header, false otherwise + */ bool IsProbeReq (void) const; + /** + * Return true if the header is a Probe Response header. + * + * \return true if the header is a Probe Response header, false otherwise + */ bool IsProbeResp (void) const; + /** + * Return true if the header is a Beacon header. + * + * \return true if the header is a Beacon header, false otherwise + */ bool IsBeacon (void) const; + /** + * Return true if the header is a Disassociation header. + * + * \return true if the header is a Disassociation header, false otherwise + */ bool IsDisassociation (void) const; + /** + * Return true if the header is an Authentication header. + * + * \return true if the header is an Authentication header, false otherwise + */ bool IsAuthentication (void) const; + /** + * Return true if the header is a Deauthentication header. + * + * \return true if the header is a Deauthentication header, false otherwise + */ bool IsDeauthentication (void) const; + /** + * Return true if the header is an Action header. + * + * \return true if the header is an Action header, false otherwise + */ bool IsAction () const; bool IsMultihopAction () const; + /** + * Return the raw duration from the Duration/ID field. + * + * \return the raw duration from the Duration/ID field + */ uint16_t GetRawDuration (void) const; + /** + * Return the duration from the Duration/ID field (Time object). + * + * \return the duration from the Duration/ID field (Time object) + */ Time GetDuration (void) const; + /** + * Return the raw Sequence Control field. + * + * \return the raw Sequence Control field + */ uint16_t GetSequenceControl (void) const; + /** + * Return the sequence number of the header. + * + * \return the sequence number of the header + */ uint16_t GetSequenceNumber (void) const; + /** + * Return the fragment number of the header. + * + * \return the fragment number of the header + */ uint16_t GetFragmentNumber (void) const; + /** + * Return if the Retry bit is set. + * + * \return true if the Retry bit is set, false otherwise + */ bool IsRetry (void) const; + /** + * Return if the More Fragment bit is set. + * + * \return true if the More Fragment bit is set, false otherwise + */ bool IsMoreFragments (void) const; + /** + * Return if the QoS ACK policy is Block ACK. + * + * \return true if the QoS ACK policy is Block ACK, false otherwise + */ bool IsQosBlockAck (void) const; + /** + * Return if the QoS ACK policy is No ACK. + * + * \return true if the QoS ACK policy is No ACK, false otherwise + */ bool IsQosNoAck (void) const; + /** + * Return if the QoS ACK policy is Normal ACK. + * + * \return true if the QoS ACK policy is No ACK, false otherwise + */ bool IsQosAck (void) const; + /** + * Return if the end of service period (EOSP) is set. + * + * \return true if the end of service period (EOSP) is set, false otherwise + */ bool IsQosEosp (void) const; bool IsQosAmsdu (void) const; + /** + * Return the Traffic ID of a QoS header. + * + * \return the Traffic ID of a QoS header + */ uint8_t GetQosTid (void) const; + /** + * Return the QoS ACK Policy of a QoS header. + * + * \return the QoS ACK Policy of a QoS header + */ enum QosAckPolicy GetQosAckPolicy (void) const; uint8_t GetQosTxopLimit (void) const; uint32_t GetSize (void) const; + /** + * Return a string corresponds to the header type. + * + * \returns a string corresponds to the header type. + */ const char * GetTypeString (void) const; private: + /** + * Return the raw Frame Control field. + * + * \return the raw Frame Control field + */ uint16_t GetFrameControl (void) const; + /** + * Return the raw QoS Control field. + * + * \return the raw QoS Control field + */ uint16_t GetQosControl (void) const; + /** + * Set the Frame Control field with the given raw value. + * + * \param control the raw Frame Control field value + */ void SetFrameControl (uint16_t control); + /** + * Set the Sequence Control field with the given raw value. + * + * \param seq the raw Sequence Control field value + */ void SetSequenceControl (uint16_t seq); + /** + * Set the QoS Control field with the given raw value. + * + * \param qos the raw QoS Control field value + */ void SetQosControl (uint16_t qos); + /** + * Print the Frame Control field to the output stream. + * + * \param os the output stream to print to + */ void PrintFrameControl (std::ostream &os) const; uint8_t m_ctrlType; diff -r b22e9f50a0da src/wifi/model/wifi-mac.h --- a/src/wifi/model/wifi-mac.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/wifi-mac.h Fri Nov 15 19:13:28 2013 -0500 @@ -85,50 +85,54 @@ */ void SetMaxPropagationDelay (Time delay); /** - * \returns the current RIFS duration. + * \return the current RIFS duration. */ virtual Time GetRifs (void) const = 0; /** - * \returns the current PIFS duration. + * \return the current PIFS duration. */ virtual Time GetPifs (void) const = 0; /** - * \returns the current SIFS duration. + * \return the current SIFS duration. */ virtual Time GetSifs (void) const = 0; /** - * \returns the current slot duration. + * \return the current slot duration. */ virtual Time GetSlot (void) const = 0; /** - * \returns the current EIFS minus DIFS duration + * \return the current EIFS minus DIFS duration */ virtual Time GetEifsNoDifs (void) const = 0; /** - * \returns the current CTS timeout duration. + * \return the current CTS timeout duration. */ virtual Time GetCtsTimeout (void) const = 0; /** - * \returns the current ACK timeout duration. + * \return the current ACK timeout duration. */ virtual Time GetAckTimeout (void) const = 0; /** + * \return the maximum lifetime of an MSDU. + * * Unused for now. */ Time GetMsduLifetime (void) const; /** + * \return the maximum propagation delay. + * * Unused for now. */ Time GetMaxPropagationDelay (void) const; /** - * \returns the MAC address associated to this MAC layer. + * \return the MAC address associated to this MAC layer. */ virtual Mac48Address GetAddress (void) const = 0; /** - * \returns the ssid which this MAC layer is going to try to stay in. + * \return the ssid which this MAC layer is going to try to stay in. */ virtual Ssid GetSsid (void) const = 0; /** @@ -140,7 +144,7 @@ */ virtual void SetSsid (Ssid ssid) = 0; /** - * \returns the bssid of the network this device belongs to. + * \return the bssid of the network this device belongs to. */ virtual Mac48Address GetBssid (void) const = 0; /** @@ -173,6 +177,13 @@ * access it granted to this MAC. */ virtual void Enqueue (Ptr packet, Mac48Address to) = 0; + /** + * \return if this MAC supports sending from arbitrary address. + * + * The interface may or may not support sending from arbitrary address. + * This function returns true if sending from arbitrary address is supported, + * false otherwise. + */ virtual bool SupportsSendFrom (void) const = 0; /** * \param phy the physical layer attached to this MAC. @@ -197,36 +208,65 @@ /* Next functions are not pure virtual so non Qos WifiMacs are not * forced to implement them. */ + + /** + * \param blockAckTimeout the duration for basic block ACK timeout. + * + * Sets the timeout for basic block ACK. + */ virtual void SetBasicBlockAckTimeout (Time blockAckTimeout); + /** + * \return the current basic block ACK timeout duration. + */ virtual Time GetBasicBlockAckTimeout (void) const; + /** + * \param blockAckTimeout + * + * Sets the timeout for compressed block ACK. + */ virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout); + /** + * \return the current compressed block ACK timeout duration. + */ virtual Time GetCompressedBlockAckTimeout (void) const; /** + * \param packet the packet being enqueued + * * Public method used to fire a MacTx trace. Implemented for encapsulation - * purposes. + * purposes. Note this trace indicates that the packet was accepted by the + * device only. The packet may be dropped later (e.g. if the queue is full). */ void NotifyTx (Ptr packet); /** + * \param packet the packet being dropped + * * Public method used to fire a MacTxDrop trace. Implemented for encapsulation - * purposes. + * purposes. This trace indicates that the packet was dropped before it was + * transmitted (e.g. when a STA is not associated with an AP). */ void NotifyTxDrop (Ptr packet); /** + * \param packet the packet we received + * * Public method used to fire a MacRx trace. Implemented for encapsulation * purposes. */ void NotifyRx (Ptr packet); /** + * \param packet the packet we received promiscuously + * * Public method used to fire a MacPromiscRx trace. Implemented for encapsulation * purposes. */ void NotifyPromiscRx (Ptr packet); /** + * \param packet the packet we received but is not destined for us + * * Public method used to fire a MacRxDrop trace. Implemented for encapsulation * purposes. */ @@ -237,18 +277,72 @@ void ConfigureStandard (enum WifiPhyStandard standard); protected: + /** + * \param dcf the DCF to be configured + * \param cwmin the minimum congestion window for the DCF + * \param cwmax the maximum congestion window for the DCF + * \param ac the access category for the DCF + * + * Configure the DCF with appropriate values depending on the given access category. + */ void ConfigureDcf (Ptr dcf, uint32_t cwmin, uint32_t cwmax, enum AcIndex ac); private: + /** + * \return the default maximum propagation delay + * + * By default, we get the maximum propagation delay from 1000 m and speed of light + * (3e8 m/s). + */ static Time GetDefaultMaxPropagationDelay (void); + /** + * \return the default slot duration + * + * Return a default slot value for 802.11a (9 microseconds). + */ static Time GetDefaultSlot (void); + /** + * \return the default short interframe space (SIFS) + * + * Return a default SIFS value for 802.11a (16 microseconds). + */ static Time GetDefaultSifs (void); + /** + * \return the default reduced interframe space (RIFS) + * + * Return a default RIFS value for 802.11n (2 microseconds). + */ static Time GetDefaultRifs (void); + /** + * \return the default extended interframe space (EIFS) without + * DCF interframe space (DIFS) + * + * Return default SIFS + default CTS-ACK delay + */ static Time GetDefaultEifsNoDifs (void); + /** + * \return the default CTS-ACK delay + * + * Return a default value for 802.11a at 6Mbps (44 microseconds) + */ static Time GetDefaultCtsAckDelay (void); + /** + * \return the default CTS and ACK timeout + * + * Return the default CTS and ACK timeout. + * Cts_Timeout and Ack_Timeout are specified in the Annex C + * (Formal description of MAC operation, see details on the + * Trsp timer setting at page 346) + */ static Time GetDefaultCtsAckTimeout (void); static Time GetDefaultBasicBlockAckDelay (void); + /** + * \return the default basic block ACK timeout + */ static Time GetDefaultBasicBlockAckTimeout (void); static Time GetDefaultCompressedBlockAckDelay (void); + /** + * \return the default compressed block ACK timeout + */ static Time GetDefaultCompressedBlockAckTimeout (void); /** * \param standard the phy standard to be used @@ -262,12 +356,33 @@ Time m_maxPropagationDelay; + /** + * Configure appropriate timing parameters for 802.11a. + */ void Configure80211a (void); + /** + * Configure appropriate timing parameters for 802.11b. + */ void Configure80211b (void); + /** + * Configure appropriate timing parameters for 802.11g. + */ void Configure80211g (void); + /** + * Configure appropriate timing parameters for 802.11 with 10Mhz channel spacing. + */ void Configure80211_10Mhz (void); + /** + * Configure appropriate timing parameters for 802.11 with 5Mhz channel spacing. + */ void Configure80211_5Mhz (); + /** + * Configure appropriate timing parameters for 802.11n operating at 2.4Ghz. + */ void Configure80211n_2_4Ghz (void); + /** + * Configure appropriate timing parameters for 802.11n operating at 5Ghz. + */ void Configure80211n_5Ghz (void); /** diff -r b22e9f50a0da src/wifi/model/wifi-phy.cc --- a/src/wifi/model/wifi-phy.cc Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/wifi-phy.cc Fri Nov 15 19:13:28 2013 -0500 @@ -499,9 +499,7 @@ } -/** - * Clause 15 rates (DSSS) - */ +// Clause 15 rates (DSSS) WifiMode WifiPhy::GetDsssRate1Mbps () @@ -530,9 +528,8 @@ } -/** - * Clause 18 rates (HR/DSSS) - */ +// Clause 18 rates (HR/DSSS) + WifiMode WifiPhy::GetDsssRate5_5Mbps () { @@ -560,9 +557,8 @@ } -/** - * Clause 19.5 rates (ERP-OFDM) - */ +// Clause 19.5 rates (ERP-OFDM) + WifiMode WifiPhy::GetErpOfdmRate6Mbps () { @@ -668,9 +664,8 @@ } -/** - * Clause 17 rates (OFDM) - */ +// Clause 17 rates (OFDM) + WifiMode WifiPhy::GetOfdmRate6Mbps () { @@ -775,7 +770,8 @@ return mode; } -/* 10 MHz channel rates */ +// 10 MHz channel rates + WifiMode WifiPhy::GetOfdmRate3MbpsBW10MHz () { @@ -880,7 +876,8 @@ return mode; } -/* 5 MHz channel rates */ +// 5 MHz channel rates + WifiMode WifiPhy::GetOfdmRate1_5MbpsBW5MHz () { @@ -985,7 +982,7 @@ return mode; } -/*Clause 20*/ +// Clause 20 WifiMode WifiPhy::GetOfdmRate6_5MbpsBW20MHz () diff -r b22e9f50a0da src/wifi/model/wifi-phy.h --- a/src/wifi/model/wifi-phy.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/wifi-phy.h Fri Nov 15 19:13:28 2013 -0500 @@ -162,10 +162,20 @@ WifiPhy (); virtual ~WifiPhy (); + /** + * Return the minimum available transmission power level (dBm). + * + * \return the minimum available transmission power level in dBm + */ virtual double GetTxPowerStart (void) const = 0; + /** + * Return the maximum available transmission power level (dBm). + * + * \return the maximum available transmission power level in dBm + */ virtual double GetTxPowerEnd (void) const = 0; /** - * \returns the number of tx power levels available for this PHY. + * \return the number of tx power levels available for this PHY. */ virtual uint32_t GetNTxPower (void) const = 0; @@ -198,41 +208,46 @@ virtual void RegisterListener (WifiPhyListener *listener) = 0; /** - * \returns true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise. + * \return true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise. */ virtual bool IsStateIdle (void) = 0; /** - * \returns true of the current state of the PHY layer is WifiPhy::CCA_BUSY, false otherwise. + * \return true of the current state of the PHY layer is WifiPhy::CCA_BUSY, false otherwise. */ virtual bool IsStateCcaBusy (void) = 0; /** - * \returns true of the current state of the PHY layer is not WifiPhy::IDLE, false otherwise. + * \return true of the current state of the PHY layer is not WifiPhy::IDLE, false otherwise. */ virtual bool IsStateBusy (void) = 0; /** - * \returns true of the current state of the PHY layer is WifiPhy::RX, false otherwise. + * \return true of the current state of the PHY layer is WifiPhy::RX, false otherwise. */ virtual bool IsStateRx (void) = 0; /** - * \returns true of the current state of the PHY layer is WifiPhy::TX, false otherwise. + * \return true of the current state of the PHY layer is WifiPhy::TX, false otherwise. */ virtual bool IsStateTx (void) = 0; /** - * \returns true of the current state of the PHY layer is WifiPhy::SWITCHING, false otherwise. + * \return true of the current state of the PHY layer is WifiPhy::SWITCHING, false otherwise. */ virtual bool IsStateSwitching (void) = 0; /** - * \returns the amount of time since the current state has started. + * \return the amount of time since the current state has started. */ virtual Time GetStateDuration (void) = 0; /** - * \returns the predicted delay until this PHY can become WifiPhy::IDLE. + * \return the predicted delay until this PHY can become WifiPhy::IDLE. * * The PHY will never become WifiPhy::IDLE _before_ the delay returned by * this method but it could become really idle later. */ virtual Time GetDelayUntilIdle (void) = 0; + /** + * Return the start time of the last received packet. + * + * \return the start time of the last received packet + */ virtual Time GetLastRxStartTime (void) const = 0; /** @@ -313,7 +328,7 @@ * WifiRemoteStationManager), which itself is a superset (again, not * necessarily proper) of the BSSBasicRateSet. * - * \returns the number of transmission modes supported by this PHY. + * \return the number of transmission modes supported by this PHY. * * \sa WifiPhy::GetMode() */ @@ -332,7 +347,7 @@ * necessarily proper) of the BSSBasicRateSet. * * \param mode index in array of supported modes - * \returns the mode whose index is specified. + * \return the mode whose index is specified. * * \sa WifiPhy::GetNModes() */ @@ -340,7 +355,7 @@ /** * \param txMode the transmission mode * \param ber the probability of bit error rate - * \returns the minimum snr which is required to achieve + * \return the minimum snr which is required to achieve * the requested ber for the specified transmission mode. (W/W) */ virtual double CalculateSnr (WifiMode txMode, double ber) const = 0; @@ -354,7 +369,7 @@ * This was introduced with 11n * * \param selector index in array of supported memeberships - * \returns the memebership selector whose index is specified. + * \return the memebership selector whose index is specified. * * \sa WifiPhy::NBssMembershipSelectors() */ @@ -371,7 +386,7 @@ * This was introduced with 11n * * \param selector index in array of supported memeberships - * \returns a WifiModeList that contains the WifiModes associrated with the selected index. + * \return a WifiModeList that contains the WifiModes associrated with the selected index. * * \sa WifiPhy::GetMembershipSelectorModes() */ @@ -386,7 +401,7 @@ * This was introduced with 11n * * \param Mcs index in array of supported Mcs - * \returns the Mcs index whose index is specified. + * \return the Mcs index whose index is specified. * * \sa WifiPhy::GetNMcs() */ @@ -405,13 +420,29 @@ * * where Starting channel frequency is standard-dependent, see SetStandard() * as defined in IEEE 802.11-2007 17.3.8.3.2. + * + * \param id the channel number */ virtual void SetChannelNumber (uint16_t id) = 0; - /// Return current channel number, see SetChannelNumber() + /** + * Return current channel number. + * + * \return the current channel number + */ virtual uint16_t GetChannelNumber () const = 0; + /** + * Configure the PHY-level parameters for different Wi-Fi standard. + * + * \param standard the Wi-Fi standard + */ virtual void ConfigureStandard (enum WifiPhyStandard standard) = 0; + /** + * Return the WifiChannel this WifiPhy is connected to. + * + * \return the WifiChannel this WifiPhy is connected to + */ virtual Ptr GetChannel (void) const = 0; static WifiMode GetDsssRate1Mbps (); @@ -488,36 +519,48 @@ /** * Public method used to fire a PhyTxBegin trace. Implemented for encapsulation * purposes. + * + * \param packet the packet being transmitted */ void NotifyTxBegin (Ptr packet); /** * Public method used to fire a PhyTxEnd trace. Implemented for encapsulation * purposes. + * + * \param packet the packet that was transmitted */ void NotifyTxEnd (Ptr packet); /** * Public method used to fire a PhyTxDrop trace. Implemented for encapsulation * purposes. + * + * \param packet the packet that was failed to transmitted */ void NotifyTxDrop (Ptr packet); /** * Public method used to fire a PhyRxBegin trace. Implemented for encapsulation * purposes. + * + * \param packet the packet being received */ void NotifyRxBegin (Ptr packet); /** * Public method used to fire a PhyRxEnd trace. Implemented for encapsulation * purposes. + * + * \param packet the packet received */ void NotifyRxEnd (Ptr packet); /** * Public method used to fire a PhyRxDrop trace. Implemented for encapsulation * purposes. + * + * \param packet the packet that was not successfully received */ void NotifyRxDrop (Ptr packet); @@ -526,20 +569,20 @@ * Public method used to fire a MonitorSniffer trace for a wifi packet being received. Implemented for encapsulation * purposes. * - * @param packet the packet being received - * @param channelFreqMhz the frequency in MHz at which the packet is - * received. Note that in real devices this is normally the - * frequency to which the receiver is tuned, and this can be - * different than the frequency at which the packet was originally - * transmitted. This is because it is possible to have the receiver - * tuned on a given channel and still to be able to receive packets - * on a nearby channel. - * @param channelNumber the channel on which the packet is received - * @param rate the PHY data rate in units of 500kbps (i.e., the same - * units used both for the radiotap and for the prism header) - * @param isShortPreamble true if short preamble is used, false otherwise - * @param signalDbm signal power in dBm - * @param noiseDbm noise power in dBm + * \param packet the packet being received + * \param channelFreqMhz the frequency in MHz at which the packet is + * received. Note that in real devices this is normally the + * frequency to which the receiver is tuned, and this can be + * different than the frequency at which the packet was originally + * transmitted. This is because it is possible to have the receiver + * tuned on a given channel and still to be able to receive packets + * on a nearby channel. + * \param channelNumber the channel on which the packet is received + * \param rate the PHY data rate in units of 500kbps (i.e., the same + * units used both for the radiotap and for the prism header) + * \param isShortPreamble true if short preamble is used, false otherwise + * \param signalDbm signal power in dBm + * \param noiseDbm noise power in dBm */ void NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm); @@ -549,13 +592,14 @@ * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted. Implemented for encapsulation * purposes. * - * @param packet the packet being transmitted - * @param channelFreqMhz the frequency in MHz at which the packet is - * transmitted. - * @param channelNumber the channel on which the packet is transmitted - * @param rate the PHY data rate in units of 500kbps (i.e., the same - * units used both for the radiotap and for the prism header) - * @param isShortPreamble true if short preamble is used, false otherwise + * \param packet the packet being transmitted + * \param channelFreqMhz the frequency in MHz at which the packet is + * transmitted. + * \param channelNumber the channel on which the packet is transmitted + * \param rate the PHY data rate in units of 500kbps (i.e., the same + * units used both for the radiotap and for the prism header) + * \param isShortPreamble true if short preamble is used, false otherwise + * \param txPower the transmission power in dBm */ void NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower); @@ -570,63 +614,69 @@ virtual int64_t AssignStreams (int64_t stream) = 0; /** - * \param the operating frequency on this node. + * \param freq the operating frequency on this node. */ virtual void SetFrequency (uint32_t freq)=0; + /** + * \return the operating frequency on this node + */ virtual uint32_t GetFrequency (void) const=0; /** - * \param the number of transmitters on this node. + * \param tx the number of transmitters on this node. */ virtual void SetNumberOfTransmitAntennas (uint32_t tx)=0; + /** + * \return the number of transmit antenna on this device + */ virtual uint32_t GetNumberOfTransmitAntennas (void) const=0; /** - * \param the number of recievers on this node. + * \param rx the number of recievers on this node. */ virtual void SetNumberOfReceiveAntennas (uint32_t rx)=0 ; /** - * \returns the number of recievers on this node. + * \return the number of recievers on this node. */ virtual uint32_t GetNumberOfReceiveAntennas (void) const=0; /** - * \paramif short guard interval is supported or not + * \param guardInterval Enable or disable short guard interval */ - virtual void SetGuardInterval (bool GuardInterval)=0; + virtual void SetGuardInterval (bool guardInterval)=0; /** - * \returns if short guard interval is supported or not + * \return true if short guard interval is supported, false otherwise */ virtual bool GetGuardInterval (void) const = 0; /** - * \paramif LDPC is supported or not + * \param ldpc Enable or disable LDPC */ - virtual void SetLdpc (bool Ldpc)=0; + virtual void SetLdpc (bool ldpc)=0; /** - * \returns if LDPC is supported or not + * \return true if LDPC is supported, false otherwise */ virtual bool GetLdpc (void) const=0; /** - * \paramif STBC is supported or not + * \param stbc Enable or disable STBC is supported */ virtual void SetStbc (bool stbc)=0; /** - * \returns if STBC is supported or not + * \return true if STBC is supported, false otherwise */ virtual bool GetStbc (void) const=0; /** - * \paramif GreenField is supported or not + * \param greenfield Enable or disable GreenField */ virtual void SetGreenfield (bool greenfield)=0; /** - * \returns if Green field is supported or not + * \return true if Greenfield is supported, false otherwise */ virtual bool GetGreenfield (void) const=0; /** - * \paramif channel bonding 40 MHz is supported or not + * \return true if channel bonding 40 MHz is supported, false otherwise */ virtual bool GetChannelBonding (void) const = 0; /** - * \returns if channel bonding is supported or not + * \param channelbonding Enable or disable channel bonding */ virtual void SetChannelBonding (bool channelbonding) = 0 ; diff -r b22e9f50a0da src/wifi/model/wifi-remote-station-manager.cc --- a/src/wifi/model/wifi-remote-station-manager.cc Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/wifi-remote-station-manager.cc Fri Nov 15 19:13:28 2013 -0500 @@ -45,6 +45,9 @@ public: HighLatencyDataTxVectorTag (); HighLatencyDataTxVectorTag (WifiTxVector dataTxVector); + /** + * \returns the transmission mode to use to send this packet + */ WifiTxVector GetDataTxVector (void) const; static TypeId GetTypeId (void); @@ -110,6 +113,10 @@ public: HighLatencyRtsTxVectorTag (); HighLatencyRtsTxVectorTag (WifiTxVector rtsTxVector); + /** + * \returns the transmission mode to use to send the RTS prior to the + * transmission of the data packet itself. + */ WifiTxVector GetRtsTxVector (void) const; static TypeId GetTypeId (void); @@ -175,6 +182,9 @@ public: HighLatencyCtsToSelfTxVectorTag (); HighLatencyCtsToSelfTxVectorTag (WifiTxVector ctsToSelfTxVector); + /** + * \returns the transmission mode to use for the CTS-to-self. + */ WifiTxVector GetCtsToSelfTxVector (void) const; static TypeId GetTypeId (void); diff -r b22e9f50a0da src/wifi/model/wifi-remote-station-manager.h --- a/src/wifi/model/wifi-remote-station-manager.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/wifi-remote-station-manager.h Fri Nov 15 19:13:28 2013 -0500 @@ -57,13 +57,15 @@ void NotifyTxSuccess (uint32_t retryCounter); /// Updates average frame error rate when final data or RTS has failed. void NotifyTxFailed (); - /// Returns frame error rate (probability that frame is corrupted due to transmission error). + /// Return frame error rate (probability that frame is corrupted due to transmission error). double GetFrameErrorRate () const; private: /** * \brief Calculate averaging coefficient for frame error rate. Depends on time of the last update. * \attention Calling this method twice gives different results, * because it resets time of last update. + * + * \return average coefficient for frame error rate */ double CalculateAveragingCoefficient (); /// averaging coefficient depends on the memory time @@ -88,33 +90,122 @@ WifiRemoteStationManager (); virtual ~WifiRemoteStationManager (); + /** + * Set up PHY associated with this device since it is the object that + * knows the full set of transmit rates that are supported. + * + * \param phy the PHY of this device + */ virtual void SetupPhy (Ptr phy); + /** + * Return the maximum STA short retry count (SSRC). + * + * \return the maximum SSRC + */ uint32_t GetMaxSsrc (void) const; + /** + * Return the maximum STA long retry count (SLRC). + * + * \return the maximum SLRC + */ uint32_t GetMaxSlrc (void) const; + /** + * Return the RTS threshold. + * + * \return the RTS threshold + */ uint32_t GetRtsCtsThreshold (void) const; + /** + * Return the fragmentation threshold. + * + * \return the fragmentation threshold + */ uint32_t GetFragmentationThreshold (void) const; + /** + * Sets the maximum STA short retry count (SSRC). + * + * \param the maximum SSRC + */ void SetMaxSsrc (uint32_t maxSsrc); + /** + * Sets the maximum STA long retry count (SLRC). + * + * \param the maximum SLRC + */ void SetMaxSlrc (uint32_t maxSlrc); + /** + * Sets the RTS threshold. + * + * \param the RTS threshold + */ void SetRtsCtsThreshold (uint32_t threshold); + /** + * Sets a fragmentation threshold. The method calls a private method + * DoSetFragmentationThreshold that checks the validity of the value given. + * + * \param threshold the fragmentation threshold + */ void SetFragmentationThreshold (uint32_t threshold); - void AddStationHtCapabilities (Mac48Address from,HtCapabilities htcapabilities); + /** + * Records HT capabilities of remote station. + * + * \param from the address of the station being recorded + * \param htcapabilities the HT capabilities of the station + */ + void AddStationHtCapabilities (Mac48Address from, HtCapabilities htcapabilities); + /** + * Enable or disable HT capability support. + * + * \param enable enable or disable HT capability support + */ void SetHtSupported (bool enable); + /** + * Return whether the device has HT capability support enabled. + * + * \return true if HT capability support is enabled, false otherwise + */ bool HasHtSupported (void) const; - // Invoked in a STA upon dis-association - // or in an AP upon reboot + /** + * Reset the station, invoked in a STA upon dis-association or in an AP upon reboot. + */ void Reset (void); - // Invoked in a STA upon association to store - // the set of rates which belong to the - // BSSBasicRateSet of the associated AP - // and which are supported locally. - // Invoked in an AP to configure the BSSBasicRateSet + /** + * Invoked in a STA upon association to store the set of rates which belong to the + * BSSBasicRateSet of the associated AP and which are supported locally. + * Invoked in an AP to configure the BSSBasicRateSet. + * + * \param mode the WifiMode to be added to the basic mode set + */ void AddBasicMode (WifiMode mode); + /** + * Return the default transmission mode. + * + * \return WifiMode the default transmission mode + */ WifiMode GetDefaultMode (void) const; + /** + * Return the number of basic modes we support. + * + * \return the number of basic modes we support + */ uint32_t GetNBasicModes (void) const; + /** + * Return a basic mode from the set of basic modes. + * + * \param i index of the basic mode in the basic mode set + * \return the basic mode at the given index + */ WifiMode GetBasicMode (uint32_t i) const; + /** + * Return whether the station supports Greenfield or not. + * + * \param address the address of the station + * \return true if Greenfield is supported by the station, + * false otherwise + */ bool GetGreenfieldSupported (Mac48Address address) const; void AddBasicMcs (uint8_t mcs); @@ -123,12 +214,19 @@ uint8_t GetBasicMcs (uint32_t i) const; void AddSupportedMcs (Mac48Address address, uint8_t mcs); + /** + * Return a mode for non-unicast packets. + * + * \return WifiMode for non-unicast packets + */ WifiMode GetNonUnicastMode (void) const; /** * Invoked in an AP upon disassociation of a * specific STA. + * + * \param address the address of the STA */ void Reset (Mac48Address address); /** @@ -137,16 +235,64 @@ * also supported locally. * The set of supported modes includes * the BSSBasicRateSet. + * + * \param address the address of the station being recorded + * \param mode the WifiMode supports by the station */ void AddSupportedMode (Mac48Address address, WifiMode mode); //void AddBssMembershipParameters(Mac48Address address, uint32_t selector); + /** + * Return whether the station state is brand new. + * + * \param address the address of the station + * \return true if the state of the station is brand new, + * false otherwise + */ bool IsBrandNew (Mac48Address address) const; + /** + * Return whether the station associated. + * + * \param address the address of the station + * \return true if the station is associated, + * false otherwise + */ bool IsAssociated (Mac48Address address) const; + /** + * Return whether we are waiting for an ACK for + * the association response we sent. + * + * \param address the address of the station + * \return true if the station is associated, + * false otherwise + */ bool IsWaitAssocTxOk (Mac48Address address) const; + /** + * Records that we are waiting for an ACK for + * the association response we sent. + * + * \param address the address of the station + */ void RecordWaitAssocTxOk (Mac48Address address); + /** + * Records that we got an ACK for + * the association response we sent. + * + * \param address the address of the station + */ void RecordGotAssocTxOk (Mac48Address address); + /** + * Records that we missed an ACK for + * the association response we sent. + * + * \param address the address of the station + */ void RecordGotAssocTxFailed (Mac48Address address); + /** + * Records that the STA was disassociated. + * + * \param address the address of the station + */ void RecordDisassociated (Mac48Address address); /** @@ -168,7 +314,7 @@ * \param header MAC header * \param packet the packet to send * \param fullPacketSize the size of the packet after its 802.11 MAC header has been added. - * \returns the transmission mode to use to send this packet + * \return the transmission mode to use to send this packet */ WifiTxVector GetDataTxVector (Mac48Address address, const WifiMacHeader *header, Ptr packet, uint32_t fullPacketSize); @@ -176,49 +322,85 @@ * \param address remote address * \param header MAC header * \param packet the packet to send - * \returns the transmission mode to use to send the RTS prior to the + * + * \return the transmission mode to use to send the RTS prior to the * transmission of the data packet itself. */ WifiTxVector GetRtsTxVector (Mac48Address address, const WifiMacHeader *header, Ptr packet); + /** + * \param header MAC header + * \param packet the packet to send + * + * \return the transmission mode to use to send the CTS-to-self prior to the + * transmission of the data packet itself. + */ WifiTxVector GetCtsToSelfTxVector (const WifiMacHeader *header, Ptr packet); - //Since CTS to Self parameters don't depened on the station it is implemented in wifiremote station manager + /** + * Since CTS-to-self parameters are not dependent on the station, + * it is implemented in wifiremote station manager + */ WifiTxVector DoGetCtsToSelfTxVector (void); /** * Should be invoked whenever the RtsTimeout associated to a transmission * attempt expires. + * + * \param address the address of the receiver + * \param header MAC header of the DATA packet */ void ReportRtsFailed (Mac48Address address, const WifiMacHeader *header); /** * Should be invoked whenever the AckTimeout associated to a transmission * attempt expires. + * + * \param address the address of the receiver + * \param header MAC header of the DATA packet */ void ReportDataFailed (Mac48Address address, const WifiMacHeader *header); /** * Should be invoked whenever we receive the Cts associated to an RTS - * we just sent. + * we just sent. Note that we also get the SNR of the RTS we sent since + * the receiver put a SnrTag in the CTS. + * + * \param address the address of the receiver + * \param header MAC header of the DATA packet + * \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 */ void ReportRtsOk (Mac48Address address, const WifiMacHeader *header, double ctsSnr, WifiMode ctsMode, double rtsSnr); /** * Should be invoked whenever we receive the Ack associated to a data packet * we just sent. + * + * \param address the address of the receiver + * \param header MAC header of the DATA packet + * \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 */ void ReportDataOk (Mac48Address address, const WifiMacHeader *header, double ackSnr, WifiMode ackMode, double dataSnr); /** * Should be invoked after calling ReportRtsFailed if * NeedRtsRetransmission returns false + * + * \param address the address of the receiver + * \param header MAC header of the DATA packet */ void ReportFinalRtsFailed (Mac48Address address, const WifiMacHeader *header); /** * Should be invoked after calling ReportDataFailed if * NeedDataRetransmission returns false + * + * \param address the address of the receiver + * \param header MAC header of the DATA packet */ void ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header); @@ -237,18 +419,23 @@ * \param address remote address * \param header MAC header * \param packet the packet to send - * \returns true if we want to use an RTS/CTS handshake for this + * \return true if we want to use an RTS/CTS handshake for this * packet before sending it, false otherwise. */ bool NeedRts (Mac48Address address, const WifiMacHeader *header, Ptr packet); + /** + * Return if we need to do Cts-to-self before sending a DATA. + * + * \return true if Cts-to-self is needed, false otherwise + */ bool NeedCtsToSelf (WifiTxVector txVector); /** * \param address remote address * \param header MAC header * \param packet the packet to send - * \returns true if we want to restart a failed RTS/CTS + * \return true if we want to restart a failed RTS/CTS * handshake, false otherwise. */ bool NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header, @@ -257,7 +444,7 @@ * \param address remote address * \param header MAC header * \param packet the packet to send - * \returns true if we want to resend a packet + * \return true if we want to resend a packet * after a failed transmission attempt, false otherwise. */ bool NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header, @@ -267,7 +454,7 @@ * \param address remote address * \param header MAC header * \param packet the packet to send - * \returns true if this packet should be fragmented, false otherwise. + * \return true if this packet should be fragmented, false otherwise. */ bool NeedFragmentation (Mac48Address address, const WifiMacHeader *header, Ptr packet); @@ -276,7 +463,7 @@ * \param header MAC header * \param packet the packet to send * \param fragmentNumber the fragment index of the next fragment to send (starts at zero). - * \returns the size of the corresponding fragment. + * \return the size of the corresponding fragment. */ uint32_t GetFragmentSize (Mac48Address address, const WifiMacHeader *header, Ptr packet, uint32_t fragmentNumber); @@ -285,7 +472,7 @@ * \param header MAC header * \param packet the packet to send * \param fragmentNumber the fragment index of the next fragment to send (starts at zero). - * \returns the offset within the original packet where this fragment starts. + * \return the offset within the original packet where this fragment starts. */ uint32_t GetFragmentOffset (Mac48Address address, const WifiMacHeader *header, Ptr packet, uint32_t fragmentNumber); @@ -294,7 +481,7 @@ * \param header MAC header * \param packet the packet to send * \param fragmentNumber the fragment index of the next fragment to send (starts at zero). - * \returns true if this is the last fragment, false otherwise. + * \return true if this is the last fragment, false otherwise. */ bool IsLastFragment (Mac48Address address, const WifiMacHeader *header, Ptr packet, uint32_t fragmentNumber); @@ -302,56 +489,108 @@ /** * \param address remote address * \param rtsMode the transmission mode used to send an RTS we just received - * \returns the transmission mode to use for the CTS to complete the RTS/CTS + * \return the transmission mode to use for the CTS to complete the RTS/CTS * handshake. */ WifiTxVector GetCtsTxVector (Mac48Address address, WifiMode rtsMode); /** * \param address * \param dataMode the transmission mode used to send an ACK we just received - * \returns the transmission mode to use for the ACK to complete the data/ACK + * \return the transmission mode to use for the ACK to complete the data/ACK * handshake. */ WifiTxVector GetAckTxVector (Mac48Address address, WifiMode dataMode); /** * \param address * \param dataMode the transmission mode used to send an ACK we just received - * \returns the transmission mode to use for the ACK to complete the data/ACK + * \return the transmission mode to use for the ACK to complete the data/ACK * handshake. */ WifiTxVector GetBlockAckTxVector (Mac48Address address, WifiMode dataMode); /** - * \returns the default transmission power + * \return the default transmission power */ uint8_t GetDefaultTxPowerLevel (void) const; /** * \param address of the remote station - * \returns information regarding the remote station associated with the given address + * \return information regarding the remote station associated with the given address */ WifiRemoteStationInfo GetInfo (Mac48Address address); /** * Set the default transmission power level + * + * \param the default transmission power level */ void SetDefaultTxPowerLevel (uint8_t txPower); /** - * \returns the number of transmit antennas supported by the phy layer + * \return the number of transmit antennas supported by the phy layer */ uint32_t GetNumberOfTransmitAntennas (void); protected: virtual void DoDispose (void); - // for convenience + /** + * Return whether mode associated with the specified station at the specified index. + * + * \param station the station being queried + * \param i the index + * \return WifiMode at the given index of the specified station + */ WifiMode GetSupported (const WifiRemoteStation *station, uint32_t i) const; + /** + * Return the number of modes supported by the given station. + * + * \param station the station being queried + * \return the number of modes supported by the given station + */ uint32_t GetNSupported (const WifiRemoteStation *station) const; uint8_t GetMcsSupported (const WifiRemoteStation *station, uint32_t i) const; uint32_t GetNMcsSupported (const WifiRemoteStation *station) const; + /** + * Return whether the given station supports short guard interval. + * + * \param station the station being queried + * \return true if the station supports short guard interval, + * false otherwise + */ bool GetShortGuardInterval (const WifiRemoteStation *station) const; bool GetStbc (const WifiRemoteStation *station) const; + /** + * Return whether the station supports Greenfield or not. + * + * \param station the station being queried + * \return true if Greenfield is supported by the station, + * false otherwise + */ bool GetGreenfield (const WifiRemoteStation *station) const; + /** + * Return the number of receive antenna the station has. + * + * \param station the station being queried + * \return the number of receive antenna the station has + */ uint32_t GetNumberOfReceiveAntennas (const WifiRemoteStation *station) const; + /** + * Return the number of transmit antenna the station has. + * + * \param station the station being queried + * \return the number of transmit antenna the station has + */ uint32_t GetNumberOfTransmitAntennas (const WifiRemoteStation *station) const; + /** + * Return the long retry limit of the given station. + * + * \param station the station being queried + * \return the long retry limit of the the station + */ uint32_t GetLongRetryCount (const WifiRemoteStation *station) const; + /** + * Return the short retry limit of the given station. + * + * \param station the station being queried + * \return the short retry limit of the the station + */ uint32_t GetShortRetryCount (const WifiRemoteStation *station) const; private: /** @@ -359,7 +598,7 @@ * \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. - * \returns true if we want to use an RTS/CTS handshake for this + * \return true if we want to use an RTS/CTS handshake for this * packet before sending it, false otherwise. * * Note: This method is called before a unicast packet is sent on the medium. @@ -371,7 +610,7 @@ * \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. - * \returns true if we want to restart a failed RTS/CTS + * \return true if we want to restart a failed RTS/CTS * handshake, false otherwise. * * Note: This method is called after an rts/cts handshake has been attempted @@ -384,7 +623,7 @@ * \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. - * \returns true if we want to resend a packet + * \return true if we want to resend a packet * after a failed transmission attempt, false otherwise. * * Note: This method is called after a unicast packet transmission has been attempted @@ -398,14 +637,14 @@ * \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. - * \returns true if this packet should be fragmented, false otherwise. + * \return true if this packet should be fragmented, false otherwise. * * Note: This method is called before sending a unicast packet. */ virtual bool DoNeedFragmentation (WifiRemoteStation *station, Ptr packet, bool normally); /** - * \returns whether this manager is a manager designed to work in low-latency + * \return whether this manager is a manager designed to work in low-latency * environments. * * Note: In this context, low vs high latency is defined in IEEE 802.11 Rate Adaptation: @@ -419,7 +658,7 @@ /** * \param station the station with which we need to communicate * \param size size of the packet or fragment we want to send - * \returns the transmission mode to use to send a packet to the station + * \return the transmission mode to use to send a packet to the station * * Note: This method is called before sending a unicast packet or a fragment * of a unicast packet to decide which transmission mode to use. @@ -428,7 +667,7 @@ uint32_t size) = 0; /** * \param station the station with which we need to communicate - * \returns the transmission mode to use to send an rts to the station + * \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 * to decide which transmission mode to use for the rts. @@ -446,7 +685,7 @@ /** * \param address the address of the recipient of the ACK - * \param ctsMode the mode to be used for the ACK + * \param ackMode the mode to be used for the ACK * * \return the power level to be used to send the ACK */ @@ -454,7 +693,7 @@ /** * \param address the address of the recipient of the Block ACK - * \param ctsMode the mode to be used for the Block ACK + * \param blockAckMode the mode to be used for the Block ACK * * \return the power level to be used to send the Block ACK */ @@ -474,28 +713,123 @@ virtual uint8_t DoGetBlockAckTxNess(Mac48Address address, WifiMode blockAckMode); virtual bool DoGetBlockAckTxStbc(Mac48Address address, WifiMode blockAckMode); + /** + * 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 + */ 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 + */ 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 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 + */ virtual void DoReportRtsOk (WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr) = 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 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 + */ virtual void DoReportDataOk (WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr) = 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 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 + */ virtual void DoReportFinalDataFailed (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 that sent the DATA to us + * \param rxSnr the SNR of the DATA we received + * \param txMode the WifiMode the sender used to send the DATA + */ virtual void DoReportRxOk (WifiRemoteStation *station, double rxSnr, WifiMode txMode) = 0; + /** + * Return the state of the station associated with the given address. + * + * \param address the address of the station + * \return WifiRemoteStationState corresponding to the address + */ WifiRemoteStationState* LookupState (Mac48Address address) const; + /** + * Return the station associated with the given address and TID. + * + * \param address the address of the station + * \param tid the TID + * \return WifiRemoteStation corresponding to the address + */ WifiRemoteStation* Lookup (Mac48Address address, uint8_t tid) const; /// Find a remote station by its remote address and TID taken from MAC header + /** + * Return the station associated with the given address and MAC header. + * It simply gets TID from the MAC header and calls Lookup with tid. + * + * \param address the address of the station + * \param header MAC header + * \return WifiRemoteStation corresponding to the address + */ WifiRemoteStation* Lookup (Mac48Address address, const WifiMacHeader *header) const; WifiMode GetControlAnswerMode (Mac48Address address, WifiMode reqMode); + /** + * Actually sets the fragmentation threshold, it also checks the validity of + * the given threshold. + * + * \param threshold the fragmentation threshold + */ void DoSetFragmentationThreshold (uint32_t threshold); + /** + * Return the current fragmentation threshold + * + * \return the fragmentation threshold + */ uint32_t DoGetFragmentationThreshold (void) const; + /** + * Return the number of fragments needed for the given packet. + * + * \param header MAC header + * \param packet the packet to be fragmented + * \return the number of fragments needed + */ uint32_t GetNFragments (const WifiMacHeader *header, Ptr packet); + /** + * A vector of WifiRemoteStations + */ typedef std::vector Stations; + /** + * A vector of WifiRemoteStationStates + */ typedef std::vector StationStates; StationStates m_states; @@ -552,6 +886,9 @@ }; +/** + * A struct that holds information about each remote station. + */ struct WifiRemoteStationState { enum diff -r b22e9f50a0da src/wifi/model/yans-error-rate-model.h --- a/src/wifi/model/yans-error-rate-model.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/yans-error-rate-model.h Fri Nov 15 19:13:28 2013 -0500 @@ -62,10 +62,46 @@ virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const; private: + /** + * Return the logarithm of the given value to base 2. + * + * \param val + * \return the logarithm of val to base 2. + */ double Log2 (double val) const; + /** + * Return BER of BPSK with the given parameters. + * + * \param snr snr value + * \param signalSpread + * \param phyRate + * \return BER of BPSK at the given SNR + */ double GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const; + /** + * Return BER of QAM-m with the given parameters. + * + * \param snr snr value + * \param m + * \param signalSpread + * \param phyRate + * \return BER of BPSK at the given SNR + */ double GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const; + /** + * Return k! + * + * \return k! + */ uint32_t Factorial (uint32_t k) const; + /** + * Return Binomial distribution for a given k, p, and n + * + * \param k + * \param p + * \param n + * \return a Binomial distribution + */ double Binomial (uint32_t k, double p, uint32_t n) const; double CalculatePdOdd (double ber, unsigned int d) const; double CalculatePdEven (double ber, unsigned int d) const; diff -r b22e9f50a0da src/wifi/model/yans-wifi-channel.h --- a/src/wifi/model/yans-wifi-channel.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/yans-wifi-channel.h Fri Nov 15 19:13:28 2013 -0500 @@ -59,6 +59,11 @@ virtual uint32_t GetNDevices (void) const; virtual Ptr GetDevice (uint32_t i) const; + /** + * Adds the given YansWifiPhy to the PHY list + * + * \param phy the YansWifiPhy to be added to the PHY list + */ void Add (Ptr phy); /** @@ -74,7 +79,7 @@ * \param sender the device from which the packet is originating. * \param packet the packet to send * \param txPowerDbm the tx power associated to the packet - * \param wifiMode the tx mode associated to the packet + * \param txVector the TXVECTOR associated to the packet * \param preamble the preamble associated to the packet * * This method should not be invoked by normal users. It is @@ -99,7 +104,21 @@ YansWifiChannel& operator = (const YansWifiChannel &); YansWifiChannel (const YansWifiChannel &); + /** + * A vector of pointers to YansWifiPhy. + */ typedef std::vector > PhyList; + /** + * This method is scheduled by Send for each associated YansWifiPhy. + * The method then calls the corresponding YansWifiPhy that the first + * bit of the packet has arrived. + * + * \param i index of the corresponding YansWifiPhy in the PHY list + * \param packet the packet being sent + * \param rxPowerDbm the received power of the packet + * \param txVector the TXVECTOR of the packet + * \param preamble the type of preamble being used to send the packet + */ void Receive (uint32_t i, Ptr packet, double rxPowerDbm, WifiTxVector txVector, WifiPreamble preamble) const; diff -r b22e9f50a0da src/wifi/model/yans-wifi-phy.cc --- a/src/wifi/model/yans-wifi-phy.cc Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/yans-wifi-phy.cc Fri Nov 15 19:13:28 2013 -0500 @@ -863,9 +863,9 @@ return m_guardInterval; } void -YansWifiPhy::SetGuardInterval (bool GuardInterval) +YansWifiPhy::SetGuardInterval (bool guardInterval) { - m_guardInterval = GuardInterval; + m_guardInterval = guardInterval; } uint32_t diff -r b22e9f50a0da src/wifi/model/yans-wifi-phy.h --- a/src/wifi/model/yans-wifi-phy.h Fri Nov 15 16:20:58 2013 -0500 +++ b/src/wifi/model/yans-wifi-phy.h Fri Nov 15 19:13:28 2013 -0500 @@ -71,25 +71,13 @@ void SetChannel (Ptr channel); + void SetChannelNumber (uint16_t id); + uint16_t GetChannelNumber () const; /** - * \brief Set channel number. + * Return current center channel frequency in MHz. * - * Channel center frequency = Channel starting frequency + 5 MHz * nch - * - * where Starting channel frequency is standard-dependent, see SetStandard() - * as defined in IEEE 802.11-2007 17.3.8.3.2. - * - * YansWifiPhy can switch among different channels. Basically, YansWifiPhy - * has a private attribute m_channelNumber that identifies the channel the - * PHY operates on. Channel switching cannot interrupt an ongoing transmission. - * When PHY is in TX state, the channel switching is postponed until the end - * of the current transmission. When the PHY is in RX state, the channel - * switching causes the drop of the synchronized packet. - */ - void SetChannelNumber (uint16_t id); - /// Return current channel number, see SetChannelNumber() - uint16_t GetChannelNumber () const; - /// Return current center channel frequency in MHz, see SetChannelNumber() + * \return the current center channel frequency in MHz + */ double GetChannelFrequencyMhz () const; void StartReceivePacket (Ptr packet, @@ -97,31 +85,134 @@ WifiTxVector txVector, WifiPreamble preamble); + /** + * Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver. + * + * \param noiseFigureDb noise figure in dB + */ void SetRxNoiseFigure (double noiseFigureDb); + /** + * Sets the minimum available transmission power level (dBm). + * + * \param start the minimum transmission power level (dBm) + */ void SetTxPowerStart (double start); + /** + * Sets the maximum available transmission power level (dBm). + * + * \param end the maximum transmission power level (dBm) + */ void SetTxPowerEnd (double end); + /** + * Sets the number of transmission power levels available between the + * minimum level and the maximum level. Transmission power levels are + * equally separated (in dBm) with the minimum and the maximum included. + * + * \param n the number of available levels + */ void SetNTxPower (uint32_t n); + /** + * Sets the transmission gain (dB). + * + * \param gain the transmission gain in dB + */ void SetTxGain (double gain); + /** + * Sets the reception gain (dB). + * + * \param gain the reception gain in dB + */ void SetRxGain (double gain); + /** + * Sets the energy detection threshold (dBm). + * The energy of a received signal should be higher than + * this threshold (dbm) to allow the PHY layer to detect the signal. + * + * \param threshold the energy detction threshold in dBm + */ void SetEdThreshold (double threshold); + /** + * Sets the CCA threshold (dBm). The energy of a received signal + * should be higher than this threshold to allow the PHY + * layer to declare CCA BUSY state. + * + * \param threshold the CCA threshold in dBm + */ void SetCcaMode1Threshold (double threshold); + /** + * Sets the error rate model. + * + * \param rate the error rate model + */ void SetErrorRateModel (Ptr rate); + /** + * Sets the device this PHY is associated with. + * + * \param device the device this PHY is associated with + */ void SetDevice (Ptr device); + /** + * Sets the mobility model. + * + * \param mobility the mobility model this PHY is associated with + */ void SetMobility (Ptr mobility); + /** + * Return the RX noise figure (dBm). + * + * \return the RX noise figure in dBm + */ double GetRxNoiseFigure (void) const; + /** + * Return the transmission gain (dB). + * + * \return the transmission gain in dB + */ double GetTxGain (void) const; + /** + * Return the reception gain (dB). + * + * \return the reception gain in dB + */ double GetRxGain (void) const; + /** + * Return the energy detection threshold (dBm). + * + * \return the energy detection threshold in dBm + */ double GetEdThreshold (void) const; + /** + * Return the CCA threshold (dBm). + * + * \return the CCA threshold in dBm + */ double GetCcaMode1Threshold (void) const; + /** + * Return the error rate model this PHY is using. + * + * \return the error rate model this PHY is using + */ Ptr GetErrorRateModel (void) const; + /** + * Return the device this PHY is associated with + * + * \return the device this PHY is associated with + */ Ptr GetDevice (void) const; + /** + * Return the mobility model this PHY is associated with. + * + * \return the mobility model this PHY is associated with + */ Ptr GetMobility (void); - - - virtual double GetTxPowerStart (void) const; virtual double GetTxPowerEnd (void) const; + /** + * Return the number of available transmission power levels. + * + * \return the number of available transmission power levels + */ virtual uint32_t GetNTxPower (void) const; virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback); virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback); @@ -140,6 +231,7 @@ virtual WifiMode GetMode (uint32_t mode) const; virtual double CalculateSnr (WifiMode txMode, double ber) const; virtual Ptr GetChannel (void) const; + virtual void ConfigureStandard (enum WifiPhyStandard standard); /** @@ -153,61 +245,83 @@ int64_t AssignStreams (int64_t stream); /** - * \param the operating frequency on this node (2.4 GHz or 5GHz). + * \param freq the operating frequency on this node (2.4 GHz or 5GHz). */ virtual void SetFrequency (uint32_t freq); /** - * \returns the operating frequency on this node + * \return the operating frequency on this node */ virtual uint32_t GetFrequency (void) const; /** - * \param the number of transmitters on this node. + * \param tx the number of transmitters on this node. */ virtual void SetNumberOfTransmitAntennas (uint32_t tx); virtual uint32_t GetNumberOfTransmitAntennas (void) const; /** - * \param the number of receivers on this node. + * \param rx the number of receivers on this node. */ virtual void SetNumberOfReceiveAntennas (uint32_t rx) ; /** - * \returns the number of receivers on this node. + * \return the number of receivers on this node. */ virtual uint32_t GetNumberOfReceiveAntennas (void) const; /** - * \param set short/long guard interval. + * Enable or disable short/long guard interval. + * + * \param guardInterval Enable or disable guard interval */ - virtual void SetGuardInterval (bool GuardInterval); - virtual bool GetGuardInterval (void) const; + virtual void SetGuardInterval (bool guardInterval); /** - * \param sets LDPC is supported or not + * Return whether guard interval is being used. + * + * \return true if guard interval is being used, false otherwise */ - virtual void SetLdpc (bool Ldpc); + virtual bool GetGuardInterval (void) const; /** - * \returns if LDPC is supported or not + * Enable or disable LDPC. + * \param ldpc Enable or disable LDPC + */ + virtual void SetLdpc (bool ldpc); + /** + * Return if LDPC is supported. + * + * \return true if LDPC is supported, false otherwise */ virtual bool GetLdpc (void) const; /** - * \param sets STBC is supported or not + * Enable or disable STBC. + * + * \param stbc Enable or disable STBC */ virtual void SetStbc (bool stbc); - /** - * \returns if STBC is supported or not + /** + * Return whether STBC is supported. + * + * \return true if STBC is supported, false otherwise */ virtual bool GetStbc (void) const; /** - * \param sets Greenfield is supported or not + * Enable or disable Greenfield support. + * + * \param greenfield Enable or disable Greenfield */ virtual void SetGreenfield (bool greenfield); /** - * \returns if Greenfield is supported or not + * Return whether Greenfield is supported. + * + * \return true if Greenfield is supported, false otherwise */ virtual bool GetGreenfield (void) const; /** - * \param sets channel bonding is supported or not + * Return whether channel bonding is supported. + * + * \return true if channel bonding is supported, false otherwise */ virtual bool GetChannelBonding (void) const ; /** - * \returns if channel bonding is supported or not + * Enable or disable channel bonding support. + * + * \param channelBonding Enable or disable channel bonding */ virtual void SetChannelBonding (bool channelbonding) ; @@ -215,7 +329,7 @@ virtual uint32_t GetBssMembershipSelector (uint32_t selector) const; virtual WifiModeList GetMembershipSelectorModes(uint32_t selector); /** - * \returns the number of MCS supported by this phy + * \return the number of MCS supported by this phy */ virtual uint8_t GetNMcs (void) const; virtual uint8_t GetMcs (uint8_t mcs) const; @@ -224,7 +338,7 @@ * as defined in the IEEE 802.11n standard * * \param mode the WifiMode - * \returns the MCS number that corresponds to the given WifiMode + * \return the MCS number that corresponds to the given WifiMode */ virtual uint32_t WifiModeToMcs (WifiMode mode); /** @@ -232,7 +346,7 @@ * as defined in the IEEE 802.11n standard. * * \param mcs the MCS number - * \returns the WifiMode that corresponds to the given mcs number + * \return the WifiMode that corresponds to the given mcs number */ virtual WifiMode McsToWifiMode (uint8_t mcs);