Bugs 458, swap 2 LOC for 526
This commit is contained in:
@@ -57,9 +57,14 @@ static uint32_t txBytes = 2000000;
|
||||
void StartFlow(Ptr<Socket>, Ipv4Address, uint16_t);
|
||||
void WriteUntilBufferFull (Ptr<Socket>, uint32_t);
|
||||
|
||||
static void
|
||||
CwndTracer (uint32_t oldval, uint32_t newval)
|
||||
{
|
||||
NS_LOG_INFO ("Moving cwnd from " << oldval << " to " << newval);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
// Users may find it convenient to turn on explicit debugging
|
||||
// for selected modules; the below lines suggest how to do this
|
||||
// LogComponentEnable("TcpL4Protocol", LOG_LEVEL_ALL);
|
||||
@@ -67,9 +72,6 @@ int main (int argc, char *argv[])
|
||||
// LogComponentEnable("PacketSink", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable("TcpLargeTransfer", LOG_LEVEL_ALL);
|
||||
|
||||
|
||||
// Allow the user to override any of the defaults and the above
|
||||
// Bind()s at run-time, via command-line arguments
|
||||
CommandLine cmd;
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
@@ -140,6 +142,9 @@ int main (int argc, char *argv[])
|
||||
Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
|
||||
localSocket->Bind ();
|
||||
|
||||
// Trace changes to the congestion window
|
||||
Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeCallback (&CwndTracer));
|
||||
|
||||
// ...and schedule the sending "Application"; This is similar to what an
|
||||
// ns3::Application subclass would do internally.
|
||||
Simulator::ScheduleNow (&StartFlow, localSocket,
|
||||
|
||||
@@ -43,6 +43,11 @@ using namespace ns3;
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("TcpNscLfn");
|
||||
|
||||
static void
|
||||
CwndTracer (uint32_t oldval, uint32_t newval)
|
||||
{
|
||||
NS_LOG_INFO ("Moving cwnd from " << oldval << " to " << newval);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
@@ -133,6 +138,10 @@ int main (int argc, char *argv[])
|
||||
clientApp.Stop (Seconds (runtime + 1.0 + i));
|
||||
}
|
||||
|
||||
// Trace changes to the congestion window
|
||||
Config::ConnectWithoutContext ("/NodeList/1/$ns3::NscTcpL4Protocol/SocketList/0/CongestionWindow",
|
||||
MakeCallback (&CwndTracer));
|
||||
|
||||
// This tells ns-3 to generate pcap traces.
|
||||
PointToPointHelper::EnablePcapAll ("tcp-nsc-lfn");
|
||||
|
||||
|
||||
@@ -167,6 +167,7 @@ PointToPointNetDevice::PointToPointNetDevice ()
|
||||
|
||||
PointToPointNetDevice::~PointToPointNetDevice ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -226,8 +227,8 @@ PointToPointNetDevice::TransmitStart (Ptr<Packet> p)
|
||||
//
|
||||
NS_ASSERT_MSG(m_txMachineState == READY, "Must be READY to transmit");
|
||||
m_txMachineState = BUSY;
|
||||
m_phyTxBeginTrace (m_currentPkt);
|
||||
m_currentPkt = p;
|
||||
m_phyTxBeginTrace (m_currentPkt);
|
||||
|
||||
Time txTime = Seconds (m_bps.CalculateTxTime(p->GetSize()));
|
||||
Time txCompleteTime = txTime + m_tInterframeGap;
|
||||
|
||||
@@ -54,6 +54,8 @@ AddUdpStack(Ptr<Node> node)
|
||||
Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
|
||||
udp->SetNode (node);
|
||||
ipv4->Insert (udp);
|
||||
node->AggregateObject (udp);
|
||||
|
||||
Ptr<UdpSocketFactoryImpl> udpFactory = CreateObject<UdpSocketFactoryImpl> ();
|
||||
udpFactory->SetUdp (udp);
|
||||
node->AggregateObject (udpFactory);
|
||||
@@ -66,6 +68,8 @@ AddIcmpStack (Ptr<Node> node)
|
||||
Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> ();
|
||||
icmp->SetNode (node);
|
||||
ipv4->Insert (icmp);
|
||||
node->AggregateObject (icmp);
|
||||
|
||||
Ptr<Ipv4RawSocketFactoryImpl> rawFactory = CreateObject<Ipv4RawSocketFactoryImpl> ();
|
||||
node->AggregateObject (rawFactory);
|
||||
}
|
||||
@@ -76,8 +80,8 @@ AddTcpStack(Ptr<Node> node)
|
||||
Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
|
||||
Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
|
||||
tcp->SetNode (node);
|
||||
|
||||
ipv4->Insert (tcp);
|
||||
node->AggregateObject (tcp);
|
||||
|
||||
Ptr<TcpSocketFactoryImpl> tcpFactory = CreateObject<TcpSocketFactoryImpl> ();
|
||||
tcpFactory->SetTcp (tcp);
|
||||
@@ -114,6 +118,8 @@ AddNscStack(Ptr<Node> node, const std::string &soname)
|
||||
tcp->SetNscLibrary(soname);
|
||||
tcp->SetNode (node);
|
||||
ipv4->Insert (tcp);
|
||||
node->AggregateObject (tcp);
|
||||
|
||||
Ptr<NscTcpSocketFactoryImpl> tcpFactory = CreateObject<NscTcpSocketFactoryImpl> ();
|
||||
tcpFactory->SetTcp (tcp);
|
||||
node->AggregateObject (tcpFactory);
|
||||
|
||||
@@ -152,15 +152,13 @@ Ipv4L3Protocol::DoDispose (void)
|
||||
NS_LOG_FUNCTION (this);
|
||||
for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
|
||||
{
|
||||
(*i)->Dispose ();
|
||||
*i = 0;
|
||||
}
|
||||
m_protocols.clear ();
|
||||
|
||||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); ++i)
|
||||
for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); ++i)
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = *i;
|
||||
interface->Dispose ();
|
||||
*i = 0;
|
||||
}
|
||||
m_interfaces.clear ();
|
||||
m_node = 0;
|
||||
|
||||
@@ -24,12 +24,13 @@
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/node.h"
|
||||
|
||||
#include "ns3/object-vector.h"
|
||||
|
||||
#include "tcp-header.h"
|
||||
#include "ipv4-end-point-demux.h"
|
||||
#include "ipv4-end-point.h"
|
||||
#include "ipv4-l3-protocol.h"
|
||||
#include "nsc-tcp-l4-protocol.h"
|
||||
#include "nsc-tcp-socket-impl.h"
|
||||
#include "nsc-sysctl.h"
|
||||
|
||||
#include "tcp-typedefs.h"
|
||||
@@ -70,6 +71,10 @@ NscTcpL4Protocol::GetTypeId (void)
|
||||
ObjectFactoryValue (GetDefaultRttEstimatorFactory ()),
|
||||
MakeObjectFactoryAccessor (&NscTcpL4Protocol::m_rttFactory),
|
||||
MakeObjectFactoryChecker ())
|
||||
.AddAttribute ("SocketList", "The list of sockets associated to this protocol.",
|
||||
ObjectVectorValue (),
|
||||
MakeObjectVectorAccessor (&NscTcpL4Protocol::m_sockets),
|
||||
MakeObjectVectorChecker<NscTcpSocketImpl> ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -154,6 +159,14 @@ void
|
||||
NscTcpL4Protocol::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
for (std::vector<Ptr<NscTcpSocketImpl> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++)
|
||||
{
|
||||
*i = 0;
|
||||
}
|
||||
m_sockets.clear ();
|
||||
|
||||
|
||||
if (m_endPoints != 0)
|
||||
{
|
||||
delete m_endPoints;
|
||||
@@ -173,6 +186,7 @@ NscTcpL4Protocol::CreateSocket (void)
|
||||
socket->SetNode (m_node);
|
||||
socket->SetTcp (this);
|
||||
socket->SetRtt (rtt);
|
||||
m_sockets.push_back (socket);
|
||||
return socket;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "ns3/timer.h"
|
||||
#include "sim_interface.h"
|
||||
#include "nsc-tcp-socket-impl.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -116,6 +117,7 @@ private:
|
||||
INetStack* m_nscStack;
|
||||
void *m_dlopenHandle;
|
||||
Timer m_softTimer;
|
||||
std::vector<Ptr<NscTcpSocketImpl> > m_sockets;
|
||||
};
|
||||
|
||||
}; // namespace ns3
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "nsc-tcp-socket-factory-impl.h"
|
||||
#include "nsc-tcp-l4-protocol.h"
|
||||
#include "nsc-tcp-socket-factory-impl.h"
|
||||
#include "ns3/socket.h"
|
||||
#include "ns3/assert.h"
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/boolean.h"
|
||||
#include "ns3/object-vector.h"
|
||||
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/node.h"
|
||||
@@ -31,7 +32,6 @@
|
||||
#include "ipv4-end-point-demux.h"
|
||||
#include "ipv4-end-point.h"
|
||||
#include "ipv4-l3-protocol.h"
|
||||
#include "tcp-socket-impl.h"
|
||||
|
||||
#include "tcp-typedefs.h"
|
||||
|
||||
@@ -334,6 +334,10 @@ TcpL4Protocol::GetTypeId (void)
|
||||
BooleanValue (false),
|
||||
MakeBooleanAccessor (&TcpL4Protocol::m_calcChecksum),
|
||||
MakeBooleanChecker ())
|
||||
.AddAttribute ("SocketList", "The list of sockets associated to this protocol.",
|
||||
ObjectVectorValue (),
|
||||
MakeObjectVectorAccessor (&TcpL4Protocol::m_sockets),
|
||||
MakeObjectVectorChecker<TcpSocketImpl> ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -366,11 +370,18 @@ void
|
||||
TcpL4Protocol::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
for (std::vector<Ptr<TcpSocketImpl> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++)
|
||||
{
|
||||
*i = 0;
|
||||
}
|
||||
m_sockets.clear ();
|
||||
|
||||
if (m_endPoints != 0)
|
||||
{
|
||||
delete m_endPoints;
|
||||
m_endPoints = 0;
|
||||
}
|
||||
|
||||
m_node = 0;
|
||||
Ipv4L4Protocol::DoDispose ();
|
||||
}
|
||||
@@ -384,6 +395,7 @@ TcpL4Protocol::CreateSocket (void)
|
||||
socket->SetNode (m_node);
|
||||
socket->SetTcp (this);
|
||||
socket->SetRtt (rtt);
|
||||
m_sockets.push_back (socket);
|
||||
return socket;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "ipv4-l4-protocol.h"
|
||||
#include "ipv4-interface.h"
|
||||
|
||||
#include "tcp-socket-impl.h"
|
||||
#include "tcp-header.h"
|
||||
#include "tcp-typedefs.h"
|
||||
|
||||
@@ -120,6 +121,7 @@ private:
|
||||
|
||||
bool m_goodChecksum;
|
||||
bool m_calcChecksum;
|
||||
std::vector<Ptr<TcpSocketImpl> > m_sockets;
|
||||
};
|
||||
|
||||
}; // namespace ns3
|
||||
|
||||
Reference in New Issue
Block a user