22 #include "ns3/string.h" 23 #include "ns3/qos-utils.h" 24 #include "ns3/ctrl-headers.h" 25 #include "ns3/packet.h" 26 #include "ns3/wifi-net-device.h" 27 #include "ns3/ap-wifi-mac.h" 28 #include "ns3/wifi-mac-header.h" 29 #include "ns3/mobility-helper.h" 30 #include "ns3/yans-wifi-helper.h" 31 #include "ns3/packet-socket-server.h" 32 #include "ns3/packet-socket-client.h" 33 #include "ns3/packet-socket-helper.h" 34 #include "ns3/config.h" 35 #include "ns3/pointer.h" 82 virtual void DoRun (
void);
87 :
TestCase (
"Check correct order of buffering when startSequence < endSeq")
103 std::list<uint16_t> m_buffer;
104 std::list<uint16_t>::iterator i,j;
105 m_buffer.push_back (0);
106 m_buffer.push_back (16);
107 m_buffer.push_back (56000);
109 uint16_t endSeq = 4000;
111 uint16_t receivedSeq = 4001 * 16;
114 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
122 m_buffer.insert (i, receivedSeq);
124 receivedSeq = 3999 * 16;
127 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
135 m_buffer.insert (i, receivedSeq);
137 for (i = m_buffer.begin (), j =
m_expectedBuffer.begin (); i != m_buffer.end (); i++, j++)
179 virtual void DoRun (
void);
184 :
TestCase (
"Check correct order of buffering when startSequence > endSeq")
201 std::list<uint16_t> m_buffer;
202 std::list<uint16_t>::iterator i,j;
203 m_buffer.push_back (256);
204 m_buffer.push_back (64000);
205 m_buffer.push_back (16);
207 uint16_t endSeq = 10;
209 uint16_t receivedSeq = 15 * 16;
212 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
220 m_buffer.insert (i, receivedSeq);
222 receivedSeq = 15 * 16 + 1;
225 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
233 m_buffer.insert (i, receivedSeq);
235 receivedSeq = 4050 * 16;
238 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
246 m_buffer.insert (i, receivedSeq);
248 for (i = m_buffer.begin (), j =
m_expectedBuffer.begin (); i != m_buffer.end (); i++, j++)
265 virtual void DoRun ();
269 :
TestCase (
"Check the correctness of the originator block ack window")
276 uint16_t winSize = 16;
277 uint16_t startingSeq = 4090;
287 for (uint16_t i = 0; i < winSize; i++)
296 uint16_t seqNumber = startingSeq;
321 for (uint16_t i = 0; i < winSize; i++)
354 for (uint16_t i = 5; i < winSize; i++)
373 for (uint16_t i = 0; i < winSize; i++)
422 for (uint16_t i = 12; i < winSize; i++)
442 "Incorrect starting sequence after transmitting an MPDU beyond the current window");
453 for (uint16_t i = 10; i < winSize; i++)
473 "Incorrect starting sequence after transmitting another MPDU beyond the current window");
479 for (uint16_t i = 5; i < winSize; i++)
499 "Incorrect starting sequence after discarding an MPDU");
500 for (uint16_t i = 0; i < winSize; i++)
507 for (uint16_t i = 1; i < winSize; i++)
521 "Incorrect starting sequence after acknowledging all but the first MPDU");
523 for (uint16_t i = 1; i < winSize; i++)
541 "Incorrect starting sequence after acknowledging the first MPDU");
542 for (uint16_t i = 0; i < winSize; i++)
560 virtual void DoRun ();
565 :
TestCase (
"Check the correctness of block ack compressed bitmap")
577 for (uint16_t i = 179; i < 220; i++)
581 for (uint16_t i = 225; i <= 242; i++)
597 for (uint16_t i = 4090; i != 10; i = (i + 1) % 4096)
601 for (uint16_t i = 22; i < 25; i++)
684 virtual void DoRun (
void);
722 if (duration >
m_max)
729 :
TestCase (
"Test case for Block Ack Policy with aggregation disabled"),
818 wifi.SetAckPolicySelectorForAc (
AC_BE,
"ns3::ConstantWifiAckPolicySelector",
820 wifi.SetRemoteStationManager (
"ns3::IdealWifiManager");
824 mac.SetType (
"ns3::StaWifiMac",
834 mac.SetType (
"ns3::ApWifiMac",
845 positionAlloc->
Add (Vector (0.0, 0.0, 0.0));
846 positionAlloc->
Add (Vector (1.0, 0.0, 0.0));
847 mobility.SetPositionAllocator (positionAlloc);
849 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
863 sta_device->GetMac ()->GetAttribute (
"BE_Txop", ptr);
869 ap_mac->GetAttribute (
"BE_Txop", ptr);
880 packetSocket.
Install (wifiStaNode);
920 Simulator::Destroy ();
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
void SetStopTime(Time stop)
Specify application stop time.
Simulation virtual time values and global simulation resolution.
std::list< uint16_t > m_expectedBuffer
expected test buffer
Smart pointer class similar to boost::intrusive_ptr.
AttributeValue implementation for Boolean.
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
Maintains the state and information about transmitted MPDUs with Ack Policy set to Block Ack for an o...
void Trace(Time startTime, Time duration)
Callback for the TxopTrace trace.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Make it easy to create and manage PHY objects for the YANS model.
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
uint32_t m_received
received packets
an address for a packet socket
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
void Transmit(std::string context, Ptr< const Packet > p, double power)
Callback invoked when PHY transmits a packet.
Keeps the maximum duration among all TXOPs.
helps to create WifiNetDevice objects
BlockAckWindow m_txWindow
originator's transmit window
Give ns3::PacketSocket powers to ns3::Node.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
uint16_t m_nBar
transmitted BlockAckReq frames
Address GetAddress(void) const
a polymophic address class
virtual void DoRun(void)
Implementation to actually run this TestCase.
void NotifyDiscardedMpdu(Ptr< const WifiMacQueueItem > mpdu)
Advance the transmit window beyond the MPDU that has been reported to be discarded.
uint16_t GetWinStart(void) const
Get the current winStart value.
virtual ~BlockAckAggregationDisabledTest()
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
AttributeValue implementation for Time.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Hold an unsigned integer type.
virtual ~PacketBufferingCaseA()
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
holds a vector of ns3::NetDevice pointers
uint16_t m_txTotal
transmitted data packets
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
void Receive(std::string context, Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
Callback invoked when PHY receives a packet.
Test for the originator block ack window.
uint16_t m_nBa
received BlockAck frames
void Connect(std::string path, const CallbackBase &cb)
void SetStartingSequence(uint16_t seq)
Set starting sequence number.
std::vector< bool >::reference At(std::size_t distance)
Get a reference to the element in the window having the given distance from the current winStart...
void NotifyAckedMpdu(Ptr< const WifiMacQueueItem > mpdu)
Record that the given MPDU has been acknowledged and advance the transmit window if possible...
virtual ~PacketBufferingCaseB()
void NotifyTransmittedMpdu(Ptr< const WifiMacQueueItem > mpdu)
Advance the transmit window so as to include the transmitted MPDU, if the latter is not an old packet...
virtual void DoRun(void)
Implementation to actually run this TestCase.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetPhysicalAddress(const Address address)
Set the destination address.
keep track of a set of node pointers.
Hold objects of type Ptr<T>.
Test for Block Ack Policy with aggregation disabled.
manage and create wifi channel objects for the YANS model.
create MAC layers for a ns3::WifiNetDevice.
BlockAckAggregationDisabledTest(bool txop)
Constructor.
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report if not.
The IEEE 802.11 SSID Information Element.
Time m_max
max TXOP duration
Helper class used to assign positions and mobility models to nodes.
Ptr< WifiMac > GetMac(void) const
uint16_t GetWinEnd(void) const
Get the current winEnd value.
virtual void DoRun()
Implementation to actually run this TestCase.
std::size_t GetWinSize(void) const
Get the window size.
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
uint32_t QosUtilsMapSeqControlToUniqueInteger(uint16_t seqControl, uint16_t endSequence)
Next function is useful to correctly sort buffered packets under block ack.
OriginatorBlockAckWindowTest()
Time Seconds(double value)
Construct a Time in the indicated unit.
AttributeValue implementation for Ssid.
void SetProtocol(uint16_t protocol)
Set the protocol.
void Add(Vector v)
Add a position to the list of positions.
bool m_txop
true for non-null TXOP limit
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
const uint16_t SEQNO_SPACE_SIZE
Size of the space of sequence numbers.
void L7Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Function to trace packets received by the server application.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
uint16_t GetStartingSequence(void) const
Return the starting sequence number of the transmit window, if a transmit window has been initialized...
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint16_t m_txSinceBar
packets transmitted since the agreement was established or the last block ack was received ...
void SetBufferSize(uint16_t bufferSize)
Set buffer size.
static BlockAckTestSuite g_blockAckTestSuite
the test suite
std::list< uint16_t > m_expectedBuffer
expected test buffer
void SetStartTime(Time start)
Specify application start time.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
void InitTxWindow(void)
Initialize the originator's transmit window by setting its size and starting sequence number equal to...
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.