--- a/src/wifi/model/aarf-wifi-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/aarf-wifi-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -31,6 +31,12 @@
namespace ns3 {
+/**
+ * \brief hold per-remote-station state for AARF Wifi manager.
+ *
+ * This struct extends from WifiRemoteStation struct to hold additional
+ * information required by the AARF Wifi manager
+ */
struct AarfWifiRemoteStation : public WifiRemoteStation
{
uint32_t m_timer;
@@ -123,6 +129,8 @@
* is the initial transmission of a packet or the retransmission of a packet.
* The fundamental reason for this is that there is a backoff between each data
* transmission, be it an initial transmission or a retransmission.
+ *
+ * \param st the station that we failed to send DATA
*/
void
AarfWifiManager::DoReportDataFailed (WifiRemoteStation *st)
--- a/src/wifi/model/aarfcd-wifi-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/aarfcd-wifi-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -34,6 +34,12 @@
namespace ns3 {
+/**
+ * \brief hold per-remote-station state for AARF-CD Wifi manager.
+ *
+ * This struct extends from WifiRemoteStation struct to hold additional
+ * information required by the AARF-CD Wifi manager
+ */
struct AarfcdWifiRemoteStation : public WifiRemoteStation
{
uint32_t m_timer;
@@ -149,15 +155,7 @@
{
NS_LOG_FUNCTION (this << station);
}
-/**
- * It is important to realize that "recovery" mode starts after failure of
- * the first transmission after a rate increase and ends at the first successful
- * transmission. Specifically, recovery mode transcends retransmissions boundaries.
- * Fundamentally, ARF handles each data transmission independently, whether it
- * is the initial transmission of a packet or the retransmission of a packet.
- * The fundamental reason for this is that there is a backoff between each data
- * transmission, be it an initial transmission or a retransmission.
- */
+
void
AarfcdWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
--- a/src/wifi/model/aarfcd-wifi-manager.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/aarfcd-wifi-manager.h Tue Dec 10 10:48:51 2013 -0500
@@ -47,7 +47,19 @@
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
+
virtual void DoReportRtsFailed (WifiRemoteStation *station);
+ /**
+ * It is important to realize that "recovery" mode starts after failure of
+ * the first transmission after a rate increase and ends at the first successful
+ * transmission. Specifically, recovery mode transcends retransmissions boundaries.
+ * Fundamentally, ARF handles each data transmission independently, whether it
+ * is the initial transmission of a packet or the retransmission of a packet.
+ * The fundamental reason for this is that there is a backoff between each data
+ * transmission, be it an initial transmission or a retransmission.
+ *
+ * \param station the station that we failed to send DATA
+ */
virtual void DoReportDataFailed (WifiRemoteStation *station);
virtual void DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr);
@@ -61,10 +73,35 @@
Ptr<const Packet> packet, bool normally);
virtual bool IsLowLatency (void) const;
+ /**
+ * Check if the use of RTS for the given station can be turned off.
+ *
+ * \param station the station that we are checking
+ */
void CheckRts (AarfcdWifiRemoteStation *station);
+ /**
+ * Increase the RTS window size of the given station.
+ *
+ * \param station the station to increase RTS window
+ */
void IncreaseRtsWnd (AarfcdWifiRemoteStation *station);
+ /**
+ * Reset the RTS window of the given station.
+ *
+ * \param station the station to reset RTS window
+ */
void ResetRtsWnd (AarfcdWifiRemoteStation *station);
+ /**
+ * Turn off RTS for the given station.
+ *
+ * \param station the station to turn RTS off
+ */
void TurnOffRts (AarfcdWifiRemoteStation *station);
+ /**
+ * Turn on RTS for the given station.
+ *
+ * \param station the station to turn RTS on
+ */
void TurnOnRts (AarfcdWifiRemoteStation *station);
// aarf fields below
--- a/src/wifi/model/amrr-wifi-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/amrr-wifi-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -30,6 +30,12 @@
namespace ns3 {
+/**
+ * \brief hold per-remote-station state for AMRR Wifi manager.
+ *
+ * This struct extends from WifiRemoteStation struct to hold additional
+ * information required by the AMRR Wifi manager
+ */
struct AmrrWifiRemoteStation : public WifiRemoteStation
{
Time m_nextModeUpdate;
--- a/src/wifi/model/amrr-wifi-manager.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/amrr-wifi-manager.h Tue Dec 10 10:48:51 2013 -0500
@@ -60,15 +60,78 @@
virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
virtual bool IsLowLatency (void) const;
- void UpdateRetry (AmrrWifiRemoteStation *station);
+ //void UpdateRetry (AmrrWifiRemoteStation *station);
+ /**
+ * Update the mode used to send to the given station.
+ *
+ * \param station
+ */
void UpdateMode (AmrrWifiRemoteStation *station);
+ /**
+ * Reset transmission statistics of the given station.
+ *
+ * \param station
+ */
void ResetCnt (AmrrWifiRemoteStation *station);
+ /**
+ * Increase the transmission rate to the given station.
+ *
+ * \param station
+ */
void IncreaseRate (AmrrWifiRemoteStation *station);
+ /**
+ * Decrease the transmission rate to the given station.
+ *
+ * \param station
+ */
void DecreaseRate (AmrrWifiRemoteStation *station);
+ /**
+ * Check if the current rate for the given station is the
+ * minimum rate.
+ *
+ * \param station
+ * \return true if the current rate is the minimum rate,
+ * false otherwise
+ */
bool IsMinRate (AmrrWifiRemoteStation *station) const;
+ /**
+ * Check if the current rate for the given station is the
+ * maximum rate.
+ *
+ * \param station
+ * \return true if the current rate is the maximum rate,
+ * false otherwise
+ */
bool IsMaxRate (AmrrWifiRemoteStation *station) const;
+ /**
+ * Check if the number of retransmission and transmission error
+ * is less than the number of successful transmission (times ratio).
+ *
+ * \param station
+ * \return true if the number of retransmission and transmission error
+ * is less than the number of successful transmission
+ * (times ratio), false otherwise
+ */
bool IsSuccess (AmrrWifiRemoteStation *station) const;
+ /**
+ * Check if the number of retransmission and transmission error
+ * is greater than the number of successful transmission (times ratio).
+ *
+ * \param station
+ * \return true if the number of retransmission and transmission error
+ * is less than the number of successful transmission
+ * (times ratio), false otherwise
+ */
bool IsFailure (AmrrWifiRemoteStation *station) const;
+ /**
+ * Check if the number of retransmission, transmission error,
+ * and successful transmission are greater than 10.
+ *
+ * \param station
+ * \return true if the number of retransmission, transmission error,
+ * and successful transmission are greater than 10,
+ * false otherwise
+ */
bool IsEnough (AmrrWifiRemoteStation *station) const;
Time m_updatePeriod;
--- a/src/wifi/model/arf-wifi-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/arf-wifi-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -30,6 +30,12 @@
namespace ns3 {
+/**
+ * \brief hold per-remote-station state for ARF Wifi manager.
+ *
+ * This struct extends from WifiRemoteStation struct to hold additional
+ * information required by the ARF Wifi manager
+ */
struct ArfWifiRemoteStation : public WifiRemoteStation
{
uint32_t m_timer;
@@ -105,6 +111,8 @@
* is the initial transmission of a packet or the retransmission of a packet.
* The fundamental reason for this is that there is a backoff between each data
* transmission, be it an initial transmission or a retransmission.
+ *
+ * \param st the station that we failed to send DATA
*/
void
ArfWifiManager::DoReportDataFailed (WifiRemoteStation *st)
--- a/src/wifi/model/block-ack-agreement.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/block-ack-agreement.h Tue Dec 10 10:48:51 2013 -0500
@@ -33,22 +33,96 @@
friend class MacLow;
public:
BlockAckAgreement ();
+ /**
+ * Constructor for BlockAckAgreement with given peer and TID.
+ *
+ * \param peer
+ * \param tid
+ */
BlockAckAgreement (Mac48Address peer, uint8_t tid);
~BlockAckAgreement ();
+ /**
+ * Set buffer size.
+ *
+ * \param bufferSize
+ */
void SetBufferSize (uint16_t bufferSize);
+ /**
+ * Set timeout.
+ *
+ * \param timeout
+ */
void SetTimeout (uint16_t timeout);
+ /**
+ * Set starting sequence number.
+ *
+ * \param seq the starting sequence number
+ */
void SetStartingSequence (uint16_t seq);
+ /**
+ * Set Block ACK policy to immediate ACK.
+ */
void SetImmediateBlockAck (void);
+ /**
+ * Set Block ACK policy to delayed ACK.
+ */
void SetDelayedBlockAck (void);
+ /**
+ * Enable or disable A-MSDU support.
+ *
+ * \param supported enable or disable A-MSDU support
+ */
void SetAmsduSupport (bool supported);
+ /**
+ * Return the Traffic ID (TID).
+ *
+ * \return TID
+ */
uint8_t GetTid (void) const;
+ /**
+ * Return the peer address.
+ *
+ * \return Mac48Address
+ */
Mac48Address GetPeer (void) const;
+ /**
+ * Return the buffer size.
+ *
+ * \return buffer size
+ */
uint16_t GetBufferSize (void) const;
+ /**
+ * Return the timeout.
+ *
+ * \return timeout
+ */
uint16_t GetTimeout (void) const;
+ /**
+ * Return the starting squence number.
+ *
+ * \return starting sequence number
+ */
uint16_t GetStartingSequence (void) const;
+ /**
+ * Return the starting squence control
+ *
+ * \return starting sequence control
+ */
uint16_t GetStartingSequenceControl (void) const;
+ /**
+ * Check whether the current ACK policy is immediate block ACK.
+ *
+ * \return true if the current ACK policy is immediate block ACK,
+ * false otherwise
+ */
bool IsImmediateBlockAck (void) const;
+ /**
+ * Check whether A-MSDU is supported
+ *
+ * \return true if A-MSDU is supported,
+ * false otherwise
+ */
bool IsAmsduSupported (void) const;
protected:
--- a/src/wifi/model/block-ack-manager.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/block-ack-manager.h Tue Dec 10 10:48:51 2013 -0500
@@ -47,6 +47,15 @@
struct Bar
{
Bar ();
+ /**
+ * Construct Block ACK request for a given packet,
+ * receiver address, Traffic ID, and ACK policy.
+ *
+ * \param packet
+ * \param recipient
+ * \param tid
+ * \param immediate
+ */
Bar (Ptr<const Packet> packet,
Mac48Address recipient,
uint8_t tid,
@@ -73,6 +82,7 @@
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
+ * \return true if a block ack agreement exists, false otherwise
*
* Checks if a block ack agreement exists with station addressed by
* <i>recipient</i> for tid <i>tid</i>.
@@ -82,7 +92,8 @@
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
* \param state The state for block ack agreement
-
+ * \return true if a block ack agreement exists, false otherwise
+ *
* Checks if a block ack agreement with a state equals to <i>state</i> exists with
* station addressed by <i>recipient</i> for tid <i>tid</i>.
*/
@@ -122,6 +133,7 @@
void StorePacket (Ptr<const Packet> packet, const WifiMacHeader &hdr, Time tStamp);
/**
* \param hdr 802.11 header of returned packet (if exists).
+ * \return the packet
*
* This methods returns a packet (if exists) indicated as not received in
* corresponding block ack bitmap.
@@ -131,6 +143,9 @@
/**
* Returns true if there are packets that need of retransmission or at least a
* BAR is scheduled. Returns false otherwise.
+ *
+ * \return true if there are packets that need of retransmission or at least a
+ * BAR is scheduled, false otherwise
*/
bool HasPackets (void) const;
/**
@@ -146,6 +161,7 @@
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
+ * \return the number of packets buffered for a specified agreement
*
* Returns number of packets buffered for a specified agreement. This methods doesn't return
* number of buffered MPDUs but number of buffered MSDUs.
@@ -154,6 +170,7 @@
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
+ * \return the number of packets for a specific agreement that need retransmission
*
* Returns number of packets for a specific agreement that need retransmission.
* This method doesn't return number of MPDUs that need retransmission but number of MSDUs.
@@ -216,12 +233,16 @@
/**
* \param sequenceNumber Sequence number of the packet which fragment is
* part of.
+ * \return true if another fragment with the given sequence number is scheduled
+ * for retransmission.
*
* Returns true if another fragment with sequence number <i>sequenceNumber</i> is scheduled
* for retransmission.
*/
bool HasOtherFragments (uint16_t sequenceNumber) const;
/**
+ * \return the size of the next packet that needs retransmission
+ *
* Returns size of the next packet that needs retransmission.
*/
uint32_t GetNextPacketSize (void) const;
@@ -238,6 +259,12 @@
void SetBlockDestinationCallback (Callback<void, Mac48Address, uint8_t> callback);
void SetUnblockDestinationCallback (Callback<void, Mac48Address, uint8_t> callback);
/**
+ * \param recipient
+ * \param tid
+ * \param startingSeq
+ * \return true if there are packets in the queue that could be sent under block ACK,
+ * false otherwise
+ *
* Checks if there are in the queue other packets that could be send under block ack.
* If yes adds these packets in current block ack exchange.
* However, number of packets exchanged in the current block ack, will not exceed
@@ -245,6 +272,10 @@
*/
bool SwitchToBlockAckIfNeeded (Mac48Address recipient, uint8_t tid, uint16_t startingSeq);
/**
+ * \param recipient
+ * \param tid
+ * \return the sequence number of the next retry packet for a specific agreement
+ *
* Returns the sequence number of the next retry packet for a specific agreement.
* If there are no packets that need retransmission for the specified agreement or
* the agreement doesn't exist the function returns 4096;
@@ -252,6 +283,10 @@
uint16_t GetSeqNumOfNextRetryPacket (Mac48Address recipient, uint8_t tid) const;
private:
/**
+ * \param recipient
+ * \param tid
+ * \return a packet
+ *
* Checks if all packets, for which a block ack agreement was established or refreshed,
* have been transmitted. If yes, adds a pair in m_bAckReqs to indicate that
* at next channel access a block ack request (for established agreement
@@ -265,17 +300,39 @@
void InactivityTimeout (Mac48Address, uint8_t);
struct Item;
+ /**
+ * typedef for a list of Item struct.
+ */
typedef std::list<Item> PacketQueue;
+ /**
+ * typedef for an iterator for PacketQueue.
+ */
typedef std::list<Item>::iterator PacketQueueI;
+ /**
+ * typedef for a const iterator for PacketQueue.
+ */
typedef std::list<Item>::const_iterator PacketQueueCI;
+ /**
+ * typedef for a map between MAC address and block ACK agreement.
+ */
typedef std::map<std::pair<Mac48Address, uint8_t>,
std::pair<OriginatorBlockAckAgreement, PacketQueue> > Agreements;
+ /**
+ * typedef for an iterator for Agreements.
+ */
typedef std::map<std::pair<Mac48Address, uint8_t>,
std::pair<OriginatorBlockAckAgreement, PacketQueue> >::iterator AgreementsI;
+ /**
+ * typedef for a const iterator for Agreements.
+ */
typedef std::map<std::pair<Mac48Address, uint8_t>,
std::pair<OriginatorBlockAckAgreement, PacketQueue> >::const_iterator AgreementsCI;
+ /**
+ * A struct for packet, Wifi header, and timestamp.
+ * Used in queue by block ACK manager.
+ */
struct Item
{
Item ();
--- a/src/wifi/model/capability-information.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/capability-information.h Tue Dec 10 10:48:51 2013 -0500
@@ -28,25 +28,84 @@
/**
* \ingroup wifi
*
- *
+ * Capability information
*/
class CapabilityInformation
{
public:
CapabilityInformation ();
+ /**
+ * Set the Extended Service Set (ESS) bit
+ * in the capability information field.
+ */
void SetEss (void);
+ /**
+ * Set the Independent BSS (IBSS) bit
+ * in the capability information field.
+ */
void SetIbss (void);
+ /**
+ * Check if the Extended Service Set (ESS) bit
+ * in the capability information field is set to 1.
+ *
+ * \return ESS bit in the capability information
+ * field is set to 1
+ */
bool IsEss (void) const;
+ /**
+ * Check if the Independent BSS (IBSS) bit
+ * in the capability information field is set to 1.
+ *
+ * \return IBSS bit in the capability information
+ * field is set to 1
+ */
bool IsIbss (void) const;
+ /**
+ * Return the serialized size of capability
+ * information.
+ *
+ * \return the serialized size
+ */
uint32_t GetSerializedSize (void) const;
+ /**
+ * Serialize capability information to the given buffer.
+ *
+ * \param start an iterator to a buffer
+ * \return an iterator to a buffer after capability information
+ * was serialized
+ */
Buffer::Iterator Serialize (Buffer::Iterator start) const;
+ /**
+ * Deserialize capability information from the given buffer.
+ *
+ * \param start an iterator to a buffer
+ * \return an iterator to a buffer after capability information
+ * was deserialized
+ */
Buffer::Iterator Deserialize (Buffer::Iterator start);
private:
+ /**
+ * Check if bit n is set to 1.
+ *
+ * \param n the bit position
+ * \return true if bit n is set to 1,
+ * false otherwise
+ */
bool Is (uint8_t n) const;
+ /**
+ * Set bit n to 1.
+ *
+ * \param n the bit position
+ */
void Set (uint8_t n);
+ /**
+ * Set bit n to 0.
+ *
+ * \param n the bit position
+ */
void Clear (uint8_t n);
uint16_t m_capability;
};
--- a/src/wifi/model/cara-wifi-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/cara-wifi-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -32,6 +32,12 @@
namespace ns3 {
+/**
+ * \brief hold per-remote-station state for CARA Wifi manager.
+ *
+ * This struct extends from WifiRemoteStation struct to hold additional
+ * information required by the CARA Wifi manager
+ */
struct CaraWifiRemoteStation : public WifiRemoteStation
{
uint32_t m_timer;
--- a/src/wifi/model/constant-rate-wifi-manager.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/constant-rate-wifi-manager.h Tue Dec 10 10:48:51 2013 -0500
@@ -57,8 +57,8 @@
virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
virtual bool IsLowLatency (void) const;
- WifiMode m_dataMode;
- WifiMode m_ctlMode;
+ WifiMode m_dataMode; //!< Wifi mode for unicast DATA frames
+ WifiMode m_ctlMode; //!< Wifi mode for request control frames
};
} // namespace ns3
--- a/src/wifi/model/ctrl-headers.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/ctrl-headers.h Tue Dec 10 10:48:51 2013 -0500
@@ -24,6 +24,9 @@
namespace ns3 {
+/**
+ * Enumeration for different block ACK policies.
+ */
enum BlockAckType
{
BASIC_BLOCK_ACK,
@@ -55,23 +58,101 @@
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
+ /**
+ * Enable or disable HT immediate ACK.
+ *
+ * \param immediateAck enable or disable HT immediate ACK
+ */
void SetHtImmediateAck (bool immediateAck);
+ /**
+ * Set the block ACK type.
+ *
+ * \param type
+ */
void SetType (enum BlockAckType type);
+ /**
+ * Set Traffic ID (TID).
+ *
+ * \param tid
+ */
void SetTidInfo (uint8_t tid);
+ /**
+ * Set the starting sequence number from the given
+ * raw sequence control field.
+ *
+ * \param seq the raw sequence control
+ */
void SetStartingSequence (uint16_t seq);
+ /**
+ * Check if the current ACK policy is immediate.
+ *
+ * \return true if the current ACK policy is immediate,
+ * false otherwise
+ */
bool MustSendHtImmediateAck (void) const;
+ /**
+ * Return the Traffic ID (TID).
+ *
+ * \return TID
+ */
uint8_t GetTidInfo (void) const;
+ /**
+ * Return the starting sequence number.
+ *
+ * \return the starting sequence number
+ */
uint16_t GetStartingSequence (void) const;
+ /**
+ * Check if the current ACK policy is basic
+ * (i.e. not multiple TID and not compressed ACK).
+ *
+ * \return true if the current ACK policy is basic,
+ * false otherwise
+ */
bool IsBasic (void) const;
+ /**
+ * Check if the current ACK policy is compressed ACK
+ * and not multiple TID.
+ *
+ * \return true if the current ACK policy is compressed ACK,
+ * false otherwise
+ */
bool IsCompressed (void) const;
+ /**
+ * Check if the current ACK policy has multiple TID.
+ *
+ * \return true if the current ACK policy has multiple TID,
+ * false otherwise
+ */
bool IsMultiTid (void) const;
+ /**
+ * Return the starting sequence control.
+ *
+ * \return the starting sequence control
+ */
uint16_t GetStartingSequenceControl (void) const;
private:
+ /**
+ * Set the starting sequence control with the given
+ * sequence control value
+ *
+ * \param seqControl
+ */
void SetStartingSequenceControl (uint16_t seqControl);
+ /**
+ * Return the Block ACK control.
+ *
+ * \return the Block ACK control
+ */
uint16_t GetBarControl (void) const;
+ /**
+ * Set the Block ACK control.
+ *
+ * \param bar
+ */
void SetBarControl (uint16_t bar);
/**
@@ -111,35 +192,169 @@
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
- void SetHtImmediateAck (bool immeadiateAck);
+ /**
+ * Enable or disable HT immediate ACK.
+ *
+ * \param immediateAck enable or disable HT immediate ACK
+ */
+ void SetHtImmediateAck (bool immediateAck);
+ /**
+ * Set the block ACK type.
+ *
+ * \param type
+ */
void SetType (enum BlockAckType type);
+ /**
+ * Set Traffic ID (TID).
+ *
+ * \param tid
+ */
void SetTidInfo (uint8_t tid);
+ /**
+ * Set the starting sequence number from the given
+ * raw sequence control field.
+ *
+ * \param seq the raw sequence control
+ */
void SetStartingSequence (uint16_t seq);
+ /**
+ * Check if the current ACK policy is immediate.
+ *
+ * \return true if the current ACK policy is immediate,
+ * false otherwise
+ */
bool MustSendHtImmediateAck (void) const;
+ /**
+ * Return the Traffic ID (TID).
+ *
+ * \return TID
+ */
uint8_t GetTidInfo (void) const;
+ /**
+ * Return the starting sequence number.
+ *
+ * \return the starting sequence number
+ */
uint16_t GetStartingSequence (void) const;
+ /**
+ * Check if the current ACK policy is basic
+ * (i.e. not multiple TID and not compressed ACK).
+ *
+ * \return true if the current ACK policy is basic,
+ * false otherwise
+ */
bool IsBasic (void) const;
+ /**
+ * Check if the current ACK policy is compressed ACK
+ * and not multiple TID.
+ *
+ * \return true if the current ACK policy is compressed ACK,
+ * false otherwise
+ */
bool IsCompressed (void) const;
+ /**
+ * Check if the current ACK policy has multiple TID.
+ *
+ * \return true if the current ACK policy has multiple TID,
+ * false otherwise
+ */
bool IsMultiTid (void) const;
+ /**
+ * Set the bitmap that the packet with the given sequence
+ * number was received.
+ *
+ * \param seq
+ */
void SetReceivedPacket (uint16_t seq);
+ /**
+ * Set the bitmap that the packet with the given sequence
+ * number and fragment number was received.
+ *
+ * \param seq
+ * \param frag
+ */
void SetReceivedFragment (uint16_t seq, uint8_t frag);
+ /**
+ * Check if the packet with the given sequence number
+ * was ACKed in this Block ACK response.
+ *
+ * \param seq
+ * \return true if the packet with the given sequence number
+ * was ACKed in this Block ACK response, false otherwise
+ */
bool IsPacketReceived (uint16_t seq) const;
+ /**
+ * Check if the packet with the given sequence number
+ * and fragment number was ACKed in this Block ACK response.
+ *
+ * \param seq
+ * \param frag
+ * \return true if the packet with the given sequence number
+ * and sequence number was ACKed in this Block ACK response,
+ * false otherwise
+ */
bool IsFragmentReceived (uint16_t seq, uint8_t frag) const;
+ /**
+ * Return the starting sequence control.
+ *
+ * \return the starting sequence control
+ */
uint16_t GetStartingSequenceControl (void) const;
+ /**
+ * Set the starting sequence control with the given
+ * sequence control value
+ *
+ * \param seqControl
+ */
void SetStartingSequenceControl (uint16_t seqControl);
+ /**
+ * Return the bitmap from the block ACK response header.
+ *
+ * \return the bitmap from the block ACK response header
+ */
const uint16_t* GetBitmap (void) const;
+ /**
+ * Return the compressed bitmap from the block ACK response header.
+ *
+ * \return the compressed bitmap from the block ACK response header
+ */
uint64_t GetCompressedBitmap (void) const;
+ /**
+ * Reset the bitmap to 0.
+ */
void ResetBitmap (void);
private:
+ /**
+ * Return the block ACK control.
+ *
+ * \return the block ACK control
+ */
uint16_t GetBaControl (void) const;
+ /**
+ * Set the block ACK control.
+ *
+ * \param bar
+ */
void SetBaControl (uint16_t bar);
+ /**
+ * Serialize bitmap to the given buffer.
+ *
+ * \param start
+ * \return Buffer::Iterator to the next available buffer
+ */
Buffer::Iterator SerializeBitmap (Buffer::Iterator start) const;
+ /**
+ * Deserialize bitmap from the given buffer.
+ *
+ * \param start
+ * \return Buffer::Iterator to the next available buffer
+ */
Buffer::Iterator DeserializeBitmap (Buffer::Iterator start);
/**
--- a/src/wifi/model/dca-txop.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/dca-txop.cc Tue Dec 10 10:48:51 2013 -0500
@@ -69,9 +69,17 @@
DcaTxop *m_txop;
};
+/**
+ * Listener for MacLow events. Forwards to DcaTxop.
+ */
class DcaTxop::TransmissionListener : public MacLowTransmissionListener
{
public:
+ /**
+ * Create a TransmissionListener for the given DcaTxop.
+ *
+ * \param txop
+ */
TransmissionListener (DcaTxop * txop)
: MacLowTransmissionListener (),
m_txop (txop) {
--- a/src/wifi/model/dca-txop.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/dca-txop.h Tue Dec 10 10:48:51 2013 -0500
@@ -69,14 +69,37 @@
public:
static TypeId GetTypeId (void);
+ /**
+ * typedef for a callback to invoke when a
+ * packet transmission was completed successfully.
+ */
typedef Callback <void, const WifiMacHeader&> TxOk;
+ /**
+ * typedef for a callback to invoke when a
+ * packet transmission was failed.
+ */
typedef Callback <void, const WifiMacHeader&> TxFailed;
DcaTxop ();
~DcaTxop ();
+ /**
+ * Set MacLow associated with this DcaTxop.
+ *
+ * \param low MacLow
+ */
void SetLow (Ptr<MacLow> low);
+ /**
+ * Set DcfManager this DcaTxop is associated to.
+ *
+ * \param manager DcfManager
+ */
void SetManager (DcfManager *manager);
+ /**
+ * Set WifiRemoteStationsManager this DcaTxop is associated to.
+ *
+ * \param remoteManager WifiRemoteStationManager
+ */
void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager);
/**
@@ -90,6 +113,11 @@
*/
void SetTxFailedCallback (TxFailed callback);
+ /**
+ * Return the packet queue associated with this DcaTxop.
+ *
+ * \return WifiMacQueue
+ */
Ptr<WifiMacQueue > GetQueue () const;
virtual void SetMinCw (uint32_t minCw);
virtual void SetMaxCw (uint32_t maxCw);
@@ -129,37 +157,149 @@
DcaTxop (const DcaTxop &o);
// Inherited from ns3::Object
+ /**
+ * Return the MacLow associated with this DcaTxop.
+ *
+ * \return MacLow
+ */
Ptr<MacLow> Low (void);
void DoInitialize ();
/* dcf notifications forwarded here */
+ /**
+ * Check if the DCF requires access.
+ *
+ * \return true if the DCF requires access,
+ * false otherwise
+ */
bool NeedsAccess (void) const;
+ /**
+ * Notify the DCF that access has been granted.
+ */
void NotifyAccessGranted (void);
+ /**
+ * Notify the DCF that internal collision has occurred.
+ */
void NotifyInternalCollision (void);
+ /**
+ * Notify the DCF that collision has occurred.
+ */
void NotifyCollision (void);
/**
- * When a channel switching occurs, enqueued packets are removed.
- */
+ * When a channel switching occurs, enqueued packets are removed.
+ */
void NotifyChannelSwitching (void);
- /* event handlers */
+
+ /* Event handlers */
+ /**
+ * Event handler when a CTS is received.
+ *
+ * \param snr
+ * \param txMode
+ */
void GotCts (double snr, WifiMode txMode);
+ /**
+ * Event handler when a CTS timeout has occurred.
+ */
void MissedCts (void);
+ /**
+ * Event handler when an ACK is received.
+ *
+ * \param snr
+ * \param txMode
+ */
void GotAck (double snr, WifiMode txMode);
+ /**
+ * Event handler when an ACK is received.
+ */
void MissedAck (void);
+ /**
+ * Start transmission for the next fragment.
+ * This is called for fragment only.
+ */
void StartNext (void);
+ /**
+ * Cancel the transmission.
+ */
void Cancel (void);
+ /**
+ * Event handler when a transmission that
+ * does not require an ACK has completed.
+ */
void EndTxNoAck (void);
+ /**
+ * Restart access request if needed.
+ */
void RestartAccessIfNeeded (void);
+ /**
+ * Request access from DCF manager if needed.
+ */
void StartAccessIfNeeded (void);
+ /**
+ * Check if the current packet should be sent with a RTS protection.
+ *
+ * \param packet
+ * \param header
+ * \return true if RTS protection should be used, false otherwise
+ */
bool NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header);
+ /**
+ * Check if RTS should be re-transmitted if CTS was missed.
+ *
+ * \return true if RTS should be re-transmitted, false otherwise
+ */
bool NeedRtsRetransmission (void);
+ /**
+ * Check if DATA should be re-transmitted if ACK was missed.
+ *
+ * \return true if DATA should be re-transmitted, false otherwise
+ */
bool NeedDataRetransmission (void);
+ /**
+ * Check if the current packet should be fragmented.
+ *
+ * \return true if the current packet should be fragmented,
+ * false otherwise
+ */
bool NeedFragmentation (void);
+ /**
+ * Calculate the size of the next fragment.
+ *
+ * \return the size of the next fragment
+ */
uint32_t GetNextFragmentSize (void);
+ /**
+ * Calculate the size of the current fragment.
+ *
+ * \return the size of the current fragment
+ */
uint32_t GetFragmentSize (void);
+ /**
+ * Calculate the offset for the current fragment.
+ *
+ * \return the offset for the current fragment
+ */
uint32_t GetFragmentOffset (void);
+ /**
+ * Check if the curren fragment is the last fragment.
+ *
+ * \return true if the curren fragment is the last fragment,
+ * false otherwise
+ */
bool IsLastFragment (void);
+ /**
+ * Continue to the next fragment. This method simply
+ * increments the internal variable that keep track
+ * of the current fragment number.
+ */
void NextFragment (void);
+ /**
+ * Get the next fragment from the packet with
+ * appropriate Wifi header for the fragment.
+ *
+ * \param hdr
+ * \return the fragment with the current fragment number
+ */
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
virtual void DoDispose (void);
--- a/src/wifi/model/dcf-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/dcf-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -163,13 +163,17 @@
}
-/***************************************************************
- * Listener for Nav events. Forwards to DcfManager
- ***************************************************************/
-
+/**
+ * Listener for NAV events. Forwards to DcfManager
+ */
class LowDcfListener : public ns3::MacLowDcfListener
{
public:
+ /**
+ * Create a LowDcfListener for the given DcfManager.
+ *
+ * \param dcf
+ */
LowDcfListener (ns3::DcfManager *dcf)
: m_dcf (dcf)
{
@@ -205,13 +209,17 @@
ns3::DcfManager *m_dcf;
};
-/***************************************************************
- * Listener for PHY events. Forwards to DcfManager
- ***************************************************************/
-
+/**
+ * Listener for PHY events. Forwards to DcfManager
+ */
class PhyListener : public ns3::WifiPhyListener
{
public:
+ /**
+ * Create a PhyListener for the given DcfManager.
+ *
+ * \param dcf
+ */
PhyListener (ns3::DcfManager *dcf)
: m_dcf (dcf)
{
--- a/src/wifi/model/dcf-manager.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/dcf-manager.h Tue Dec 10 10:48:51 2013 -0500
@@ -57,10 +57,35 @@
* Calling this method after DcfManager::Add has been called is not recommended.
*/
void SetAifsn (uint32_t aifsn);
+ /**
+ * Set the minimum congestion window size.
+ *
+ * \param minCw the minimum congestion window size
+ */
void SetCwMin (uint32_t minCw);
+ /**
+ * Set the maximum congestion window size.
+ *
+ * \param maxCw the maximum congestion window size
+ */
void SetCwMax (uint32_t maxCw);
+ /**
+ * Return the number of slots that make up an AIFS.
+ *
+ * \return the number of slots that make up an AIFS
+ */
uint32_t GetAifsn (void) const;
+ /**
+ * Return the minimum congestion window size.
+ *
+ * \return the minimum congestion window size
+ */
uint32_t GetCwMin (void) const;
+ /**
+ * Return the maximum congestion window size.
+ *
+ * \return the maximum congestion window size
+ */
uint32_t GetCwMax (void) const;
/**
* Update the value of the CW variable to take into account
@@ -96,13 +121,44 @@
private:
friend class DcfManager;
+ /**
+ * Return the current number of backoff slots.
+ *
+ * \return the current number of backoff slots
+ */
uint32_t GetBackoffSlots (void) const;
+ /**
+ * Return the time when the backoff procedure started.
+ *
+ * \return the time when the backoff procedure started
+ */
Time GetBackoffStart (void) const;
+ /**
+ * Update backoff slots that nSlots has passed.
+ *
+ * \param nSlots
+ * \param backoffUpdateBound
+ */
void UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound);
+ /**
+ * Notify that access request has been received.
+ */
void NotifyAccessRequested (void);
+ /**
+ * Notify that access has been granted.
+ */
void NotifyAccessGranted (void);
+ /**
+ * Notify that collision has occurred.
+ */
void NotifyCollision (void);
+ /**
+ * Notify that internal collision has occurred.
+ */
void NotifyInternalCollision (void);
+ /**
+ * Notify that the device is switching channel.
+ */
void NotifyChannelSwitching (void);
@@ -176,7 +232,17 @@
DcfManager ();
~DcfManager ();
+ /**
+ * Set up listener for Phy events.
+ *
+ * \param phy
+ */
void SetupPhyListener (Ptr<WifiPhy> phy);
+ /**
+ * Set up listener for MacLow events.
+ *
+ * \param low
+ */
void SetupLowListener (Ptr<MacLow> low);
/**
@@ -280,16 +346,82 @@
* Called at end of rx
*/
void NotifyNavStartNow (Time duration);
+ /**
+ * Notify that ACK timer has started for the given duration.
+ *
+ * \param duration
+ */
void NotifyAckTimeoutStartNow (Time duration);
+ /**
+ * Notify that ACK timer has resetted.
+ */
void NotifyAckTimeoutResetNow ();
+ /**
+ * Notify that CTS timer has started for the given duration.
+ *
+ * \param duration
+ */
void NotifyCtsTimeoutStartNow (Time duration);
+ /**
+ * Notify that CTS timer has resetted.
+ */
void NotifyCtsTimeoutResetNow ();
private:
+ /**
+ * Update backoff slots for all DcfStates.
+ */
void UpdateBackoff (void);
+ /**
+ * Return the most recent time.
+ *
+ * \param a
+ * \param b
+ * \return the most recent time
+ */
Time MostRecent (Time a, Time b) const;
+ /**
+ * Return the most recent time.
+ *
+ * \param a
+ * \param b
+ * \param c
+ * \return the most recent time
+ */
Time MostRecent (Time a, Time b, Time c) const;
+ /**
+ * Return the most recent time.
+ *
+ * \param a
+ * \param b
+ * \param c
+ * \param d
+ * \return the most recent time
+ */
Time MostRecent (Time a, Time b, Time c, Time d) const;
+ /**
+ * Return the most recent time.
+ *
+ * \param a
+ * \param b
+ * \param c
+ * \param d
+ * \param e
+ * \param f
+ * \return the most recent time
+ */
Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const;
+ /**
+ * Return the most recent time.
+ *
+ * \param a
+ * \param b
+ * \param c
+ * \param d
+ * \param e
+ * \param f
+ * \param g
+ * \return the most recent time
+ */
Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const;
/**
* Access will never be granted to the medium _before_
@@ -299,13 +431,44 @@
* be granted
*/
Time GetAccessGrantStart (void) const;
+ /**
+ * Return the time when the backoff procedure
+ * started for the given DcfState.
+ *
+ * \param state
+ * \return the time when the backoff procedure started
+ */
Time GetBackoffStartFor (DcfState *state);
+ /**
+ * Return the time when the backoff procedure
+ * ended (or will ended) for the given DcfState.
+ *
+ * \param state
+ * \return the time when the backoff procedure ended (or will ended)
+ */
Time GetBackoffEndFor (DcfState *state);
void DoRestartAccessTimeoutIfNeeded (void);
+ /**
+ * Called when access timeout should occur
+ * (e.g. backoff procedure expired).
+ */
void AccessTimeout (void);
+ /**
+ * Grant access to DCF
+ */
void DoGrantAccess (void);
+ /**
+ * Check if the device is busy sending or receiving,
+ * or NAV busy.
+ *
+ * \return true if the device is busy,
+ * false otherwise
+ */
bool IsBusy (void) const;
+ /**
+ * typedef for a vector of DcfStates
+ */
typedef std::vector<DcfState *> States;
States m_states;
--- a/src/wifi/model/dcf.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/dcf.h Tue Dec 10 10:48:51 2013 -0500
@@ -34,11 +34,42 @@
public:
static TypeId GetTypeId (void);
+ /**
+ * Set the minimum congestion window size.
+ *
+ * \param minCw the minimum congestion window size
+ */
virtual void SetMinCw (uint32_t minCw) = 0;
+ /**
+ * Set the maximum congestion window size.
+ *
+ * \param maxCw the maximum congestion window size
+ */
virtual void SetMaxCw (uint32_t maxCw) = 0;
+ /**
+ * \param aifsn the number of slots which make up an AIFS for a specific DCF.
+ * a DIFS corresponds to an AIFSN = 2.
+ *
+ * Calling this method after DcfManager::Add has been called is not recommended.
+ */
virtual void SetAifsn (uint32_t aifsn) = 0;
+ /**
+ * Return the minimum congestion window size.
+ *
+ * \return the minimum congestion window size
+ */
virtual uint32_t GetMinCw (void) const = 0;
+ /**
+ * Return the maximum congestion window size.
+ *
+ * \return the maximum congestion window size
+ */
virtual uint32_t GetMaxCw (void) const = 0;
+ /**
+ * Return the number of slots that make up an AIFS.
+ *
+ * \return the number of slots that make up an AIFS
+ */
virtual uint32_t GetAifsn (void) const = 0;
};
--- a/src/wifi/model/edca-txop-n.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/edca-txop-n.h Tue Dec 10 10:48:51 2013 -0500
@@ -53,6 +53,9 @@
class BlockAckManager;
class MgtDelBaHeader;
+/**
+ * Enumeration for type of station
+ */
enum TypeOfStation
{
STA,
@@ -81,7 +84,15 @@
class EdcaTxopN : public Dcf
{
public:
+ /**
+ * typedef for a callback to invoke when a
+ * packet transmission was completed successfully.
+ */
typedef Callback <void, const WifiMacHeader&> TxOk;
+ /**
+ * typedef for a callback to invoke when a
+ * packet transmission was failed.
+ */
typedef Callback <void, const WifiMacHeader&> TxFailed;
static TypeId GetTypeId (void);
@@ -89,15 +100,53 @@
virtual ~EdcaTxopN ();
void DoDispose ();
+ /**
+ * Set MacLow associated with this EdcaTxopN.
+ *
+ * \param low MacLow
+ */
void SetLow (Ptr<MacLow> low);
void SetTxMiddle (MacTxMiddle *txMiddle);
+ /**
+ * Set DcfManager this EdcaTxopN is associated to.
+ *
+ * \param manager DcfManager
+ */
void SetManager (DcfManager *manager);
+ /**
+ * \param callback the callback to invoke when a
+ * packet transmission was completed successfully.
+ */
void SetTxOkCallback (TxOk callback);
+ /**
+ * \param callback the callback to invoke when a
+ * packet transmission was completed unsuccessfully.
+ */
void SetTxFailedCallback (TxFailed callback);
+ /**
+ * Set WifiRemoteStationsManager this EdcaTxopN is associated to.
+ *
+ * \param remoteManager WifiRemoteStationManager
+ */
void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager);
+ /**
+ * Set type of station with the given type.
+ *
+ * \param type
+ */
void SetTypeOfStation (enum TypeOfStation type);
+ /**
+ * Return type of station.
+ *
+ * \return type of station
+ */
enum TypeOfStation GetTypeOfStation (void) const;
+ /**
+ * Return the packet queue associated with this EdcaTxopN.
+ *
+ * \return WifiMacQueue
+ */
Ptr<WifiMacQueue > GetQueue () const;
virtual void SetMinCw (uint32_t minCw);
virtual void SetMaxCw (uint32_t maxCw);
@@ -106,51 +155,202 @@
virtual uint32_t GetMaxCw (void) const;
virtual uint32_t GetAifsn (void) const;
+ /**
+ * Return the MacLow associated with this EdcaTxopN.
+ *
+ * \return MacLow
+ */
Ptr<MacLow> Low (void);
Ptr<MsduAggregator> GetMsduAggregator (void) const;
/* dcf notifications forwarded here */
+ /**
+ * Check if the EDCAF requires access.
+ *
+ * \return true if the EDCAF requires access,
+ * false otherwise
+ */
bool NeedsAccess (void) const;
+ /**
+ * Notify the EDCAF that access has been granted.
+ */
void NotifyAccessGranted (void);
+ /**
+ * Notify the EDCAF that internal collision has occurred.
+ */
void NotifyInternalCollision (void);
+ /**
+ * Notify the EDCAF that collision has occurred.
+ */
void NotifyCollision (void);
/**
- * When a channel switching occurs, enqueued packets are removed.
- */
+ * When a channel switching occurs, enqueued packets are removed.
+ */
void NotifyChannelSwitching (void);
- /*event handlers*/
+ /* Event handlers */
+ /**
+ * Event handler when a CTS is received.
+ *
+ * \param snr
+ * \param txMode
+ */
void GotCts (double snr, WifiMode txMode);
+ /**
+ * Event handler when a CTS timeout has occurred.
+ */
void MissedCts (void);
+ /**
+ * Event handler when an ACK is received.
+ *
+ * \param snr
+ * \param txMode
+ */
void GotAck (double snr, WifiMode txMode);
+ /**
+ * Event handler when a Block ACK is received.
+ *
+ * \param blockAck
+ * \param recipient
+ */
void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient);
+ /**
+ * Event handler when a Block ACK timeout has occurred.
+ */
void MissedBlockAck (void);
void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
+ /**
+ * Event handler when an ACK is received.
+ */
void MissedAck (void);
+ /**
+ * Start transmission for the next fragment.
+ * This is called for fragment only.
+ */
void StartNext (void);
+ /**
+ * Cancel the transmission.
+ */
void Cancel (void);
+ /**
+ * Event handler when a transmission that
+ * does not require an ACK has completed.
+ */
void EndTxNoAck (void);
+ /**
+ * Restart access request if needed.
+ */
void RestartAccessIfNeeded (void);
+ /**
+ * Request access from DCF manager if needed.
+ */
void StartAccessIfNeeded (void);
+ /**
+ * Check if the current packet should be sent with a RTS protection.
+ *
+ * \return true if RTS protection should be used, false otherwise
+ */
bool NeedRts (void);
+ /**
+ * Check if RTS should be re-transmitted if CTS was missed.
+ *
+ * \return true if RTS should be re-transmitted, false otherwise
+ */
bool NeedRtsRetransmission (void);
+ /**
+ * Check if DATA should be re-transmitted if ACK was missed.
+ *
+ * \return true if DATA should be re-transmitted, false otherwise
+ */
bool NeedDataRetransmission (void);
+ /**
+ * Check if the current packet should be fragmented.
+ *
+ * \return true if the current packet should be fragmented,
+ * false otherwise
+ */
bool NeedFragmentation (void) const;
+ /**
+ * Calculate the size of the next fragment.
+ *
+ * \return the size of the next fragment
+ */
uint32_t GetNextFragmentSize (void);
+ /**
+ * Calculate the size of the current fragment.
+ *
+ * \return the size of the current fragment
+ */
uint32_t GetFragmentSize (void);
+ /**
+ * Calculate the offset for the current fragment.
+ *
+ * \return the offset for the current fragment
+ */
uint32_t GetFragmentOffset (void);
+ /**
+ * Check if the curren fragment is the last fragment.
+ *
+ * \return true if the curren fragment is the last fragment,
+ * false otherwise
+ */
bool IsLastFragment (void) const;
+ /**
+ * Continue to the next fragment. This method simply
+ * increments the internal variable that keep track
+ * of the current fragment number.
+ */
void NextFragment (void);
+ /**
+ * Get the next fragment from the packet with
+ * appropriate Wifi header for the fragment.
+ *
+ * \param hdr
+ * \return the fragment with the current fragment number
+ */
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
+ /**
+ * Set the access category of this EDCAF.
+ *
+ * \param ac
+ */
void SetAccessCategory (enum AcIndex ac);
+ /**
+ * \param packet packet to send
+ * \param hdr header of packet to send.
+ *
+ * Store the packet in the internal queue until it
+ * can be sent safely.
+ */
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
void SetMsduAggregator (Ptr<MsduAggregator> aggr);
+ /**
+ * \param packet packet to send
+ * \param hdr header of packet to send.
+ *
+ * Store the packet in the front of the internal queue until it
+ * can be sent safely.
+ */
void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
+ /**
+ * Complete block ACK configuration.
+ */
void CompleteConfig (void);
+ /**
+ * Set threshold for block ACK mechanism. If number of packets in the
+ * queue reaches the threshold, block ACK mechanism is used.
+ *
+ * \param threshold
+ */
void SetBlockAckThreshold (uint8_t threshold);
+ /**
+ * Return the current threshold for block ACK mechanism.
+ *
+ * \return the current threshold for block ACK mechanism
+ */
uint8_t GetBlockAckThreshold (void) const;
void SetBlockAckInactivityTimeout (uint16_t timeout);
void SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator);
@@ -175,30 +375,48 @@
* If aggregating sta is an AP
* SA = Address3
* DA = Address1
+ *
+ * \param hdr
+ * \return Mac48Address
*/
Mac48Address MapSrcAddressForAggregation (const WifiMacHeader &hdr);
Mac48Address MapDestAddressForAggregation (const WifiMacHeader &hdr);
EdcaTxopN &operator = (const EdcaTxopN &);
EdcaTxopN (const EdcaTxopN &);
- /* If number of packets in the queue reaches m_blockAckThreshold value, an ADDBARequest frame
+ /**
+ * If number of packets in the queue reaches m_blockAckThreshold value, an ADDBARequest frame
* is sent to destination in order to setup a block ack.
+ *
+ * \return true if we tried to set up block ACK, false otherwise
*/
bool SetupBlockAckIfNeeded ();
- /* Sends an ADDBARequest to establish a block ack agreement with sta
+ /**
+ * Sends an ADDBARequest to establish a block ack agreement with sta
* addressed by <i>recipient</i> for tid <i>tid</i>.
+ *
+ * \param recipient
+ * \param tid
+ * \param startSeq
+ * \param timeout
+ * \param immediateBAck
*/
void SendAddBaRequest (Mac48Address recipient, uint8_t tid, uint16_t startSeq,
uint16_t timeout, bool immediateBAck);
- /* After that all packets, for which a block ack agreement was established, have been
+ /**
+ * After that all packets, for which a block ack agreement was established, have been
* transmitted, we have to send a block ack request.
+ *
+ * \param bar
*/
void SendBlockAckRequest (const struct Bar &bar);
- /* For now is typically invoked to complete transmission of a packets sent with ack policy
+ /**
+ * For now is typically invoked to complete transmission of a packets sent with ack policy
* Block Ack: the packet is buffered and dcf is reset.
*/
void CompleteTx (void);
- /* Verifies if dequeued packet has to be transmitted with ack policy Block Ack. This happens
+ /**
+ * Verifies if dequeued packet has to be transmitted with ack policy Block Ack. This happens
* if an established block ack agreement exists with the receiver.
*/
void VerifyBlockAck (void);
--- a/src/wifi/model/error-rate-model.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/error-rate-model.h Tue Dec 10 10:48:51 2013 -0500
@@ -55,6 +55,7 @@
* \param mode the Wi-Fi mode the chunk is sent
* \param snr the SNR of the chunk
* \param nbits the number of bits in this chunk
+ * \return probability of successfully receiving the chunk
*/
virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const = 0;
};
--- a/src/wifi/model/ht-capabilities.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/ht-capabilities.h Tue Dec 10 10:48:51 2013 -0500
@@ -72,13 +72,23 @@
void SerializeInformationField (Buffer::Iterator start) const;
uint8_t DeserializeInformationField (Buffer::Iterator start,
uint8_t length);
- /*
+ /**
* This information element is a bit special in that it is only
* included if the STA is an HT STA. To support this we
* override the Serialize and GetSerializedSize methods of
* WifiInformationElement.
+ *
+ * \param start
+ * \return an iterator
*/
Buffer::Iterator Serialize (Buffer::Iterator start) const;
+ /**
+ * Return the serialized size of this HT capability
+ * information element.
+ *
+ * \return the serialized size of this HT capability
+ * information element
+ */
uint16_t GetSerializedSize () const;
private:
--- a/src/wifi/model/ideal-wifi-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/ideal-wifi-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -27,6 +27,12 @@
namespace ns3 {
+/**
+ * \brief hold per-remote-station state for Ideal Wifi manager.
+ *
+ * This struct extends from WifiRemoteStation struct to hold additional
+ * information required by the Ideal Wifi manager
+ */
struct IdealWifiRemoteStation : public WifiRemoteStation
{
double m_lastSnr;
--- a/src/wifi/model/interference-helper.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/interference-helper.h Tue Dec 10 10:48:51 2013 -0500
@@ -41,21 +41,74 @@
class InterferenceHelper
{
public:
+ /**
+ * Signal event for a packet.
+ */
class Event : public SimpleRefCount<InterferenceHelper::Event>
{
public:
+ /**
+ * Create an Event with the given parameters.
+ *
+ * \param size packet size
+ * \param payloadMode Wi-Fi mode used for the payload
+ * \param preamble preamble type
+ * \param duration duration of the signal
+ * \param rxPower the receive power (w)
+ * \param txvector TXVECTOR of the packet
+ */
Event (uint32_t size, WifiMode payloadMode,
enum WifiPreamble preamble,
Time duration, double rxPower, WifiTxVector txvector);
~Event ();
+ /**
+ * Return the duration of the signal.
+ *
+ * \return the duration of the signal
+ */
Time GetDuration (void) const;
+ /**
+ * Return the start time of the signal.
+ *
+ * \return the start time of the signal
+ */
Time GetStartTime (void) const;
+ /**
+ * Return the end time of the signal.
+ *
+ * \return the end time of the signal
+ */
Time GetEndTime (void) const;
+ /**
+ * Return the receive power (w).
+ *
+ * \return the receive power (w)
+ */
double GetRxPowerW (void) const;
+ /**
+ * Return the size of the packet (bytes).
+ *
+ * \return the size of the packet (bytes)
+ */
uint32_t GetSize (void) const;
+ /**
+ * Return the Wi-Fi mode used for the payload.
+ *
+ * \return the Wi-Fi mode used for the payload
+ */
WifiMode GetPayloadMode (void) const;
+ /**
+ * Return the preamble type of the packet.
+ *
+ * \return the preamble type of the packet
+ */
enum WifiPreamble GetPreambleType (void) const;
+ /**
+ * Return the TXVECTOR of the packet.
+ *
+ * \return the TXVECTOR of the packet
+ */
WifiTxVector GetTxVector (void) const;
private:
uint32_t m_size;
@@ -66,6 +119,9 @@
double m_rxPowerW;
WifiTxVector m_txVector;
};
+ /**
+ * A struct for both SNR and PER
+ */
struct SnrPer
{
double snr;
@@ -75,10 +131,30 @@
InterferenceHelper ();
~InterferenceHelper ();
+ /**
+ * Set the noise figure.
+ *
+ * \param value noise figure
+ */
void SetNoiseFigure (double value);
+ /**
+ * Set the error rate model for this interference helper.
+ *
+ * \param rate Error rate model
+ */
void SetErrorRateModel (Ptr<ErrorRateModel> rate);
+ /**
+ * Return the noise figure.
+ *
+ * \return the noise figure
+ */
double GetNoiseFigure (void) const;
+ /**
+ * Return the error rate model.
+ *
+ * \return Error rate model
+ */
Ptr<ErrorRateModel> GetErrorRateModel (void) const;
@@ -90,36 +166,131 @@
*/
Time GetEnergyDuration (double energyW);
-
+ /**
+ * Add the packet-related signal to interference helper.
+ *
+ * \param size packet size
+ * \param payloadMode Wi-Fi mode for the payload
+ * \param preamble Wi-Fi preamble for the packet
+ * \param duration the duration of the signal
+ * \param rxPower receive power (w)
+ * \param txvector TXVECTOR of the packet
+ * \return InterferenceHelper::Event
+ */
Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiMode payloadMode,
enum WifiPreamble preamble,
Time duration, double rxPower, WifiTxVector txvector);
+ /**
+ * Calculate the SNIR at the start of the packet and accumulate
+ * all SNIR changes in the snir vector.
+ *
+ * \param event the event corresponding to the first time the packet arrives
+ * \return struct of SNR and PER
+ */
struct InterferenceHelper::SnrPer CalculateSnrPer (Ptr<InterferenceHelper::Event> event);
+ /**
+ * Notify that RX has started.
+ */
void NotifyRxStart ();
+ /**
+ * Notify that RX has ended.
+ */
void NotifyRxEnd ();
+ /**
+ * Erase all events.
+ */
void EraseEvents (void);
private:
+ /**
+ * Noise and Interference (thus Ni) event.
+ */
class NiChange
{
public:
+ /**
+ * Create a NiChange at the given time and the amount of NI change.
+ *
+ * \param time time of the event
+ * \param delta the power
+ */
NiChange (Time time, double delta);
+ /**
+ * Return the event time.
+ *
+ * \return the event time.
+ */
Time GetTime (void) const;
+ /**
+ * Return the power
+ *
+ * \return the power
+ */
double GetDelta (void) const;
+ /**
+ * Compare the event time of two NiChange objects (a < o).
+ *
+ * \param o
+ * \return true if a < o.time, false otherwise
+ */
bool operator < (const NiChange& o) const;
private:
Time m_time;
double m_delta;
};
+ /**
+ * typedef for a vector of NiChanges
+ */
typedef std::vector <NiChange> NiChanges;
+ /**
+ * typedef for a list of Events
+ */
typedef std::list<Ptr<Event> > Events;
- InterferenceHelper (const InterferenceHelper &o);
- InterferenceHelper &operator = (const InterferenceHelper &o);
+ //InterferenceHelper (const InterferenceHelper &o);
+ //InterferenceHelper &operator = (const InterferenceHelper &o);
+ /**
+ * Append the given Event.
+ *
+ * \param event
+ */
void AppendEvent (Ptr<Event> event);
+ /**
+ * Calculate noise and interference power in W.
+ *
+ * \param event
+ * \param ni
+ * \return noise and interference power
+ */
double CalculateNoiseInterferenceW (Ptr<Event> event, NiChanges *ni) const;
+ /**
+ * Calculate SNR (linear ratio) from the given signal power and noise+interference power.
+ * (Mode is not currently used)
+ *
+ * \param signal
+ * \param noiseInterference
+ * \param mode
+ * \return SNR in liear ratio
+ */
double CalculateSnr (double signal, double noiseInterference, WifiMode mode) const;
- double CalculateChunkSuccessRate (double snir, Time delay, WifiMode mode) const;
+ /**
+ * Calculate the success rate of the chunk given the SINR, duration, and Wi-Fi mode.
+ * The duration and mode are used to calculate how many bits are present in the chunk.
+ *
+ * \param snir SINR
+ * \param duration
+ * \param mode
+ * \return the success rate
+ */
+ double CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode) const;
+ /**
+ * Calculate the error rate of the given packet. The packet can be divided into
+ * multiple chunks (e.g. due to interference from other transmissions).
+ *
+ * \param event
+ * \param ni
+ * \return the error rate of the packet
+ */
double CalculatePer (Ptr<const Event> event, NiChanges *ni) const;
double m_noiseFigure; /**< noise figure (linear) */
@@ -130,6 +301,11 @@
bool m_rxing;
/// Returns an iterator to the first nichange, which is later than moment
NiChanges::iterator GetPosition (Time moment);
+ /**
+ * Add NiChange to the list at the appropriate position.
+ *
+ * \param change
+ */
void AddNiChangeEvent (NiChange change);
};
--- a/src/wifi/model/mac-low.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/mac-low.cc Tue Dec 10 10:48:51 2013 -0500
@@ -243,14 +243,17 @@
}
-/***************************************************************
- * Listener for PHY events. Forwards to MacLow
- ***************************************************************/
-
-
+/**
+ * Listener for PHY events. Forwards to MacLow
+ */
class PhyMacLowListener : public ns3::WifiPhyListener
{
public:
+ /**
+ * Create a PhyMacLowListener for the given MacLow.
+ *
+ * \param macLow
+ */
PhyMacLowListener (ns3::MacLow *macLow)
: m_macLow (macLow)
{
--- a/src/wifi/model/mac-low.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/mac-low.h Tue Dec 10 10:48:51 2013 -0500
@@ -150,16 +150,36 @@
MacLowDcfListener ();
virtual ~MacLowDcfListener ();
/**
+ * Norify that NAV has started for the given duration.
+ *
* \param duration duration of NAV timer
*/
virtual void NavStart (Time duration) = 0;
/**
+ * Notify that NAV has resetted.
+ *
* \param duration duration of NAV timer
*/
virtual void NavReset (Time duration) = 0;
+ /**
+ * Notify that ACK timeout has started for a given duration.
+ *
+ * \param duration duration of ACK timeout
+ */
virtual void AckTimeoutStart (Time duration) = 0;
+ /**
+ * Notify that ACK timeout has resetted.
+ */
virtual void AckTimeoutReset () = 0;
+ /**
+ * Notify that CTS timeout has started for a given duration.
+ *
+ * \param duration duration of CTS timeout
+ */
virtual void CtsTimeoutStart (Time duration) = 0;
+ /**
+ * Notify that CTS timeout has resetted.
+ */
virtual void CtsTimeoutReset () = 0;
};
@@ -180,6 +200,9 @@
* agreement. Timer is reset when a frame with ack policy block ack
* or a block ack request are received. When this timer reaches zero
* this method is called and a delba frame is scheduled for transmission.
+ *
+ * \param originator MAC address of the data originator
+ * \param tid
*/
virtual void BlockAckInactivityTimeout (Mac48Address originator, uint8_t tid) = 0;
};
@@ -354,6 +377,7 @@
uint32_t GetNextPacketSize (void) const;
private:
+
friend std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms);
uint32_t m_nextSize;
enum
@@ -370,6 +394,13 @@
Time m_overrideDurationId;
};
+/**
+ * Serialize MacLowTransmissionParameters to ostream in a human-readable form.
+ *
+ * \param os std::ostream
+ * \param params MacLowTransmissionParameters
+ * \return std::ostream
+ */
std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms);
@@ -380,37 +411,169 @@
class MacLow : public Object
{
public:
+ /**
+ * typedef for a callback for MacLowRx
+ */
typedef Callback<void, Ptr<Packet>, const WifiMacHeader*> MacLowRxCallback;
MacLow ();
virtual ~MacLow ();
+ /**
+ * Set up WifiPhy associated with this MacLow.
+ *
+ * \param phy WifiPhy associated with this MacLow
+ */
void SetPhy (Ptr<WifiPhy> phy);
+ /**
+ * Set up WifiRemoteStationManager associated with this MacLow.
+ *
+ * \param manager WifiRemoteStationManager associated with this MacLow
+ */
void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> manager);
+ /**
+ * Set MAC address of this MacLow.
+ *
+ * \param ad Mac48Address of this MacLow
+ */
void SetAddress (Mac48Address ad);
+ /**
+ * Set ACK timeout of this MacLow.
+ *
+ * \param ackTimeout ACK timeout of this MacLow
+ */
void SetAckTimeout (Time ackTimeout);
+ /**
+ * Set Basic Block ACK timeout of this MacLow.
+ *
+ * \param blockAckTimeout Basic Block ACK timeout of this MacLow
+ */
void SetBasicBlockAckTimeout (Time blockAckTimeout);
+ /**
+ * Set Compressed Block ACK timeout of this MacLow.
+ *
+ * \param blockAckTimeout Compressed Block ACK timeout of this MacLow
+ */
void SetCompressedBlockAckTimeout (Time blockAckTimeout);
+ /**
+ * Enable or disable CTS-to-self capability.
+ *
+ * \param enable Enable or disable CTS-to-self capability
+ */
void SetCtsToSelfSupported (bool enable);
+ /**
+ * Set CTS timeout of this MacLow.
+ *
+ * \param ctsTimeout CTS timeout of this MacLow
+ */
void SetCtsTimeout (Time ctsTimeout);
+ /**
+ * Set Short Interframe Space (SIFS) of this MacLow.
+ *
+ * \param sifs SIFS of this MacLow
+ */
void SetSifs (Time sifs);
+ /**
+ * Set Reduced Interframe Space (RIFS) of this MacLow.
+ *
+ * \param rifs RIFS of this MacLow
+ */
void SetRifs (Time rifs);
+ /**
+ * Set slot duration of this MacLow.
+ *
+ * \param slotTime slot duration of this MacLow
+ */
void SetSlotTime (Time slotTime);
+ /**
+ * Set PCF Interframe Space (PIFS) of this MacLow.
+ *
+ * \param pifs PIFS of this MacLow
+ */
void SetPifs (Time pifs);
+ /**
+ * Set the Basic Service Set Identification.
+ *
+ * \param ad the BSSID
+ */
void SetBssid (Mac48Address ad);
+ /**
+ * Enable promiscuous mode.
+ */
void SetPromisc (void);
+ /**
+ * Return whether CTS-to-self capability is supported.
+ *
+ * \return true if CTS-to-self is supported, false otherwise
+ */
bool GetCtsToSelfSupported () const;
+ /**
+ * Return the MAC address of this MacLow.
+ *
+ * \return Mac48Address of this MacLow
+ */
Mac48Address GetAddress (void) const;
+ /**
+ * Return ACK timeout of this MacLow.
+ *
+ * \return ACK timeout
+ */
Time GetAckTimeout (void) const;
+ /**
+ * Return Basic Block ACK timeout of this MacLow.
+ *
+ * \return Basic Block ACK timeout
+ */
Time GetBasicBlockAckTimeout () const;
+ /**
+ * Return Compressed Block ACK timeout of this MacLow.
+ *
+ * \return Compressed Block ACK timeout
+ */
Time GetCompressedBlockAckTimeout () const;
+ /**
+ * Return CTS timeout of this MacLow.
+ *
+ * \return CTS timeout
+ */
Time GetCtsTimeout (void) const;
+ /**
+ * Return Short Interframe Space (SIFS) of this MacLow.
+ *
+ * \return SIFS
+ */
Time GetSifs (void) const;
+ /**
+ * Return slot duration of this MacLow.
+ *
+ * \return slot duration
+ */
Time GetSlotTime (void) const;
+ /**
+ * Return PCF Interframe Space (PIFS) of this MacLow.
+ *
+ * \return PIFS
+ */
Time GetPifs (void) const;
+ /**
+ * Return Reduced Interframe Space (RIFS) of this MacLow.
+ *
+ * \return RIFS
+ */
Time GetRifs (void) const;
+ /**
+ * Return the Basic Service Set Identification.
+ *
+ * \return BSSID
+ */
Mac48Address GetBssid (void) const;
+ /**
+ * Check if MacLow is operating in promiscuous mode.
+ *
+ * \return true if MacLow is operating in promiscuous mode,
+ * false otherwise
+ */
bool IsPromisc (void) const;
/**
@@ -430,6 +593,7 @@
* \param packet to send (does not include the 802.11 MAC header and checksum)
* \param hdr header associated to the packet to send.
* \param parameters transmission parameters of packet.
+ * \return the transmission time that includes the time for the next packet transmission
*
* This transmission time includes the time required for
* the next packet transmission if one was selected.
@@ -514,62 +678,325 @@
*/
void RegisterBlockAckListenerForAc (enum AcIndex ac, MacLowBlockAckEventListener *listener);
protected:
+ /**
+ * Return a TXVECTOR for the DATA frame given the destination.
+ * The function consults WifiRemoteStationManager, which controls the rate
+ * to different destinations.
+ *
+ * \param packet the packet being asked for TXVECTOR
+ * \param hdr the WifiMacHeader
+ * \return TXVECTOR for the given packet
+ */
virtual WifiTxVector GetDataTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
private:
+ /**
+ * Cancel all scheduled events. Called before beginning a transmission
+ * or switching channel.
+ */
void CancelAllEvents (void);
+ /**
+ * Return the total ACK size (including FCS trailer).
+ *
+ * \return the total ACK size
+ */
uint32_t GetAckSize (void) const;
+ /**
+ * Return the total Block ACK size (including FCS trailer).
+ *
+ * \param type the Block ACK type
+ * \return the total Block ACK size
+ */
uint32_t GetBlockAckSize (enum BlockAckType type) const;
+ /**
+ * Return the total RTS size (including FCS trailer).
+ *
+ * \return the total RTS size
+ */
uint32_t GetRtsSize (void) const;
+ /**
+ * Return the total CTS size (including FCS trailer).
+ *
+ * \return the total CTS size
+ */
uint32_t GetCtsSize (void) const;
+ /**
+ * Return the total size of the packet after WifiMacHeader and FCS trailer
+ * have been added.
+ *
+ * \param packet the packet to be encapsulated with WifiMacHeader and FCS trailer
+ * \param hdr the WifiMacHeader
+ * \return the total packet size
+ */
uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
+ /**
+ * Forward the packet down to WifiPhy for transmission.
+ *
+ * \param packet
+ * \param hdr
+ * \param txVector
+ * \param preamble
+ */
void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,
WifiTxVector txVector, WifiPreamble preamble);
+ /**
+ * Return a TXVECTOR for the RTS frame given the destination.
+ * The function consults WifiRemoteStationManager, which controls the rate
+ * to different destinations.
+ *
+ * \param packet the packet being asked for RTS TXVECTOR
+ * \param hdr the WifiMacHeader
+ * \return TXVECTOR for the RTS of the given packet
+ */
WifiTxVector GetRtsTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
+ /**
+ * Return a TXVECTOR for the CTS frame given the destination and the mode of the RTS
+ * used by the sender.
+ * The function consults WifiRemoteStationManager, which controls the rate
+ * to different destinations.
+ *
+ * \param to the MAC address of the CTS receiver
+ * \param rtsTxMode the mode of the RTS used by the sender
+ * \return TXVECTOR for the CTS
+ */
WifiTxVector GetCtsTxVector (Mac48Address to, WifiMode rtsTxMode) const;
+ /**
+ * Return a TXVECTOR for the ACK frame given the destination and the mode of the DATA
+ * used by the sender.
+ * The function consults WifiRemoteStationManager, which controls the rate
+ * to different destinations.
+ *
+ * \param to the MAC address of the ACK receiver
+ * \param dataTxMode the mode of the DATA used by the sender
+ * \return TXVECTOR for the ACK
+ */
WifiTxVector GetAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
+ /**
+ * Return a TXVECTOR for the Block ACK frame given the destination and the mode of the DATA
+ * used by the sender.
+ * The function consults WifiRemoteStationManager, which controls the rate
+ * to different destinations.
+ *
+ * \param to the MAC address of the Block ACK receiver
+ * \param dataTxMode the mode of the DATA used by the sender
+ * \return TXVECTOR for the Block ACK
+ */
WifiTxVector GetBlockAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
+ /**
+ * Return a TXVECTOR for the CTS-to-self frame.
+ * The function consults WifiRemoteStationManager, which controls the rate
+ * to different destinations.
+ *
+ * \param packet the packet that requires CTS-to-self
+ * \param hdr the Wifi header of the packet
+ * \return TXVECTOR for the CTS-to-self operation
+ */
WifiTxVector GetCtsToSelfTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
+ /**
+ * Return a TXVECTOR for the CTS frame given the destination and the mode of the RTS
+ * used by the sender.
+ * The function consults WifiRemoteStationManager, which controls the rate
+ * to different destinations.
+ *
+ * \param to the MAC address of the CTS receiver
+ * \param rtsTxMode the mode of the RTS used by the sender
+ * \return TXVECTOR for the CTS
+ */
WifiTxVector GetCtsTxVectorForRts (Mac48Address to, WifiMode rtsTxMode) const;
+ /**
+ * Return a TXVECTOR for the Block ACK frame given the destination and the mode of the DATA
+ * used by the sender.
+ * The function consults WifiRemoteStationManager, which controls the rate
+ * to different destinations.
+ *
+ * \param to the MAC address of the Block ACK receiver
+ * \param dataTxMode the mode of the DATA used by the sender
+ * \return TXVECTOR for the Block ACK
+ */
WifiTxVector GetAckTxVectorForData (Mac48Address to, WifiMode dataTxMode) const;
+ /**
+ * Return the time required to transmit the CTS (including preamble and FCS).
+ *
+ * \param ctsTxVector
+ * \return the time required to transmit the CTS (including preamble and FCS)
+ */
Time GetCtsDuration (WifiTxVector ctsTxVector) const;
+ /**
+ * Return the time required to transmit the CTS to the specified address
+ * given the TXVECTOR of the RTS (including preamble and FCS).
+ *
+ * \param to
+ * \param rtsTxVector
+ * \return the time required to transmit the CTS (including preamble and FCS)
+ */
Time GetCtsDuration (Mac48Address to, WifiTxVector rtsTxVector) const;
+ /**
+ * Return the time required to transmit the ACK (including preamble and FCS).
+ *
+ * \param ackTxVector
+ * \return the time required to transmit the ACK (including preamble and FCS)
+ */
Time GetAckDuration (WifiTxVector ackTxVector) const;
+ /**
+ * Return the time required to transmit the ACK to the specified address
+ * given the TXVECTOR of the DATA (including preamble and FCS).
+ *
+ * \param to
+ * \param dataTxVector
+ * \return the time required to transmit the ACK (including preamble and FCS)
+ */
Time GetAckDuration (Mac48Address to, WifiTxVector dataTxVector) const;
Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const;
+ /**
+ * Check if CTS-to-self mechanism should be used for the current packet.
+ *
+ * \return true if CTS-to-self mechanism should be used for the current packet,
+ * false otherwise
+ */
bool NeedCtsToSelf (void);
Time CalculateOverallTxTime (Ptr<const Packet> packet,
const WifiMacHeader* hdr,
const MacLowTransmissionParameters ¶ms) const;
void NotifyNav (Ptr<const Packet> packet,const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble);
+ /**
+ * Reset NAV with the given duration.
+ *
+ * \param duration
+ */
void DoNavResetNow (Time duration);
+ /**
+ * Start NAV with the given duration.
+ *
+ * \param duration
+ * \return true if NAV is resetted
+ */
bool DoNavStartNow (Time duration);
+ /**
+ * Check if NAV is zero.
+ *
+ * \return true if NAV is zero,
+ * false otherwise
+ */
bool IsNavZero (void) const;
+ /**
+ * Notify DcfManager (via DcfListener) that
+ * ACK timer should be started for the given
+ * duration.
+ *
+ * \param duration
+ */
void NotifyAckTimeoutStartNow (Time duration);
+ /**
+ * Notify DcfManager (via DcfListener) that
+ * ACK timer should be resetted.
+ */
void NotifyAckTimeoutResetNow ();
+ /**
+ * Notify DcfManager (via DcfListener) that
+ * CTS timer should be started for the given
+ * duration.
+ *
+ * \param duration
+ */
void NotifyCtsTimeoutStartNow (Time duration);
+ /**
+ * Notify DcfManager (via DcfListener) that
+ * CTS timer should be resetted.
+ */
void NotifyCtsTimeoutResetNow ();
+ /**
+ * Reset NAV after CTS was missed when the NAV was
+ * setted with RTS.
+ *
+ * \param rtsEndRxTime
+ */
void NavCounterResetCtsMissed (Time rtsEndRxTime);
+
+ /* Event handlers */
+ /**
+ * Event handler when normal ACK timeout occurs.
+ */
void NormalAckTimeout (void);
+ /**
+ * Event handler when fast ACK timeout occurs (idle).
+ */
void FastAckTimeout (void);
+ /**
+ * Event handler when super fast ACK timeout occurs.
+ */
void SuperFastAckTimeout (void);
+ /**
+ * Event handler when fast ACK timeout occurs (busy).
+ */
void FastAckFailedTimeout (void);
+ /**
+ * Event handler when block ACK timeout occurs.
+ */
void BlockAckTimeout (void);
+ /**
+ * Event handler when CTS timeout occurs.
+ */
void CtsTimeout (void);
+ /**
+ * Send CTS for a CTS-to-self mechanism.
+ */
void SendCtsToSelf (void);
+ /**
+ * Send CTS after receiving RTS.
+ *
+ * \param source
+ * \param duration
+ * \param txMode
+ * \param rtsSnr
+ */
void SendCtsAfterRts (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr);
- void SendAckAfterData (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr);
+ /**
+ * Send ACK after receiving DATA.
+ *
+ * \param source
+ * \param duration
+ * \param dataTxMode
+ * \param dataSnr
+ */
+ void SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr);
+ /**
+ * Send DATA after receiving CTS.
+ *
+ * \param source
+ * \param duration
+ * \param txMode
+ */
void SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode);
+ /**
+ * Event handler that is usually scheduled to fired at the appropriate time
+ * after completing transmissions.
+ */
void WaitSifsAfterEndTx (void);
+ /**
+ * A transmission that does not require an ACK has completed.
+ */
void EndTxNoAck (void);
+ /**
+ * Send RTS to begin RTS-CTS-DATA-ACK transaction.
+ */
void SendRtsForPacket (void);
+ /**
+ * Send DATA packet, which can be DATA-ACK or
+ * RTS-CTS-DATA-ACK transaction.
+ */
void SendDataPacket (void);
+ /**
+ * Start a DATA timer by scheduling appropriate
+ * ACK timeout.
+ *
+ * \param dataTxVector
+ */
void StartDataTxTimers (WifiTxVector dataTxVector);
virtual void DoDispose (void);
/**
@@ -601,31 +1028,55 @@
* circularly modulo 2^12.
*/
bool StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr);
- /*
+ /**
* Invoked after that a block ack request has been received. Looks for corresponding
* block ack agreement and creates block ack bitmap on a received packets basis.
+ *
+ * \param reqHdr
+ * \param originator
+ * \param duration
+ * \param blockAckReqTxMode
*/
void SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Mac48Address originator,
Time duration, WifiMode blockAckReqTxMode);
- /*
+ /**
* This method creates block ack frame with header equals to <i>blockAck</i> and start its transmission.
+ *
+ * \param blockAck
+ * \param originator
+ * \param immediate
+ * \param duration
+ * \param blockAckReqTxMode
*/
void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate,
Time duration, WifiMode blockAckReqTxMode);
- /*
+ /**
* Every time that a block ack request or a packet with ack policy equals to <i>block ack</i>
* are received, if a relative block ack agreement exists and the value of inactivity timeout
* is not 0, the timer is reset.
* see section 11.5.3 in IEEE802.11e for more details.
+ *
+ * \param agreement
*/
void ResetBlockAckInactivityTimerIfNeeded (BlockAckAgreement &agreement);
+ /**
+ * Set up WifiPhy listener for this MacLow.
+ *
+ * \param phy the WifiPhy this MacLow is connected to
+ */
void SetupPhyMacLowListener (Ptr<WifiPhy> phy);
Ptr<WifiPhy> m_phy;
Ptr<WifiRemoteStationManager> m_stationManager;
MacLowRxCallback m_rxCallback;
+ /**
+ * typedef for an iterator for a list of MacLowDcfListener.
+ */
typedef std::vector<MacLowDcfListener *>::const_iterator DcfListenersCI;
+ /**
+ * typedef for a list of MacLowDcfListener.
+ */
typedef std::vector<MacLowDcfListener *> DcfListeners;
DcfListeners m_dcfListeners;
--- a/src/wifi/model/mac-rx-middle.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/mac-rx-middle.cc Tue Dec 10 10:48:51 2013 -0500
@@ -33,10 +33,20 @@
namespace ns3 {
+/**
+ * A class to keep track of the packet originator status.
+ * It recomposes the packet from multiple fragments.
+ */
class OriginatorRxStatus
{
private:
+ /**
+ * typedef for a list of fragments (i.e. incomplete Packet).
+ */
typedef std::list<Ptr<const Packet> > Fragments;
+ /**
+ * typedef for a const iterator for Fragments
+ */
typedef std::list<Ptr<const Packet> >::const_iterator FragmentsCI;
bool m_defragmenting;
@@ -53,16 +63,37 @@
{
m_fragments.clear ();
}
+ /**
+ * Check if we are de-fragmenting packets.
+ *
+ * \return true if we are de-fragmenting packets,
+ * false otherwise
+ */
bool IsDeFragmenting (void)
{
return m_defragmenting;
}
+ /**
+ * We have received a first fragmented packet.
+ * We start the deframentation by saving the first fragment.
+ *
+ * \param packet the first fragmented packet
+ */
void AccumulateFirstFragment (Ptr<const Packet> packet)
{
NS_ASSERT (!m_defragmenting);
m_defragmenting = true;
m_fragments.push_back (packet);
}
+ /**
+ * We have received a last fragment of the fragmented packets
+ * (indicated by the no more fragment field).
+ * We re-construct the packet from the fragments we saved
+ * and return the full packet.
+ *
+ * \param packet the last fragment
+ * \return the fully reconstructed packet
+ */
Ptr<Packet> AccumulateLastFragment (Ptr<const Packet> packet)
{
NS_ASSERT (m_defragmenting);
@@ -76,11 +107,25 @@
m_fragments.erase (m_fragments.begin (), m_fragments.end ());
return full;
}
+ /**
+ * We received a fragmented packet (not first and not last).
+ * We simply save it into our internal list.
+ *
+ * \param packet the received fragment
+ */
void AccumulateFragment (Ptr<const Packet> packet)
{
NS_ASSERT (m_defragmenting);
m_fragments.push_back (packet);
}
+ /**
+ * Check if the sequence control (i.e. fragment number) is
+ * in order.
+ *
+ * \param sequenceControl the raw sequence control
+ * \return true if the sequence control is in order,
+ * false otherwise
+ */
bool IsNextFragment (uint16_t sequenceControl)
{
if ((sequenceControl >> 4) == (m_lastSequenceControl >> 4)
@@ -93,10 +138,20 @@
return false;
}
}
+ /**
+ * Return the last sequence control we received.
+ *
+ * \return the last sequence control
+ */
uint16_t GetLastSequenceControl (void)
{
return m_lastSequenceControl;
}
+ /**
+ * Set the last sequence control we received.
+ *
+ * \param sequenceControl the last sequence control we received
+ */
void SetSequenceControl (uint16_t sequenceControl)
{
m_lastSequenceControl = sequenceControl;
--- a/src/wifi/model/mac-rx-middle.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/mac-rx-middle.h Tue Dec 10 10:48:51 2013 -0500
@@ -40,24 +40,75 @@
class MacRxMiddle
{
public:
+ /**
+ * typedef for callback
+ */
typedef Callback<void, Ptr<Packet>, const WifiMacHeader*> ForwardUpCallback;
MacRxMiddle ();
~MacRxMiddle ();
+ /**
+ * Set a callback to forward the packet up.
+ *
+ * \param callback
+ */
void SetForwardCallback (ForwardUpCallback callback);
void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
private:
friend class MacRxMiddleTest;
+ /**
+ * Look up for OriginatorRxStatus associated with the sender address
+ * (by looking at ADDR2 field in the header).
+ * The method creates a new OriginatorRxStatus if one is not already presented.
+ *
+ * \param hdr
+ * \return OriginatorRxStatus
+ */
OriginatorRxStatus* Lookup (const WifiMacHeader* hdr);
+ /**
+ * Check if we have already received the packet from the sender before
+ * (by looking at the sequence control field).
+ *
+ * \param hdr
+ * \param originator
+ * \return true if we already received the packet previously,
+ * false otherwise
+ */
bool IsDuplicate (const WifiMacHeader* hdr, OriginatorRxStatus *originator) const;
+ /**
+ * Check if the received packet is a fragment and handle it appropriately.
+ * If the packet is not a fragment, the method returns the packet.
+ * If the packet is a fragment (not the last fragment), the method initiates
+ * de-fragmentation process and return 0.
+ * If the packet is the last fragment, the method tries to re-construct the full packet
+ * and return the packet if success.
+ *
+ * \param packet
+ * \param hdr
+ * \param originator
+ * \return a packet if the packet is successfully reassembled (or not a fragment),
+ * 0 if we failed to reassemble the packet (e.g. missing fragments/out-of-order).
+ */
Ptr<Packet> HandleFragments (Ptr<Packet> packet, const WifiMacHeader* hdr,
OriginatorRxStatus *originator);
+ /**
+ * typedef for a map between address and OriginatorRxStatus
+ */
typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> > Originators;
+ /**
+ * typedef for a map between address, OriginatorRxStatus, and Traffic ID
+ */
typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > > QosOriginators;
+ /**
+ * typedef for an interator for Originators
+ */
typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> >::iterator OriginatorsI;
+ /**
+ * typedef for an interator for QosOriginators
+ */
typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > >::iterator QosOriginatorsI;
Originators m_originatorStatus;
QosOriginators m_qosOriginatorStatus;
--- a/src/wifi/model/mac-tx-middle.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/mac-tx-middle.h Tue Dec 10 10:48:51 2013 -0500
@@ -42,7 +42,20 @@
MacTxMiddle ();
~MacTxMiddle ();
+ /**
+ * Return the next sequence number for the given header.
+ *
+ * \param hdr Wi-Fi header
+ * \return the next sequence number
+ */
uint16_t GetNextSequenceNumberfor (const WifiMacHeader *hdr);
+ /**
+ * Return the next sequence number for the Traffic ID and destination.
+ *
+ * \param tid Traffic ID
+ * \param addr destination address
+ * \return the next sequence number
+ */
uint16_t GetNextSeqNumberByTidAndAddress (uint8_t tid, Mac48Address addr) const;
private:
--- a/src/wifi/model/mgt-headers.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/mgt-headers.h Tue Dec 10 10:48:51 2013 -0500
@@ -43,14 +43,54 @@
MgtAssocRequestHeader ();
~MgtAssocRequestHeader ();
+ /**
+ * Set the Service Set Identifier (SSID).
+ *
+ * \param ssid SSID
+ */
void SetSsid (Ssid ssid);
+ /**
+ * Set the supported rates.
+ *
+ * \param rates the supported rates
+ */
void SetSupportedRates (SupportedRates rates);
+ /**
+ * Set the listen interval.
+ *
+ * \param interval the listen interval
+ */
void SetListenInterval (uint16_t interval);
+ /**
+ * Set the HT capabilities.
+ *
+ * \param htcapabilities HT capabilities
+ */
void SetHtCapabilities(HtCapabilities htcapabilities);
+ /**
+ * Return the HT capabilities.
+ *
+ * \return HT capabilities
+ */
HtCapabilities GetHtCapabilities (void) const;
+ /**
+ * Return the Service Set Identifier (SSID).
+ *
+ * \return SSID
+ */
Ssid GetSsid (void) const;
+ /**
+ * Return the supported rates.
+ *
+ * \return the supported rates
+ */
SupportedRates GetSupportedRates (void) const;
+ /**
+ * Return the listen interval.
+ *
+ * \return the listen interval
+ */
uint16_t GetListenInterval (void) const;
static TypeId GetTypeId (void);
@@ -79,12 +119,42 @@
MgtAssocResponseHeader ();
~MgtAssocResponseHeader ();
+ /**
+ * Return the status code.
+ *
+ * \return the status code
+ */
StatusCode GetStatusCode (void);
+ /**
+ * Return the supported rates.
+ *
+ * \return the supported rates
+ */
SupportedRates GetSupportedRates (void);
+ /**
+ * Return the HT capabilities.
+ *
+ * \return HT capabilities
+ */
HtCapabilities GetHtCapabilities (void) const;
+ /**
+ * Set the HT capabilities.
+ *
+ * \param htcapabilities HT capabilities
+ */
void SetHtCapabilities(HtCapabilities htcapabilities);
+ /**
+ * Set the supported rates.
+ *
+ * \param rates the supported rates
+ */
void SetSupportedRates (SupportedRates rates);
+ /**
+ * Set the status code.
+ *
+ * \param code the status code
+ */
void SetStatusCode (StatusCode code);
static TypeId GetTypeId (void);
@@ -112,12 +182,42 @@
public:
~MgtProbeRequestHeader ();
+ /**
+ * Set the Service Set Identifier (SSID).
+ *
+ * \param ssid SSID
+ */
void SetSsid (Ssid ssid);
+ /**
+ * Set the supported rates.
+ *
+ * \param rates the supported rates
+ */
void SetSupportedRates (SupportedRates rates);
+ /**
+ * Return the Service Set Identifier (SSID).
+ *
+ * \return SSID
+ */
Ssid GetSsid (void) const;
+ /**
+ * Return the supported rates.
+ *
+ * \return the supported rates
+ */
SupportedRates GetSupportedRates (void) const;
- HtCapabilities GetHtCapabilities (void) const;
+ /**
+ * Return the HT capabilities.
+ *
+ * \return HT capabilities
+ */
+ HtCapabilities GetHtCapabilities (void) const;
+ /**
+ * Set the HT capabilities.
+ *
+ * \param htcapabilities HT capabilities
+ */
void SetHtCapabilities(HtCapabilities htcapabilities);
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
@@ -142,15 +242,60 @@
MgtProbeResponseHeader ();
~MgtProbeResponseHeader ();
+ /**
+ * Return the Service Set Identifier (SSID).
+ *
+ * \return SSID
+ */
Ssid GetSsid (void) const;
+ /**
+ * Return the beacon interval in microseconds unit.
+ *
+ * \return beacon interval in microseconds unit
+ */
uint64_t GetBeaconIntervalUs (void) const;
+ /**
+ * Return the supported rates.
+ *
+ * \return the supported rates
+ */
SupportedRates GetSupportedRates (void) const;
- HtCapabilities GetHtCapabilities (void) const;
+ /**
+ * Return the HT capabilities.
+ *
+ * \return HT capabilities
+ */
+ HtCapabilities GetHtCapabilities (void) const;
+ /**
+ * Set the HT capabilities.
+ *
+ * \param htcapabilities HT capabilities
+ */
void SetHtCapabilities(HtCapabilities htcapabilities);
+ /**
+ * Set the Service Set Identifier (SSID).
+ *
+ * \param ssid SSID
+ */
void SetSsid (Ssid ssid);
+ /**
+ * Set the beacon interval in microseconds unit.
+ *
+ * \param us beacon interval in microseconds unit
+ */
void SetBeaconIntervalUs (uint64_t us);
+ /**
+ * Set the supported rates.
+ *
+ * \param rates the supported rates
+ */
void SetSupportedRates (SupportedRates rates);
+ /**
+ * Return the time stamp.
+ *
+ * \return time stamp
+ */
uint64_t GetTimestamp ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
@@ -194,8 +339,11 @@
WifiActionHeader ();
~WifiActionHeader ();
- /* Compatible with open80211s implementation */
- enum CategoryValue //table 7-24 staring from 4
+ /**
+ * Compatible with open80211s implementation
+ * Category values - see 802.11-2012 Table 8-38
+ */
+ enum CategoryValue
{
BLOCK_ACK = 3,
MESH_PEERING_MGT = 30,
@@ -208,7 +356,9 @@
// refer to vendor-specific-action in wave module.
VENDOR_SPECIFIC_ACTION = 127,
};
- /* Compatible with open80211s implementation */
+ /**
+ * Compatible with open80211s implementation
+ */
enum PeerLinkMgtActionValue
{
PEER_LINK_OPEN = 0,
@@ -220,7 +370,9 @@
LINK_METRIC_REQUEST = 0,
LINK_METRIC_REPORT,
};
- /* Compatible with open80211s implementation */
+ /**
+ * Compatible with open80211s implementation
+ */
enum PathSelectionActionValue
{
PATH_SELECTION = 0,
@@ -242,12 +394,19 @@
TBTT_ADJUSTMENT_REQUEST,
MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
};
+ /**
+ * Block ACK action field values
+ * See 802.11 Table 8-202
+ */
enum BlockAckActionValue
{
BLOCK_ACK_ADDBA_REQUEST = 0,
BLOCK_ACK_ADDBA_RESPONSE = 1,
BLOCK_ACK_DELBA = 2
};
+ /**
+ * typedef for union of different ActionValues
+ */
typedef union
{
enum PeerLinkMgtActionValue peerLink;
@@ -257,9 +416,25 @@
enum ResourceCoordinationActionValue resourceCoordination;
enum BlockAckActionValue blockAck;
} ActionValue;
+ /**
+ * Set action for this Action header.
+ *
+ * \param type category
+ * \param action action
+ */
void SetAction (enum CategoryValue type,ActionValue action);
+ /**
+ * Return the category value.
+ *
+ * \return CategoryValue
+ */
CategoryValue GetCategory ();
+ /**
+ * Return the action value.
+ *
+ * \return ActionValue
+ */
ActionValue GetAction ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId () const;
@@ -288,25 +463,106 @@
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
+ /**
+ * Enable delayed Block ACK.
+ */
void SetDelayedBlockAck ();
+ /**
+ * Enable immediate Block ACK
+ */
void SetImmediateBlockAck ();
+ /**
+ * Set Traffic ID (TID).
+ *
+ * \param tid traffic ID
+ */
void SetTid (uint8_t tid);
+ /**
+ * Set timeout.
+ *
+ * \param timeout timeout
+ */
void SetTimeout (uint16_t timeout);
+ /**
+ * Set buffer size.
+ *
+ * \param size buffer size
+ */
void SetBufferSize (uint16_t size);
+ /**
+ * Set the starting sequence number.
+ *
+ * \param seq the starting sequence number
+ */
void SetStartingSequence (uint16_t seq);
+ /**
+ * Enable or disable A-MSDU support.
+ *
+ * \param supported enable or disable A-MSDU support
+ */
void SetAmsduSupport (bool supported);
+ /**
+ * Return the starting sequence number.
+ *
+ * \return the starting sequence number
+ */
uint16_t GetStartingSequence (void) const;
+ /**
+ * Return the Traffic ID (TID).
+ *
+ * \return TID
+ */
uint8_t GetTid (void) const;
+ /**
+ * Return whether the Block ACK policy is immediate Block ACK.
+ *
+ * \return true if immediate Block ACK is being used, false otherwise
+ */
bool IsImmediateBlockAck (void) const;
+ /**
+ * Return the timeout.
+ *
+ * \return timeout
+ */
uint16_t GetTimeout (void) const;
+ /**
+ * Return the buffer size.
+ *
+ * \return the buffer size.
+ */
uint16_t GetBufferSize (void) const;
+ /**
+ * Return whether A-MSDU capability is supported.
+ *
+ * \return true is A-MSDU is supported, false otherwise
+ */
bool IsAmsduSupported (void) const;
private:
+ /**
+ * Return the raw parameter set.
+ *
+ * \return the raw parameter set
+ */
uint16_t GetParameterSet (void) const;
+ /**
+ * Set the parameter set from the given raw value.
+ *
+ * \param params raw parameter set value
+ */
void SetParameterSet (uint16_t params);
+ /**
+ * Return the raw sequence control.
+ *
+ * \return the raw sequence control
+ */
uint16_t GetStartingSequenceControl (void) const;
+ /**
+ * Set sequence control with the given raw value.
+ *
+ * \param seqControl
+ */
void SetStartingSequenceControl (uint16_t seqControl);
uint8_t m_dialogToken; /* Not used for now */
@@ -335,23 +591,94 @@
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
+ /**
+ * Enable delayed Block ACK.
+ */
void SetDelayedBlockAck ();
+ /**
+ * Enable immediate Block ACK
+ */
void SetImmediateBlockAck ();
+ /**
+ * Set Traffic ID (TID).
+ *
+ * \param tid traffic ID
+ */
void SetTid (uint8_t tid);
+ /**
+ * Set timeout.
+ *
+ * \param timeout timeout
+ */
void SetTimeout (uint16_t timeout);
+ /**
+ * Set buffer size.
+ *
+ * \param size buffer size
+ */
void SetBufferSize (uint16_t size);
+ /**
+ * Set the status code.
+ *
+ * \param code the status code
+ */
void SetStatusCode (StatusCode code);
+ /**
+ * Enable or disable A-MSDU support.
+ *
+ * \param supported enable or disable A-MSDU support
+ */
void SetAmsduSupport (bool supported);
+ /**
+ * Return the status code.
+ *
+ * \return the status code
+ */
StatusCode GetStatusCode (void) const;
+ /**
+ * Return the Traffic ID (TID).
+ *
+ * \return TID
+ */
uint8_t GetTid (void) const;
+ /**
+ * Return whether the Block ACK policy is immediate Block ACK.
+ *
+ * \return true if immediate Block ACK is being used, false otherwise
+ */
bool IsImmediateBlockAck (void) const;
+ /**
+ * Return the timeout.
+ *
+ * \return timeout
+ */
uint16_t GetTimeout (void) const;
+ /**
+ * Return the buffer size.
+ *
+ * \return the buffer size.
+ */
uint16_t GetBufferSize (void) const;
+ /**
+ * Return whether A-MSDU capability is supported.
+ *
+ * \return true is A-MSDU is supported, false otherwise
+ */
bool IsAmsduSupported (void) const;
private:
+ /**
+ * Return the raw parameter set.
+ *
+ * \return the raw parameter set
+ */
uint16_t GetParameterSet (void) const;
+ /**
+ * Set the parameter set from the given raw value.
+ *
+ * \param params raw parameter set value
+ */
void SetParameterSet (uint16_t params);
uint8_t m_dialogToken; /* Not used for now */
@@ -380,14 +707,46 @@
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
+ /**
+ * Check if the initiator bit in the DELBA is setted.
+ *
+ * \return true if the initiator bit in the DELBA is setted,
+ * false otherwise
+ */
bool IsByOriginator (void) const;
+ /**
+ * Return the Traffic ID (TID).
+ *
+ * \return TID
+ */
uint8_t GetTid (void) const;
+ /**
+ * Set Traffic ID (TID).
+ *
+ * \param tid traffic ID
+ */
void SetTid (uint8_t);
+ /**
+ * Set the initiator bit in the DELBA.
+ */
void SetByOriginator (void);
+ /**
+ * Un-set the initiator bit in the DELBA.
+ */
void SetByRecipient (void);
private:
+ /**
+ * Return the raw parameter set.
+ *
+ * \return the raw parameter set
+ */
uint16_t GetParameterSet (void) const;
+ /**
+ * Set the parameter set from the given raw value.
+ *
+ * \param params raw parameter set value
+ */
void SetParameterSet (uint16_t params);
uint16_t m_initiator;
--- a/src/wifi/model/minstrel-wifi-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/minstrel-wifi-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -45,7 +45,12 @@
namespace ns3 {
-
+/**
+ * \brief hold per-remote-station state for Minstrel Wifi manager.
+ *
+ * This struct extends from WifiRemoteStation struct to hold additional
+ * information required by the Minstrel Wifi manager
+ */
struct MinstrelWifiRemoteStation : public WifiRemoteStation
{
Time m_nextStatsUpdate; ///< 10 times every second
--- a/src/wifi/model/minstrel-wifi-manager.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/minstrel-wifi-manager.h Tue Dec 10 10:48:51 2013 -0500
@@ -123,6 +123,12 @@
/// for estimating the TxTime of a packet with a given mode
Time GetCalcTxTime (WifiMode mode) const;
+ /**
+ * Add transmission time for the given mode to an internal list.
+ *
+ * \param mode Wi-Fi mode
+ * \param t transmission time
+ */
void AddCalcTxTime (WifiMode mode, Time t);
/// update the number of retries and reset accordingly
@@ -151,7 +157,11 @@
void CheckInit (MinstrelWifiRemoteStation *station); ///< check for initializations
-
+ /**
+ * typedef for a vector of a pair of Time, WifiMode.
+ * (Essentially a list for WifiMode and its corresponding transmission time
+ * to transmit a reference packet.
+ */
typedef std::vector<std::pair<Time,WifiMode> > TxTime;
MinstrelRate m_minstrelTable; ///< minstrel table
SampleRate m_sampleTable; ///< sample table
--- a/src/wifi/model/msdu-standard-aggregator.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/msdu-standard-aggregator.h Tue Dec 10 10:48:51 2013 -0500
@@ -40,6 +40,7 @@
* \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible,
* \param src Source address of <i>packet</i>.
* \param dest Destination address of <i>packet</i>.
+ * \return true if the packet can be aggregated, false otherwise
*
* This method performs an MSDU aggregation.
* Returns true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
@@ -47,9 +48,13 @@
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
Mac48Address src, Mac48Address dest);
private:
- /* Calculates how much padding must be added to the end of aggregated packet,
- after that a new packet is added.
- Each A-MSDU subframe is padded so that its length is multiple of 4 octets.
+ /**
+ * Calculates how much padding must be added to the end of aggregated packet,
+ * after that a new packet is added.
+ * Each A-MSDU subframe is padded so that its length is multiple of 4 octets.
+ *
+ * \param packet
+ * \return the number of octets required for padding
*/
uint32_t CalculatePadding (Ptr<const Packet> packet);
--- a/src/wifi/model/nist-error-rate-model.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/nist-error-rate-model.h Tue Dec 10 10:48:51 2013 -0500
@@ -45,6 +45,13 @@
virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const;
private:
+ /**
+ * Return the coded BER for the given p and b.
+ *
+ * \param p
+ * \param bValue
+ * \return BER
+ */
double CalculatePe (double p, uint32_t bValue) const;
/**
* Return BER of BPSK at the given SNR.
--- a/src/wifi/model/onoe-wifi-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/onoe-wifi-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -29,6 +29,12 @@
namespace ns3 {
+/**
+ * \brief hold per-remote-station state for ONOE Wifi manager.
+ *
+ * This struct extends from WifiRemoteStation struct to hold additional
+ * information required by the ONOE Wifi manager
+ */
struct OnoeWifiRemoteStation : public WifiRemoteStation
{
Time m_nextModeUpdate;
--- a/src/wifi/model/onoe-wifi-manager.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/onoe-wifi-manager.h Tue Dec 10 10:48:51 2013 -0500
@@ -62,6 +62,11 @@
virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
virtual bool IsLowLatency (void) const;
+ /**
+ * Update the number of retry (both short and long).
+ *
+ * \param station
+ */
void UpdateRetry (OnoeWifiRemoteStation *station);
void UpdateMode (OnoeWifiRemoteStation *station);
--- a/src/wifi/model/originator-block-ack-agreement.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/originator-block-ack-agreement.h Tue Dec 10 10:48:51 2013 -0500
@@ -94,17 +94,46 @@
UNSUCCESSFUL
};
void SetState (enum State state);
+ /**
+ * Check if the current state of this agreement is PENDING.
+ *
+ * \return true if the current state of this agreement is PENDING,
+ * false otherwise
+ */
bool IsPending (void) const;
+ /**
+ * Check if the current state of this agreement is ESTABLISHED.
+ *
+ * \return true if the current state of this agreement is ESTABLISHED,
+ * false otherwise
+ */
bool IsEstablished (void) const;
+ /**
+ * Check if the current state of this agreement is INACTIVE.
+ *
+ * \return true if the current state of this agreement is INACTIVE,
+ * false otherwise
+ */
bool IsInactive (void) const;
+ /**
+ * Check if the current state of this agreement is UNSUCCESSFUL.
+ *
+ * \return true if the current state of this agreement is UNSUCCESSFUL,
+ * false otherwise
+ */
bool IsUnsuccessful (void) const;
/**
* Notifies a packet's transmission with ack policy Block Ack.
+ *
+ * \param nextSeqNumber
*/
void NotifyMpduTransmission (uint16_t nextSeqNumber);
/**
* Returns true if all packets for which a block ack was negotiated have been transmitted so
* a block ack request is needed in order to acknowledge them.
+ *
+ * \return true if all packets for which a block ack was negotiated have been transmitted,
+ * false otherwise
*/
bool IsBlockAckRequestNeeded (void) const;
void CompleteExchange (void);
--- a/src/wifi/model/qos-blocked-destinations.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/qos-blocked-destinations.h Tue Dec 10 10:48:51 2013 -0500
@@ -26,19 +26,55 @@
namespace ns3 {
+/**
+ * Keep track of destination address - TID pairs that are waiting
+ * for a block ACK response.
+ */
class QosBlockedDestinations
{
public:
QosBlockedDestinations ();
~QosBlockedDestinations ();
+ /**
+ * Block the given destination address and TID from sending (e.g. pending
+ * block ACK response).
+ *
+ * \param dest
+ * \param tid
+ */
void Block (Mac48Address dest, uint8_t tid);
+ /**
+ * Un-block the given destination address and TID (e.g. block ACK
+ * response received).
+ *
+ * \param dest
+ * \param tid
+ */
void Unblock (Mac48Address dest, uint8_t tid);
+ /**
+ * Check if the given destination address and TID are blocked
+ * from sending (e.g. pending block ACK response).
+ *
+ * \param dest
+ * \param tid
+ * \return true if the given destination address and TID are blocked
+ * from sending, false otherwise
+ */
bool IsBlocked (Mac48Address dest, uint8_t tid) const;
private:
+ /**
+ * typedef for a list of <Mac48Address, TID> pair.
+ */
typedef std::list<std::pair<Mac48Address, uint8_t> > BlockedPackets;
+ /**
+ * typedef for an iterator of BlockedPackets
+ */
typedef std::list<std::pair<Mac48Address, uint8_t> >::iterator BlockedPacketsI;
+ /**
+ * typedef for a constan iterator of BlockedPackets
+ */
typedef std::list<std::pair<Mac48Address, uint8_t> >::const_iterator BlockedPacketsCI;
BlockedPackets m_blockedQosPackets;
};
--- a/src/wifi/model/qos-utils.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/qos-utils.h Tue Dec 10 10:48:51 2013 -0500
@@ -54,6 +54,7 @@
* For more details see table 9-1 of IEEE802.11 standard.
*
* \param tid the Traffic ID to be mapped to Access class
+ * \return the access class for the given TID
*/
AcIndex QosUtilsMapTidToAc (uint8_t tid);
@@ -74,8 +75,9 @@
* When an BAR is received from originator station, completed "old"
* (see section 9.10.3 in IEEE802.11e) packets must be forwarded up before "new" packets.
*
- * \param seqConrol the sequence control field
+ * \param seqControl the sequence control field
* \param endSequence
+ * \return a unique integer for the given sequence control and end sequence
*/
uint32_t QosUtilsMapSeqControlToUniqueInteger (uint16_t seqControl, uint16_t endSequence);
@@ -113,6 +115,7 @@
*
* \param startingSeq the starting sequence number
* \param seqNumber the sequence number to be checked
+ * \return true if the packet is old, false otherwise
*/
bool QosUtilsIsOldPacket (uint16_t startingSeq, uint16_t seqNumber);
--- a/src/wifi/model/random-stream.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/random-stream.h Tue Dec 10 10:48:51 2013 -0500
@@ -34,6 +34,13 @@
{
public:
virtual ~RandomStream ();
+ /**
+ * Get integer between min and max (including min and max).
+ *
+ * \param min lower bound (inclusive)
+ * \param max upper bound (inclusive)
+ * \return a random number between min and max (including min and max)
+ */
virtual uint32_t GetNext (uint32_t min, uint32_t max) = 0;
/**
@@ -71,6 +78,11 @@
class TestRandomStream : public RandomStream
{
public:
+ /**
+ * Add the given value to the list.
+ *
+ * \param v
+ */
void AddNext (uint32_t v);
virtual uint32_t GetNext (uint32_t min, uint32_t max);
--- a/src/wifi/model/regular-wifi-mac.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/regular-wifi-mac.h Tue Dec 10 10:48:51 2013 -0500
@@ -234,19 +234,19 @@
virtual void DoInitialize ();
virtual void DoDispose ();
- MacRxMiddle *m_rxMiddle;
- MacTxMiddle *m_txMiddle;
- Ptr<MacLow> m_low;
- DcfManager *m_dcfManager;
- Ptr<WifiPhy> m_phy;
+ MacRxMiddle *m_rxMiddle; //!< RX middle (de-fragmentation etc.)
+ MacTxMiddle *m_txMiddle; //!< TX middle (aggregation etc.)
+ Ptr<MacLow> m_low; //!< MacLow (RTS, CTS, DATA, ACK etc.)
+ DcfManager *m_dcfManager; //!< DCF manager (access to channel)
+ Ptr<WifiPhy> m_phy; //!< Wifi PHY
- Ptr<WifiRemoteStationManager> m_stationManager;
+ Ptr<WifiRemoteStationManager> m_stationManager; //!< Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
- ForwardUpCallback m_forwardUp;
- Callback<void> m_linkUp;
- Callback<void> m_linkDown;
+ ForwardUpCallback m_forwardUp; //!< Callback to forward packet up the stack
+ Callback<void> m_linkUp; //!< Callback when a link is up
+ Callback<void> m_linkDown; //!< Callback when a link is down
- Ssid m_ssid;
+ Ssid m_ssid; //!< Service Set ID (SSID)
/** This holds a pointer to the DCF instance for this WifiMac - used
for transmission of frames to non-QoS peers. */
@@ -259,16 +259,36 @@
channel access function */
EdcaQueues m_edca;
- /** Accessor for the DCF object */
+ /**
+ * Accessor for the DCF object
+ *
+ * \return a smart pointer to DcaTxop
+ */
Ptr<DcaTxop> GetDcaTxop (void) const;
- /** Accessor for the AC_VO channel access function */
+ /**
+ * Accessor for the AC_VO channel access function
+ *
+ * \return a smart pointer to EdcaTxopN
+ */
Ptr<EdcaTxopN> GetVOQueue (void) const;
- /** Accessor for the AC_VI channel access function */
+ /**
+ * Accessor for the AC_VI channel access function
+ *
+ * \return a smart pointer to EdcaTxopN
+ */
Ptr<EdcaTxopN> GetVIQueue (void) const;
- /** Accessor for the AC_BE channel access function */
+ /**
+ * Accessor for the AC_BE channel access function
+ *
+ * \return a smart pointer to EdcaTxopN
+ */
Ptr<EdcaTxopN> GetBEQueue (void) const;
- /** Accessor for the AC_BK channel access function */
+ /**
+ * Accessor for the AC_BK channel access function
+ *
+ * \return a smart pointer to EdcaTxopN
+ */
Ptr<EdcaTxopN> GetBKQueue (void) const;
/**
--- a/src/wifi/model/rraa-wifi-manager.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/rraa-wifi-manager.cc Tue Dec 10 10:48:51 2013 -0500
@@ -32,6 +32,12 @@
namespace ns3 {
+/**
+ * \brief hold per-remote-station state for RRAA Wifi manager.
+ *
+ * This struct extends from WifiRemoteStation struct to hold additional
+ * information required by the RRAA Wifi manager
+ */
struct RraaWifiRemoteStation : public WifiRemoteStation
{
uint32_t m_counter;
--- a/src/wifi/model/rraa-wifi-manager.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/rraa-wifi-manager.h Tue Dec 10 10:48:51 2013 -0500
@@ -71,13 +71,61 @@
Ptr<const Packet> packet, bool normally);
virtual bool IsLowLatency (void) const;
+ /**
+ * Return the index for the maximum transmission rate for
+ * the given station.
+ *
+ * \param station
+ * \return the index for the maximum transmission rate
+ */
uint32_t GetMaxRate (RraaWifiRemoteStation *station);
+ /**
+ * Return the index for the minimum transmission rate for
+ * the given station.
+ *
+ * \param station
+ * \return the index for the minimum transmission rate
+ */
uint32_t GetMinRate (RraaWifiRemoteStation *station);
+ /**
+ * Check if the counter should be resetted.
+ *
+ * \param station
+ */
void CheckTimeout (RraaWifiRemoteStation *station);
+ /**
+ * Find an appropriate rate for the given station, using
+ * a basic algorithm.
+ *
+ * \param station
+ */
void RunBasicAlgorithm (RraaWifiRemoteStation *station);
+ /**
+ * Activate the use of RTS for the given station if the conditions are met.
+ *
+ * \param station
+ */
void ARts (RraaWifiRemoteStation *station);
+ /**
+ * Reset the counters of the given station.
+ *
+ * \param station
+ */
void ResetCountersBasic (RraaWifiRemoteStation *station);
+ /**
+ * Get a threshold for the given mode.
+ *
+ * \param mode
+ * \return threshold
+ */
struct ThresholdsItem GetThresholds (WifiMode mode) const;
+ /**
+ * Get a threshold for the given station and mode index.
+ *
+ * \param station
+ * \param rate
+ * \return threshold
+ */
struct ThresholdsItem GetThresholds (RraaWifiRemoteStation *station, uint32_t rate) const;
bool m_basic;
--- a/src/wifi/model/ssid.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/ssid.cc Tue Dec 10 10:48:51 2013 -0500
@@ -129,6 +129,13 @@
ATTRIBUTE_HELPER_CPP (Ssid);
+/**
+ * Serialize SSID to the given ostream
+ *
+ * \param os
+ * \param ssid
+ * \return std::ostream
+ */
std::ostream &
operator << (std::ostream &os, const Ssid &ssid)
{
@@ -136,6 +143,13 @@
return os;
}
+/**
+ * Serialize from the given istream to this SSID.
+ *
+ * \param is
+ * \param ssid
+ * \return std::istream
+ */
std::istream &operator >> (std::istream &is, Ssid &ssid)
{
std::string str;
--- a/src/wifi/model/ssid.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/ssid.h Tue Dec 10 10:48:51 2013 -0500
@@ -37,12 +37,41 @@
public:
// broadcast ssid
Ssid ();
+ /**
+ * Create SSID from a given string
+ *
+ * \param s SSID in string
+ */
Ssid (std::string s);
+ /**
+ * Create SSID from a given array of char and given length.
+ *
+ * \param ssid
+ * \param length
+ */
Ssid (char const ssid[32], uint8_t length);
+ /**
+ * Check if the two SSIDs are equal.
+ *
+ * \param o SSID to compare to
+ * \return true if the two SSIDs are equal,
+ * false otherwise
+ */
bool IsEqual (const Ssid& o) const;
+ /**
+ * Check if the SSID is broadcast.
+ *
+ * \return true if the SSID is broadcast,
+ * false otherwise
+ */
bool IsBroadcast (void) const;
+ /**
+ * Peek the SSID.
+ *
+ * \return a pointer to SSID string
+ */
char* PeekString (void) const;
WifiInformationElementId ElementId () const;
--- a/src/wifi/model/status-code.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/status-code.cc Tue Dec 10 10:48:51 2013 -0500
@@ -61,6 +61,13 @@
return start;
}
+/**
+ * Serialize StatusCode to the given ostream.
+ *
+ * \param os
+ * \param code
+ * \return std::ostream
+ */
std::ostream &
operator << (std::ostream &os, const StatusCode &code)
{
--- a/src/wifi/model/status-code.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/status-code.h Tue Dec 10 10:48:51 2013 -0500
@@ -26,17 +26,54 @@
namespace ns3 {
+/**
+ * Status code for association response.
+ */
class StatusCode
{
public:
StatusCode ();
+ /**
+ * Set success bit to 0 (success).
+ */
void SetSuccess (void);
+ /**
+ * Set success bit to 1 (failure.
+ */
void SetFailure (void);
+ /**
+ * Return whether the status code is success.
+ *
+ * \return true if success, false otherwise
+ */
bool IsSuccess (void) const;
+ /**
+ * \returns the expected size of the status code.
+ *
+ * This method should return the number of bytes which are needed to store
+ * the status code data by Serialize.
+ */
uint32_t GetSerializedSize (void) const;
+ /**
+ * \param start an iterator which points to where the status code should
+ * be written.
+ * \return Buffer::Iterator
+ *
+ * This method is used to store a status code into the byte buffer.
+ * The data written is expected to match bit-for-bit the representation of this
+ * header in a real network.
+ */
Buffer::Iterator Serialize (Buffer::Iterator start) const;
+ /**
+ * \param start an iterator which points to where the status code should be read.
+ * \returns the number of bytes read.
+ *
+ * This method is used to re-create a status code from the byte buffer.
+ * The data read is expected to match bit-for-bit the representation of this
+ * header in real networks.
+ */
Buffer::Iterator Deserialize (Buffer::Iterator start);
private:
uint16_t m_code;
--- a/src/wifi/model/supported-rates.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/supported-rates.cc Tue Dec 10 10:48:51 2013 -0500
@@ -217,6 +217,13 @@
return length;
}
+/**
+ * Serialize SupportedRates to the given ostream.
+ *
+ * \param os
+ * \param rates
+ * \return std::ostream
+ */
std::ostream &operator << (std::ostream &os, const SupportedRates &rates)
{
os << "[";
--- a/src/wifi/model/supported-rates.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/supported-rates.h Tue Dec 10 10:48:51 2013 -0500
@@ -53,6 +53,12 @@
{
public:
ExtendedSupportedRatesIE ();
+ /**
+ * Create an extended supported rates information element
+ * from the given rates.
+ *
+ * \param rates
+ */
ExtendedSupportedRatesIE (SupportedRates *rates);
WifiInformationElementId ElementId () const;
@@ -61,13 +67,23 @@
uint8_t DeserializeInformationField (Buffer::Iterator start,
uint8_t length);
- /*
+ /**
* This information element is a bit special in that it is only
* included if there are more than 8 rates. To support this we
* override the Serialize and GetSerializedSize methods of
* WifiInformationElement.
+ *
+ * \param start
+ * \return an iterator
*/
Buffer::Iterator Serialize (Buffer::Iterator start) const;
+ /**
+ * Return the serialized size of this supported rates
+ * information element.
+ *
+ * \return the serialized size of this supported rates
+ * information element
+ */
uint16_t GetSerializedSize () const;
private:
/**
@@ -94,13 +110,46 @@
public:
SupportedRates ();
+ /**
+ * Add the given rate to the supported rates.
+ *
+ * \param bs the rate to be added
+ */
void AddSupportedRate (uint32_t bs);
+ /**
+ * Set the given rate to basic rates.
+ *
+ * \param bs the rate to be set
+ */
void SetBasicRate (uint32_t bs);
+ /**
+ * Check if the given rate is supported.
+ *
+ * \param bs the rate to be checked
+ * \return true if the rate is supported, false otherwise
+ */
bool IsSupportedRate (uint32_t bs) const;
+ /**
+ * Check if the given rate is a basic rate.
+ *
+ * \param bs the rate to be checked
+ * \return true if the rate is a basic rate, false otherwise
+ */
bool IsBasicRate (uint32_t bs) const;
+ /**
+ * Return the number of supported rates.
+ *
+ * \return the number of supported rates
+ */
uint8_t GetNRates (void) const;
+ /**
+ * Return the rate at the given index.
+ *
+ * \param i the given index
+ * \return the rate
+ */
uint32_t GetRate (uint8_t i) const;
WifiInformationElementId ElementId () const;
--- a/src/wifi/model/wifi-information-element-vector.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-information-element-vector.h Tue Dec 10 10:48:51 2013 -0500
@@ -45,8 +45,7 @@
public:
WifiInformationElementVector ();
~WifiInformationElementVector ();
- ///\name Inherited from Header
- // \{
+
static TypeId GetTypeId ();
TypeId GetInstanceTypeId () const;
virtual uint32_t GetSerializedSize () const;
@@ -59,7 +58,7 @@
*/
virtual uint32_t Deserialize (Buffer::Iterator start);
virtual void Print (std::ostream &os) const;
- //\}
+
/**
* \brief Needed when you try to deserialize a lonely IE inside other header
* \param start is the start of the buffer
@@ -79,8 +78,18 @@
/// vector of pointers to information elements is the body of IeVector
Ptr<WifiInformationElement> FindFirst (WifiInformationElementId id) const;
+ /**
+ * Check if the given WifiInformationElementVectors are equivalent.
+ *
+ * \param a another WifiInformationElementVector
+ * \return true if the given WifiInformationElementVectors are equivalent,
+ * false otherwise
+ */
virtual bool operator== (const WifiInformationElementVector & a) const;
protected:
+ /**
+ * typedef for a vector of WifiInformationElements.
+ */
typedef std::vector<Ptr<WifiInformationElement> > IE_VECTOR;
/// Current number of bytes
uint32_t GetSize () const;
--- a/src/wifi/model/wifi-information-element.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-information-element.h Tue Dec 10 10:48:51 2013 -0500
@@ -131,48 +131,99 @@
{
public:
virtual ~WifiInformationElement ();
- /// Serialize entire IE including Element ID and length fields
+ /**
+ * Serialize entire IE including Element ID and length fields
+ *
+ * \param i an iterator which points to where the IE should
+ * be written.
+ * \return an iterator
+ */
Buffer::Iterator Serialize (Buffer::Iterator i) const;
- /// Deserialize entire IE, which must be present. The iterator
- /// passed in must be pointing at the Element ID (i.e., the very
- /// first octet) of the correct type of information element,
- /// otherwise this method will generate a fatal error.
+ /**
+ * Deserialize entire IE, which must be present. The iterator
+ * passed in must be pointing at the Element ID (i.e., the very
+ * first octet) of the correct type of information element,
+ * otherwise this method will generate a fatal error.
+ *
+ * \param i an iterator which points to where the IE should be read.
+ * \return an iterator
+ */
Buffer::Iterator Deserialize (Buffer::Iterator i);
- /// Deserialize entire IE if it is present. The iterator passed in
- /// must be pointing at the Element ID of an information element. If
- /// the Element ID is not the one that the given class is interested
- /// in then it will return the same iterator.
+ /**
+ * Deserialize entire IE if it is present. The iterator passed in
+ * must be pointing at the Element ID of an information element. If
+ * the Element ID is not the one that the given class is interested
+ * in then it will return the same iterator.
+ *
+ * \param i an iterator which points to where the IE should be read.
+ * \return an iterator
+ */
Buffer::Iterator DeserializeIfPresent (Buffer::Iterator i);
- /// Get the size of the serialized IE including Element ID and
- /// length fields.
+ /**
+ * Get the size of the serialized IE including Element ID and
+ * length fields.
+ *
+ * \return the size of the serialized IE
+ */
uint16_t GetSerializedSize () const;
///\name Each subclass must implement
//\{
/// Own unique Element ID
virtual WifiInformationElementId ElementId () const = 0;
- /// Length of serialized information (i.e., the length of the body
- /// of the IE, not including the Element ID and length octets. This
- /// is the value that will appear in the second octet of the entire
- /// IE - the length field)
+ /**
+ * Length of serialized information (i.e., the length of the body
+ * of the IE, not including the Element ID and length octets. This
+ * is the value that will appear in the second octet of the entire
+ * IE - the length field)
+ *
+ * \return the length of serialized information
+ */
virtual uint8_t GetInformationFieldSize () const = 0;
- /// Serialize information (i.e., the body of the IE, not including
- /// the Element ID and length octets)
+ /**
+ * Serialize information (i.e., the body of the IE, not including
+ * the Element ID and length octets)
+ *
+ * \param start an iterator which points to where the information should
+ * be written.
+ */
virtual void SerializeInformationField (Buffer::Iterator start) const = 0;
- /// Deserialize information (i.e., the body of the IE, not including
- /// the Element ID and length octets)
+ /**
+ * Deserialize information (i.e., the body of the IE, not including
+ * the Element ID and length octets)
+ *
+ * \param start an iterator which points to where the information should
+ * be written.
+ * \param length
+ * \return the number of bytes read
+ */
virtual uint8_t DeserializeInformationField (Buffer::Iterator start,
uint8_t length) = 0;
//\}
/// In addition, a subclass may optionally override the following...
//\{
- /// Generate human-readable form of IE
+ /**
+ * Generate human-readable form of IE
+ *
+ * \param os output stream
+ */
virtual void Print (std::ostream &os) const;
- /// Compare information elements using Element ID
+ /**
+ * Compare information elements using Element ID
+ *
+ * \param a another information element to compare with
+ * \return true if the Element ID is less than the other IE Element ID,
+ * false otherwise
+ */
virtual bool operator< (WifiInformationElement const & a) const;
- /// Compare two IEs for equality by ID & Length, and then through
- /// memcmp of serialised version
+ /**
+ * Compare two IEs for equality by ID & Length, and then through
+ * memcmp of serialised version
+ *
+ * \param a another information element to compare with
+ * \return true if the two IEs are equal, false otherwise
+ */
virtual bool operator== (WifiInformationElement const & a) const;
//\}
};
--- a/src/wifi/model/wifi-mac-header.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-mac-header.h Tue Dec 10 10:48:51 2013 -0500
@@ -29,6 +29,9 @@
namespace ns3 {
+/**
+ * Combination of valid MAC header type/subtype.
+ */
enum WifiMacType
{
WIFI_MAC_CTL_RTS = 0,
@@ -77,6 +80,9 @@
class WifiMacHeader : public Header
{
public:
+ /**
+ * ACK policy for QoS frames.
+ */
enum QosAckPolicy
{
NORMAL_ACK = 0,
@@ -85,6 +91,9 @@
BLOCK_ACK = 3,
};
+ /**
+ * Address types.
+ */
enum AddressType
{
ADDR1,
@@ -140,6 +149,9 @@
* Set Type/Subtype values for a Block Ack header.
*/
void SetBlockAck (void);
+ /**
+ * Set Type/Subtype values for a multihop action header.
+ */
void SetMultihopAction ();
/**
* Set the From DS bit in the Frame Control field.
@@ -251,8 +263,10 @@
void SetQosNoEosp ();
/**
* Set the QoS ACK policy in the QoS control field.
+ *
+ * \param policy
*/
- void SetQosAckPolicy (enum QosAckPolicy);
+ void SetQosAckPolicy (enum QosAckPolicy policy);
/**
* Set the QoS ACK policy in the QoS control field to normal ACK.
*/
@@ -265,10 +279,27 @@
* Set the QoS ACK policy in the QoS control field to no ACK.
*/
void SetQosNoAck (void);
+ /**
+ * Set that A-MSDU is present.
+ */
void SetQosAmsdu (void);
+ /**
+ * Set that A-MSDU is not present.
+ */
void SetQosNoAmsdu (void);
+ /**
+ * Set TXOP limit in the QoS control field.
+ *
+ * \param txop
+ */
void SetQosTxopLimit (uint8_t txop);
+ /**
+ * Set order bit in the frame control field.
+ */
void SetOrder (void);
+ /**
+ * Unset order bit in the frame control field.
+ */
void SetNoOrder (void);
/**
@@ -438,6 +469,12 @@
* \return true if the header is an Action header, false otherwise
*/
bool IsAction () const;
+ /**
+ * Check if the header is a Multihop action header.
+ *
+ * \return true if the header is a Multihop action header,
+ * false otherwise
+ */
bool IsMultihopAction () const;
/**
* Return the raw duration from the Duration/ID field.
@@ -505,6 +542,12 @@
* \return true if the end of service period (EOSP) is set, false otherwise
*/
bool IsQosEosp (void) const;
+ /**
+ * Check if the A-MSDU present bit is set in the QoS control field.
+ *
+ * \return true if the A-MSDU present bit is set,
+ * false otherwise
+ */
bool IsQosAmsdu (void) const;
/**
* Return the Traffic ID of a QoS header.
@@ -518,8 +561,19 @@
* \return the QoS ACK Policy of a QoS header
*/
enum QosAckPolicy GetQosAckPolicy (void) const;
+ /**
+ * Return the TXOP limit.
+ *
+ * \return the TXOP limit
+ */
uint8_t GetQosTxopLimit (void) const;
+ /**
+ * Return the size of the WifiMacHeader in octets.
+ * GetSerializedSize calls this function.
+ *
+ * \return the size of the WifiMacHeader in octets
+ */
uint32_t GetSize (void) const;
/**
* Return a string corresponds to the header type.
--- a/src/wifi/model/wifi-mac-queue.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-mac-queue.h Tue Dec 10 10:48:51 2013 -0500
@@ -54,14 +54,58 @@
WifiMacQueue ();
~WifiMacQueue ();
+ /**
+ * Set the maximum queue size.
+ *
+ * \param maxSize the maximum queue size
+ */
void SetMaxSize (uint32_t maxSize);
+ /**
+ * Set the maximum delay before the packet is discarded.
+ *
+ * \param delay the maximum delay
+ */
void SetMaxDelay (Time delay);
+ /**
+ * Return the maximum queue size.
+ *
+ * \return the maximum queue size
+ */
uint32_t GetMaxSize (void) const;
+ /**
+ * Return the maximum delay before the packet is discarded.
+ *
+ * \return the maximum delay
+ */
Time GetMaxDelay (void) const;
+ /**
+ * Enqueue the given packet and its corresponding WifiMacHeader at the <i>end</i> of the queue.
+ *
+ * \param packet the packet to be euqueued at the end
+ * \param hdr the header of the given packet
+ */
void Enqueue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
+ /**
+ * Enqueue the given packet and its corresponding WifiMacHeader at the <i>front</i> of the queue.
+ *
+ * \param packet the packet to be euqueued at the end
+ * \param hdr the header of the given packet
+ */
void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
+ /**
+ * Dequeue the packet in the front of the queue.
+ *
+ * \param hdr the WifiMacHeader of the packet
+ * \return the packet
+ */
Ptr<const Packet> Dequeue (WifiMacHeader *hdr);
+ /**
+ * Peek the packet in the front of the queue. The packet is not removed.
+ *
+ * \param hdr the WifiMacHeader of the packet
+ * \return the packet
+ */
Ptr<const Packet> Peek (WifiMacHeader *hdr);
/**
* Searchs and returns, if is present in this queue, first packet having
@@ -69,6 +113,12 @@
* equals to <i>tid</i>. This method removes the packet from this queue.
* Is typically used by ns3::EdcaTxopN in order to perform correct MSDU
* aggregation (A-MSDU).
+ *
+ * \param hdr the header of the dequeued packet
+ * \param tid the given TID
+ * \param type the given address type
+ * \param addr the given destination
+ * \return packet
*/
Ptr<const Packet> DequeueByTidAndAddress (WifiMacHeader *hdr,
uint8_t tid,
@@ -80,6 +130,12 @@
* equals to <i>tid</i>. This method doesn't remove the packet from this queue.
* Is typically used by ns3::EdcaTxopN in order to perform correct MSDU
* aggregation (A-MSDU).
+ *
+ * \param hdr the header of the dequeued packet
+ * \param tid the given TID
+ * \param type the given address type
+ * \param addr the given destination
+ * \return packet
*/
Ptr<const Packet> PeekByTidAndAddress (WifiMacHeader *hdr,
uint8_t tid,
@@ -89,11 +145,19 @@
* If exists, removes <i>packet</i> from queue and returns true. Otherwise it
* takes no effects and return false. Deletion of the packet is
* performed in linear time (O(n)).
+ *
+ * \param packet the packet to be removed
+ * \return true if the packet was removed, false otherwise
*/
bool Remove (Ptr<const Packet> packet);
/**
* Returns number of QoS packets having tid equals to <i>tid</i> and address
* specified by <i>type</i> equals to <i>addr</i>.
+ *
+ * \param tid the given TID
+ * \param type the given address type
+ * \param addr the given destination
+ * \return the number of QoS packets
*/
uint32_t GetNPacketsByTidAndAddress (uint8_t tid,
WifiMacHeader::AddressType type,
@@ -104,45 +168,97 @@
* respectively that index a pending agreement in the BlockAckManager object.
* So that packet must not be transmitted until reception of an ADDBA response frame from station
* addressed by <i>addr</i>. This method removes the packet from queue.
+ *
+ * \param hdr the header of the dequeued packet
+ * \param tStamp
+ * \param blockedPackets
+ * \return packet
*/
Ptr<const Packet> DequeueFirstAvailable (WifiMacHeader *hdr,
Time &tStamp,
const QosBlockedDestinations *blockedPackets);
/**
- * Returns first available packet for transmission. The packet isn't removed from queue.
+ * Returns first available packet for transmission. The packet isn't removed from queue.
+ *
+ * \param hdr the header of the dequeued packet
+ * \param tStamp
+ * \param blockedPackets
+ * \return packet
*/
Ptr<const Packet> PeekFirstAvailable (WifiMacHeader *hdr,
Time &tStamp,
const QosBlockedDestinations *blockedPackets);
+ /**
+ * Flush the queue.
+ */
void Flush (void);
+ /**
+ * Return if the queue is empty.
+ *
+ * \return true if the queue is empty, false otherwise
+ */
bool IsEmpty (void);
+ /**
+ * Return the current queue size.
+ *
+ * \return the current queue size
+ */
uint32_t GetSize (void);
protected:
+ /**
+ * Clean up the queue by removing packets that exceeded the maximum delay.
+ */
virtual void Cleanup (void);
struct Item;
+ /**
+ * typedef for packet (struct Item) queue.
+ */
typedef std::list<struct Item> PacketQueue;
+ /**
+ * typedef for packet (struct Item) queue reverse iterator.
+ */
typedef std::list<struct Item>::reverse_iterator PacketQueueRI;
+ /**
+ * typedef for packet (struct Item) queue iterator.
+ */
typedef std::list<struct Item>::iterator PacketQueueI;
+ /**
+ * Return the appropriate address for the given packet (given by PacketQueue iterator).
+ *
+ * \param type
+ * \param it
+ * \return the address
+ */
+ Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI it);
- Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI);
-
+ /**
+ * A struct that holds information about a packet for putting
+ * in a packet queue.
+ */
struct Item
{
+ /**
+ * Create a struct with the given parameters.
+ *
+ * \param packet
+ * \param hdr
+ * \param tstamp
+ */
Item (Ptr<const Packet> packet,
const WifiMacHeader &hdr,
Time tstamp);
- Ptr<const Packet> packet;
- WifiMacHeader hdr;
- Time tstamp;
+ Ptr<const Packet> packet; //!< Actual packet
+ WifiMacHeader hdr; //!< Wifi MAC header associated with the packet
+ Time tstamp; //!< timestamp when the packet arrived at the queue
};
- PacketQueue m_queue;
- uint32_t m_size;
- uint32_t m_maxSize;
- Time m_maxDelay;
+ PacketQueue m_queue; //!< Packet (struct Item) queue
+ uint32_t m_size; //! Current queue size
+ uint32_t m_maxSize; //!< Queue capacity
+ Time m_maxDelay; //! Time to live for packets in the queue
};
} // namespace ns3
--- a/src/wifi/model/wifi-mac.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-mac.h Tue Dec 10 10:48:51 2013 -0500
@@ -334,13 +334,29 @@
* Trsp timer setting at page 346)
*/
static Time GetDefaultCtsAckTimeout (void);
+ /**
+ * Return the default basic block ACK delay.
+ * Currently it returns 250 microseconds.
+ *
+ * \return the default basic block ACK delay
+ */
static Time GetDefaultBasicBlockAckDelay (void);
/**
+ * Return the default basic block ACK timeout.
+ *
* \return the default basic block ACK timeout
*/
static Time GetDefaultBasicBlockAckTimeout (void);
+ /**
+ * Return the default compressed block ACK delay.
+ * Currently it returns 76 microseconds.
+ *
+ * \return the default compressed block ACK delay
+ */
static Time GetDefaultCompressedBlockAckDelay (void);
/**
+ * Return the default compressed block ACK timeout.
+ *
* \return the default compressed block ACK timeout
*/
static Time GetDefaultCompressedBlockAckTimeout (void);
--- a/src/wifi/model/wifi-mode.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-mode.cc Tue Dec 10 10:48:51 2013 -0500
@@ -24,15 +24,37 @@
namespace ns3 {
+/**
+ * Check if the two WifiModes are identical.
+ *
+ * \param a WifiMode
+ * \param b WifiMode
+ * \return true if the two WifiModes are identical,
+ * false otherwise
+ */
bool operator == (const WifiMode &a, const WifiMode &b)
{
return a.GetUid () == b.GetUid ();
}
+/**
+ * Serialize WifiMode to ostream (human-readable).
+ *
+ * \param os std::ostream
+ * \param mode
+ * \return std::ostream
+ */
std::ostream & operator << (std::ostream & os, const WifiMode &mode)
{
os << mode.GetUniqueName ();
return os;
}
+/**
+ * Serialize WifiMode from istream (human-readable).
+ *
+ * \param is std::istream
+ * \param mode
+ * \return std::istream
+ */
std::istream & operator >> (std::istream &is, WifiMode &mode)
{
std::string str;
--- a/src/wifi/model/wifi-mode.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-mode.h Tue Dec 10 10:48:51 2013 -0500
@@ -150,9 +150,20 @@
* its initialization.
*/
WifiMode ();
+ /**
+ * Create a WifiMode if the given string represents a valid
+ * WifiMode name.
+ *
+ * \param name std::string of a valid WifiMode name
+ */
WifiMode (std::string name);
private:
friend class WifiModeFactory;
+ /**
+ * Create a WifiMode from a given unique ID.
+ *
+ * \param uid unique ID
+ */
WifiMode (uint32_t uid);
uint32_t m_uid;
};
@@ -175,9 +186,18 @@
* WifiModeList type, and a corresponding iterator.
*/
typedef std::vector<WifiMode> WifiModeList;
+/**
+ * An iterator for WifiModeList vector.
+ */
typedef WifiModeList::const_iterator WifiModeListIterator;
+/**
+ * A list of Wi-Fi Modulation and Coding Scheme (MCS).
+ */
typedef std::vector<uint8_t> WifiMcsList;
+/**
+ * An iterator for WifiMcsList vector.
+ */
typedef WifiMcsList::const_iterator WifiMcsListIterator;
/**
@@ -198,11 +218,12 @@
* associated WifiMode is used.
* \param dataRate the rate (bits/second) at which the user data is transmitted
* \param codingRate if convolutional coding is used for this rate
- * then this parameter specifies the convolutional coding rate
- * used. If there is no explicit convolutional coding step (e.g.,
- * for DSSS rates) then the caller should set this parameter to
- * WIFI_CODE_RATE_UNCODED.
+ * then this parameter specifies the convolutional coding rate
+ * used. If there is no explicit convolutional coding step (e.g.,
+ * for DSSS rates) then the caller should set this parameter to
+ * WIFI_CODE_RATE_UNCODED.
* \param constellationSize the order of the constellation used.
+ * \return WifiMode
*
* Create a WifiMode.
*/
@@ -217,6 +238,12 @@
private:
friend class WifiMode;
friend std::istream & operator >> (std::istream &is, WifiMode &mode);
+
+ /**
+ * Return a WifiModeFactory
+ *
+ * \return a WifiModeFactory
+ */
static WifiModeFactory* GetFactory ();
WifiModeFactory ();
@@ -237,10 +264,31 @@
bool isMandatory;
};
+ /**
+ * Search and return WifiMode from a given name.
+ *
+ * \param name human-readable WifiMode
+ * \return WifiMode
+ */
WifiMode Search (std::string name);
- uint32_t AllocateUid (std::string uniqueName);
+ /**
+ * Allocate a WifiModeItem from a given uniqueUid.
+ *
+ * \param uniqueUid
+ * \return uid
+ */
+ uint32_t AllocateUid (std::string uniqueUid);
+ /**
+ * Return a WifiModeItem at the given uid index.
+ *
+ * \param uid
+ * \return WifiModeItem at the given uid
+ */
WifiModeItem* Get (uint32_t uid);
+ /**
+ * typedef for a vector of WifiModeItem.
+ */
typedef std::vector<struct WifiModeItem> WifiModeItemList;
WifiModeItemList m_itemList;
};
--- a/src/wifi/model/wifi-net-device.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-net-device.h Tue Dec 10 10:48:51 2013 -0500
@@ -112,14 +112,38 @@
protected:
virtual void DoDispose (void);
virtual void DoInitialize (void);
+ /**
+ * Receive a packet from the lower layer and pass the
+ * packet up the stack.
+ *
+ * \param packet
+ * \param from
+ * \param to
+ */
void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
private:
// This value conforms to the 802.11 specification
static const uint16_t MAX_MSDU_SIZE = 2304;
+ /**
+ * Set that the link is up. A link is always up in ad-hoc mode.
+ * For a STA, a link is up when the STA is associated with an AP.
+ */
void LinkUp (void);
+ /**
+ * Set that the link is down (i.e. STA is not associated).
+ */
void LinkDown (void);
+ /**
+ * Return the WifiChannel this device is connected to.
+ *
+ * \return WifiChannel
+ */
Ptr<WifiChannel> DoGetChannel (void) const;
+ /**
+ * Complete the configuration of this Wi-Fi device by
+ * connecting all lower components (e.g. MAC, WifiRemoteStation) together.
+ */
void CompleteConfig (void);
Ptr<Node> m_node;
--- a/src/wifi/model/wifi-phy-state-helper.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-phy-state-helper.h Tue Dec 10 10:48:51 2013 -0500
@@ -39,40 +39,179 @@
WifiPhyStateHelper ();
+ /**
+ * Set a callback for a successful reception.
+ *
+ * \param callback
+ */
void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
+ /**
+ * Set a callback for a failed reception.
+ *
+ * \param callback
+ */
void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
+ /**
+ * Register WifiPhyListener to this WifiPhyStateHelper.
+ *
+ * \param listener
+ */
void RegisterListener (WifiPhyListener *listener);
+ /**
+ * Return the current state of WifiPhy.
+ *
+ * \return the current state of WifiPhy
+ */
enum WifiPhy::State GetState (void);
+ /**
+ * Check whether the current state is CCA busy.
+ *
+ * \return true if the current state is CCA busy, false otherwise
+ */
bool IsStateCcaBusy (void);
+ /**
+ * Check whether the current state is IDLE.
+ *
+ * \return true if the current state is IDLE, false otherwise
+ */
bool IsStateIdle (void);
+ /**
+ * Check whether the current state is not IDLE.
+ *
+ * \return true if the current state is not IDLE, false otherwise
+ */
bool IsStateBusy (void);
+ /**
+ * Check whether the current state is RX.
+ *
+ * \return true if the current state is RX, false otherwise
+ */
bool IsStateRx (void);
+ /**
+ * Check whether the current state is TX.
+ *
+ * \return true if the current state is TX, false otherwise
+ */
bool IsStateTx (void);
+ /**
+ * Check whether the current state is SWITCHING.
+ *
+ * \return true if the current state is SWITCHING, false otherwise
+ */
bool IsStateSwitching (void);
+ /**
+ * Return the elapsed time of the current state.
+ *
+ * \return the elapsed time of the current state
+ */
Time GetStateDuration (void);
+ /**
+ * Return the time before the state is back to IDLE.
+ *
+ * \return the delay before the state is back to IDLE
+ */
Time GetDelayUntilIdle (void);
+ /**
+ * Return the time the last RX start.
+ *
+ * \return the time the last RX start.
+ */
Time GetLastRxStartTime (void) const;
+ /**
+ * Switch state to TX for the given duration.
+ *
+ * \param txDuration the duration of the TX
+ * \param packet the packet
+ * \param txMode the transmission mode of the packet
+ * \param preamble the preamble of the packet
+ * \param txPower the transmission power
+ */
void SwitchToTx (Time txDuration, Ptr<const Packet> packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower);
+ /**
+ * Switch state to RX for the given duration.
+ *
+ * \param rxDuration the duration of the RX
+ */
void SwitchToRx (Time rxDuration);
+ /**
+ * Switch state to channel switching for the given duration.
+ *
+ * \param switchingDuration the duration of required to switch the channel
+ */
void SwitchToChannelSwitching (Time switchingDuration);
+ /**
+ * Switch from RX after the reception was successful.
+ *
+ * \param packet the successfully received packet
+ * \param snr the SNR of the received packet
+ * \param mode the transmission mode of the packet
+ * \param preamble the preamble of the received packet
+ */
void SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
+ /**
+ * Switch from RX after the reception failed.
+ *
+ * \param packet the packet that we failed to received
+ * \param snr the SNR of the received packet
+ */
void SwitchFromRxEndError (Ptr<const Packet> packet, double snr);
+ /**
+ * Switch to CCA busy.
+ *
+ * \param duration the duration of CCA busy state
+ */
void SwitchMaybeToCcaBusy (Time duration);
TracedCallback<Time,Time,enum WifiPhy::State> m_stateLogger;
private:
+ /**
+ * typedef for a list of WifiPhyListeners
+ */
typedef std::vector<WifiPhyListener *> Listeners;
+ /**
+ * Log the ideal and CCA states.
+ */
void LogPreviousIdleAndCcaBusyStates (void);
+ /**
+ * Notify all WifiPhyListener that the transmission has started for the given duration.
+ *
+ * \param duration the duration of the transmission
+ */
void NotifyTxStart (Time duration);
- void NotifyWakeup (void);
+ //void NotifyWakeup (void);
+ /**
+ * Notify all WifiPhyListener that the reception has started for the given duration.
+ *
+ * \param duration the duration of the reception
+ */
void NotifyRxStart (Time duration);
+ /**
+ * Notify all WifiPhyListener that the reception was successful.
+ */
void NotifyRxEndOk (void);
+ /**
+ * Notify all WifiPhyListener that the reception was not successful.
+ */
void NotifyRxEndError (void);
+ /**
+ * Notify all WifiPhyListener that the CCA has started for the given duration.
+ *
+ * \param duration the duration of the CCA state
+ */
void NotifyMaybeCcaBusyStart (Time duration);
+ /**
+ * Notify all WifiPhyListener that we are switching channel with the given channel
+ * switching delay.
+ *
+ * \param duration the delay to switch the channel
+ */
void NotifySwitchingStart (Time duration);
+ /**
+ * Switch the state from RX.
+ */
void DoSwitchFromRx (void);
bool m_rxing;
--- a/src/wifi/model/wifi-phy.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-phy.h Tue Dec 10 10:48:51 2013 -0500
@@ -360,7 +360,20 @@
*/
virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
/**
- * The WifiPhy::NBssMembershipSelectors() and WifiPhy::BssMembershipSelector() methods are used
+ * The WifiPhy::NBssMembershipSelectors() method is used
+ * (e.g., by a WifiRemoteStationManager) to determine the set of
+ * transmission/reception modes that this WifiPhy(-derived class)
+ * can support - a set of WifiMode objects which we call the
+ * BssMemebershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSelectorSet.
+ *
+ * This was introduced with 11n
+ *
+ * \return the memebership selector whose index is specified.
+ */
+ virtual uint32_t GetNBssMembershipSelectors (void) const=0;
+
+ /**
+ * The WifiPhy::BssMembershipSelector() method is used
* (e.g., by a WifiRemoteStationManager) to determine the set of
* transmission/reception modes that this WifiPhy(-derived class)
* can support - a set of WifiMode objects which we call the
@@ -370,11 +383,7 @@
*
* \param selector index in array of supported memeberships
* \return the memebership selector whose index is specified.
- *
- * \sa WifiPhy::NBssMembershipSelectors()
*/
- virtual uint32_t GetNBssMembershipSelectors (void) const=0;
-
virtual uint32_t GetBssMembershipSelector (uint32_t selector) const=0;
/**
* The WifiPhy::GetMembershipSelectorModes() method is used
@@ -392,7 +401,19 @@
*/
virtual WifiModeList GetMembershipSelectorModes(uint32_t selector)=0;
/**
- * The WifiPhy::GetNMcs() and WifiPhy::GetMcs() methods are used
+ * The WifiPhy::GetNMcs() method is used
+ * (e.g., by a WifiRemoteStationManager) to determine the set of
+ * transmission/reception MCS indexes that this WifiPhy(-derived class)
+ * can support - a set of Mcs indexes which we call the
+ * DeviceMcsSet, and which is stored as WifiPhy::m_deviceMcsSet.
+ *
+ * This was introduced with 11n
+ *
+ * \return the Mcs index whose index is specified.
+ */
+ virtual uint8_t GetNMcs (void) const=0;
+ /**
+ * The WifiPhy::GetMcs() method is used
* (e.g., by a WifiRemoteStationManager) to determine the set of
* transmission/reception MCS indexes that this WifiPhy(-derived class)
* can support - a set of Mcs indexes which we call the
@@ -400,16 +421,26 @@
*
* This was introduced with 11n
*
- * \param Mcs index in array of supported Mcs
+ * \param mcs index in array of supported Mcs
* \return the Mcs index whose index is specified.
- *
- * \sa WifiPhy::GetNMcs()
*/
- virtual uint8_t GetNMcs (void) const=0;
virtual uint8_t GetMcs (uint8_t mcs) const=0;
- /* Converts from DataRate to MCS index and vice versa */
+ /**
+ * For a given WifiMode finds the corresponding MCS value and returns it
+ * as defined in the IEEE 802.11n standard
+ *
+ * \param mode the WifiMode
+ * \return the MCS number that corresponds to the given WifiMode
+ */
virtual uint32_t WifiModeToMcs (WifiMode mode)=0;
+ /**
+ * For a given MCS finds the corresponding WifiMode and returns it
+ * as defined in the IEEE 802.11n standard.
+ *
+ * \param mcs the MCS number
+ * \return the WifiMode that corresponds to the given mcs number
+ */
virtual WifiMode McsToWifiMode (uint8_t mcs)=0;
@@ -445,74 +476,416 @@
*/
virtual Ptr<WifiChannel> GetChannel (void) const = 0;
+ /**
+ * Return a WifiMode for DSSS at 1Mbps.
+ *
+ * \return a WifiMode for DSSS at 1Mbps
+ */
static WifiMode GetDsssRate1Mbps ();
+ /**
+ * Return a WifiMode for DSSS at 2Mbps.
+ *
+ * \return a WifiMode for DSSS at 2Mbps
+ */
static WifiMode GetDsssRate2Mbps ();
+ /**
+ * Return a WifiMode for DSSS at 5.5Mbps.
+ *
+ * \return a WifiMode for DSSS at 5.5Mbps
+ */
static WifiMode GetDsssRate5_5Mbps ();
+ /**
+ * Return a WifiMode for DSSS at 11Mbps.
+ *
+ * \return a WifiMode for DSSS at 11Mbps
+ */
static WifiMode GetDsssRate11Mbps ();
+ /**
+ * Return a WifiMode for ERP-ODFM at 6Mbps.
+ *
+ * \return a WifiMode for ERP-OFDM at 6Mbps
+ */
static WifiMode GetErpOfdmRate6Mbps ();
+ /**
+ * Return a WifiMode for ERP-ODFM at 9Mbps.
+ *
+ * \return a WifiMode for ERP-OFDM at 9Mbps
+ */
static WifiMode GetErpOfdmRate9Mbps ();
+ /**
+ * Return a WifiMode for ERP-ODFM at 12Mbps.
+ *
+ * \return a WifiMode for ERP-OFDM at 12Mbps
+ */
static WifiMode GetErpOfdmRate12Mbps ();
+ /**
+ * Return a WifiMode for ERP-ODFM at 18Mbps.
+ *
+ * \return a WifiMode for ERP-OFDM at 18Mbps
+ */
static WifiMode GetErpOfdmRate18Mbps ();
+ /**
+ * Return a WifiMode for ERP-ODFM at 24Mbps.
+ *
+ * \return a WifiMode for ERP-OFDM at 24Mbps
+ */
static WifiMode GetErpOfdmRate24Mbps ();
+ /**
+ * Return a WifiMode for ERP-ODFM at 36Mbps.
+ *
+ * \return a WifiMode for ERP-OFDM at 36Mbps
+ */
static WifiMode GetErpOfdmRate36Mbps ();
+ /**
+ * Return a WifiMode for ERP-ODFM at 48Mbps.
+ *
+ * \return a WifiMode for ERP-OFDM at 48Mbps
+ */
static WifiMode GetErpOfdmRate48Mbps ();
+ /**
+ * Return a WifiMode for ERP-ODFM at 54Mbps.
+ *
+ * \return a WifiMode for ERP-OFDM at 54Mbps
+ */
static WifiMode GetErpOfdmRate54Mbps ();
+ /**
+ * Return a WifiMode for ODFM at 6Mbps.
+ *
+ * \return a WifiMode for OFDM at 6Mbps
+ */
static WifiMode GetOfdmRate6Mbps ();
+ /**
+ * Return a WifiMode for ODFM at 9Mbps.
+ *
+ * \return a WifiMode for OFDM at 9Mbps
+ */
static WifiMode GetOfdmRate9Mbps ();
+ /**
+ * Return a WifiMode for ODFM at 12Mbps.
+ *
+ * \return a WifiMode for OFDM at 12Mbps
+ */
static WifiMode GetOfdmRate12Mbps ();
+ /**
+ * Return a WifiMode for ODFM at 18Mbps.
+ *
+ * \return a WifiMode for OFDM at 18Mbps
+ */
static WifiMode GetOfdmRate18Mbps ();
+ /**
+ * Return a WifiMode for ODFM at 24Mbps.
+ *
+ * \return a WifiMode for OFDM at 24Mbps
+ */
static WifiMode GetOfdmRate24Mbps ();
+ /**
+ * Return a WifiMode for ODFM at 36Mbps.
+ *
+ * \return a WifiMode for OFDM at 36Mbps
+ */
static WifiMode GetOfdmRate36Mbps ();
+ /**
+ * Return a WifiMode for ODFM at 48Mbps.
+ *
+ * \return a WifiMode for OFDM at 48Mbps
+ */
static WifiMode GetOfdmRate48Mbps ();
+ /**
+ * Return a WifiMode for ODFM at 54Mbps.
+ *
+ * \return a WifiMode for OFDM at 54Mbps
+ */
static WifiMode GetOfdmRate54Mbps ();
+ /**
+ * Return a WifiMode for ODFM at 3Mbps with 10MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 3Mbps with 10MHz channel spacing
+ */
static WifiMode GetOfdmRate3MbpsBW10MHz ();
+ /**
+ * Return a WifiMode for ODFM at 4.5Mbps with 10MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 4.5Mbps with 10MHz channel spacing
+ */
static WifiMode GetOfdmRate4_5MbpsBW10MHz ();
+ /**
+ * Return a WifiMode for ODFM at 6Mbps with 10MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 6Mbps with 10MHz channel spacing
+ */
static WifiMode GetOfdmRate6MbpsBW10MHz ();
+ /**
+ * Return a WifiMode for ODFM at 9Mbps with 10MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 9Mbps with 10MHz channel spacing
+ */
static WifiMode GetOfdmRate9MbpsBW10MHz ();
+ /**
+ * Return a WifiMode for ODFM at 12Mbps with 10MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 12Mbps with 10MHz channel spacing
+ */
static WifiMode GetOfdmRate12MbpsBW10MHz ();
+ /**
+ * Return a WifiMode for ODFM at 18Mbps with 10MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 18Mbps with 10MHz channel spacing
+ */
static WifiMode GetOfdmRate18MbpsBW10MHz ();
+ /**
+ * Return a WifiMode for ODFM at 24Mbps with 10MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 24Mbps with 10MHz channel spacing
+ */
static WifiMode GetOfdmRate24MbpsBW10MHz ();
+ /**
+ * Return a WifiMode for ODFM at 27Mbps with 10MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 27Mbps with 10MHz channel spacing
+ */
static WifiMode GetOfdmRate27MbpsBW10MHz ();
+ /**
+ * Return a WifiMode for ODFM at 1.5Mbps with 5MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 1.5Mbps with 5MHz channel spacing
+ */
static WifiMode GetOfdmRate1_5MbpsBW5MHz ();
+ /**
+ * Return a WifiMode for ODFM at 2.25Mbps with 5MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 2.25Mbps with 5MHz channel spacing
+ */
static WifiMode GetOfdmRate2_25MbpsBW5MHz ();
+ /**
+ * Return a WifiMode for ODFM at 3Mbps with 5MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 3Mbps with 5MHz channel spacing
+ */
static WifiMode GetOfdmRate3MbpsBW5MHz ();
+ /**
+ * Return a WifiMode for ODFM at 4.5Mbps with 5MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 4.5Mbps with 5MHz channel spacing
+ */
static WifiMode GetOfdmRate4_5MbpsBW5MHz ();
+ /**
+ * Return a WifiMode for ODFM at 6Mbps with 5MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 6Mbps with 5MHz channel spacing
+ */
static WifiMode GetOfdmRate6MbpsBW5MHz ();
+ /**
+ * Return a WifiMode for ODFM at 9Mbps with 5MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 9Mbps with 5MHz channel spacing
+ */
static WifiMode GetOfdmRate9MbpsBW5MHz ();
+ /**
+ * Return a WifiMode for ODFM at 12Mbps with 5MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 12Mbps with 5MHz channel spacing
+ */
static WifiMode GetOfdmRate12MbpsBW5MHz ();
+ /**
+ * Return a WifiMode for ODFM at 13.5Mbps with 5MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 13.5Mbps with 5MHz channel spacing
+ */
static WifiMode GetOfdmRate13_5MbpsBW5MHz ();
+ /**
+ * Return a WifiMode for ODFM at 6.5Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 6.5Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate6_5MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 13Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 13Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate13MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 19.5Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 19.5Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate19_5MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 26Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 26Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate26MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 39Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 39Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate39MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 52Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 52Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate52MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 58.5Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 58.5Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate58_5MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 65Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 65Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate65MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 13.5Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 13.5Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate13_5MbpsBW40MHz ();
- static WifiMode GetOfdmRate27MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 27Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 27Mbps with 40MHz channel spacing
+ */
+ static WifiMode GetOfdmRate27MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 40.5Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 40.5Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate40_5MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 54Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 54Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate54MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 81Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 81Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate81MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 108Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 108Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate108MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 121.5Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 121.5Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate121_5MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 135Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 135Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate135MbpsBW40MHz ();
//Rates for clause 20 with short guard interval
+ /**
+ * Return a WifiMode for ODFM at 7.2Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 7.2Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate7_2MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 14.4Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 14.4Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate14_4MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 21.7Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 21.7Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate21_7MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 28.9Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 28.9Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate28_9MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 43.3Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 43.3Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate43_3MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 57.8Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 57.8Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate57_8MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 65Mbps with 20MHz channel spacing.
+ * The rate supports short guard interval.
+ *
+ * \return a WifiMode for OFDM at 65Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate65MbpsBW20MHzShGi ();
+ /**
+ * Return a WifiMode for ODFM at 72.2Mbps with 20MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 72.2Mbps with 20MHz channel spacing
+ */
static WifiMode GetOfdmRate72_2MbpsBW20MHz ();
+ /**
+ * Return a WifiMode for ODFM at 15Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 15Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate15MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 30Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 30Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate30MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 45Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 45Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate45MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 60Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 60Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate60MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 90Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 90Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate90MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 120Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 120Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate120MbpsBW40MHz ();
+ /**
+ * Return a WifiMode for ODFM at 135Mbps with 40MHz channel spacing.
+ * The rate supports short guard interval.
+ *
+ * \return a WifiMode for OFDM at 135Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate135MbpsBW40MHzShGi ();
+ /**
+ * Return a WifiMode for ODFM at 150Mbps with 40MHz channel spacing.
+ *
+ * \return a WifiMode for OFDM at 150Mbps with 40MHz channel spacing
+ */
static WifiMode GetOfdmRate150MbpsBW40MHz ();
@@ -757,6 +1130,7 @@
/**
* \param os output stream
* \param state wifi state to stringify
+ * \return output stream
*/
std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state);
--- a/src/wifi/model/wifi-remote-station-manager.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-remote-station-manager.h Tue Dec 10 10:48:51 2013 -0500
@@ -125,19 +125,19 @@
/**
* Sets the maximum STA short retry count (SSRC).
*
- * \param the maximum SSRC
+ * \param maxSsrc the maximum SSRC
*/
void SetMaxSsrc (uint32_t maxSsrc);
/**
* Sets the maximum STA long retry count (SLRC).
*
- * \param the maximum SLRC
+ * \param maxSlrc the maximum SLRC
*/
void SetMaxSlrc (uint32_t maxSlrc);
/**
* Sets the RTS threshold.
*
- * \param the RTS threshold
+ * \param threshold the RTS threshold
*/
void SetRtsCtsThreshold (uint32_t threshold);
/**
@@ -148,7 +148,7 @@
*/
void SetFragmentationThreshold (uint32_t threshold);
/**
- * Records HT capabilities of remote station.
+ * Records HT capabilities of the remote station.
*
* \param from the address of the station being recorded
* \param htcapabilities the HT capabilities of the station
@@ -207,11 +207,39 @@
* false otherwise
*/
bool GetGreenfieldSupported (Mac48Address address) const;
+ /**
+ * Add a given Modulation and Coding Scheme (MCS) index to
+ * the set of basic MCS.
+ *
+ * \param mcs the MCS index
+ */
void AddBasicMcs (uint8_t mcs);
+ /**
+ * Return the default Modulation and Coding Scheme (MCS) index.
+ *
+ * \return the default MCS index
+ */
uint8_t GetDefaultMcs (void) const;
+ /**
+ * Return the number of basic MCS index.
+ *
+ * \return the number of basic MCS index
+ */
uint32_t GetNBasicMcs (void) const;
+ /**
+ * Return the MCS at the given <i>list</i> index.
+ *
+ * \param i the position in the list
+ * \return the MCS at the given list index
+ */
uint8_t GetBasicMcs (uint32_t i) const;
+ /**
+ * Record the MCS index supported by the station.
+ *
+ * \param address the address of the station
+ * \param mcs the MCS index
+ */
void AddSupportedMcs (Mac48Address address, uint8_t mcs);
/**
@@ -342,6 +370,9 @@
/**
* Since CTS-to-self parameters are not dependent on the station,
* it is implemented in wifiremote station manager
+ *
+ * \return the transmission mode to use to send the CTS-to-self prior to the
+ * transmission of the data packet itself.
*/
WifiTxVector DoGetCtsToSelfTxVector (void);
@@ -427,6 +458,7 @@
/**
* Return if we need to do Cts-to-self before sending a DATA.
*
+ * \param txVector the TXVECTOR of the packet to be sent
* \return true if Cts-to-self is needed, false otherwise
*/
bool NeedCtsToSelf (WifiTxVector txVector);
@@ -519,7 +551,7 @@
/**
* Set the default transmission power level
*
- * \param the default transmission power level
+ * \param txPower the default transmission power level
*/
void SetDefaultTxPowerLevel (uint8_t txPower);
/**
@@ -544,7 +576,20 @@
* \return the number of modes supported by the given station
*/
uint32_t GetNSupported (const WifiRemoteStation *station) const;
+ /**
+ * Return the MCS index supported by the specified station at the specified index.
+ *
+ * \param station the station being queried
+ * \param i the index
+ * \return the MCS index at the given index of the specified station
+ */
uint8_t GetMcsSupported (const WifiRemoteStation *station, uint32_t i) const;
+ /**
+ * Return the number of MCS supported by the given station.
+ *
+ * \param station the station being queried
+ * \return the number of MCS supported by the given station
+ */
uint32_t GetNMcsSupported (const WifiRemoteStation *station) const;
/**
@@ -555,6 +600,12 @@
* false otherwise
*/
bool GetShortGuardInterval (const WifiRemoteStation *station) const;
+ /**
+ * Return whether the given station supports space-time block coding (STBC).
+ *
+ * \param station the station being queried
+ * \return true if the station supports STBC, false otherwise
+ */
bool GetStbc (const WifiRemoteStation *station) const;
/**
* Return whether the station supports Greenfield or not.
@@ -594,7 +645,7 @@
uint32_t GetShortRetryCount (const WifiRemoteStation *station) const;
private:
/**
- * \param station the station with which we need to communicate
+ * \param station the station that we need to communicate
* \param packet the packet to send
* \param normally indicates whether the normal 802.11 rts enable mechanism would
* request that the rts is sent or not.
@@ -606,7 +657,7 @@
virtual bool DoNeedRts (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally);
/**
- * \param station the station with which we need to communicate
+ * \param station the station that we need to communicate
* \param packet the packet to send
* \param normally indicates whether the normal 802.11 rts enable mechanism would
* request that the rts is retransmitted or not.
@@ -619,7 +670,7 @@
virtual bool DoNeedRtsRetransmission (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally);
/**
- * \param station the station with which we need to communicate
+ * \param station the station that we need to communicate
* \param packet the packet to send
* \param normally indicates whether the normal 802.11 data retransmission mechanism
* would request that the data is retransmitted or not.
@@ -633,7 +684,7 @@
Ptr<const Packet> packet, bool normally);
/**
- * \param station the station with which we need to communicate
+ * \param station the station that we need to communicate
* \param packet the packet to send
* \param normally indicates whether the normal 802.11 data fragmentation mechanism
* would request that the data packet is fragmented or not.
@@ -656,7 +707,7 @@
*/
virtual WifiRemoteStation* DoCreateStation (void) const = 0;
/**
- * \param station the station with which we need to communicate
+ * \param station the station that we need to communicate
* \param size size of the packet or fragment we want to send
* \return the transmission mode to use to send a packet to the station
*
@@ -666,7 +717,7 @@
virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station,
uint32_t size) = 0;
/**
- * \param station the station with which we need to communicate
+ * \param station the station that we need to communicate
* \return the transmission mode to use to send an rts to the station
*
* Note: This method is called before sending an rts to a station
@@ -717,21 +768,21 @@
* This method is a pure virtual method that must be implemented by the sub-class.
* This allows different types of WifiRemoteStationManager to respond differently,
*
- * \param station the station with which we failed to send RTS
+ * \param station the station that we failed to send RTS
*/
virtual void DoReportRtsFailed (WifiRemoteStation *station) = 0;
/**
* This method is a pure virtual method that must be implemented by the sub-class.
* This allows different types of WifiRemoteStationManager to respond differently,
*
- * \param station the station with which we failed to send DATA
+ * \param station the station that we failed to send DATA
*/
virtual void DoReportDataFailed (WifiRemoteStation *station) = 0;
/**
* This method is a pure virtual method that must be implemented by the sub-class.
* This allows different types of WifiRemoteStationManager to respond differently,
*
- * \param station the station with which we successfully sent RTS
+ * \param station the station that we successfully sent RTS
* \param ctsSnr the SNR of the CTS we received
* \param ctsMode the WifiMode the receiver used to send the CTS
* \param rtsSnr the SNR of the RTS we sent
@@ -742,7 +793,7 @@
* This method is a pure virtual method that must be implemented by the sub-class.
* This allows different types of WifiRemoteStationManager to respond differently,
*
- * \param station the station with which we successfully sent RTS
+ * \param station the station that we successfully sent RTS
* \param ackSnr the SNR of the ACK we received
* \param ackMode the WifiMode the receiver used to send the ACK
* \param dataSnr the SNR of the DATA we sent
@@ -753,14 +804,14 @@
* This method is a pure virtual method that must be implemented by the sub-class.
* This allows different types of WifiRemoteStationManager to respond differently,
*
- * \param station the station with which we failed to send RTS
+ * \param station the station that we failed to send RTS
*/
virtual void DoReportFinalRtsFailed (WifiRemoteStation *station) = 0;
/**
* This method is a pure virtual method that must be implemented by the sub-class.
* This allows different types of WifiRemoteStationManager to respond differently,
*
- * \param station the station with which we failed to send DATA
+ * \param station the station that we failed to send DATA
*/
virtual void DoReportFinalDataFailed (WifiRemoteStation *station) = 0;
/**
@@ -910,7 +961,7 @@
*/
WifiModeList m_operationalRateSet;
WifiMcsList m_operationalMcsSet;
- Mac48Address m_address;
+ Mac48Address m_address;
WifiRemoteStationInfo m_info;
bool m_shortGuardInterval;
uint32_t m_rx;
@@ -930,10 +981,10 @@
*/
struct WifiRemoteStation
{
- WifiRemoteStationState *m_state;
- uint32_t m_ssrc;
- uint32_t m_slrc;
- uint8_t m_tid;
+ WifiRemoteStationState *m_state; //!< Remote station state
+ uint32_t m_ssrc; //!< STA short retry count
+ uint32_t m_slrc; //!< STA long retry count
+ uint8_t m_tid; //!< traffic ID
};
--- a/src/wifi/model/wifi-tx-vector.cc Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-tx-vector.cc Tue Dec 10 10:48:51 2013 -0500
@@ -27,14 +27,14 @@
{
}
-WifiTxVector::WifiTxVector (WifiMode m, uint8_t l, uint8_t r, bool sg, uint8_t ns, uint8_t ne, bool Stbc)
- : m_mode (m),
- m_txPowerLevel (l),
- m_retries (r),
- m_shortGuardInterval(sg),
- m_nss(ns),
- m_ness(ne),
- m_stbc(Stbc)
+WifiTxVector::WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries, bool shortGuardInterval, uint8_t nss, uint8_t ness, bool stbc)
+ : m_mode (mode),
+ m_txPowerLevel (powerLevel),
+ m_retries (retries),
+ m_shortGuardInterval(shortGuardInterval),
+ m_nss(nss),
+ m_ness(ness),
+ m_stbc(stbc)
{
}
--- a/src/wifi/model/wifi-tx-vector.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/wifi-tx-vector.h Tue Dec 10 10:48:51 2013 -0500
@@ -48,13 +48,26 @@
{
public:
WifiTxVector ();
- WifiTxVector (WifiMode m, uint8_t l, uint8_t r, bool sg, uint8_t ns, uint8_t ne, bool Stbc);
+ /**
+ * Create a TXVECTOR with the given parameters.
+ *
+ * \param mode WifiMode
+ * \param powerLevel transmission power level
+ * \param retries retries
+ * \param shortGuardInterval enable or disable short guard interval
+ * \param nss the number of spatial STBC streams (NSS)
+ * \param ness the number of extension spatial streams (NESS)
+ * \param stbc enable or disable STBC
+ */
+ WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries, bool shortGuardInterval, uint8_t nss, uint8_t ness, bool stbc);
/**
* \returns the txvector payload mode
*/
WifiMode GetMode (void) const;
- /**
+ /**
* Sets the selected payload transmission mode
+ *
+ * \param mode
*/
void SetMode (WifiMode mode);
/**
@@ -63,14 +76,18 @@
uint8_t GetTxPowerLevel (void) const;
/**
* Sets the selected transmission power level
+ *
+ * \param powerlevel
*/
void SetTxPowerLevel (uint8_t powerlevel);
/**
* \returns the number of retries
*/
uint8_t GetRetries (void) const;
- /**
+ /**
* Sets the number of retries
+ *
+ * \param retries
*/
void SetRetries (uint8_t retries);
/**
@@ -79,32 +96,42 @@
bool IsShortGuardInterval (void) const;
/**
* Sets if short gurad interval is being used
+ *
+ * \param guardinterval enable or disable short guard interval
*/
void SetShortGuardInterval (bool guardinterval);
- /**
+ /**
* \returns the number of Nss
*/
uint8_t GetNss (void) const;
- /**
+ /**
* Sets the number of Nss refer to IEEE802.11n Table 20-28 for explanation and range
+ *
+ * \param nss
*/
void SetNss (uint8_t nss);
/**
* \returns the number of Ness
*/
uint8_t GetNess (void) const;
- /**
+ /**
* Sets the Ness number refer to IEEE802.11n Table 20-6 for explanation
+ *
+ * \param ness
*/
void SetNess (uint8_t ness);
/**
- * \returns if STBC is used or not
+ * Check if STBC is used or not
+ * \returns true if STBC is used,
+ * false otherwise
*/
bool IsStbc (void) const;
/**
* Sets if STBC is being used
+ *
+ * \param stbc enable or disable STBC
*/
- void SetStbc (bool stbcsatuts);
+ void SetStbc (bool stbc);
private:
@@ -124,6 +151,13 @@
};
+/**
+ * Serialize WifiTxVector to the given ostream.
+ *
+ * \param os
+ * \param v
+ * \return ostream
+ */
std::ostream & operator << (std::ostream & os,const WifiTxVector &v);
} // namespace ns3
--- a/src/wifi/model/yans-error-rate-model.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/yans-error-rate-model.h Tue Dec 10 10:48:51 2013 -0500
@@ -91,6 +91,7 @@
/**
* Return k!
*
+ * \param k
* \return k!
*/
uint32_t Factorial (uint32_t k) const;
@@ -103,12 +104,47 @@
* \return a Binomial distribution
*/
double Binomial (uint32_t k, double p, uint32_t n) const;
+ /**
+ * \param ber
+ * \param d
+ * \return double
+ */
double CalculatePdOdd (double ber, unsigned int d) const;
+ /**
+ * \param ber
+ * \param d
+ * \return double
+ */
double CalculatePdEven (double ber, unsigned int d) const;
+ /**
+ * \param ber
+ * \param d
+ * \return double
+ */
double CalculatePd (double ber, unsigned int d) const;
+ /**
+ * \param snr
+ * \param nbits
+ * \param signalSpread
+ * \param phyRate
+ * \param dFree
+ * \param adFree
+ * \return double
+ */
double GetFecBpskBer (double snr, double nbits,
uint32_t signalSpread, uint32_t phyRate,
uint32_t dFree, uint32_t adFree) const;
+ /**
+ * \param snr
+ * \param nbits
+ * \param signalSpread
+ * \param phyRate
+ * \param m
+ * \param dfree
+ * \param adFree
+ * \param adFreePlusOne
+ * \return double
+ */
double GetFecQamBer (double snr, uint32_t nbits,
uint32_t signalSpread,
uint32_t phyRate,
--- a/src/wifi/model/yans-wifi-channel.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/yans-wifi-channel.h Tue Dec 10 10:48:51 2013 -0500
@@ -101,8 +101,8 @@
int64_t AssignStreams (int64_t stream);
private:
- YansWifiChannel& operator = (const YansWifiChannel &);
- YansWifiChannel (const YansWifiChannel &);
+ //YansWifiChannel& operator = (const YansWifiChannel &);
+ //YansWifiChannel (const YansWifiChannel &);
/**
* A vector of pointers to YansWifiPhy.
@@ -123,9 +123,9 @@
WifiTxVector txVector, WifiPreamble preamble) const;
- PhyList m_phyList;
- Ptr<PropagationLossModel> m_loss;
- Ptr<PropagationDelayModel> m_delay;
+ PhyList m_phyList; //!< List of YansWifiPhys connected to this YansWifiChannel
+ Ptr<PropagationLossModel> m_loss; //!< Propagation loss model
+ Ptr<PropagationDelayModel> m_delay; //!< Propagation delay model
};
} // namespace ns3
--- a/src/wifi/model/yans-wifi-phy.h Mon Dec 09 09:28:17 2013 -0800
+++ b/src/wifi/model/yans-wifi-phy.h Tue Dec 10 10:48:51 2013 -0500
@@ -69,9 +69,24 @@
YansWifiPhy ();
virtual ~YansWifiPhy ();
+ /**
+ * Set the YansWifiChannel this YansWifiPhy is to be connected to.
+ *
+ * \param channel the YansWifiChannel this YansWifiPhy is to be connected to
+ */
void SetChannel (Ptr<YansWifiChannel> channel);
+ /**
+ * Set the current channel number.
+ *
+ * \param id the channel number
+ */
void SetChannelNumber (uint16_t id);
+ /**
+ * Return the current channel number.
+ *
+ * \return the current channel number
+ */
uint16_t GetChannelNumber () const;
/**
* Return current center channel frequency in MHz.
@@ -80,6 +95,14 @@
*/
double GetChannelFrequencyMhz () const;
+ /**
+ * Starting receiving the packet (i.e. the first bit of the preamble has arrived).
+ *
+ * \param packet the arriving packet
+ * \param rxPowerDbm the receive power in dBm
+ * \param txVector the TXVECTOR of the arriving packet
+ * \param preamble the preamble of the arriving packet
+ */
void StartReceivePacket (Ptr<Packet> packet,
double rxPowerDbm,
WifiTxVector txVector,
@@ -206,7 +229,15 @@
*/
Ptr<Object> GetMobility (void);
+ /**
+ * Return the minimum available transmission power level (dBm).
+ * \return the minimum available transmission power level (dBm)
+ */
virtual double GetTxPowerStart (void) const;
+ /**
+ * Return the maximum available transmission power level (dBm).
+ * \return the maximum available transmission power level (dBm)
+ */
virtual double GetTxPowerEnd (void) const;
/**
* Return the number of available transmission power levels.
@@ -321,7 +352,7 @@
/**
* Enable or disable channel bonding support.
*
- * \param channelBonding Enable or disable channel bonding
+ * \param channelbonding Enable or disable channel bonding
*/
virtual void SetChannelBonding (bool channelbonding) ;
@@ -333,39 +364,92 @@
*/
virtual uint8_t GetNMcs (void) const;
virtual uint8_t GetMcs (uint8_t mcs) const;
- /**
- * For a given WifiMode finds the corresponding MCS value and returns it
- * as defined in the IEEE 802.11n standard
- *
- * \param mode the WifiMode
- * \return the MCS number that corresponds to the given WifiMode
- */
+
virtual uint32_t WifiModeToMcs (WifiMode mode);
- /**
- * For a given MCS finds the corresponding WifiMode and returns it
- * as defined in the IEEE 802.11n standard.
- *
- * \param mcs the MCS number
- * \return the WifiMode that corresponds to the given mcs number
- */
virtual WifiMode McsToWifiMode (uint8_t mcs);
private:
- YansWifiPhy (const YansWifiPhy &o);
+ //YansWifiPhy (const YansWifiPhy &o);
virtual void DoDispose (void);
+ /**
+ * Configure YansWifiPhy with appropriate channel frequency and
+ * supported rates for 802.11a standard.
+ */
void Configure80211a (void);
+ /**
+ * Configure YansWifiPhy with appropriate channel frequency and
+ * supported rates for 802.11b standard.
+ */
void Configure80211b (void);
+ /**
+ * Configure YansWifiPhy with appropriate channel frequency and
+ * supported rates for 802.11g standard.
+ */
void Configure80211g (void);
+ /**
+ * Configure YansWifiPhy with appropriate channel frequency and
+ * supported rates for 802.11a standard with 10MHz channel spacing.
+ */
void Configure80211_10Mhz (void);
+ /**
+ * Configure YansWifiPhy with appropriate channel frequency and
+ * supported rates for 802.11a standard with 5MHz channel spacing.
+ */
void Configure80211_5Mhz ();
void ConfigureHolland (void);
+ /**
+ * Configure YansWifiPhy with appropriate channel frequency and
+ * supported rates for 802.11n standard.
+ */
void Configure80211n (void);
+ /**
+ * Return the energy detection threshold.
+ *
+ * \return the energy detection threshold.
+ */
double GetEdThresholdW (void) const;
+ /**
+ * Convert from dBm to Watts.
+ *
+ * \param dbm the power in dBm
+ * \return the equivalent Watts for the given dBm
+ */
double DbmToW (double dbm) const;
+ /**
+ * Convert from dB to ratio.
+ *
+ * \param db
+ * \return ratio
+ */
double DbToRatio (double db) const;
+ /**
+ * Convert from Watts to dBm.
+ *
+ * \param w the power in Watts
+ * \return the equivalent dBm for the given Watts
+ */
double WToDbm (double w) const;
+ /**
+ * Convert from ratio to dB.
+ *
+ * \param ratio
+ * \return dB
+ */
double RatioToDb (double ratio) const;
+ /**
+ * Get the power of the given power level in dBm.
+ * In YansWifiPhy implementation, the power levels are equally spaced (in dBm).
+ *
+ * \param power the power level
+ * \return the transmission power in dBm at the given power level
+ */
double GetPowerDbm (uint8_t power) const;
+ /**
+ * The last bit of the packet has arrived.
+ *
+ * \param packet the packet that the last bit has arrived
+ * \param event the corresponding event of the first time the packet arrives
+ */
void EndReceive (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event);
private: