move Tcp to TcpSocketFactory
This commit is contained in:
@@ -169,15 +169,15 @@ int main (int argc, char *argv[])
|
||||
uint16_t servPort = 50000;
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
PacketSinkHelper sink ("ns3::Tcp",
|
||||
PacketSinkHelper sink ("ns3::TcpSocketFactory",
|
||||
InetSocketAddress (Ipv4Address::GetAny (), servPort));
|
||||
|
||||
ApplicationContainer apps = sink.Install (c1.Get (1));
|
||||
apps.Start (Seconds (0.0));
|
||||
|
||||
// and generate traffic to remote sink.
|
||||
//TypeId tid = TypeId::LookupByName ("ns3::Tcp");
|
||||
Ptr<Socket> localSocket = Socket::CreateSocket (c0.Get (0), Tcp::GetTypeId ());
|
||||
//TypeId tid = TypeId::LookupByName ("ns3::TcpSocketFactory");
|
||||
Ptr<Socket> localSocket = Socket::CreateSocket (c0.Get (0), TcpSocketFactory::GetTypeId ());
|
||||
localSocket->Bind ();
|
||||
Simulator::ScheduleNow (&StartFlow, localSocket, nBytes,
|
||||
ipInterfs.GetAddress (1), servPort);
|
||||
|
||||
@@ -47,7 +47,7 @@ PacketSinkHelper::SetUdpLocal (Ipv4Address ip, uint16_t port)
|
||||
void
|
||||
PacketSinkHelper::SetTcpLocal (Ipv4Address ip, uint16_t port)
|
||||
{
|
||||
m_factory.Set ("Protocol", String ("ns3::Tcp"));
|
||||
m_factory.Set ("Protocol", String ("ns3::TcpSocketFactory"));
|
||||
m_factory.Set ("Local", Address (InetSocketAddress (ip, port)));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <stdint.h>
|
||||
#include "ns3/header.h"
|
||||
#include "ns3/buffer.h"
|
||||
#include "ns3/tcp.h"
|
||||
#include "ns3/tcp-socket-factory.h"
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/sequence-number.h"
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ void
|
||||
TcpImpl::DoDispose (void)
|
||||
{
|
||||
m_tcp = 0;
|
||||
Tcp::DoDispose ();
|
||||
TcpSocketFactory::DoDispose ();
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef TCP_IMPL_H
|
||||
#define TCP_IMPL_H
|
||||
|
||||
#include "ns3/tcp.h"
|
||||
#include "ns3/tcp-socket-factory.h"
|
||||
#include "ns3/ptr.h"
|
||||
|
||||
namespace ns3 {
|
||||
@@ -39,7 +39,7 @@ class TcpL4Protocol;
|
||||
*
|
||||
* Most of the logic is in class ns3::TcpSocketImpl.
|
||||
*/
|
||||
class TcpImpl : public Tcp
|
||||
class TcpImpl : public TcpSocketFactory
|
||||
{
|
||||
public:
|
||||
TcpImpl ();
|
||||
|
||||
@@ -176,7 +176,7 @@ void
|
||||
TcpSocketImpl::SetNode (Ptr<Node> node)
|
||||
{
|
||||
m_node = node;
|
||||
Ptr<Tcp> t = node->GetObject<Tcp> ();
|
||||
Ptr<TcpSocketFactory> t = node->GetObject<TcpSocketFactory> ();
|
||||
m_segmentSize = t->GetDefaultSegSize ();
|
||||
m_rxWindowSize = t->GetDefaultAdvWin ();
|
||||
m_advertisedWindowSize = t->GetDefaultAdvWin ();
|
||||
|
||||
@@ -17,122 +17,122 @@
|
||||
*
|
||||
* Author: Raj Bhattacharjea <raj.b@gatech.edu>
|
||||
*/
|
||||
#include "tcp.h"
|
||||
#include "tcp-socket-factory.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/double.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Tcp);
|
||||
NS_OBJECT_ENSURE_REGISTERED (TcpSocketFactory);
|
||||
|
||||
TypeId
|
||||
Tcp::GetTypeId (void)
|
||||
TcpSocketFactory::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Tcp")
|
||||
static TypeId tid = TypeId ("ns3::TcpSocketFactory")
|
||||
.SetParent<SocketFactory> ()
|
||||
.AddAttribute ("DefaultSegmentSize",
|
||||
"Default TCP maximum segment size in bytes (may be adjusted based on MTU discovery)",
|
||||
UintegerValue (536),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultSegSize),
|
||||
MakeUintegerAccessor (&TcpSocketFactory::m_defaultSegSize),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultAdvertisedWindowSize",
|
||||
"Default TCP advertised window size (bytes)",
|
||||
UintegerValue (0xffff),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultAdvWin),
|
||||
MakeUintegerAccessor (&TcpSocketFactory::m_defaultAdvWin),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultSlowStartThreshold",
|
||||
"Default TCP slow start threshold (bytes)",
|
||||
UintegerValue (0xffff),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultSsThresh),
|
||||
MakeUintegerAccessor (&TcpSocketFactory::m_defaultSsThresh),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultTxBufferSize",
|
||||
"Default TCP maximum transmit buffer size (bytes)",
|
||||
UintegerValue (0xffffffffl),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultTxBuffer),
|
||||
MakeUintegerAccessor (&TcpSocketFactory::m_defaultTxBuffer),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultRxBufferSize",
|
||||
"Default TCP maximum receive buffer size (bytes)",
|
||||
UintegerValue (0xffffffffl),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultRxBuffer),
|
||||
MakeUintegerAccessor (&TcpSocketFactory::m_defaultRxBuffer),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultInitialCongestionWindowSize",
|
||||
"Default TCP initial congestion window size (segments)",
|
||||
UintegerValue (1),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultInitialCwnd),
|
||||
MakeUintegerAccessor (&TcpSocketFactory::m_defaultInitialCwnd),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultConnTimeout",
|
||||
"Default TCP retransmission timeout when opening connection (seconds)",
|
||||
UintegerValue (3),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultConnTimeout),
|
||||
MakeUintegerAccessor (&TcpSocketFactory::m_defaultConnTimeout),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultConnCount",
|
||||
"Default number of connection attempts (SYN retransmissions) before returning failure",
|
||||
UintegerValue (6),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultConnCount),
|
||||
MakeUintegerAccessor (&TcpSocketFactory::m_defaultConnCount),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("DefaultDelAckTimeout",
|
||||
"Default timeout value for TCP delayed acks, in seconds",
|
||||
DoubleValue (0.2),
|
||||
MakeDoubleAccessor (&Tcp::m_defaultDelAckTimeout),
|
||||
MakeDoubleAccessor (&TcpSocketFactory::m_defaultDelAckTimeout),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("DefaultDelAckCount",
|
||||
"Default number of packets to wait before sending a TCP ack",
|
||||
UintegerValue (2),
|
||||
MakeUintegerAccessor (&Tcp::m_defaultDelAckCount),
|
||||
MakeUintegerAccessor (&TcpSocketFactory::m_defaultDelAckCount),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Tcp::GetDefaultSegSize (void) const
|
||||
TcpSocketFactory::GetDefaultSegSize (void) const
|
||||
{
|
||||
return m_defaultSegSize;
|
||||
}
|
||||
uint32_t
|
||||
Tcp::GetDefaultAdvWin (void) const
|
||||
TcpSocketFactory::GetDefaultAdvWin (void) const
|
||||
{
|
||||
return m_defaultAdvWin;
|
||||
}
|
||||
uint32_t
|
||||
Tcp::GetDefaultSsThresh (void) const
|
||||
TcpSocketFactory::GetDefaultSsThresh (void) const
|
||||
{
|
||||
return m_defaultSsThresh;
|
||||
}
|
||||
uint32_t
|
||||
Tcp::GetDefaultTxBuffer (void) const
|
||||
TcpSocketFactory::GetDefaultTxBuffer (void) const
|
||||
{
|
||||
return m_defaultTxBuffer;
|
||||
}
|
||||
uint32_t
|
||||
Tcp::GetDefaultRxBuffer (void) const
|
||||
TcpSocketFactory::GetDefaultRxBuffer (void) const
|
||||
{
|
||||
return m_defaultRxBuffer;
|
||||
}
|
||||
uint32_t
|
||||
Tcp::GetDefaultInitialCwnd (void) const
|
||||
TcpSocketFactory::GetDefaultInitialCwnd (void) const
|
||||
{
|
||||
return m_defaultInitialCwnd;
|
||||
}
|
||||
uint32_t
|
||||
Tcp::GetDefaultConnTimeout (void) const
|
||||
TcpSocketFactory::GetDefaultConnTimeout (void) const
|
||||
{
|
||||
return m_defaultConnTimeout;
|
||||
}
|
||||
uint32_t
|
||||
Tcp::GetDefaultConnCount (void) const
|
||||
TcpSocketFactory::GetDefaultConnCount (void) const
|
||||
{
|
||||
return m_defaultConnCount;
|
||||
}
|
||||
|
||||
double
|
||||
Tcp::GetDefaultDelAckTimeout (void) const
|
||||
TcpSocketFactory::GetDefaultDelAckTimeout (void) const
|
||||
{
|
||||
return m_defaultDelAckTimeout;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Tcp::GetDefaultDelAckCount (void) const
|
||||
TcpSocketFactory::GetDefaultDelAckCount (void) const
|
||||
{
|
||||
return m_defaultDelAckCount;
|
||||
}
|
||||
@@ -17,8 +17,8 @@
|
||||
*
|
||||
* Author: Raj Bhattacharjea <raj.b@gatech.edu>
|
||||
*/
|
||||
#ifndef TCP_H
|
||||
#define TCP_H
|
||||
#ifndef TCP_SOCKET_FACTORY_H
|
||||
#define TCP_SOCKET_FACTORY_H
|
||||
|
||||
#include "socket-factory.h"
|
||||
|
||||
@@ -34,13 +34,14 @@ class Socket;
|
||||
* initialize newly created sockets, such as values that are
|
||||
* set through the sysctl or proc interfaces in Linux.
|
||||
|
||||
* All TCP implementations must provide an implementation of CreateSocket
|
||||
* All TCP socket factory implementations must provide an implementation
|
||||
* of CreateSocket
|
||||
* below, and should make use of the default values configured below.
|
||||
*
|
||||
* \see TcpImpl
|
||||
* \see TcpSocketFactoryImpl
|
||||
*
|
||||
*/
|
||||
class Tcp : public SocketFactory
|
||||
class TcpSocketFactory : public SocketFactory
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
@@ -74,4 +75,4 @@ private:
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* TCP_H */
|
||||
#endif /* TCP_SOCKET_FACTORY_H */
|
||||
@@ -27,7 +27,7 @@ def build(bld):
|
||||
'packet-socket.cc',
|
||||
'udp-socket.cc',
|
||||
'udp-socket-factory.cc',
|
||||
'tcp.cc',
|
||||
'tcp-socket-factory.cc',
|
||||
'ipv4.cc',
|
||||
'application.cc',
|
||||
'simple-channel.cc',
|
||||
@@ -60,7 +60,7 @@ def build(bld):
|
||||
'packet-socket-factory.h',
|
||||
'udp-socket.h',
|
||||
'udp-socket-factory.h',
|
||||
'tcp.h',
|
||||
'tcp-socket-factory.h',
|
||||
'ipv4.h',
|
||||
'application.h',
|
||||
'simple-channel.h',
|
||||
|
||||
@@ -236,7 +236,7 @@ int main (int argc, char *argv[])
|
||||
NodeContainer c; c.Create (1);
|
||||
|
||||
StaticInformation info;
|
||||
info.RecordAggregationInfo ("ns3::Node", "ns3::Tcp");
|
||||
info.RecordAggregationInfo ("ns3::Node", "ns3::TcpSocketFactory");
|
||||
info.RecordAggregationInfo ("ns3::Node", "ns3::UdpSocketFactory");
|
||||
info.RecordAggregationInfo ("ns3::Node", "ns3::PacketSocketFactory");
|
||||
info.RecordAggregationInfo ("ns3::Node", "ns3::olsr::Agent");
|
||||
|
||||
Reference in New Issue
Block a user