diff --git a/examples/tcp-large-transfer.cc b/examples/tcp-large-transfer.cc index 560f6f447..33665b848 100644 --- a/examples/tcp-large-transfer.cc +++ b/examples/tcp-large-transfer.cc @@ -143,15 +143,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 localSocket = Socket::CreateSocket (c0.Get (0), Tcp::GetTypeId ()); + //TypeId tid = TypeId::LookupByName ("ns3::TcpSocketFactory"); + Ptr localSocket = Socket::CreateSocket (c0.Get (0), TcpSocketFactory::GetTypeId ()); localSocket->Bind (); Simulator::ScheduleNow (&StartFlow, localSocket, nBytes, ipInterfs.GetAddress (1), servPort); diff --git a/src/helper/packet-sink-helper.cc b/src/helper/packet-sink-helper.cc index e7cc76f72..ef2704114 100644 --- a/src/helper/packet-sink-helper.cc +++ b/src/helper/packet-sink-helper.cc @@ -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 diff --git a/src/internet-node/internet-stack.cc b/src/internet-node/internet-stack.cc index 8aaab0509..5b8f3bfd1 100644 --- a/src/internet-node/internet-stack.cc +++ b/src/internet-node/internet-stack.cc @@ -28,7 +28,7 @@ #include "ipv4-l3-protocol.h" #include "arp-l3-protocol.h" #include "udp-socket-factory-impl.h" -#include "tcp-impl.h" +#include "tcp-socket-factory-impl.h" #include "ipv4-impl.h" namespace ns3 { @@ -59,18 +59,18 @@ AddInternetStack (Ptr node) ipv4L4Demux->Insert (tcp); Ptr udpFactory = CreateObject (); - Ptr tcpImpl = CreateObject (); + Ptr tcpFactory = CreateObject (); Ptr ipv4Impl = CreateObject (); udpFactory->SetUdp (udp); - tcpImpl->SetTcp (tcp); + tcpFactory->SetTcp (tcp); ipv4Impl->SetIpv4 (ipv4); node->AggregateObject (ipv4); node->AggregateObject (arp); node->AggregateObject (ipv4Impl); node->AggregateObject (udpFactory); - node->AggregateObject (tcpImpl); + node->AggregateObject (tcpFactory); node->AggregateObject (ipv4L4Demux); } diff --git a/src/internet-node/tcp-header.cc b/src/internet-node/tcp-header.cc index f5c485999..c0f476220 100644 --- a/src/internet-node/tcp-header.cc +++ b/src/internet-node/tcp-header.cc @@ -20,7 +20,7 @@ #include #include -#include "tcp-socket.h" +#include "tcp-socket-impl.h" #include "tcp-header.h" #include "ns3/buffer.h" diff --git a/src/internet-node/tcp-header.h b/src/internet-node/tcp-header.h index 3181b03be..e676287f6 100644 --- a/src/internet-node/tcp-header.h +++ b/src/internet-node/tcp-header.h @@ -24,7 +24,7 @@ #include #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" diff --git a/src/internet-node/tcp-l4-protocol.cc b/src/internet-node/tcp-l4-protocol.cc index 653575db0..2898b09f4 100644 --- a/src/internet-node/tcp-l4-protocol.cc +++ b/src/internet-node/tcp-l4-protocol.cc @@ -30,7 +30,7 @@ #include "ipv4-end-point-demux.h" #include "ipv4-end-point.h" #include "ipv4-l3-protocol.h" -#include "tcp-socket.h" +#include "tcp-socket-impl.h" #include "tcp-typedefs.h" @@ -379,7 +379,7 @@ TcpL4Protocol::CreateSocket (void) { NS_LOG_FUNCTION_NOARGS (); Ptr rtt = m_rttFactory.Create (); - Ptr socket = CreateObject (); + Ptr socket = CreateObject (); socket->SetNode (m_node); socket->SetTcp (this); socket->SetRtt (rtt); diff --git a/src/internet-node/tcp-l4-protocol.h b/src/internet-node/tcp-l4-protocol.h index e832a69a2..b08eabeba 100644 --- a/src/internet-node/tcp-l4-protocol.h +++ b/src/internet-node/tcp-l4-protocol.h @@ -59,7 +59,7 @@ public: virtual int GetVersion (void) const; /** - * \return A smart Socket pointer to a TcpSocket, allocated by this instance + * \return A smart Socket pointer to a TcpSocketImpl, allocated by this instance * of the TCP protocol */ Ptr CreateSocket (void); @@ -73,7 +73,7 @@ public: void DeAllocate (Ipv4EndPoint *endPoint); -// // called by TcpSocket. +// // called by TcpSocketImpl. // bool Connect (const Ipv4Address& saddr, const Ipv4Address& daddr, // uint16_t sport, uint16_t dport); @@ -107,7 +107,7 @@ private: Ipv4EndPointDemux *m_endPoints; ObjectFactory m_rttFactory; private: - friend class TcpSocket; + friend class TcpSocketImpl; void SendPacket (Ptr, TcpHeader, Ipv4Address, Ipv4Address); static ObjectFactory GetDefaultRttEstimatorFactory (void); diff --git a/src/internet-node/tcp-impl.cc b/src/internet-node/tcp-socket-factory-impl.cc similarity index 78% rename from src/internet-node/tcp-impl.cc rename to src/internet-node/tcp-socket-factory-impl.cc index 5a1ad3954..ef806adf4 100644 --- a/src/internet-node/tcp-impl.cc +++ b/src/internet-node/tcp-socket-factory-impl.cc @@ -17,38 +17,38 @@ * * Author: Raj Bhattacharjea */ -#include "tcp-impl.h" +#include "tcp-socket-factory-impl.h" #include "tcp-l4-protocol.h" #include "ns3/socket.h" #include "ns3/assert.h" namespace ns3 { -TcpImpl::TcpImpl () +TcpSocketFactoryImpl::TcpSocketFactoryImpl () : m_tcp (0) {} -TcpImpl::~TcpImpl () +TcpSocketFactoryImpl::~TcpSocketFactoryImpl () { NS_ASSERT (m_tcp == 0); } void -TcpImpl::SetTcp (Ptr tcp) +TcpSocketFactoryImpl::SetTcp (Ptr tcp) { m_tcp = tcp; } Ptr -TcpImpl::CreateSocket (void) +TcpSocketFactoryImpl::CreateSocket (void) { return m_tcp->CreateSocket (); } void -TcpImpl::DoDispose (void) +TcpSocketFactoryImpl::DoDispose (void) { m_tcp = 0; - Tcp::DoDispose (); + TcpSocketFactory::DoDispose (); } } // namespace ns3 diff --git a/src/internet-node/tcp-impl.h b/src/internet-node/tcp-socket-factory-impl.h similarity index 81% rename from src/internet-node/tcp-impl.h rename to src/internet-node/tcp-socket-factory-impl.h index 9990c7721..38bf123a2 100644 --- a/src/internet-node/tcp-impl.h +++ b/src/internet-node/tcp-socket-factory-impl.h @@ -17,10 +17,10 @@ * * Author: Raj Bhattacharjea */ -#ifndef TCP_IMPL_H -#define TCP_IMPL_H +#ifndef TCP_SOCKET_FACTORY_IMPL_H +#define TCP_SOCKET_FACTORY_IMPL_H -#include "ns3/tcp.h" +#include "ns3/tcp-socket-factory.h" #include "ns3/ptr.h" namespace ns3 { @@ -37,13 +37,13 @@ class TcpL4Protocol; * * Georgia Tech Network Simulator (GTNetS). * - * Most of the logic is in class ns3::TcpSocket. + * Most of the logic is in class ns3::TcpSocketImpl. */ -class TcpImpl : public Tcp +class TcpSocketFactoryImpl : public TcpSocketFactory { public: - TcpImpl (); - virtual ~TcpImpl (); + TcpSocketFactoryImpl (); + virtual ~TcpSocketFactoryImpl (); void SetTcp (Ptr tcp); @@ -57,4 +57,4 @@ private: } // namespace ns3 -#endif /* TCP_IMPL_H */ +#endif /* TCP_SOCKET_FACTORY_IMPL_H */ diff --git a/src/internet-node/tcp-socket.cc b/src/internet-node/tcp-socket-impl.cc similarity index 79% rename from src/internet-node/tcp-socket.cc rename to src/internet-node/tcp-socket-impl.cc index dee834a2a..57c0e0d09 100644 --- a/src/internet-node/tcp-socket.cc +++ b/src/internet-node/tcp-socket-impl.cc @@ -23,7 +23,7 @@ #include "ns3/inet-socket-address.h" #include "ns3/log.h" #include "ns3/ipv4.h" -#include "tcp-socket.h" +#include "tcp-socket-impl.h" #include "tcp-l4-protocol.h" #include "ipv4-end-point.h" #include "ipv4-l4-demux.h" @@ -36,27 +36,27 @@ #include -NS_LOG_COMPONENT_DEFINE ("TcpSocket"); +NS_LOG_COMPONENT_DEFINE ("TcpSocketImpl"); using namespace std; namespace ns3 { -NS_OBJECT_ENSURE_REGISTERED (TcpSocket); +NS_OBJECT_ENSURE_REGISTERED (TcpSocketImpl); TypeId -TcpSocket::GetTypeId () +TcpSocketImpl::GetTypeId () { - static TypeId tid = TypeId("ns3::TcpSocket") - .SetParent () + static TypeId tid = TypeId("ns3::TcpSocketImpl") + .SetParent () .AddTraceSource ("CongestionWindow", "The TCP connection's congestion window", - MakeTraceSourceAccessor (&TcpSocket::m_cWnd)) + MakeTraceSourceAccessor (&TcpSocketImpl::m_cWnd)) ; return tid; } - TcpSocket::TcpSocket () + TcpSocketImpl::TcpSocketImpl () : m_skipRetxResched (false), m_dupAckCount (0), m_delAckCount (0), @@ -81,21 +81,18 @@ TcpSocket::GetTypeId () m_rtt (0), m_lastMeasuredRtt (Seconds(0.0)), m_rxAvailable (0), - m_sndBufLimit (0xffffffff), - m_rcvBufLimit (0xffffffff), m_wouldBlock (false) { NS_LOG_FUNCTION (this); - } -TcpSocket::TcpSocket(const TcpSocket& sock) - : Socket(sock), //copy the base class callbacks +TcpSocketImpl::TcpSocketImpl(const TcpSocketImpl& sock) + : TcpSocket(sock), //copy the base class callbacks m_skipRetxResched (sock.m_skipRetxResched), m_dupAckCount (sock.m_dupAckCount), m_delAckCount (0), m_delAckMaxCount (sock.m_delAckMaxCount), - m_delAckTimout (sock.m_delAckTimout), + m_delAckTimeout (sock.m_delAckTimeout), m_endPoint (0), m_node (sock.m_node), m_tcp (sock.m_tcp), @@ -128,9 +125,7 @@ TcpSocket::TcpSocket(const TcpSocket& sock) m_lastMeasuredRtt (Seconds(0.0)), m_cnTimeout (sock.m_cnTimeout), m_cnCount (sock.m_cnCount), - m_rxAvailable (0), - m_sndBufLimit (0xffffffff), - m_rcvBufLimit (0xffffffff) + m_rxAvailable (0) { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC("Invoked the copy constructor"); @@ -148,7 +143,7 @@ TcpSocket::TcpSocket(const TcpSocket& sock) //too; this is in SYN_ACK_TX } -TcpSocket::~TcpSocket () +TcpSocketImpl::~TcpSocketImpl () { NS_LOG_FUNCTION(this); m_node = 0; @@ -173,50 +168,42 @@ TcpSocket::~TcpSocket () } void -TcpSocket::SetNode (Ptr node) +TcpSocketImpl::SetNode (Ptr node) { m_node = node; - Ptr t = node->GetObject (); - m_segmentSize = t->GetDefaultSegSize (); - m_rxWindowSize = t->GetDefaultAdvWin (); - m_advertisedWindowSize = t->GetDefaultAdvWin (); - m_cWnd = t->GetDefaultInitialCwnd () * m_segmentSize; - m_ssThresh = t->GetDefaultSsThresh (); - m_initialCWnd = t->GetDefaultInitialCwnd (); - m_cnTimeout = Seconds (t->GetDefaultConnTimeout ()); - m_cnCount = t->GetDefaultConnCount (); - m_delAckTimout = Seconds(t->GetDefaultDelAckTimeout ()); - m_delAckMaxCount = t->GetDefaultDelAckCount (); + // Initialize some variables + m_cWnd = m_initialCWnd * m_segmentSize; + m_rxWindowSize = m_advertisedWindowSize; } void -TcpSocket::SetTcp (Ptr tcp) +TcpSocketImpl::SetTcp (Ptr tcp) { m_tcp = tcp; } void -TcpSocket::SetRtt (Ptr rtt) +TcpSocketImpl::SetRtt (Ptr rtt) { m_rtt = rtt; } enum Socket::SocketErrno -TcpSocket::GetErrno (void) const +TcpSocketImpl::GetErrno (void) const { NS_LOG_FUNCTION_NOARGS (); return m_errno; } Ptr -TcpSocket::GetNode (void) const +TcpSocketImpl::GetNode (void) const { NS_LOG_FUNCTION_NOARGS (); return m_node; } void -TcpSocket::Destroy (void) +TcpSocketImpl::Destroy (void) { NS_LOG_FUNCTION_NOARGS (); m_node = 0; @@ -225,29 +212,29 @@ TcpSocket::Destroy (void) m_retxEvent.Cancel (); } int -TcpSocket::FinishBind (void) +TcpSocketImpl::FinishBind (void) { NS_LOG_FUNCTION_NOARGS (); if (m_endPoint == 0) { return -1; } - m_endPoint->SetRxCallback (MakeCallback (&TcpSocket::ForwardUp, Ptr(this))); - m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocket::Destroy, Ptr(this))); + m_endPoint->SetRxCallback (MakeCallback (&TcpSocketImpl::ForwardUp, Ptr(this))); + m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketImpl::Destroy, Ptr(this))); m_localAddress = m_endPoint->GetLocalAddress (); m_localPort = m_endPoint->GetLocalPort (); return 0; } int -TcpSocket::Bind (void) +TcpSocketImpl::Bind (void) { NS_LOG_FUNCTION_NOARGS (); m_endPoint = m_tcp->Allocate (); return FinishBind (); } int -TcpSocket::Bind (const Address &address) +TcpSocketImpl::Bind (const Address &address) { NS_LOG_FUNCTION (this<Allocate (); - NS_LOG_LOGIC ("TcpSocket "<Allocate (port); - NS_LOG_LOGIC ("TcpSocket "<Allocate (ipv4); - NS_LOG_LOGIC ("TcpSocket "<Allocate (ipv4, port); - NS_LOG_LOGIC ("TcpSocket "<Size() != 0) - { // App shutdown with pending data must wait until all data transmitted - m_closeOnEmpty = true; - NS_LOG_LOGIC("TcpSocket "<Size() != 0) { // App close with pending data must wait until all data transmitted m_closeOnEmpty = true; - NS_LOG_LOGIC("TcpSocket " << this << + NS_LOG_LOGIC("Socket " << this << " deferring close, state " << m_state); return 0; } @@ -331,7 +306,7 @@ TcpSocket::Close (void) } int -TcpSocket::Connect (const Address & address) +TcpSocketImpl::Connect (const Address & address) { NS_LOG_FUNCTION (this << address); if (m_endPoint == 0) @@ -369,12 +344,12 @@ TcpSocket::Connect (const Address & address) return -1; } int -TcpSocket::Send (const Ptr p) //p here is just data, no headers +TcpSocketImpl::Send (const Ptr p) //p here is just data, no headers { // TCP Does not deal with packets from app, just data return Send(p->PeekData(), p->GetSize()); } -int TcpSocket::Send (const uint8_t* buf, uint32_t size) +int TcpSocketImpl::Send (const uint8_t* buf, uint32_t size) { NS_LOG_FUNCTION (this << buf << size); if (m_state == ESTABLISHED || m_state == SYN_SENT || m_state == CLOSE_WAIT) @@ -409,7 +384,7 @@ int TcpSocket::Send (const uint8_t* buf, uint32_t size) } } -int TcpSocket::DoSendTo (Ptr p, const Address &address) +int TcpSocketImpl::DoSendTo (Ptr p, const Address &address) { NS_LOG_FUNCTION (this << p << address); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); @@ -418,7 +393,7 @@ int TcpSocket::DoSendTo (Ptr p, const Address &address) return DoSendTo (p, ipv4, port); } -int TcpSocket::DoSendTo (Ptr p, Ipv4Address ipv4, uint16_t port) +int TcpSocketImpl::DoSendTo (Ptr p, Ipv4Address ipv4, uint16_t port) { NS_LOG_FUNCTION (this << p << ipv4 << port); if (m_endPoint == 0) @@ -442,7 +417,7 @@ int TcpSocket::DoSendTo (Ptr p, Ipv4Address ipv4, uint16_t port) } int -TcpSocket::SendTo (Ptr p, const Address &address) +TcpSocketImpl::SendTo (Ptr p, const Address &address) { NS_LOG_FUNCTION (this << address << p); if (!m_connected) @@ -457,24 +432,24 @@ TcpSocket::SendTo (Ptr p, const Address &address) } uint32_t -TcpSocket::GetTxAvailable (void) const +TcpSocketImpl::GetTxAvailable (void) const { NS_LOG_FUNCTION_NOARGS (); if (m_pendingData != 0) { uint32_t unAckedDataSize = m_pendingData->SizeFromSeq (m_firstPendingSequence, m_highestRxAck); - NS_ASSERT (m_sndBufLimit >= unAckedDataSize); //else a logical error - return m_sndBufLimit-unAckedDataSize; + NS_ASSERT (m_sndBufSize >= unAckedDataSize); //else a logical error + return m_sndBufSize-unAckedDataSize; } else { - return m_sndBufLimit; + return m_sndBufSize; } } int -TcpSocket::Listen (uint32_t q) +TcpSocketImpl::Listen (uint32_t q) { NS_LOG_FUNCTION (this << q); Actions_t action = ProcessEvent (APP_LISTEN); @@ -483,7 +458,7 @@ TcpSocket::Listen (uint32_t q) } Ptr -TcpSocket::Recv (uint32_t maxSize, uint32_t flags) +TcpSocketImpl::Recv (uint32_t maxSize, uint32_t flags) { NS_LOG_FUNCTION_NOARGS (); if (m_deliveryQueue.empty() ) @@ -504,7 +479,7 @@ TcpSocket::Recv (uint32_t maxSize, uint32_t flags) } uint32_t -TcpSocket::GetRxAvailable (void) const +TcpSocketImpl::GetRxAvailable (void) const { NS_LOG_FUNCTION_NOARGS (); // We separately maintain this state to avoid walking the queue @@ -513,35 +488,7 @@ TcpSocket::GetRxAvailable (void) const } void -TcpSocket::SetSndBuf (uint32_t size) -{ - NS_LOG_FUNCTION_NOARGS (); - m_sndBufLimit = size; -} - -uint32_t -TcpSocket::GetSndBuf (void) const -{ - NS_LOG_FUNCTION_NOARGS (); - return m_sndBufLimit; -} - -void -TcpSocket::SetRcvBuf (uint32_t size) -{ - NS_LOG_FUNCTION_NOARGS (); - m_rcvBufLimit = size; -} - -uint32_t -TcpSocket::GetRcvBuf (void) const -{ - NS_LOG_FUNCTION_NOARGS (); - return m_rcvBufLimit; -} - -void -TcpSocket::ForwardUp (Ptr packet, Ipv4Address ipv4, uint16_t port) +TcpSocketImpl::ForwardUp (Ptr packet, Ipv4Address ipv4, uint16_t port) { NS_LOG_DEBUG("Socket " << this << " got forward up" << " dport " << m_endPoint->GetLocalPort() << @@ -575,26 +522,26 @@ TcpSocket::ForwardUp (Ptr packet, Ipv4Address ipv4, uint16_t port) ProcessPacketAction (action, packet, tcpHeader, address); } -Actions_t TcpSocket::ProcessEvent (Events_t e) +Actions_t TcpSocketImpl::ProcessEvent (Events_t e) { NS_LOG_FUNCTION (this << e); States_t saveState = m_state; - NS_LOG_LOGIC ("TcpSocket " << this << " processing event " << e); + NS_LOG_LOGIC ("TcpSocketImpl " << this << " processing event " << e); // simulation singleton is a way to get a single global static instance of a // class intended to be a singleton; see simulation-singleton.h SA stateAction = SimulationSingleton::Get ()->Lookup (m_state,e); // debug if (stateAction.action == RST_TX) { - NS_LOG_LOGIC ("TcpSocket " << this << " sending RST from state " + NS_LOG_LOGIC ("TcpSocketImpl " << this << " sending RST from state " << saveState << " event " << e); } bool needCloseNotify = (stateAction.state == CLOSED && m_state != CLOSED && e != TIMEOUT); m_state = stateAction.state; - NS_LOG_LOGIC ("TcpSocket " << this << " moved from state " << saveState + NS_LOG_LOGIC ("TcpSocketImpl " << this << " moved from state " << saveState << " to state " <SetPeer (m_remoteAddress, m_remotePort); - NS_LOG_LOGIC ("TcpSocket " << this << " Connected!"); + NS_LOG_LOGIC ("TcpSocketImpl " << this << " Connected!"); } if (needCloseNotify && !m_closeNotified) { - NS_LOG_LOGIC ("TcpSocket " << this << " transition to CLOSED from " + NS_LOG_LOGIC ("TcpSocketImpl " << this << " transition to CLOSED from " << m_state << " event " << e << " closeNot " << m_closeNotified << " action " << stateAction.action); NotifyCloseCompleted (); m_closeNotified = true; - NS_LOG_LOGIC ("TcpSocket " << this << " calling Closed from PE" + NS_LOG_LOGIC ("TcpSocketImpl " << this << " calling Closed from PE" << " origState " << saveState << " event " << e); - NS_LOG_LOGIC ("TcpSocket " << this << " transition to CLOSED from " + NS_LOG_LOGIC ("TcpSocketImpl " << this << " transition to CLOSED from " << m_state << " event " << e << " set CloseNotif "); } return stateAction.action; } -void TcpSocket::SendEmptyPacket (uint8_t flags) +void TcpSocketImpl::SendEmptyPacket (uint8_t flags) { NS_LOG_FUNCTION (this << flags); Ptr p = Create (); @@ -652,17 +599,17 @@ void TcpSocket::SendEmptyPacket (uint8_t flags) NS_LOG_LOGIC ("Schedule retransmission timeout at time " << Simulator::Now ().GetSeconds () << " to expire at time " << (Simulator::Now () + rto).GetSeconds ()); - m_retxEvent = Simulator::Schedule (rto, &TcpSocket::ReTxTimeout, this); + m_retxEvent = Simulator::Schedule (rto, &TcpSocketImpl::ReTxTimeout, this); } } -bool TcpSocket::ProcessAction (Actions_t a) +bool TcpSocketImpl::ProcessAction (Actions_t a) { // These actions do not require a packet or any TCP Headers NS_LOG_FUNCTION (this << a); switch (a) { case NO_ACT: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action: NO_ACT"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action: NO_ACT"); break; case ACK_TX: SendEmptyPacket (TcpHeader::ACK); @@ -671,11 +618,11 @@ bool TcpSocket::ProcessAction (Actions_t a) NS_ASSERT (false); // This should be processed in ProcessPacketAction break; case RST_TX: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action RST_TX"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action RST_TX"); SendEmptyPacket (TcpHeader::RST); break; case SYN_TX: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action SYN_TX"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SYN_TX"); // TCP SYN Flag consumes one byte // is the above correct? we're SENDING a syn, not acking back -- Raj // commented out for now @@ -683,17 +630,17 @@ bool TcpSocket::ProcessAction (Actions_t a) SendEmptyPacket (TcpHeader::SYN); break; case SYN_ACK_TX: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action SYN_ACK_TX"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SYN_ACK_TX"); // TCP SYN Flag consumes one byte ++m_nextRxSequence; SendEmptyPacket (TcpHeader::SYN | TcpHeader::ACK); break; case FIN_TX: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action FIN_TX"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action FIN_TX"); SendEmptyPacket (TcpHeader::FIN); break; case FIN_ACK_TX: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action FIN_ACK_TX"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action FIN_ACK_TX"); SendEmptyPacket (TcpHeader::FIN | TcpHeader::ACK); break; case NEW_ACK: @@ -703,36 +650,36 @@ bool TcpSocket::ProcessAction (Actions_t a) NS_ASSERT (false); // This should be processed in ProcessPacketAction break; case RETX: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action RETX"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action RETX"); break; case TX_DATA: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action TX_DATA"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action TX_DATA"); SendPendingData (); break; case PEER_CLOSE: NS_ASSERT (false); // This should be processed in ProcessPacketAction - NS_LOG_LOGIC ("TcpSocket " << this <<" Action PEER_CLOSE"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action PEER_CLOSE"); break; case APP_CLOSED: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action APP_CLOSED"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action APP_CLOSED"); break; case CANCEL_TM: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action CANCEL_TM"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action CANCEL_TM"); break; case APP_NOTIFY: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action APP_NOTIFY"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action APP_NOTIFY"); break; case SERV_NOTIFY: NS_ASSERT (false); // This should be processed in ProcessPacketAction break; case LAST_ACTION: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action LAST_ACTION"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action LAST_ACTION"); break; } return true; } -bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, +bool TcpSocketImpl::ProcessPacketAction (Actions_t a, Ptr p, const TcpHeader& tcpHeader, const Address& fromAddress) { @@ -742,24 +689,24 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, switch (a) { case SYN_ACK_TX: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action SYN_ACK_TX"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SYN_ACK_TX"); // m_remotePort = InetSocketAddress::ConvertFrom (fromAddress).GetPort (); // m_remoteAddress = InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (); // if (ipv4->GetIfIndexForDestination (m_remoteAddress, localIfIndex)) // { // m_localAddress = ipv4->GetAddress (localIfIndex); // } - if (m_state == LISTEN) //this means we should fork a new TcpSocket + if (m_state == LISTEN) //this means we should fork a new TcpSocketImpl { NS_LOG_DEBUG("In SYN_ACK_TX, m_state is LISTEN, this " << this); //notify the server that we got a SYN // If server refuses connection do nothing if (!NotifyConnectionRequest(fromAddress)) return true; // Clone the socket - Ptr newSock = Copy (); - NS_LOG_LOGIC ("Cloned a TcpSocket " << newSock); + Ptr newSock = Copy (); + NS_LOG_LOGIC ("Cloned a TcpSocketImpl " << newSock); //this listening socket should do nothing more - Simulator::ScheduleNow (&TcpSocket::CompleteFork, newSock, + Simulator::ScheduleNow (&TcpSocketImpl::CompleteFork, newSock, p, tcpHeader,fromAddress); return true; } @@ -778,12 +725,12 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, SendEmptyPacket (TcpHeader::SYN | TcpHeader::ACK); break; case ACK_TX_1: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action ACK_TX_1"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action ACK_TX_1"); // TCP SYN consumes one byte m_nextRxSequence = tcpHeader.GetSequenceNumber() + SequenceNumber(1); m_nextTxSequence = tcpHeader.GetAckNumber (); m_firstPendingSequence = m_nextTxSequence; //bug 166 - NS_LOG_DEBUG ("TcpSocket " << this << " ACK_TX_1" << + NS_LOG_DEBUG ("TcpSocketImpl " << this << " ACK_TX_1" << " nextRxSeq " << m_nextRxSequence); SendEmptyPacket (TcpHeader::ACK); m_rxWindowSize = tcpHeader.GetWindowSize (); @@ -800,7 +747,7 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, SendPendingData (); break; case NEW_ACK: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action NEW_ACK_TX"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action NEW_ACK_TX"); if (tcpHeader.GetAckNumber () < m_highestRxAck) //old ack, do nothing { break; @@ -818,7 +765,7 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, NewAck (tcpHeader.GetAckNumber ()); break; case NEW_SEQ_RX: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action NEW_SEQ_RX"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action NEW_SEQ_RX"); NewRx (p, tcpHeader, fromAddress); // Process new data received break; case PEER_CLOSE: @@ -829,7 +776,7 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, if (tcpHeader.GetSequenceNumber () != m_nextRxSequence) { // process close later m_pendingClose = true; - NS_LOG_LOGIC ("TcpSocket " << this << " setting pendingClose" + NS_LOG_LOGIC ("TcpSocketImpl " << this << " setting pendingClose" << " rxseq " << tcpHeader.GetSequenceNumber () << " nextRxSeq " << m_nextRxSequence); NewRx (p, tcpHeader, fromAddress); @@ -842,7 +789,7 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, NewRx (p, tcpHeader, fromAddress); } States_t saveState = m_state; // Used to see if app responds - NS_LOG_LOGIC ("TcpSocket " << this + NS_LOG_LOGIC ("TcpSocketImpl " << this << " peer close, state " << m_state); if (!m_closeRequestNotified) { @@ -851,7 +798,7 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, NotifyCloseRequested(); m_closeRequestNotified = true; } - NS_LOG_LOGIC ("TcpSocket " << this + NS_LOG_LOGIC ("TcpSocketImpl " << this << " peer close, state after " << m_state); if (m_state == saveState) { // Need to ack, the application will close later @@ -860,15 +807,15 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, } if (m_state == LAST_ACK) { - NS_LOG_LOGIC ("TcpSocket " << this << " scheduling LATO1"); + NS_LOG_LOGIC ("TcpSocketImpl " << this << " scheduling LATO1"); m_lastAckEvent = Simulator::Schedule (m_rtt->RetransmitTimeout (), - &TcpSocket::LastAckTimeout,this); + &TcpSocketImpl::LastAckTimeout,this); } break; } case SERV_NOTIFY: - NS_LOG_LOGIC ("TcpSocket " << this <<" Action SERV_NOTIFY"); - NS_LOG_LOGIC ("TcpSocket " << this << " Connected!"); + NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SERV_NOTIFY"); + NS_LOG_LOGIC ("TcpSocketImpl " << this << " Connected!"); NotifyNewConnectionCreated (this, fromAddress); m_connected = true; // ! This is bogus; fix when we clone the tcp m_endPoint->SetPeer (m_remoteAddress, m_remotePort); @@ -881,7 +828,7 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr p, return true; } -void TcpSocket::CompleteFork(Ptr p, const TcpHeader& h, const Address& fromAddress) +void TcpSocketImpl::CompleteFork(Ptr p, const TcpHeader& h, const Address& fromAddress) { // Get port and address from peer (connecting host) m_remotePort = InetSocketAddress::ConvertFrom (fromAddress).GetPort (); @@ -893,19 +840,19 @@ void TcpSocket::CompleteFork(Ptr p, const TcpHeader& h, const Address& f //the cloned socket with be in listen state, so manually change state m_state = SYN_RCVD; //equivalent to FinishBind - m_endPoint->SetRxCallback (MakeCallback (&TcpSocket::ForwardUp, Ptr(this))); - m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocket::Destroy, Ptr(this))); + m_endPoint->SetRxCallback (MakeCallback (&TcpSocketImpl::ForwardUp, Ptr(this))); + m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketImpl::Destroy, Ptr(this))); ProcessPacketAction(SYN_ACK_TX, p, h, fromAddress); } -void TcpSocket::ConnectionSucceeded() +void TcpSocketImpl::ConnectionSucceeded() { // We would preferred to have scheduled an event directly to // NotifyConnectionSucceeded, but (sigh) these are protected // and we can get the address of it :( NotifyConnectionSucceeded(); } -bool TcpSocket::SendPendingData (bool withAck) +bool TcpSocketImpl::SendPendingData (bool withAck) { NS_LOG_FUNCTION (this << withAck); NS_LOG_LOGIC ("ENTERING SendPendingData"); @@ -917,7 +864,7 @@ bool TcpSocket::SendPendingData (bool withAck) while (m_pendingData->SizeFromSeq (m_firstPendingSequence, m_nextTxSequence)) { uint32_t w = AvailableWindow ();// Get available window size - NS_LOG_LOGIC ("TcpSocket " << this << " SendPendingData" + NS_LOG_LOGIC ("TcpSocketImpl " << this << " SendPendingData" << " w " << w << " rxwin " << m_rxWindowSize << " cWnd " << m_cWnd @@ -934,7 +881,7 @@ bool TcpSocket::SendPendingData (bool withAck) uint32_t s = std::min (w, m_segmentSize); // Send no more than window Ptr p = m_pendingData->CopyFromSeq (s, m_firstPendingSequence, m_nextTxSequence); - NS_LOG_LOGIC("TcpSocket " << this << " sendPendingData" + NS_LOG_LOGIC("TcpSocketImpl " << this << " sendPendingData" << " txseq " << m_nextTxSequence << " s " << s << " datasize " << p->GetSize() ); @@ -972,19 +919,15 @@ bool TcpSocket::SendPendingData (bool withAck) NS_LOG_LOGIC ("Schedule retransmission timeout at time " << Simulator::Now ().GetSeconds () << " to expire at time " << (Simulator::Now () + rto).GetSeconds () ); - m_retxEvent = Simulator::Schedule (rto,&TcpSocket::ReTxTimeout,this); + m_retxEvent = Simulator::Schedule (rto,&TcpSocketImpl::ReTxTimeout,this); } NS_LOG_LOGIC ("About to send a packet with flags: " << flags); m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (), m_remoteAddress); m_rtt->SentSeq(m_nextTxSequence, sz); // notify the RTT - // Notify the application data was sent - Simulator::ScheduleNow(&TcpSocket::NotifyDataSent, this, p->GetSize ()); - if (m_state == FIN_WAIT_1) - { - Simulator::ScheduleNow(&TcpSocket::NotifyCloseUnblocks, this); - } + // Notify the application + Simulator::ScheduleNow(&TcpSocketImpl::NotifyDataSent, this, p->GetSize ()); nPacketsSent++; // Count sent this loop m_nextTxSequence += sz; // Advance next tx sequence // Note the high water mark @@ -995,26 +938,26 @@ bool TcpSocket::SendPendingData (bool withAck) return (nPacketsSent>0); } -uint32_t TcpSocket::UnAckDataCount () +uint32_t TcpSocketImpl::UnAckDataCount () { NS_LOG_FUNCTION_NOARGS (); return m_nextTxSequence - m_highestRxAck; } -uint32_t TcpSocket::BytesInFlight () +uint32_t TcpSocketImpl::BytesInFlight () { NS_LOG_FUNCTION_NOARGS (); return m_highTxMark - m_highestRxAck; } -uint32_t TcpSocket::Window () +uint32_t TcpSocketImpl::Window () { NS_LOG_FUNCTION_NOARGS (); - NS_LOG_LOGIC ("TcpSocket::Window() "< p, +void TcpSocketImpl::NewRx (Ptr p, const TcpHeader& tcpHeader, const Address& fromAddress) { NS_LOG_FUNCTION (this << p << "tcpHeader " << fromAddress); - NS_LOG_LOGIC ("TcpSocket " << this << " NewRx," + NS_LOG_LOGIC ("TcpSocketImpl " << this << " NewRx," << " seq " << tcpHeader.GetSequenceNumber() << " ack " << tcpHeader.GetAckNumber() << " p.size is " << p->GetSize () ); - NS_LOG_DEBUG ("TcpSocket " << this << + NS_LOG_DEBUG ("TcpSocketImpl " << this << " NewRx," << " seq " << tcpHeader.GetSequenceNumber() << " ack " << tcpHeader.GetAckNumber() << @@ -1071,7 +1014,7 @@ void TcpSocket::NewRx (Ptr p, { NS_LOG_LOGIC ("Tcp " << this << " HuH? Got data after closeNotif"); } - NS_LOG_LOGIC ("TcpSocket " << this << " adv rxseq by " << s); + NS_LOG_LOGIC ("TcpSocketImpl " << this << " adv rxseq by " << s); // Look for buffered data UnAckData_t::iterator i; // Note that the bufferedData list DOES contain the tcp header @@ -1125,11 +1068,11 @@ void TcpSocket::NewRx (Ptr p, m_rxAvailable += p->GetSize (); NotifyDataRecv (); - NS_LOG_LOGIC ("TcpSocket " << this << " adv rxseq1 by " << s1 ); + NS_LOG_LOGIC ("TcpSocketImpl " << this << " adv rxseq1 by " << s1 ); m_nextRxSequence += s1; // Note data received m_bufferedData.erase (i); // Remove from list if (flags & TcpHeader::FIN) - NS_LOG_LOGIC("TcpSocket " << this + NS_LOG_LOGIC("TcpSocketImpl " << this << " found FIN in buffered"); } @@ -1169,17 +1112,17 @@ void TcpSocket::NewRx (Ptr p, } else { - m_delAckEvent = Simulator::Schedule (m_delAckTimout, &TcpSocket::DelAckTimeout, this); + m_delAckEvent = Simulator::Schedule (m_delAckTimeout, &TcpSocketImpl::DelAckTimeout, this); } } -void TcpSocket::DelAckTimeout () +void TcpSocketImpl::DelAckTimeout () { m_delAckCount = 0; SendEmptyPacket (TcpHeader::ACK); } -void TcpSocket::CommonNewAck (SequenceNumber ack, bool skipTimer) +void TcpSocketImpl::CommonNewAck (SequenceNumber ack, bool skipTimer) { // CommonNewAck is called only for "New" (non-duplicate) acks // and MUST be called by any subclass, from the NewAck function // Always cancel any pending re-tx timer on new acknowledgement @@ -1193,7 +1136,7 @@ void TcpSocket::CommonNewAck (SequenceNumber ack, bool skipTimer) NS_LOG_LOGIC ("Schedule retransmission timeout at time " << Simulator::Now ().GetSeconds () << " to expire at time " << (Simulator::Now () + rto).GetSeconds ()); - m_retxEvent = Simulator::Schedule (rto, &TcpSocket::ReTxTimeout, this); + m_retxEvent = Simulator::Schedule (rto, &TcpSocketImpl::ReTxTimeout, this); } NS_LOG_LOGIC ("TCP " << this << " NewAck " << ack << " numberAck " << (ack - m_highestRxAck)); // Number bytes ack'ed @@ -1225,23 +1168,23 @@ void TcpSocket::CommonNewAck (SequenceNumber ack, bool skipTimer) SendPendingData(); } -Ptr TcpSocket::Copy () +Ptr TcpSocketImpl::Copy () { - return CopyObject (this); + return CopyObject (this); } -void TcpSocket::NewAck (SequenceNumber seq) +void TcpSocketImpl::NewAck (SequenceNumber seq) { // New acknowledgement up to sequence number "seq" // Adjust congestion window in response to new ack's received NS_LOG_FUNCTION (this << seq); - NS_LOG_LOGIC ("TcpSocket " << this << " NewAck " + NS_LOG_LOGIC ("TcpSocketImpl " << this << " NewAck " << " seq " << seq << " cWnd " << m_cWnd << " ssThresh " << m_ssThresh); if (m_cWnd < m_ssThresh) { // Slow start mode, add one segSize to cWnd m_cWnd += m_segmentSize; - NS_LOG_LOGIC ("TcpSocket " << this << " NewCWnd SlowStart, cWnd " << m_cWnd + NS_LOG_LOGIC ("TcpSocketImpl " << this << " NewCWnd SlowStart, cWnd " << m_cWnd << " sst " << m_ssThresh); } else @@ -1258,17 +1201,17 @@ void TcpSocket::NewAck (SequenceNumber seq) CommonNewAck (seq, false); // Complete newAck processing } -void TcpSocket::DupAck (const TcpHeader& t, uint32_t count) +void TcpSocketImpl::DupAck (const TcpHeader& t, uint32_t count) { NS_LOG_FUNCTION (this << "t " << count); - NS_LOG_LOGIC ("TcpSocket " << this << " DupAck " << t.GetAckNumber () + NS_LOG_LOGIC ("TcpSocketImpl " << this << " DupAck " << t.GetAckNumber () << ", count " << count << ", time " << Simulator::Now ()); if (count == 3) { // Count of three indicates triple duplicate ack m_ssThresh = Window () / 2; // Per RFC2581 m_ssThresh = std::max (m_ssThresh, 2 * m_segmentSize); - NS_LOG_LOGIC("TcpSocket " << this << "Tahoe TDA, time " << Simulator::Now () + NS_LOG_LOGIC("TcpSocketImpl " << this << "Tahoe TDA, time " << Simulator::Now () << " seq " << t.GetAckNumber () << " in flight " << BytesInFlight () << " new ssthresh " << m_ssThresh); @@ -1280,7 +1223,7 @@ void TcpSocket::DupAck (const TcpHeader& t, uint32_t count) } } -void TcpSocket::ReTxTimeout () +void TcpSocketImpl::ReTxTimeout () { // Retransmit timeout NS_LOG_FUNCTION (this); m_ssThresh = Window () / 2; // Per RFC2581 @@ -1293,7 +1236,7 @@ void TcpSocket::ReTxTimeout () Retransmit (); // Retransmit the packet } -void TcpSocket::LastAckTimeout () +void TcpSocketImpl::LastAckTimeout () { m_lastAckEvent.Cancel (); if (m_state == LAST_ACK) @@ -1307,7 +1250,7 @@ void TcpSocket::LastAckTimeout () } } -void TcpSocket::Retransmit () +void TcpSocketImpl::Retransmit () { NS_LOG_FUNCTION (this); uint8_t flags = TcpHeader::NONE; @@ -1344,14 +1287,14 @@ void TcpSocket::Retransmit () flags = flags | TcpHeader::FIN; } - NS_LOG_LOGIC ("TcpSocket " << this << " retxing seq " << m_highestRxAck); + NS_LOG_LOGIC ("TcpSocketImpl " << this << " retxing seq " << m_highestRxAck); if (m_retxEvent.IsExpired () ) { Time rto = m_rtt->RetransmitTimeout (); NS_LOG_LOGIC ("Schedule retransmission timeout at time " << Simulator::Now ().GetSeconds () << " to expire at time " << (Simulator::Now () + rto).GetSeconds ()); - m_retxEvent = Simulator::Schedule (rto,&TcpSocket::ReTxTimeout,this); + m_retxEvent = Simulator::Schedule (rto,&TcpSocketImpl::ReTxTimeout,this); } m_rtt->SentSeq (m_highestRxAck,p->GetSize ()); // And send the packet @@ -1367,4 +1310,124 @@ void TcpSocket::Retransmit () m_remoteAddress); } +void +TcpSocketImpl::SetSndBufSize (uint32_t size) +{ + m_sndBufSize = size; +} + +uint32_t +TcpSocketImpl::GetSndBufSize (void) const +{ + return m_sndBufSize; +} + +void +TcpSocketImpl::SetRcvBufSize (uint32_t size) +{ + m_rcvBufSize = size; +} + +uint32_t +TcpSocketImpl::GetRcvBufSize (void) const +{ + return m_rcvBufSize; +} + +void +TcpSocketImpl::SetSegSize (uint32_t size) +{ + m_segmentSize = size; +} + +uint32_t +TcpSocketImpl::GetSegSize (void) const +{ + return m_segmentSize; +} + +void +TcpSocketImpl::SetAdvWin (uint32_t window) +{ + m_advertisedWindowSize = window; +} + +uint32_t +TcpSocketImpl::GetAdvWin (void) const +{ + return m_advertisedWindowSize; +} + +void +TcpSocketImpl::SetSSThresh (uint32_t threshold) +{ + m_ssThresh = threshold; +} + +uint32_t +TcpSocketImpl::GetSSThresh (void) const +{ + return m_ssThresh; +} + +void +TcpSocketImpl::SetInitialCwnd (uint32_t cwnd) +{ + m_initialCWnd = cwnd; +} + +uint32_t +TcpSocketImpl::GetInitialCwnd (void) const +{ + return m_initialCWnd; +} + +void +TcpSocketImpl::SetConnTimeout (Time timeout) +{ + m_cnTimeout = timeout; +} + +Time +TcpSocketImpl::GetConnTimeout (void) const +{ + return m_cnTimeout; +} + +void +TcpSocketImpl::SetConnCount (uint32_t count) +{ + m_cnCount = count; +} + +uint32_t +TcpSocketImpl::GetConnCount (void) const +{ + return m_cnCount; +} + +void +TcpSocketImpl::SetDelAckTimeout (Time timeout) +{ + m_delAckTimeout = timeout; +} + +Time +TcpSocketImpl::GetDelAckTimeout (void) const +{ + return m_delAckTimeout; +} + +void +TcpSocketImpl::SetDelAckMaxCount (uint32_t count) +{ + m_delAckMaxCount = count; +} + +uint32_t +TcpSocketImpl::GetDelAckMaxCount (void) const +{ + return m_delAckMaxCount; +} + }//namespace ns3 diff --git a/src/internet-node/tcp-socket.h b/src/internet-node/tcp-socket-impl.h similarity index 80% rename from src/internet-node/tcp-socket.h rename to src/internet-node/tcp-socket-impl.h index 023d3029d..7adc8669e 100644 --- a/src/internet-node/tcp-socket.h +++ b/src/internet-node/tcp-socket-impl.h @@ -17,14 +17,14 @@ * * Author: Raj Bhattacharjea */ -#ifndef TCP_SOCKET_H -#define TCP_SOCKET_H +#ifndef TCP_SOCKET_IMPL_H +#define TCP_SOCKET_IMPL_H #include #include #include "ns3/callback.h" #include "ns3/traced-value.h" -#include "ns3/socket.h" +#include "ns3/tcp-socket.h" #include "ns3/ptr.h" #include "ns3/ipv4-address.h" #include "ns3/event-id.h" @@ -42,16 +42,16 @@ class Packet; class TcpL4Protocol; class TcpHeader; -class TcpSocket : public Socket +class TcpSocketImpl : public TcpSocket { public: static TypeId GetTypeId (void); /** * Create an unbound tcp socket. */ - TcpSocket (); - TcpSocket (const TcpSocket& sock); - virtual ~TcpSocket (); + TcpSocketImpl (); + TcpSocketImpl (const TcpSocketImpl& sock); + virtual ~TcpSocketImpl (); void SetNode (Ptr node); void SetTcp (Ptr tcp); @@ -74,12 +74,6 @@ public: virtual Ptr Recv (uint32_t maxSize, uint32_t flags); virtual uint32_t GetRxAvailable (void) const; -protected: - virtual void SetSndBuf (uint32_t size); - virtual uint32_t GetSndBuf (void) const; - virtual void SetRcvBuf (uint32_t size); - virtual uint32_t GetRcvBuf (void) const; - private: friend class Tcp; // invoked by Tcp class @@ -110,7 +104,7 @@ private: // Manage data tx/rx void NewRx (Ptr, const TcpHeader&, const Address&); // XXX This should be virtual and overridden - Ptr Copy (); + Ptr Copy (); void NewAck (SequenceNumber seq); // XXX This should be virtual and overridden void DupAck (const TcpHeader& t, uint32_t count); @@ -120,6 +114,28 @@ private: void Retransmit (); void CommonNewAck (SequenceNumber seq, bool skipTimer = false); + // attribute related + virtual void SetSndBufSize (uint32_t size); + virtual uint32_t GetSndBufSize (void) const; + virtual void SetRcvBufSize (uint32_t size); + virtual uint32_t GetRcvBufSize (void) const; + virtual void SetSegSize (uint32_t size); + virtual uint32_t GetSegSize (void) const; + virtual void SetAdvWin (uint32_t window); + virtual uint32_t GetAdvWin (void) const; + virtual void SetSSThresh (uint32_t threshold); + virtual uint32_t GetSSThresh (void) const; + virtual void SetInitialCwnd (uint32_t cwnd); + virtual uint32_t GetInitialCwnd (void) const; + virtual void SetConnTimeout (Time timeout); + virtual Time GetConnTimeout (void) const; + virtual void SetConnCount (uint32_t count); + virtual uint32_t GetConnCount (void) const; + virtual void SetDelAckTimeout (Time timeout); + virtual Time GetDelAckTimeout (void) const; + virtual void SetDelAckMaxCount (uint32_t count); + virtual uint32_t GetDelAckMaxCount (void) const; + bool m_skipRetxResched; uint32_t m_dupAckCount; EventId m_retxEvent; @@ -128,7 +144,7 @@ private: EventId m_delAckEvent; uint32_t m_delAckCount; uint32_t m_delAckMaxCount; - Time m_delAckTimout; + Time m_delAckTimeout; Ipv4EndPoint *m_endPoint; Ptr m_node; @@ -187,11 +203,13 @@ private: std::queue > m_deliveryQueue; uint32_t m_rxAvailable; - uint32_t m_sndBufLimit; // buffer limit for the outgoing queue - uint32_t m_rcvBufLimit; // maximum receive socket buffer size bool m_wouldBlock; // set to true whenever socket would block on send() + + // Attributes + uint32_t m_rcvBufSize; // maximum receive socket buffer size + uint32_t m_sndBufSize; // buffer limit for the outgoing queue }; }//namespace ns3 -#endif /* TCP_SOCKET_H */ +#endif /* TCP_SOCKET_IMPL_H */ diff --git a/src/internet-node/udp-socket-impl.h b/src/internet-node/udp-socket-impl.h index 71bded586..42047a5d0 100644 --- a/src/internet-node/udp-socket-impl.h +++ b/src/internet-node/udp-socket-impl.h @@ -64,6 +64,7 @@ public: virtual Ptr Recv (uint32_t maxSize, uint32_t flags); virtual uint32_t GetRxAvailable (void) const; +private: // Attributes set through UdpSocket base class virtual void SetRcvBufSize (uint32_t size); virtual uint32_t GetRcvBufSize (void) const; @@ -72,7 +73,6 @@ public: virtual void SetIpMulticastTtl (uint32_t ipTtl); virtual uint32_t GetIpMulticastTtl (void) const; -private: friend class UdpSocketFactory; // invoked by Udp class int FinishBind (void); diff --git a/src/internet-node/wscript b/src/internet-node/wscript index 7b05bdaf0..20f69c7b2 100644 --- a/src/internet-node/wscript +++ b/src/internet-node/wscript @@ -23,13 +23,13 @@ def build(bld): 'arp-l3-protocol.cc', 'ipv4-loopback-interface.cc', 'udp-socket-impl.cc', - 'tcp-socket.cc', + 'tcp-socket-impl.cc', 'ipv4-end-point-demux.cc', 'ipv4-impl.cc', 'ascii-trace.cc', 'pcap-trace.cc', 'udp-socket-factory-impl.cc', - 'tcp-impl.cc', + 'tcp-socket-factory-impl.cc', 'pending-data.cc', 'sequence-number.cc', 'rtt-estimator.cc', diff --git a/src/node/tcp-socket-factory.cc b/src/node/tcp-socket-factory.cc new file mode 100644 index 000000000..ca1ae25b8 --- /dev/null +++ b/src/node/tcp-socket-factory.cc @@ -0,0 +1,37 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 Georgia Tech Research Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Raj Bhattacharjea + */ +#include "tcp-socket-factory.h" +#include "ns3/uinteger.h" +#include "ns3/double.h" + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (TcpSocketFactory); + +TypeId +TcpSocketFactory::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::TcpSocketFactory") + .SetParent () + ; + return tid; +} + +} // namespace ns3 diff --git a/src/node/tcp.h b/src/node/tcp-socket-factory.h similarity index 59% rename from src/node/tcp.h rename to src/node/tcp-socket-factory.h index 91923cb62..35909cb54 100644 --- a/src/node/tcp.h +++ b/src/node/tcp-socket-factory.h @@ -17,8 +17,8 @@ * * Author: Raj Bhattacharjea */ -#ifndef TCP_H -#define TCP_H +#ifndef TCP_SOCKET_FACTORY_H +#define TCP_SOCKET_FACTORY_H #include "socket-factory.h" @@ -34,44 +34,22 @@ 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); virtual Ptr CreateSocket (void) = 0; - uint32_t GetDefaultSegSize (void) const; - uint32_t GetDefaultAdvWin (void) const; - uint32_t GetDefaultSsThresh (void) const; - uint32_t GetDefaultTxBuffer (void) const; - uint32_t GetDefaultRxBuffer (void) const; - uint32_t GetDefaultInitialCwnd (void) const; - uint32_t GetDefaultConnTimeout (void) const; - uint32_t GetDefaultConnCount (void) const; - double GetDefaultDelAckTimeout (void) const; - uint32_t GetDefaultDelAckCount (void) const; - -private: - uint32_t m_defaultSegSize; - uint32_t m_defaultAdvWin; - uint32_t m_defaultSsThresh; - uint32_t m_defaultTxBuffer; - uint32_t m_defaultRxBuffer; - uint32_t m_defaultInitialCwnd; - uint32_t m_defaultConnTimeout; - uint32_t m_defaultConnCount; - double m_defaultDelAckTimeout; - uint32_t m_defaultDelAckCount; - }; } // namespace ns3 -#endif /* TCP_H */ +#endif /* TCP_SOCKET_FACTORY_H */ diff --git a/src/node/tcp-socket.cc b/src/node/tcp-socket.cc new file mode 100644 index 000000000..1dd3d4057 --- /dev/null +++ b/src/node/tcp-socket.cc @@ -0,0 +1,114 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mathieu Lacage + */ + +#include "ns3/object.h" +#include "ns3/log.h" +#include "ns3/uinteger.h" +#include "ns3/double.h" +#include "ns3/trace-source-accessor.h" +#include "ns3/nstime.h" +#include "tcp-socket.h" + +NS_LOG_COMPONENT_DEFINE ("TcpSocket"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (TcpSocket); + +TypeId +TcpSocket::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::TcpSocket") + .SetParent () + .AddAttribute ("SndBufSize", + "TcpSocket maximum transmit buffer size (bytes)", + UintegerValue (0xffffffffl), + MakeUintegerAccessor (&TcpSocket::GetSndBufSize, + &TcpSocket::SetSndBufSize), + MakeUintegerChecker ()) + .AddAttribute ("RcvBufSize", + "TcpSocket maximum receive buffer size (bytes)", + UintegerValue (0xffffffffl), + MakeUintegerAccessor (&TcpSocket::GetRcvBufSize, + &TcpSocket::SetRcvBufSize), + MakeUintegerChecker ()) + .AddAttribute ("SegmentSize", + "TCP maximum segment size in bytes (may be adjusted based on MTU discovery)", + UintegerValue (536), + MakeUintegerAccessor (&TcpSocket::GetSegSize, + &TcpSocket::SetSegSize), + MakeUintegerChecker ()) + .AddAttribute ("AdvertisedWindowSize", + "TCP advertised window size (bytes)", + UintegerValue (0xffff), + MakeUintegerAccessor (&TcpSocket::GetAdvWin, + &TcpSocket::SetAdvWin), + MakeUintegerChecker ()) + .AddAttribute ("SlowStartThreshold", + "TCP slow start threshold (bytes)", + UintegerValue (0xffff), + MakeUintegerAccessor (&TcpSocket::GetSSThresh, + &TcpSocket::SetSSThresh), + MakeUintegerChecker ()) + .AddAttribute ("InitialCwnd", + "TCP initial congestion window size (segments)", + UintegerValue (1), + MakeUintegerAccessor (&TcpSocket::GetInitialCwnd, + &TcpSocket::SetInitialCwnd), + MakeUintegerChecker ()) + .AddAttribute ("ConnTimeout", + "TCP retransmission timeout when opening connection (seconds)", + TimeValue (Seconds (3)), + MakeTimeAccessor (&TcpSocket::GetConnTimeout, + &TcpSocket::SetConnTimeout), + MakeTimeChecker ()) + .AddAttribute ("ConnCount", + "Number of connection attempts (SYN retransmissions) before returning failure", + UintegerValue (6), + MakeUintegerAccessor (&TcpSocket::GetConnCount, + &TcpSocket::SetConnCount), + MakeUintegerChecker ()) + .AddAttribute ("DelAckTimeout", + "Timeout value for TCP delayed acks, in seconds", + TimeValue (Seconds (0.2)), + MakeTimeAccessor (&TcpSocket::GetDelAckTimeout, + &TcpSocket::SetDelAckTimeout), + MakeTimeChecker ()) + .AddAttribute ("DelAckCount", + "Number of packets to wait before sending a TCP ack", + UintegerValue (2), + MakeUintegerAccessor (&TcpSocket::GetDelAckMaxCount, + &TcpSocket::SetDelAckMaxCount), + MakeUintegerChecker ()) + ; + return tid; +} + +TcpSocket::TcpSocket () +{ + NS_LOG_FUNCTION_NOARGS (); +} + +TcpSocket::~TcpSocket () +{ + NS_LOG_FUNCTION_NOARGS (); +} + +}; // namespace ns3 diff --git a/src/node/tcp-socket.h b/src/node/tcp-socket.h new file mode 100644 index 000000000..9092474f4 --- /dev/null +++ b/src/node/tcp-socket.h @@ -0,0 +1,94 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006 Georgia Tech Research Corporation + * 2007 INRIA + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: George F. Riley + * Mathieu Lacage + */ + +#ifndef __TCP_SOCKET_H__ +#define __TCP_SOCKET_H__ + +#include "socket.h" +#include "ns3/traced-callback.h" +#include "ns3/callback.h" +#include "ns3/ptr.h" +#include "ns3/object.h" +#include "ns3/nstime.h" + +namespace ns3 { + +class Node; +class Packet; + +/** + * \brief (abstract) base class of all TcpSockets + * + * This class exists solely for hosting TcpSocket attributes that can + * be reused across different implementations. + */ +class TcpSocket : public Socket +{ +public: + static TypeId GetTypeId (void); + + TcpSocket (void); + virtual ~TcpSocket (void); + + virtual enum Socket::SocketErrno GetErrno (void) const = 0; + virtual Ptr GetNode (void) const = 0; + virtual int Bind () = 0; + virtual int Close (void) = 0; + virtual int ShutdownSend (void) = 0; + virtual int ShutdownRecv (void) = 0; + virtual int Connect (const Address &address) = 0; + virtual int Send (Ptr p) = 0; + virtual uint32_t GetTxAvailable (void) const = 0; + virtual int SendTo (Ptr p, const Address &address) = 0; + virtual Ptr Recv (uint32_t maxSize, uint32_t flags) = 0; + virtual uint32_t GetRxAvailable (void) const = 0; + +private: + // Indirect the attribute setting and getting through private virtual methods + virtual void SetSndBufSize (uint32_t size) = 0; + virtual uint32_t GetSndBufSize (void) const = 0; + virtual void SetRcvBufSize (uint32_t size) = 0; + virtual uint32_t GetRcvBufSize (void) const = 0; + virtual void SetSegSize (uint32_t size) = 0; + virtual uint32_t GetSegSize (void) const = 0; + virtual void SetAdvWin (uint32_t window) = 0; + virtual uint32_t GetAdvWin (void) const = 0; + virtual void SetSSThresh (uint32_t threshold) = 0; + virtual uint32_t GetSSThresh (void) const = 0; + virtual void SetInitialCwnd (uint32_t count) = 0; + virtual uint32_t GetInitialCwnd (void) const = 0; + virtual void SetConnTimeout (Time timeout) = 0; + virtual Time GetConnTimeout (void) const = 0; + virtual void SetConnCount (uint32_t count) = 0; + virtual uint32_t GetConnCount (void) const = 0; + virtual void SetDelAckTimeout (Time timeout) = 0; + virtual Time GetDelAckTimeout (void) const = 0; + virtual void SetDelAckMaxCount (uint32_t count) = 0; + virtual uint32_t GetDelAckMaxCount (void) const = 0; + +}; + +} //namespace ns3 + +#endif /* TCP_SOCKET_H */ + + diff --git a/src/node/tcp.cc b/src/node/tcp.cc deleted file mode 100644 index 77e02362f..000000000 --- a/src/node/tcp.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 Georgia Tech Research Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Raj Bhattacharjea - */ -#include "tcp.h" -#include "ns3/uinteger.h" -#include "ns3/double.h" - -namespace ns3 { - -NS_OBJECT_ENSURE_REGISTERED (Tcp); - -TypeId -Tcp::GetTypeId (void) -{ - static TypeId tid = TypeId ("ns3::Tcp") - .SetParent () - .AddAttribute ("DefaultSegmentSize", - "Default TCP maximum segment size in bytes (may be adjusted based on MTU discovery)", - UintegerValue (536), - MakeUintegerAccessor (&Tcp::m_defaultSegSize), - MakeUintegerChecker ()) - .AddAttribute ("DefaultAdvertisedWindowSize", - "Default TCP advertised window size (bytes)", - UintegerValue (0xffff), - MakeUintegerAccessor (&Tcp::m_defaultAdvWin), - MakeUintegerChecker ()) - .AddAttribute ("DefaultSlowStartThreshold", - "Default TCP slow start threshold (bytes)", - UintegerValue (0xffff), - MakeUintegerAccessor (&Tcp::m_defaultSsThresh), - MakeUintegerChecker ()) - .AddAttribute ("DefaultTxBufferSize", - "Default TCP maximum transmit buffer size (bytes)", - UintegerValue (0xffffffffl), - MakeUintegerAccessor (&Tcp::m_defaultTxBuffer), - MakeUintegerChecker ()) - .AddAttribute ("DefaultRxBufferSize", - "Default TCP maximum receive buffer size (bytes)", - UintegerValue (0xffffffffl), - MakeUintegerAccessor (&Tcp::m_defaultRxBuffer), - MakeUintegerChecker ()) - .AddAttribute ("DefaultInitialCongestionWindowSize", - "Default TCP initial congestion window size (segments)", - UintegerValue (1), - MakeUintegerAccessor (&Tcp::m_defaultInitialCwnd), - MakeUintegerChecker ()) - .AddAttribute ("DefaultConnTimeout", - "Default TCP retransmission timeout when opening connection (seconds)", - UintegerValue (3), - MakeUintegerAccessor (&Tcp::m_defaultConnTimeout), - MakeUintegerChecker ()) - .AddAttribute ("DefaultConnCount", - "Default number of connection attempts (SYN retransmissions) before returning failure", - UintegerValue (6), - MakeUintegerAccessor (&Tcp::m_defaultConnCount), - MakeUintegerChecker ()) - .AddAttribute ("DefaultDelAckTimeout", - "Default timeout value for TCP delayed acks, in seconds", - DoubleValue (0.2), - MakeDoubleAccessor (&Tcp::m_defaultDelAckTimeout), - MakeDoubleChecker ()) - .AddAttribute ("DefaultDelAckCount", - "Default number of packets to wait before sending a TCP ack", - UintegerValue (2), - MakeUintegerAccessor (&Tcp::m_defaultDelAckCount), - MakeUintegerChecker ()) - ; - return tid; -} - -uint32_t -Tcp::GetDefaultSegSize (void) const -{ - return m_defaultSegSize; -} -uint32_t -Tcp::GetDefaultAdvWin (void) const -{ - return m_defaultAdvWin; -} -uint32_t -Tcp::GetDefaultSsThresh (void) const -{ - return m_defaultSsThresh; -} -uint32_t -Tcp::GetDefaultTxBuffer (void) const -{ - return m_defaultTxBuffer; -} -uint32_t -Tcp::GetDefaultRxBuffer (void) const -{ - return m_defaultRxBuffer; -} -uint32_t -Tcp::GetDefaultInitialCwnd (void) const -{ - return m_defaultInitialCwnd; -} -uint32_t -Tcp::GetDefaultConnTimeout (void) const -{ - return m_defaultConnTimeout; -} -uint32_t -Tcp::GetDefaultConnCount (void) const -{ - return m_defaultConnCount; -} - -double -Tcp::GetDefaultDelAckTimeout (void) const -{ - return m_defaultDelAckTimeout; -} - -uint32_t -Tcp::GetDefaultDelAckCount (void) const -{ - return m_defaultDelAckCount; -} - -} // namespace ns3 diff --git a/src/node/udp-socket.h b/src/node/udp-socket.h index 5f20fd7c0..1c81916c2 100644 --- a/src/node/udp-socket.h +++ b/src/node/udp-socket.h @@ -61,7 +61,7 @@ public: virtual Ptr Recv (uint32_t maxSize, uint32_t flags) = 0; virtual uint32_t GetRxAvailable (void) const = 0; -public: +private: // Indirect the attribute setting and getting through private virtual methods virtual void SetRcvBufSize (uint32_t size) = 0; virtual uint32_t GetRcvBufSize (void) const = 0; diff --git a/src/node/wscript b/src/node/wscript index 3f35ca216..2f91f1e2a 100644 --- a/src/node/wscript +++ b/src/node/wscript @@ -27,7 +27,8 @@ def build(bld): 'packet-socket.cc', 'udp-socket.cc', 'udp-socket-factory.cc', - 'tcp.cc', + 'tcp-socket.cc', + 'tcp-socket-factory.cc', 'ipv4.cc', 'application.cc', 'simple-channel.cc', @@ -60,7 +61,8 @@ def build(bld): 'packet-socket-factory.h', 'udp-socket.h', 'udp-socket-factory.h', - 'tcp.h', + 'tcp-socket.h', + 'tcp-socket-factory.h', 'ipv4.h', 'application.h', 'simple-channel.h', diff --git a/utils/print-introspected-doxygen.cc b/utils/print-introspected-doxygen.cc index c714d5ee7..24f8b944f 100644 --- a/utils/print-introspected-doxygen.cc +++ b/utils/print-introspected-doxygen.cc @@ -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");