internet: fix doxygen warnings and tweak tests
This commit is contained in:
@@ -26,21 +26,34 @@
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* Generates traffic.
|
||||
*
|
||||
* The first call sends a packet of the specified size, and then
|
||||
* the function is scheduled to send a packet of (size-50) after 0.5s.
|
||||
* The process is iterated until the packet size is zero.
|
||||
*
|
||||
* \param socket output socket
|
||||
* \param size packet size
|
||||
*/
|
||||
static void
|
||||
GenerateTraffic (Ptr<Socket> socket, uint32_t size)
|
||||
GenerateTraffic (Ptr<Socket> socket, int32_t size)
|
||||
{
|
||||
std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl;
|
||||
socket->Send (Create<Packet> (size));
|
||||
if (size > 0)
|
||||
{
|
||||
Simulator::Schedule (Seconds (0.5), &GenerateTraffic, socket, size - 50);
|
||||
}
|
||||
else
|
||||
if (size <= 0)
|
||||
{
|
||||
socket->Close ();
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl;
|
||||
socket->Send (Create<Packet> (size));
|
||||
Simulator::Schedule (Seconds (0.5), &GenerateTraffic, socket, size - 50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the packets received by a socket
|
||||
* \param socket input socket
|
||||
*/
|
||||
static void
|
||||
SocketPrinter (Ptr<Socket> socket)
|
||||
{
|
||||
@@ -51,15 +64,11 @@ SocketPrinter (Ptr<Socket> socket)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
PrintTraffic (Ptr<Socket> socket)
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
socket->SetRecvCallback (MakeCallback (&SocketPrinter));
|
||||
}
|
||||
CommandLine cmd (__FILE__);
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
void
|
||||
RunSimulation (void)
|
||||
{
|
||||
NodeContainer c;
|
||||
c.Create (1);
|
||||
|
||||
@@ -77,20 +86,11 @@ RunSimulation (void)
|
||||
source->Connect (remote);
|
||||
|
||||
GenerateTraffic (source, 500);
|
||||
PrintTraffic (sink);
|
||||
|
||||
sink->SetRecvCallback (MakeCallback (&SocketPrinter));
|
||||
|
||||
Simulator::Run ();
|
||||
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
CommandLine cmd (__FILE__);
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
RunSimulation ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -47,137 +47,136 @@ namespace ns3 {
|
||||
class Ipv4AddressHelper
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a helper class to make life easier while doing simple IPv4
|
||||
* address assignment in scripts.
|
||||
*/
|
||||
/**
|
||||
* @brief Construct a helper class to make life easier while doing simple IPv4
|
||||
* address assignment in scripts.
|
||||
*/
|
||||
Ipv4AddressHelper ();
|
||||
|
||||
/**
|
||||
* @brief Construct a helper class to make life easier while doing simple IPv4
|
||||
* address assignment in scripts. This version sets the base and mask
|
||||
* in the constructor
|
||||
* @param network the network part
|
||||
* @param mask the address mask
|
||||
* @param base the host part to start from
|
||||
*/
|
||||
/**
|
||||
* @brief Construct a helper class to make life easier while doing simple IPv4
|
||||
* address assignment in scripts. This version sets the base and mask
|
||||
* in the constructor
|
||||
* @param network the network part
|
||||
* @param mask the address mask
|
||||
* @param base the host part to start from
|
||||
*/
|
||||
Ipv4AddressHelper (Ipv4Address network, Ipv4Mask mask,
|
||||
Ipv4Address base = "0.0.0.1");
|
||||
|
||||
/**
|
||||
* @brief Set the base network number, network mask and base address.
|
||||
*
|
||||
* The address helper allocates IP addresses based on a given network number
|
||||
* and mask combination along with an initial IP address.
|
||||
*
|
||||
* For example, if you want to use a /24 prefix with an initial network number
|
||||
* of 192.168.1 (corresponding to a mask of 255.255.255.0) and you want to
|
||||
* start allocating IP addresses out of that network beginning at 192.168.1.3,
|
||||
* you would call
|
||||
*
|
||||
* SetBase ("192.168.1.0", "255.255.255.0", "0.0.0.3");
|
||||
*
|
||||
* If you don't care about the initial address it defaults to "0.0.0.1" in
|
||||
* which case you can simply use,
|
||||
*
|
||||
* SetBase ("192.168.1.0", "255.255.255.0");
|
||||
*
|
||||
* and the first address generated will be 192.168.1.1.
|
||||
*
|
||||
* @param network The Ipv4Address containing the initial network number to
|
||||
* use during allocation. The bits outside the network mask are not used.
|
||||
* @param mask The Ipv4Mask containing one bits in each bit position of the
|
||||
* network number.
|
||||
* @param base An optional Ipv4Address containing the initial address used for
|
||||
* IP address allocation. Will be combined (ORed) with the network number to
|
||||
* generate the first IP address. Defaults to 0.0.0.1.
|
||||
* @returns Nothing.
|
||||
*/
|
||||
/**
|
||||
* @brief Set the base network number, network mask and base address.
|
||||
*
|
||||
* The address helper allocates IP addresses based on a given network number
|
||||
* and mask combination along with an initial IP address.
|
||||
*
|
||||
* For example, if you want to use a /24 prefix with an initial network number
|
||||
* of 192.168.1 (corresponding to a mask of 255.255.255.0) and you want to
|
||||
* start allocating IP addresses out of that network beginning at 192.168.1.3,
|
||||
* you would call
|
||||
*
|
||||
* SetBase ("192.168.1.0", "255.255.255.0", "0.0.0.3");
|
||||
*
|
||||
* If you don't care about the initial address it defaults to "0.0.0.1" in
|
||||
* which case you can simply use,
|
||||
*
|
||||
* SetBase ("192.168.1.0", "255.255.255.0");
|
||||
*
|
||||
* and the first address generated will be 192.168.1.1.
|
||||
*
|
||||
* @param network The Ipv4Address containing the initial network number to
|
||||
* use during allocation. The bits outside the network mask are not used.
|
||||
* @param mask The Ipv4Mask containing one bits in each bit position of the
|
||||
* network number.
|
||||
* @param base An optional Ipv4Address containing the initial address used for
|
||||
* IP address allocation. Will be combined (ORed) with the network number to
|
||||
* generate the first IP address. Defaults to 0.0.0.1.
|
||||
*/
|
||||
void SetBase (Ipv4Address network, Ipv4Mask mask,
|
||||
Ipv4Address base = "0.0.0.1");
|
||||
|
||||
/**
|
||||
* @brief Increment the network number and reset the IP address counter to
|
||||
* the base value provided in the SetBase method.
|
||||
*
|
||||
* The address helper allocates IP addresses based on a given network number
|
||||
* and initial IP address. In order to separate the network number and IP
|
||||
* address parts, SetBase was given an initial network number value, a network
|
||||
* mask and an initial address base.
|
||||
*
|
||||
* This method increments the network number and resets the IP address
|
||||
* counter to the last base value used. For example, if the network number was
|
||||
* set to 192.168.0.0 with a mask of 255.255.255.0 and a base address of
|
||||
* 0.0.0.3 in the SetBase call; a call to NewNetwork will increment the
|
||||
* network number counter resulting in network numbers incrementing as
|
||||
* 192.168.1.0, 192.168.2.0, etc. After each network number increment, the
|
||||
* IP address counter is reset to the initial value specified in SetBase. In
|
||||
* this case, that would be 0.0.0.3. so if you were to call NewAddress after
|
||||
* the increment that resulted in a network number of 192.168.2.0, the
|
||||
* allocated addresses returned by NewAddress would be 192.168.2.3,
|
||||
* 192.168.2.4, etc.
|
||||
*
|
||||
* @returns The value of the incremented network number that will be used in
|
||||
* following address allocations.
|
||||
* @see SetBase
|
||||
* @see NewAddress
|
||||
*/
|
||||
/**
|
||||
* @brief Increment the network number and reset the IP address counter to
|
||||
* the base value provided in the SetBase method.
|
||||
*
|
||||
* The address helper allocates IP addresses based on a given network number
|
||||
* and initial IP address. In order to separate the network number and IP
|
||||
* address parts, SetBase was given an initial network number value, a network
|
||||
* mask and an initial address base.
|
||||
*
|
||||
* This method increments the network number and resets the IP address
|
||||
* counter to the last base value used. For example, if the network number was
|
||||
* set to 192.168.0.0 with a mask of 255.255.255.0 and a base address of
|
||||
* 0.0.0.3 in the SetBase call; a call to NewNetwork will increment the
|
||||
* network number counter resulting in network numbers incrementing as
|
||||
* 192.168.1.0, 192.168.2.0, etc. After each network number increment, the
|
||||
* IP address counter is reset to the initial value specified in SetBase. In
|
||||
* this case, that would be 0.0.0.3. so if you were to call NewAddress after
|
||||
* the increment that resulted in a network number of 192.168.2.0, the
|
||||
* allocated addresses returned by NewAddress would be 192.168.2.3,
|
||||
* 192.168.2.4, etc.
|
||||
*
|
||||
* @returns The value of the incremented network number that will be used in
|
||||
* following address allocations.
|
||||
* @see SetBase
|
||||
* @see NewAddress
|
||||
*/
|
||||
Ipv4Address NewNetwork (void);
|
||||
|
||||
/**
|
||||
* @brief Increment the IP address counter used to allocate IP addresses
|
||||
*
|
||||
* The address helper allocates IP addresses based on a given network number
|
||||
* and initial IP address. In order to separate the network number and IP
|
||||
* address parts, SetBase was given an initial network number value, a network
|
||||
* mask and an initial address base.
|
||||
*
|
||||
* This method increments IP address counter. A check is made to ensure that
|
||||
* the address returned will not overflow the number of bits allocated to IP
|
||||
* addresses in SetBase (the number of address bits is defined by the number
|
||||
* of mask bits that are not '1').
|
||||
*
|
||||
* For example, if the network number was set to 192.168.0.0 with a mask of
|
||||
* 255.255.255.0 and a base address of 0.0.0.3 in SetBase, the next call to
|
||||
* NewAddress will return 192.168.1.3. The NewAddress method
|
||||
* has post-increment semantics. A following NewAddress would return
|
||||
* 192.168.0.4, etc., until the 253rd call which would assert due to an address
|
||||
* overflow.
|
||||
*
|
||||
* @returns The value of the newly allocated IP address.
|
||||
* @see SetBase
|
||||
* @see NewNetwork
|
||||
*/
|
||||
/**
|
||||
* @brief Increment the IP address counter used to allocate IP addresses
|
||||
*
|
||||
* The address helper allocates IP addresses based on a given network number
|
||||
* and initial IP address. In order to separate the network number and IP
|
||||
* address parts, SetBase was given an initial network number value, a network
|
||||
* mask and an initial address base.
|
||||
*
|
||||
* This method increments IP address counter. A check is made to ensure that
|
||||
* the address returned will not overflow the number of bits allocated to IP
|
||||
* addresses in SetBase (the number of address bits is defined by the number
|
||||
* of mask bits that are not '1').
|
||||
*
|
||||
* For example, if the network number was set to 192.168.0.0 with a mask of
|
||||
* 255.255.255.0 and a base address of 0.0.0.3 in SetBase, the next call to
|
||||
* NewAddress will return 192.168.1.3. The NewAddress method
|
||||
* has post-increment semantics. A following NewAddress would return
|
||||
* 192.168.0.4, etc., until the 253rd call which would assert due to an address
|
||||
* overflow.
|
||||
*
|
||||
* @returns The value of the newly allocated IP address.
|
||||
* @see SetBase
|
||||
* @see NewNetwork
|
||||
*/
|
||||
Ipv4Address NewAddress (void);
|
||||
|
||||
/**
|
||||
* @brief Assign IP addresses to the net devices specified in the container
|
||||
* based on the current network prefix and address base.
|
||||
*
|
||||
* The address helper allocates IP addresses based on a given network number
|
||||
* and initial IP address. In order to separate the network number and IP
|
||||
* address parts, SetBase was given an initial value and a network mask.
|
||||
* The one bits of this mask define the prefix category from which the helper
|
||||
* will allocate new network numbers. An initial value for the network
|
||||
* numbers was provided in the base parameter of the SetBase method in the
|
||||
* bits corresponding to positions in the mask that were 1. An initial value
|
||||
* for the IP address counter was also provided in the base parameter in the
|
||||
* bits corresponding to positions in the mask that were 0.
|
||||
*
|
||||
* This method gets new addresses for each net device in the container. For
|
||||
* each net device in the container, the helper finds the associated node and
|
||||
* looks up the Ipv4 interface corresponding to the net device. It then sets
|
||||
* the Ipv4Address and mask in the interface to the appropriate values. If
|
||||
* the addresses overflow the number of bits allocated for them by the network
|
||||
* mask in the SetBase method, the system will NS_ASSERT and halt.
|
||||
*
|
||||
* @param c The NetDeviceContainer holding the collection of net devices we
|
||||
* are asked to assign Ipv4 addresses to.
|
||||
*
|
||||
* @returns A container holding the added NetDevices
|
||||
* @see SetBase
|
||||
* @see NewNetwork
|
||||
*/
|
||||
/**
|
||||
* @brief Assign IP addresses to the net devices specified in the container
|
||||
* based on the current network prefix and address base.
|
||||
*
|
||||
* The address helper allocates IP addresses based on a given network number
|
||||
* and initial IP address. In order to separate the network number and IP
|
||||
* address parts, SetBase was given an initial value and a network mask.
|
||||
* The one bits of this mask define the prefix category from which the helper
|
||||
* will allocate new network numbers. An initial value for the network
|
||||
* numbers was provided in the base parameter of the SetBase method in the
|
||||
* bits corresponding to positions in the mask that were 1. An initial value
|
||||
* for the IP address counter was also provided in the base parameter in the
|
||||
* bits corresponding to positions in the mask that were 0.
|
||||
*
|
||||
* This method gets new addresses for each net device in the container. For
|
||||
* each net device in the container, the helper finds the associated node and
|
||||
* looks up the Ipv4 interface corresponding to the net device. It then sets
|
||||
* the Ipv4Address and mask in the interface to the appropriate values. If
|
||||
* the addresses overflow the number of bits allocated for them by the network
|
||||
* mask in the SetBase method, the system will NS_ASSERT and halt.
|
||||
*
|
||||
* @param c The NetDeviceContainer holding the collection of net devices we
|
||||
* are asked to assign Ipv4 addresses to.
|
||||
*
|
||||
* @returns A container holding the added NetDevices
|
||||
* @see SetBase
|
||||
* @see NewNetwork
|
||||
*/
|
||||
Ipv4InterfaceContainer Assign (const NetDeviceContainer &c);
|
||||
|
||||
private:
|
||||
|
||||
@@ -42,8 +42,9 @@ public:
|
||||
/**
|
||||
* \brief Construct a GlobalRoutingHelper from another previously initialized
|
||||
* instance (Copy Constructor).
|
||||
* \param o object to be copied
|
||||
*/
|
||||
Ipv4GlobalRoutingHelper (const Ipv4GlobalRoutingHelper &);
|
||||
Ipv4GlobalRoutingHelper (const Ipv4GlobalRoutingHelper &o);
|
||||
|
||||
/**
|
||||
* \returns pointer to clone of this Ipv4GlobalRoutingHelper
|
||||
|
||||
@@ -51,8 +51,9 @@ public:
|
||||
/**
|
||||
* \brief Construct an Ipv4ListRoutingHelper from another previously
|
||||
* initialized instance (Copy Constructor).
|
||||
* \param o object to be copied
|
||||
*/
|
||||
Ipv4ListRoutingHelper (const Ipv4ListRoutingHelper &);
|
||||
Ipv4ListRoutingHelper (const Ipv4ListRoutingHelper &o);
|
||||
|
||||
/**
|
||||
* \returns pointer to clone of this Ipv4ListRoutingHelper
|
||||
|
||||
@@ -119,6 +119,7 @@ public:
|
||||
* \brief prints the neighbor cache of all nodes at a particular time.
|
||||
* \param printTime the time at which the neighbor cache is supposed to be printed.
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintArpCache() method of the
|
||||
* ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
|
||||
@@ -134,6 +135,7 @@ public:
|
||||
* \brief prints the neighbor cache of all nodes at regular intervals specified by user.
|
||||
* \param printInterval the time interval for which the neighbor cache is supposed to be printed.
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintArpCache() method of the
|
||||
* ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
|
||||
@@ -150,6 +152,7 @@ public:
|
||||
* \param printTime the time at which the neighbor cache is supposed to be printed.
|
||||
* \param node The node ptr for which we need the neighbor cache to be printed
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintArpCache() method of the
|
||||
* ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
|
||||
@@ -166,6 +169,7 @@ public:
|
||||
* \param printInterval the time interval for which the neighbor cache is supposed to be printed.
|
||||
* \param node The node ptr for which we need the neighbor cache to be printed
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintArpCache() method of the
|
||||
* ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
|
||||
@@ -219,6 +223,7 @@ private:
|
||||
* \brief prints the neighbor cache of a node.
|
||||
* \param node The node ptr for which we need the neighbor cache to be printed
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintArpCache() method of the
|
||||
* ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
|
||||
@@ -235,6 +240,7 @@ private:
|
||||
* \param printInterval the time interval for which the neighbor cache is supposed to be printed.
|
||||
* \param node The node ptr for which we need the neighbor cache to be printed
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintArpCache() method of the
|
||||
* ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
|
||||
|
||||
@@ -51,8 +51,9 @@ public:
|
||||
/**
|
||||
* \brief Construct an Ipv4StaticRoutingHelper from another previously
|
||||
* initialized instance (Copy Constructor).
|
||||
* \param o object to be copied
|
||||
*/
|
||||
Ipv4StaticRoutingHelper (const Ipv4StaticRoutingHelper &);
|
||||
Ipv4StaticRoutingHelper (const Ipv4StaticRoutingHelper &o);
|
||||
|
||||
/**
|
||||
* \returns pointer to clone of this Ipv4StaticRoutingHelper
|
||||
|
||||
@@ -53,8 +53,9 @@ public:
|
||||
/**
|
||||
* \brief Construct an Ipv6ListRoutingHelper from another previously
|
||||
* initialized instance (Copy Constructor).
|
||||
* \param o object to be copied
|
||||
*/
|
||||
Ipv6ListRoutingHelper (const Ipv6ListRoutingHelper &);
|
||||
Ipv6ListRoutingHelper (const Ipv6ListRoutingHelper &o);
|
||||
|
||||
/**
|
||||
* \returns pointer to clone of this Ipv6ListRoutingHelper
|
||||
|
||||
@@ -120,6 +120,7 @@ public:
|
||||
* \brief prints the neighbor cache of all nodes at a particular time.
|
||||
* \param printTime the time at which the neighbor cache is supposed to be printed.
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintNdiscCache() method of the
|
||||
* NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
|
||||
@@ -135,6 +136,7 @@ public:
|
||||
* \brief prints the neighbor cache of all nodes at regular intervals specified by user.
|
||||
* \param printInterval the time interval for which the neighbor cache is supposed to be printed.
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintNdiscCache() method of the
|
||||
* NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
|
||||
@@ -151,6 +153,7 @@ public:
|
||||
* \param printTime the time at which the neighbor cache is supposed to be printed.
|
||||
* \param node The node ptr for which we need the neighbor cache to be printed
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintNdiscCache() method of the
|
||||
* NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
|
||||
@@ -167,6 +170,7 @@ public:
|
||||
* \param printInterval the time interval for which the neighbor cache is supposed to be printed.
|
||||
* \param node The node ptr for which we need the neighbor cache to be printed
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintNdiscCache() method of the
|
||||
* NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
|
||||
@@ -220,6 +224,7 @@ private:
|
||||
* \brief prints the neighbor cache of a node.
|
||||
* \param node The node ptr for which we need the neighbor cache to be printed
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintNdiscCache() method of the
|
||||
* NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
|
||||
@@ -236,6 +241,7 @@ private:
|
||||
* \param printInterval the time interval for which the neighbor cache is supposed to be printed.
|
||||
* \param node The node ptr for which we need the neighbor cache to be printed
|
||||
* \param stream The output stream object to use
|
||||
* \param unit The time unit to be used in the report
|
||||
*
|
||||
* This method calls the PrintNdiscCache() method of the
|
||||
* NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
|
||||
|
||||
@@ -51,8 +51,9 @@ public:
|
||||
/**
|
||||
* \brief Construct an Ipv6ListRoutingHelper from another previously
|
||||
* initialized instance (Copy Constructor).
|
||||
* \param o object to be copied
|
||||
*/
|
||||
Ipv6StaticRoutingHelper (const Ipv6StaticRoutingHelper &);
|
||||
Ipv6StaticRoutingHelper (const Ipv6StaticRoutingHelper &o);
|
||||
|
||||
/**
|
||||
* \returns pointer to clone of this Ipv6StaticRoutingHelper
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
bool m_retrans {false}; //!< Indicates if the segment is retransmitted
|
||||
|
||||
private:
|
||||
// Only TcpTxBuffer is allower to touch this part of the TcpTxItem, to manage
|
||||
// Only TcpTxBuffer is allowed to touch this part of the TcpTxItem, to manage
|
||||
// its internal lists and counters
|
||||
friend class TcpTxBuffer;
|
||||
|
||||
|
||||
@@ -100,13 +100,21 @@ public:
|
||||
IcmpEchoReplyTestCase ();
|
||||
virtual ~IcmpEchoReplyTestCase ();
|
||||
|
||||
/**
|
||||
* Send data
|
||||
* \param socket output socket
|
||||
* \param dst destination address
|
||||
*/
|
||||
void SendData (Ptr<Socket> socket, Ipv4Address dst);
|
||||
void DoSendData (Ptr<Socket> socket, Ipv4Address dst);
|
||||
/**
|
||||
* Receive data
|
||||
* \param socket input socket
|
||||
*/
|
||||
void ReceivePkt (Ptr<Socket> socket);
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
Ptr<Packet> m_receivedPacket;
|
||||
Ptr<Packet> m_receivedPacket; //!< received packet
|
||||
|
||||
};
|
||||
|
||||
@@ -125,7 +133,7 @@ IcmpEchoReplyTestCase::~IcmpEchoReplyTestCase ()
|
||||
|
||||
|
||||
void
|
||||
IcmpEchoReplyTestCase::DoSendData (Ptr<Socket> socket, Ipv4Address dst)
|
||||
IcmpEchoReplyTestCase::SendData (Ptr<Socket> socket, Ipv4Address dst)
|
||||
{
|
||||
Ptr<Packet> p = Create<Packet> ();
|
||||
Icmpv4Echo echo;
|
||||
@@ -146,15 +154,6 @@ IcmpEchoReplyTestCase::DoSendData (Ptr<Socket> socket, Ipv4Address dst)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IcmpEchoReplyTestCase::SendData (Ptr<Socket> socket, Ipv4Address dst)
|
||||
{
|
||||
m_receivedPacket = Create<Packet> ();
|
||||
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
|
||||
&IcmpEchoReplyTestCase::DoSendData, this, socket, dst);
|
||||
Simulator::Run ();
|
||||
}
|
||||
|
||||
void
|
||||
IcmpEchoReplyTestCase::ReceivePkt (Ptr <Socket> socket)
|
||||
{
|
||||
@@ -210,7 +209,9 @@ IcmpEchoReplyTestCase::DoRun ()
|
||||
|
||||
// Set a TTL big enough
|
||||
socket->SetIpTtl (1);
|
||||
SendData (socket, i.GetAddress (1,0));
|
||||
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
|
||||
&IcmpEchoReplyTestCase::SendData, this, socket, i.GetAddress (1,0));
|
||||
Simulator::Run ();
|
||||
|
||||
NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 28, " Unexpected ICMPV4_ECHO_REPLY packet size");
|
||||
|
||||
@@ -231,13 +232,21 @@ public:
|
||||
IcmpTimeExceedTestCase ();
|
||||
virtual ~IcmpTimeExceedTestCase ();
|
||||
|
||||
/**
|
||||
* Send data
|
||||
* \param socket output socket
|
||||
* \param dst destination address
|
||||
*/
|
||||
void SendData (Ptr<Socket> socket, Ipv4Address dst);
|
||||
void DoSendData (Ptr<Socket> socket, Ipv4Address dst);
|
||||
/**
|
||||
* Receive data
|
||||
* \param socket input socket
|
||||
*/
|
||||
void ReceivePkt (Ptr<Socket> socket);
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
Ptr<Packet> m_receivedPacket;
|
||||
Ptr<Packet> m_receivedPacket; //!< received packet
|
||||
|
||||
};
|
||||
|
||||
@@ -256,7 +265,7 @@ IcmpTimeExceedTestCase::~IcmpTimeExceedTestCase ()
|
||||
|
||||
|
||||
void
|
||||
IcmpTimeExceedTestCase::DoSendData (Ptr<Socket> socket, Ipv4Address dst)
|
||||
IcmpTimeExceedTestCase::SendData (Ptr<Socket> socket, Ipv4Address dst)
|
||||
{
|
||||
Ptr<Packet> p = Create<Packet> ();
|
||||
Icmpv4Echo echo;
|
||||
@@ -276,16 +285,6 @@ IcmpTimeExceedTestCase::DoSendData (Ptr<Socket> socket, Ipv4Address dst)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IcmpTimeExceedTestCase::SendData (Ptr<Socket> socket, Ipv4Address dst)
|
||||
{
|
||||
m_receivedPacket = Create<Packet> ();
|
||||
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
|
||||
&IcmpTimeExceedTestCase::DoSendData, this, socket, dst);
|
||||
Simulator::Run ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IcmpTimeExceedTestCase::ReceivePkt (Ptr<Socket> socket)
|
||||
{
|
||||
@@ -355,7 +354,9 @@ IcmpTimeExceedTestCase::DoRun ()
|
||||
|
||||
// The ttl is not big enough , causing an ICMP Time Exceeded response
|
||||
socket->SetIpTtl (1);
|
||||
SendData (socket, i2.GetAddress (1,0));
|
||||
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
|
||||
&IcmpTimeExceedTestCase::SendData, this, socket, i2.GetAddress (1,0));
|
||||
Simulator::Run ();
|
||||
|
||||
NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 56, " Unexpected ICMP Time Exceed Response packet size");
|
||||
|
||||
@@ -375,13 +376,21 @@ public:
|
||||
IcmpV6EchoReplyTestCase ();
|
||||
virtual ~IcmpV6EchoReplyTestCase ();
|
||||
|
||||
/**
|
||||
* Send data
|
||||
* \param socket output socket
|
||||
* \param dst destination address
|
||||
*/
|
||||
void SendData (Ptr<Socket> socket, Ipv6Address dst);
|
||||
void DoSendData (Ptr<Socket> socket, Ipv6Address dst);
|
||||
/**
|
||||
* Receive data
|
||||
* \param socket input socket
|
||||
*/
|
||||
void ReceivePkt (Ptr<Socket> socket);
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
Ptr<Packet> m_receivedPacket;
|
||||
Ptr<Packet> m_receivedPacket; //!< received packet
|
||||
|
||||
};
|
||||
|
||||
@@ -400,7 +409,7 @@ IcmpV6EchoReplyTestCase::~IcmpV6EchoReplyTestCase ()
|
||||
|
||||
|
||||
void
|
||||
IcmpV6EchoReplyTestCase::DoSendData (Ptr<Socket> socket, Ipv6Address dst)
|
||||
IcmpV6EchoReplyTestCase::SendData (Ptr<Socket> socket, Ipv6Address dst)
|
||||
{
|
||||
Ptr<Packet> p = Create<Packet> ();
|
||||
Icmpv6Echo echo (1);
|
||||
@@ -421,15 +430,6 @@ IcmpV6EchoReplyTestCase::DoSendData (Ptr<Socket> socket, Ipv6Address dst)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IcmpV6EchoReplyTestCase::SendData (Ptr<Socket> socket, Ipv6Address dst)
|
||||
{
|
||||
m_receivedPacket = Create<Packet> ();
|
||||
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
|
||||
&IcmpV6EchoReplyTestCase::DoSendData, this, socket, dst);
|
||||
Simulator::Run ();
|
||||
}
|
||||
|
||||
void
|
||||
IcmpV6EchoReplyTestCase::ReceivePkt (Ptr <Socket> socket)
|
||||
{
|
||||
@@ -498,7 +498,9 @@ IcmpV6EchoReplyTestCase::DoRun ()
|
||||
// Set a TTL big enough
|
||||
socket->SetIpTtl (1);
|
||||
|
||||
SendData (socket, i.GetAddress (1,1));
|
||||
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
|
||||
&IcmpV6EchoReplyTestCase::SendData, this, socket, i.GetAddress (1,1));
|
||||
Simulator::Run ();
|
||||
|
||||
NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 72, " Unexpected ICMPV6_ECHO_REPLY packet size");
|
||||
|
||||
@@ -518,13 +520,21 @@ public:
|
||||
IcmpV6TimeExceedTestCase ();
|
||||
virtual ~IcmpV6TimeExceedTestCase ();
|
||||
|
||||
/**
|
||||
* Send data
|
||||
* \param socket output socket
|
||||
* \param dst destination address
|
||||
*/
|
||||
void SendData (Ptr<Socket> socket, Ipv6Address dst);
|
||||
void DoSendData (Ptr<Socket> socket, Ipv6Address dst);
|
||||
/**
|
||||
* Receive data
|
||||
* \param socket input socket
|
||||
*/
|
||||
void ReceivePkt (Ptr<Socket> socket);
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
Ptr<Packet> m_receivedPacket;
|
||||
Ptr<Packet> m_receivedPacket; //!< received packet
|
||||
|
||||
};
|
||||
|
||||
@@ -543,7 +553,7 @@ IcmpV6TimeExceedTestCase::~IcmpV6TimeExceedTestCase ()
|
||||
|
||||
|
||||
void
|
||||
IcmpV6TimeExceedTestCase::DoSendData (Ptr<Socket> socket, Ipv6Address dst)
|
||||
IcmpV6TimeExceedTestCase::SendData (Ptr<Socket> socket, Ipv6Address dst)
|
||||
{
|
||||
Ptr<Packet> p = Create<Packet> ();
|
||||
Icmpv6Echo echo (1);
|
||||
@@ -564,15 +574,6 @@ IcmpV6TimeExceedTestCase::DoSendData (Ptr<Socket> socket, Ipv6Address dst)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IcmpV6TimeExceedTestCase::SendData (Ptr<Socket> socket, Ipv6Address dst)
|
||||
{
|
||||
m_receivedPacket = Create<Packet> ();
|
||||
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
|
||||
&IcmpV6TimeExceedTestCase::DoSendData, this, socket, dst);
|
||||
Simulator::Run ();
|
||||
}
|
||||
|
||||
void
|
||||
IcmpV6TimeExceedTestCase::ReceivePkt (Ptr <Socket> socket)
|
||||
{
|
||||
@@ -658,7 +659,9 @@ IcmpV6TimeExceedTestCase::DoRun ()
|
||||
// The hop limit is not big enough , causing an ICMPV6 Time Exceeded error
|
||||
socket->SetIpv6HopLimit (1);
|
||||
|
||||
SendData (socket, interfaces2.GetAddress (1,1));
|
||||
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
|
||||
&IcmpV6TimeExceedTestCase::SendData, this, socket, interfaces2.GetAddress (1,1));
|
||||
Simulator::Run ();
|
||||
|
||||
NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 72, " Unexpected ICMPV6_ECHO_REPLY packet size");
|
||||
|
||||
|
||||
@@ -126,19 +126,35 @@ class Ipv4DeduplicationTest : public TestCase
|
||||
*/
|
||||
void CheckDrops (const std::string &name);
|
||||
|
||||
static const Time DELAY;
|
||||
static const Time DELAY; //!< Channel delay
|
||||
|
||||
/**
|
||||
* Creates the test name according to the parameters
|
||||
* \param enable deduplication enabled
|
||||
* \param expire expiration delay for duplicate cache entries
|
||||
* \returns A string describing the test
|
||||
*/
|
||||
static std::string MakeName (bool enable, Time expire);
|
||||
|
||||
/**
|
||||
* Enum of test types
|
||||
*/
|
||||
enum MODE {ENABLED = 0,
|
||||
DISABLED,
|
||||
DEGENERATE}; // enabled, but expiration time too low
|
||||
MODE m_mode;
|
||||
Time m_expire;
|
||||
std::map<std::string, uint32_t> m_packetCountMap;
|
||||
std::map<std::string, uint32_t> m_dropCountMap;
|
||||
MODE m_mode; //!< Test type
|
||||
Time m_expire; //!< Expiration delay for duplicate cache entries
|
||||
std::map<std::string, uint32_t> m_packetCountMap; //!< map of received packets (node name, counter)
|
||||
std::map<std::string, uint32_t> m_dropCountMap; //!< map of received packets (node name, counter)
|
||||
|
||||
public:
|
||||
virtual void DoRun (void);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* \param enable deduplication enabled
|
||||
* \param expire expiration delay for duplicate cache entries
|
||||
*/
|
||||
Ipv4DeduplicationTest (bool enable, Time expire = Seconds (1));
|
||||
|
||||
/**
|
||||
@@ -532,9 +548,16 @@ class Ipv4DeduplicationPerformanceTest : public TestCase
|
||||
Ipv4DeduplicationPerformanceTest (void);
|
||||
virtual void DoRun (void);
|
||||
private:
|
||||
std::vector <Ptr<Socket> > m_sockets;
|
||||
std::vector <uint8_t> m_txPackets;
|
||||
uint8_t m_target;
|
||||
std::vector <Ptr<Socket> > m_sockets; //!< sockets in use
|
||||
std::vector <uint8_t> m_txPackets; //!< transmitted packets for each socket
|
||||
uint8_t m_target; //!< number of packets to transmit on each socket
|
||||
|
||||
/**
|
||||
* Send data
|
||||
* \param socket output socket
|
||||
* \param to destination address
|
||||
* \param socketIndex index of the socket
|
||||
*/
|
||||
void DoSendData (Ptr<Socket> socket, Address to, uint8_t socketIndex);
|
||||
};
|
||||
|
||||
|
||||
@@ -113,6 +113,10 @@ class Ipv4FragmentationTest: public TestCase
|
||||
|
||||
public:
|
||||
virtual void DoRun (void);
|
||||
/**
|
||||
* Constructor
|
||||
* \param broadcast send broadcast packets (true) or unicast packets (false)
|
||||
*/
|
||||
Ipv4FragmentationTest (bool broadcast);
|
||||
~Ipv4FragmentationTest ();
|
||||
|
||||
|
||||
@@ -353,6 +353,11 @@ TcpAdvertisedWindowTest::InvalidAwndCb (uint16_t oldAwnd, uint16_t newAwnd)
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* \ingroup internet-tests
|
||||
* \ingroup test
|
||||
* \brief Test the TCP's advertised window size when there is a loss of specific packets.
|
||||
*/
|
||||
class TcpAdvWindowOnLossTest : public TcpGeneralTest
|
||||
{
|
||||
public:
|
||||
@@ -361,7 +366,7 @@ public:
|
||||
* \param desc description
|
||||
* \param size segment size
|
||||
* \param packets number of packets to send
|
||||
* \param lossRatio error ratio
|
||||
* \param toDrop packets to be dropped
|
||||
*/
|
||||
TcpAdvWindowOnLossTest (const std::string &desc, uint32_t size, uint32_t packets,
|
||||
std::vector<uint32_t> &toDrop);
|
||||
|
||||
@@ -55,10 +55,14 @@ protected:
|
||||
m_recvClose = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a packet is dropped.
|
||||
* \param ipH IP header
|
||||
* \param tcpH TCP header
|
||||
* \param pkt packet
|
||||
*/
|
||||
void PktDropped (const Ipv4Header &ipH, const TcpHeader& tcpH, Ptr<const Packet> pkt);
|
||||
|
||||
virtual void BytesAvailable (uint32_t size, SocketWho who);
|
||||
|
||||
private:
|
||||
Ptr<TcpSeqErrorModel> m_errorModel; //!< The error model
|
||||
bool m_sendClose; //!< true when the sender has closed
|
||||
@@ -108,18 +112,6 @@ TcpCloseWithLossTestCase::CreateReceiverErrorModel ()
|
||||
|
||||
return m_errorModel;
|
||||
}
|
||||
|
||||
void TcpCloseWithLossTestCase::BytesAvailable(uint32_t size, SocketWho who)
|
||||
{
|
||||
if (m_synReceived && (who == SENDER))
|
||||
{
|
||||
this->GetSenderSocket()->Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_synReceived = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TcpCloseWithLossTestCase::PktDropped (const Ipv4Header &ipH, const TcpHeader& tcpH, Ptr<const Packet> pkt)
|
||||
@@ -154,8 +146,8 @@ TcpCloseWithLossTestCase::Rx (const Ptr<const Packet> p, const TcpHeader &h, Soc
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the TCP is correctly closing its state
|
||||
*/
|
||||
* Check if the TCP is correctly closing its state
|
||||
*/
|
||||
class TcpTcpCloseTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
#include "ns3/ipv4.h"
|
||||
#include "ns3/ipv6.h"
|
||||
#include "../model/ipv4-end-point.h"
|
||||
#include "../model/ipv6-end-point.h"
|
||||
#include "ns3/ipv4-end-point.h"
|
||||
#include "ns3/ipv6-end-point.h"
|
||||
#include "tcp-general-test.h"
|
||||
#include "ns3/node.h"
|
||||
#include "ns3/log.h"
|
||||
@@ -63,10 +63,10 @@ protected:
|
||||
void ConfigureEnvironment ();
|
||||
|
||||
private:
|
||||
uint32_t m_senderSent;
|
||||
uint32_t m_receiverSent;
|
||||
uint32_t m_senderReceived;
|
||||
uint8_t m_testCase;
|
||||
uint32_t m_senderSent; //!< Number of packets sent by the sender
|
||||
uint32_t m_receiverSent; //!< Number of packets sent by the receiver
|
||||
uint32_t m_senderReceived; //!< Number of packets received by the sender
|
||||
uint8_t m_testCase; //!< Test type
|
||||
};
|
||||
|
||||
TcpDctcpCodePointsTest::TcpDctcpCodePointsTest (uint8_t testCase, const std::string &desc)
|
||||
@@ -197,8 +197,8 @@ public:
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
uint32_t m_dataPacketSent;
|
||||
uint8_t m_testCase;
|
||||
uint32_t m_dataPacketSent; //!< Number of packets sent
|
||||
uint8_t m_testCase; //!< Test type
|
||||
|
||||
TcpDctcpCongestedRouter ()
|
||||
: TcpSocketMsgBase ()
|
||||
@@ -215,6 +215,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the test case type
|
||||
* \param testCase test case type
|
||||
*/
|
||||
void SetTestCase (uint8_t testCase);
|
||||
protected:
|
||||
virtual uint32_t SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck);
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "ns3/ipv6-route.h"
|
||||
#include "ns3/ipv4-routing-protocol.h"
|
||||
#include "ns3/ipv6-routing-protocol.h"
|
||||
#include "../model/ipv4-end-point.h"
|
||||
#include "../model/ipv6-end-point.h"
|
||||
#include "ns3/ipv4-end-point.h"
|
||||
#include "ns3/ipv6-end-point.h"
|
||||
#include "tcp-general-test.h"
|
||||
#include "ns3/node.h"
|
||||
#include "ns3/log.h"
|
||||
@@ -69,11 +69,11 @@ protected:
|
||||
void ConfigureProperties ();
|
||||
|
||||
private:
|
||||
uint32_t m_cwndChangeCount;
|
||||
uint32_t m_senderSent;
|
||||
uint32_t m_senderReceived;
|
||||
uint32_t m_receiverReceived;
|
||||
uint32_t m_testcase;
|
||||
uint32_t m_cwndChangeCount; //!< Number of times the congestion window did change
|
||||
uint32_t m_senderSent; //!< Number of segments sent by the sender
|
||||
uint32_t m_senderReceived; //!< Number of segments received by the sender
|
||||
uint32_t m_receiverReceived; //!< Number of segments received by the receiver
|
||||
uint32_t m_testcase; //!< Test case type
|
||||
};
|
||||
|
||||
|
||||
@@ -98,8 +98,8 @@ public:
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
uint32_t m_dataPacketSent;
|
||||
uint8_t m_testcase;
|
||||
uint32_t m_dataPacketSent; //!< Number of packets sent
|
||||
uint8_t m_testcase; //!< Test case type
|
||||
|
||||
TcpSocketCongestedRouter ()
|
||||
: TcpSocketMsgBase ()
|
||||
@@ -116,6 +116,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the test case type
|
||||
* \param testCase Test case type
|
||||
*/
|
||||
void SetTestCase (uint8_t testCase);
|
||||
|
||||
protected:
|
||||
@@ -528,7 +532,7 @@ TcpEcnTest::CreateSenderSocket (Ptr<Node> node)
|
||||
*
|
||||
* \brief TCP ECN TestSuite
|
||||
*/
|
||||
static class TcpEcnTestSuite : public TestSuite
|
||||
class TcpEcnTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
TcpEcnTestSuite () : TestSuite ("tcp-ecn-test", UNIT)
|
||||
@@ -546,6 +550,8 @@ public:
|
||||
AddTestCase (new TcpEcnTest (6, "Congestion Window Reduction Test :ECN capable sender and ECN capable receiver"),
|
||||
TestCase::QUICK);
|
||||
}
|
||||
} g_tcpECNTestSuite;
|
||||
};
|
||||
|
||||
static TcpEcnTestSuite g_tcpECNTestSuite; //!< static var for test initialization
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/queue.h"
|
||||
#include "ns3/tcp-l4-protocol.h"
|
||||
#include "../model/ipv4-end-point.h"
|
||||
#include "../model/ipv6-end-point.h"
|
||||
#include "ns3/ipv4-end-point.h"
|
||||
#include "ns3/ipv6-end-point.h"
|
||||
#include "ns3/tcp-header.h"
|
||||
#include "ns3/tcp-tx-buffer.h"
|
||||
#include "ns3/tcp-rx-buffer.h"
|
||||
|
||||
@@ -619,7 +619,7 @@ protected:
|
||||
* \brief Enable or disable pacing of the initial window
|
||||
*
|
||||
* \param who socket
|
||||
* \param pacing Boolean to enable or disable pacing of initial window
|
||||
* \param paceWindow Boolean to enable or disable pacing of initial window
|
||||
*/
|
||||
void SetPaceInitialWindow (SocketWho who, bool paceWindow);
|
||||
|
||||
@@ -682,7 +682,7 @@ protected:
|
||||
*
|
||||
* \param recovery typeid of the recovery algorithm
|
||||
*/
|
||||
void SetRecoveryAlgorithm (TypeId reccovery) { m_recoveryTypeId = reccovery; }
|
||||
void SetRecoveryAlgorithm (TypeId recovery) { m_recoveryTypeId = recovery; }
|
||||
|
||||
/**
|
||||
* \brief MTU of the bottleneck link
|
||||
|
||||
@@ -29,15 +29,21 @@ using namespace ns3;
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("TcpLinuxRenoTest");
|
||||
|
||||
// This unit test checks that the slow start and congestion avoidance
|
||||
// behavior matches Linux behavior as follows:
|
||||
// 1) in both slow start and congestion avoidance phases, presence or
|
||||
// absence of delayed acks does not alter the window growth
|
||||
// 2) in congestion avoidance phase, the arithmetic for counting the number
|
||||
// of segments acked and deciding when to increment the congestion window
|
||||
// (i.e. following the Linux function tcp_cong_avoid_ai()) is followed.
|
||||
// Different segment sizes (524 bytes and 1500 bytes) are tested.
|
||||
|
||||
/**
|
||||
* \ingroup internet-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* This unit test checks that the slow start and congestion avoidance
|
||||
* behavior matches Linux behavior as follows:
|
||||
* 1) in both slow start and congestion avoidance phases, presence or
|
||||
* absence of delayed acks does not alter the window growth
|
||||
* 2) in congestion avoidance phase, the arithmetic for counting the number
|
||||
* of segments acked and deciding when to increment the congestion window
|
||||
* (i.e. following the Linux function tcp_cong_avoid_ai()) is followed.
|
||||
* Different segment sizes (524 bytes and 1500 bytes) are tested.
|
||||
*
|
||||
* This is the Slow Start test.
|
||||
*/
|
||||
class
|
||||
TcpLinuxRenoSSTest : public TcpGeneralTest
|
||||
{
|
||||
@@ -181,6 +187,21 @@ TcpLinuxRenoSSTest::DoTeardown (void)
|
||||
TcpGeneralTest::DoTeardown (); // call up to base class method to finish
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup internet-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* This unit test checks that the slow start and congestion avoidance
|
||||
* behavior matches Linux behavior as follows:
|
||||
* 1) in both slow start and congestion avoidance phases, presence or
|
||||
* absence of delayed acks does not alter the window growth
|
||||
* 2) in congestion avoidance phase, the arithmetic for counting the number
|
||||
* of segments acked and deciding when to increment the congestion window
|
||||
* (i.e. following the Linux function tcp_cong_avoid_ai()) is followed.
|
||||
* Different segment sizes (524 bytes and 1500 bytes) are tested.
|
||||
*
|
||||
* This is the Congestion avoidance test.
|
||||
*/
|
||||
class
|
||||
TcpLinuxRenoCongAvoidTest : public TcpGeneralTest
|
||||
{
|
||||
|
||||
@@ -74,12 +74,12 @@ protected:
|
||||
const TcpSocketState::TcpCongState_t newValue);
|
||||
Ptr<ErrorModel> CreateReceiverErrorModel ();
|
||||
private:
|
||||
uint32_t m_firstLoss;
|
||||
uint32_t m_secondLoss;
|
||||
uint32_t m_sent {0};
|
||||
uint32_t m_received {0};
|
||||
uint32_t m_lastSegment {0};
|
||||
std::list<int> m_expectedStates;
|
||||
uint32_t m_firstLoss; //!< First segment loss
|
||||
uint32_t m_secondLoss; //!< Second segment loss
|
||||
uint32_t m_sent {0}; //!< Number of segments sent
|
||||
uint32_t m_received {0}; //!< Number of segments received
|
||||
uint32_t m_lastSegment {0}; //!< Last received segment
|
||||
std::list<int> m_expectedStates; //!< Expected TCP states
|
||||
};
|
||||
|
||||
TcpLargeTransferLossTest::TcpLargeTransferLossTest (uint32_t firstLoss, uint32_t secondLoss, uint32_t lastSegment, const std::string &desc)
|
||||
|
||||
@@ -32,23 +32,34 @@ namespace ns3 {
|
||||
NS_LOG_COMPONENT_DEFINE ("TcpLpTestSuite");
|
||||
|
||||
/**
|
||||
* \ingroup internet-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Testing the behaviour common to New Reno
|
||||
*/
|
||||
class TcpLpToNewReno : public TestCase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* \param cWnd Congestion window size
|
||||
* \param segmentSize Segment size
|
||||
* \param segmentsAcked Segments acked
|
||||
* \param ssThresh Slow start threshold
|
||||
* \param rtt RTT
|
||||
* \param name Test case name
|
||||
*/
|
||||
TcpLpToNewReno (uint32_t cWnd, uint32_t segmentSize,
|
||||
uint32_t segmentsAcked,uint32_t ssThresh, Time rtt, const std::string &name);
|
||||
uint32_t segmentsAcked, uint32_t ssThresh, Time rtt, const std::string &name);
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
void ExecuteTest (void);
|
||||
uint32_t m_cWnd;
|
||||
uint32_t m_segmentSize;
|
||||
uint32_t m_ssThresh;
|
||||
uint32_t m_segmentsAcked;
|
||||
Time m_rtt;
|
||||
Ptr<TcpSocketState> m_state;
|
||||
uint32_t m_cWnd; //!< Congestion window size
|
||||
uint32_t m_segmentSize; //!< Segment size
|
||||
uint32_t m_ssThresh; //!< Slow start threshold
|
||||
uint32_t m_segmentsAcked; //!< Segments acked
|
||||
Time m_rtt; //!< RTT
|
||||
Ptr<TcpSocketState> m_state; //!< TCP socket state
|
||||
};
|
||||
|
||||
TcpLpToNewReno::TcpLpToNewReno (uint32_t cWnd, uint32_t segmentSize,
|
||||
@@ -64,14 +75,6 @@ TcpLpToNewReno::TcpLpToNewReno (uint32_t cWnd, uint32_t segmentSize,
|
||||
|
||||
void
|
||||
TcpLpToNewReno::DoRun ()
|
||||
{
|
||||
Simulator::Schedule (Seconds (0.0), &TcpLpToNewReno::ExecuteTest, this);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
|
||||
void
|
||||
TcpLpToNewReno::ExecuteTest ()
|
||||
{
|
||||
m_state = CreateObject <TcpSocketState> ();
|
||||
m_state->m_cWnd = m_cWnd;
|
||||
@@ -96,26 +99,38 @@ TcpLpToNewReno::ExecuteTest ()
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ (m_state->m_cWnd.Get (), state->m_cWnd.Get (),
|
||||
"cWnd has not updated correctly");
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
/**
|
||||
* \brief Testing TcpLp when owd exceeds threshold
|
||||
*/
|
||||
|
||||
/**
|
||||
* \ingroup internet-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Testing TcpLp when cwd exceeds threshold
|
||||
*/
|
||||
class TcpLpInferenceTest1 : public TestCase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* \param cWnd Congestion window size
|
||||
* \param segmentSize Segment size
|
||||
* \param segmentsAcked Segments acked
|
||||
* \param rtt RTT
|
||||
* \param name Test case name
|
||||
*/
|
||||
TcpLpInferenceTest1 (uint32_t cWnd, uint32_t segmentSize,
|
||||
uint32_t segmentsAcked, Time rtt, const std::string &name);
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
void ExecuteTest (void);
|
||||
|
||||
uint32_t m_cWnd;
|
||||
uint32_t m_segmentSize;
|
||||
uint32_t m_segmentsAcked;
|
||||
Time m_rtt;
|
||||
Ptr<TcpSocketState> m_state;
|
||||
uint32_t m_cWnd; //!< Congestion window size
|
||||
uint32_t m_segmentSize; //!< Segment size
|
||||
uint32_t m_segmentsAcked; //!< Segments acked
|
||||
Time m_rtt; //!< RTT
|
||||
Ptr<TcpSocketState> m_state; //!< TCP socket state
|
||||
};
|
||||
|
||||
TcpLpInferenceTest1::TcpLpInferenceTest1 (uint32_t cWnd, uint32_t segmentSize,
|
||||
@@ -130,14 +145,6 @@ TcpLpInferenceTest1::TcpLpInferenceTest1 (uint32_t cWnd, uint32_t segmentSize,
|
||||
|
||||
void
|
||||
TcpLpInferenceTest1::DoRun ()
|
||||
{
|
||||
Simulator::Schedule (Seconds (0.0), &TcpLpInferenceTest1::ExecuteTest, this);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
|
||||
void
|
||||
TcpLpInferenceTest1::ExecuteTest ()
|
||||
{
|
||||
m_state = CreateObject <TcpSocketState> ();
|
||||
m_state->m_cWnd = m_cWnd;
|
||||
@@ -157,26 +164,38 @@ TcpLpInferenceTest1::ExecuteTest ()
|
||||
m_cWnd = m_cWnd / 2;
|
||||
NS_TEST_ASSERT_MSG_EQ (m_state->m_cWnd.Get (), m_cWnd,
|
||||
"cWnd has not updated correctly");
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup internet-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Testing TcpLp when it is inference phase
|
||||
*/
|
||||
class TcpLpInferenceTest2 : public TestCase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* \param cWnd Congestion window size
|
||||
* \param segmentSize Segment size
|
||||
* \param segmentsAcked Segments acked
|
||||
* \param rtt RTT
|
||||
* \param name Test case name
|
||||
*/
|
||||
TcpLpInferenceTest2 (uint32_t cWnd, uint32_t segmentSize,
|
||||
uint32_t segmentsAcked, Time rtt, const std::string &name);
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
void ExecuteTest (void);
|
||||
|
||||
uint32_t m_cWnd;
|
||||
uint32_t m_segmentSize;
|
||||
uint32_t m_segmentsAcked;
|
||||
Time m_rtt;
|
||||
Ptr<TcpSocketState> m_state;
|
||||
uint32_t m_cWnd; //!< Congestion window size
|
||||
uint32_t m_segmentSize; //!< Segment size
|
||||
uint32_t m_segmentsAcked; //!< Segments acked
|
||||
Time m_rtt; //!< RTT
|
||||
Ptr<TcpSocketState> m_state; //!< TCP socket state
|
||||
};
|
||||
|
||||
TcpLpInferenceTest2::TcpLpInferenceTest2 (uint32_t cWnd, uint32_t segmentSize,uint32_t segmentsAcked, Time rtt, const std::string &name)
|
||||
@@ -190,14 +209,6 @@ TcpLpInferenceTest2::TcpLpInferenceTest2 (uint32_t cWnd, uint32_t segmentSize,ui
|
||||
|
||||
void
|
||||
TcpLpInferenceTest2::DoRun ()
|
||||
{
|
||||
Simulator::Schedule (Seconds (0.0), &TcpLpInferenceTest2::ExecuteTest, this);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
|
||||
void
|
||||
TcpLpInferenceTest2::ExecuteTest ()
|
||||
{
|
||||
m_state = CreateObject <TcpSocketState> ();
|
||||
m_state->m_cWnd = m_cWnd;
|
||||
@@ -221,19 +232,29 @@ TcpLpInferenceTest2::ExecuteTest ()
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ (m_state->m_cWnd.Get (), m_cWnd,
|
||||
"cWnd has not updated correctly");
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
|
||||
static class TcpLpTestSuite : public TestSuite
|
||||
/**
|
||||
* \ingroup internet-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* Test the behaviour common to New Reno
|
||||
*/
|
||||
class TcpLpTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
TcpLpTestSuite () : TestSuite ("tcp-lp-test", UNIT)
|
||||
{
|
||||
AddTestCase (new TcpLpToNewReno (4 * 1446, 1446,2, 2 * 1446, MilliSeconds (100), "LP falls to New Reno if the owd is within threshold"), TestCase::QUICK);
|
||||
AddTestCase (new TcpLpToNewReno (4 * 1446, 1446, 2, 2 * 1446, MilliSeconds (100), "LP falls to New Reno if the cwd is within threshold"), TestCase::QUICK);
|
||||
|
||||
AddTestCase (new TcpLpInferenceTest1 (2 * 1446, 1446,2, MilliSeconds (100), "LP enters Inference phase when owd exceeds threshold for the first time"), TestCase::QUICK);
|
||||
AddTestCase (new TcpLpInferenceTest1 (2 * 1446, 1446, 2, MilliSeconds (100), "LP enters Inference phase when cwd exceeds threshold for the first time"), TestCase::QUICK);
|
||||
|
||||
AddTestCase (new TcpLpInferenceTest2 (2 * 1446, 1446,2, MilliSeconds (100), "LP reduces cWnd to 1 if owd exceeds threshold in inference phase"), TestCase::QUICK);
|
||||
AddTestCase (new TcpLpInferenceTest2 (2 * 1446, 1446, 2, MilliSeconds (100), "LP reduces cWnd to 1 if cwd exceeds threshold in inference phase"), TestCase::QUICK);
|
||||
}
|
||||
} g_tcplpTest;
|
||||
};
|
||||
|
||||
static TcpLpTestSuite g_tcplpTest; //!< static var for test initialization
|
||||
|
||||
}
|
||||
|
||||
@@ -44,31 +44,47 @@ class MimicCongControl;
|
||||
class TcpRateLinuxBasicTest : public TestCase
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* \param cWnd Congestion window size
|
||||
* \param tailSeq Tail sequence number
|
||||
* \param nextTx Tx next sequence number
|
||||
* \param testCase test case type
|
||||
* \param testName test name
|
||||
*/
|
||||
TcpRateLinuxBasicTest (uint32_t cWnd, SequenceNumber32 tailSeq, SequenceNumber32 nextTx,
|
||||
uint32_t lostOut, uint32_t retransOut, uint32_t testCase,
|
||||
std::string testName);
|
||||
uint32_t testCase, std::string testName);
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
|
||||
/**
|
||||
* Send an application packet
|
||||
* \param skb the data to send
|
||||
*/
|
||||
void SendSkb (TcpTxItem * skb);
|
||||
/**
|
||||
* Deliver an application packet
|
||||
* \param skb the data to deliver
|
||||
*/
|
||||
void SkbDelivered (TcpTxItem * skb);
|
||||
|
||||
TcpRateLinux m_rateOps;
|
||||
uint32_t m_cWnd;
|
||||
uint32_t m_inFlight;
|
||||
uint32_t m_segmentSize;
|
||||
uint32_t m_delivered;
|
||||
Time m_deliveredTime;
|
||||
SequenceNumber32 m_tailSeq;
|
||||
SequenceNumber32 m_nextTx;
|
||||
uint32_t m_testCase;
|
||||
std::vector <TcpTxItem *> m_skbs;
|
||||
TcpRateLinux m_rateOps; //!< Rate information for TCP
|
||||
uint32_t m_cWnd; //!< Congestion window size
|
||||
uint32_t m_inFlight; //!< Number of packets in-flight
|
||||
uint32_t m_segmentSize; //!< Segment size
|
||||
uint32_t m_delivered; //!< Number of segments delivered
|
||||
Time m_deliveredTime; //!< Last time of a delivery
|
||||
SequenceNumber32 m_tailSeq; //!< Tail sequence number
|
||||
SequenceNumber32 m_nextTx; //!< Tx next sequence number
|
||||
uint32_t m_testCase; //!< Test case type
|
||||
std::vector <TcpTxItem *> m_skbs; //!< Application packets
|
||||
};
|
||||
|
||||
TcpRateLinuxBasicTest::TcpRateLinuxBasicTest (uint32_t cWnd, SequenceNumber32 tailSeq,
|
||||
SequenceNumber32 nextTx, uint32_t lostOut,
|
||||
uint32_t retransOut, uint32_t testCase, std::string testName)
|
||||
SequenceNumber32 nextTx,
|
||||
uint32_t testCase, std::string testName)
|
||||
: TestCase (testName),
|
||||
m_cWnd (cWnd),
|
||||
m_inFlight (0),
|
||||
@@ -548,8 +564,8 @@ public:
|
||||
TcpRateOpsTestSuite ()
|
||||
: TestSuite ("tcp-rate-ops", UNIT)
|
||||
{
|
||||
AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (20), SequenceNumber32 (11), 1, 0, 0, "Testing SkbDelivered and SkbSent"), TestCase::QUICK);
|
||||
AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (11), SequenceNumber32 (11), 2, 0, 0, "Testing SkbDelivered and SkbSent with app limited data"), TestCase::QUICK);
|
||||
AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (20), SequenceNumber32 (11), 1, "Testing SkbDelivered and SkbSent"), TestCase::QUICK);
|
||||
AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (11), SequenceNumber32 (11), 2, "Testing SkbDelivered and SkbSent with app limited data"), TestCase::QUICK);
|
||||
|
||||
std::vector<uint32_t> toDrop;
|
||||
toDrop.push_back (4001);
|
||||
|
||||
@@ -51,8 +51,8 @@ public:
|
||||
virtual void DoRun ();
|
||||
|
||||
private:
|
||||
bool m_connectionFailed{false};
|
||||
bool m_useEcn {false};
|
||||
bool m_connectionFailed{false}; //!< Connection failure indicator
|
||||
bool m_useEcn {false}; //!< Use ECN (true or false)
|
||||
};
|
||||
|
||||
TcpSynConnectionFailedTest::TcpSynConnectionFailedTest (std::string desc, bool useEcn) : TestCase (desc), m_useEcn (useEcn)
|
||||
|
||||
@@ -53,7 +53,10 @@ private:
|
||||
/** \brief Test the logic of merging items in GetTransmittedSegment()
|
||||
* which is triggered by CopyFromSequence()*/
|
||||
void TestMergeItemsWhenGetTransmittedSegment ();
|
||||
/** \brief Callback to provide a value of receiver window */
|
||||
/**
|
||||
* \brief Callback to provide a value of receiver window
|
||||
* \returns the receiver window size
|
||||
*/
|
||||
uint32_t GetRWnd (void) const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user