From ad374c8d874bbb54e57ca2cc17b0950e924f5c93 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Tue, 20 May 2008 10:30:40 -0700 Subject: [PATCH] rename UdpSocket to UdpSocketImpl --- src/internet-node/udp-l4-protocol.cc | 4 +- src/internet-node/udp-socket-impl.cc | 102 ++++++++++----------- src/internet-node/udp-socket-impl.h | 14 +-- src/internet-node/wscript | 2 +- src/node/{udp-socketx.cc => udp-socket.cc} | 26 +++--- src/node/{udp-socketx.h => udp-socket.h} | 10 +- src/node/wscript | 4 +- 7 files changed, 81 insertions(+), 81 deletions(-) rename src/node/{udp-socketx.cc => udp-socket.cc} (72%) rename src/node/{udp-socketx.h => udp-socket.h} (94%) diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index 424908712..f3b85e15e 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -28,7 +28,7 @@ #include "ipv4-end-point-demux.h" #include "ipv4-end-point.h" #include "ipv4-l3-protocol.h" -#include "udp-socket.h" +#include "udp-socket-impl.h" NS_LOG_COMPONENT_DEFINE ("UdpL4Protocol"); @@ -95,7 +95,7 @@ Ptr UdpL4Protocol::CreateSocket (void) { NS_LOG_FUNCTION_NOARGS (); - Ptr socket = CreateObject (); + Ptr socket = CreateObject (); socket->SetNode (m_node); socket->SetUdp (this); return socket; diff --git a/src/internet-node/udp-socket-impl.cc b/src/internet-node/udp-socket-impl.cc index a7513e27f..9f326246e 100644 --- a/src/internet-node/udp-socket-impl.cc +++ b/src/internet-node/udp-socket-impl.cc @@ -27,12 +27,12 @@ #include "ns3/trace-source-accessor.h" #include "ns3/uinteger.h" #include "ns3/boolean.h" -#include "udp-socket.h" +#include "udp-socket-impl.h" #include "udp-l4-protocol.h" #include "ipv4-end-point.h" #include "ipv4-l4-demux.h" -NS_LOG_COMPONENT_DEFINE ("UdpSocket"); +NS_LOG_COMPONENT_DEFINE ("UdpSocketImpl"); namespace ns3 { @@ -40,18 +40,18 @@ static const uint32_t MAX_IPV4_UDP_DATAGRAM_SIZE = 65507; // Add attributes generic to all UdpSockets to base class UdpSocket TypeId -UdpSocket::GetTypeId (void) +UdpSocketImpl::GetTypeId (void) { - static TypeId tid = TypeId ("ns3::UdpSocket") - .SetParent () - .AddConstructor () + static TypeId tid = TypeId ("ns3::UdpSocketImpl") + .SetParent () + .AddConstructor () .AddTraceSource ("Drop", "Drop UDP packet due to receive buffer overflow", - MakeTraceSourceAccessor (&UdpSocket::m_dropTrace)) + MakeTraceSourceAccessor (&UdpSocketImpl::m_dropTrace)) ; return tid; } -UdpSocket::UdpSocket () +UdpSocketImpl::UdpSocketImpl () : m_endPoint (0), m_node (0), m_udp (0), @@ -64,7 +64,7 @@ UdpSocket::UdpSocket () NS_LOG_FUNCTION_NOARGS (); } -UdpSocket::~UdpSocket () +UdpSocketImpl::~UdpSocketImpl () { NS_LOG_FUNCTION_NOARGS (); @@ -88,14 +88,14 @@ UdpSocket::~UdpSocket () } void -UdpSocket::SetNode (Ptr node) +UdpSocketImpl::SetNode (Ptr node) { NS_LOG_FUNCTION_NOARGS (); m_node = node; } void -UdpSocket::SetUdp (Ptr udp) +UdpSocketImpl::SetUdp (Ptr udp) { NS_LOG_FUNCTION_NOARGS (); m_udp = udp; @@ -103,21 +103,21 @@ UdpSocket::SetUdp (Ptr udp) enum Socket::SocketErrno -UdpSocket::GetErrno (void) const +UdpSocketImpl::GetErrno (void) const { NS_LOG_FUNCTION_NOARGS (); return m_errno; } Ptr -UdpSocket::GetNode (void) const +UdpSocketImpl::GetNode (void) const { NS_LOG_FUNCTION_NOARGS (); return m_node; } void -UdpSocket::Destroy (void) +UdpSocketImpl::Destroy (void) { NS_LOG_FUNCTION_NOARGS (); m_node = 0; @@ -126,20 +126,20 @@ UdpSocket::Destroy (void) } int -UdpSocket::FinishBind (void) +UdpSocketImpl::FinishBind (void) { NS_LOG_FUNCTION_NOARGS (); if (m_endPoint == 0) { return -1; } - m_endPoint->SetRxCallback (MakeCallback (&UdpSocket::ForwardUp, this)); - m_endPoint->SetDestroyCallback (MakeCallback (&UdpSocket::Destroy, this)); + m_endPoint->SetRxCallback (MakeCallback (&UdpSocketImpl::ForwardUp, this)); + m_endPoint->SetDestroyCallback (MakeCallback (&UdpSocketImpl::Destroy, this)); return 0; } int -UdpSocket::Bind (void) +UdpSocketImpl::Bind (void) { NS_LOG_FUNCTION_NOARGS (); m_endPoint = m_udp->Allocate (); @@ -147,7 +147,7 @@ UdpSocket::Bind (void) } int -UdpSocket::Bind (const Address &address) +UdpSocketImpl::Bind (const Address &address) { NS_LOG_FUNCTION (this << address); @@ -180,7 +180,7 @@ UdpSocket::Bind (const Address &address) } int -UdpSocket::ShutdownSend (void) +UdpSocketImpl::ShutdownSend (void) { NS_LOG_FUNCTION_NOARGS (); m_shutdownSend = true; @@ -188,7 +188,7 @@ UdpSocket::ShutdownSend (void) } int -UdpSocket::ShutdownRecv (void) +UdpSocketImpl::ShutdownRecv (void) { NS_LOG_FUNCTION_NOARGS (); m_shutdownRecv = false; @@ -196,7 +196,7 @@ UdpSocket::ShutdownRecv (void) } int -UdpSocket::Close(void) +UdpSocketImpl::Close(void) { NS_LOG_FUNCTION_NOARGS (); NotifyCloseCompleted (); @@ -204,7 +204,7 @@ UdpSocket::Close(void) } int -UdpSocket::Connect(const Address & address) +UdpSocketImpl::Connect(const Address & address) { NS_LOG_FUNCTION (this << address); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); @@ -217,7 +217,7 @@ UdpSocket::Connect(const Address & address) } int -UdpSocket::Send (Ptr p) +UdpSocketImpl::Send (Ptr p) { NS_LOG_FUNCTION (this << p); @@ -230,7 +230,7 @@ UdpSocket::Send (Ptr p) } int -UdpSocket::DoSend (Ptr p) +UdpSocketImpl::DoSend (Ptr p) { NS_LOG_FUNCTION_NOARGS (); if (m_endPoint == 0) @@ -252,7 +252,7 @@ UdpSocket::DoSend (Ptr p) } int -UdpSocket::DoSendTo (Ptr p, const Address &address) +UdpSocketImpl::DoSendTo (Ptr p, const Address &address) { NS_LOG_FUNCTION (this << p << address); @@ -273,7 +273,7 @@ UdpSocket::DoSendTo (Ptr p, const Address &address) } int -UdpSocket::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port) +UdpSocketImpl::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port) { NS_LOG_FUNCTION (this << p << dest << port); @@ -364,7 +364,7 @@ UdpSocket::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port) // XXX maximum message size for UDP broadcast is limited by MTU // size of underlying link; we are not checking that now. uint32_t -UdpSocket::GetTxAvailable (void) const +UdpSocketImpl::GetTxAvailable (void) const { NS_LOG_FUNCTION_NOARGS (); // No finite send buffer is modelled, but we must respect @@ -373,7 +373,7 @@ UdpSocket::GetTxAvailable (void) const } int -UdpSocket::SendTo (Ptr p, const Address &address) +UdpSocketImpl::SendTo (Ptr p, const Address &address) { NS_LOG_FUNCTION (this << address << p); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); @@ -383,7 +383,7 @@ UdpSocket::SendTo (Ptr p, const Address &address) } Ptr -UdpSocket::Recv (uint32_t maxSize, uint32_t flags) +UdpSocketImpl::Recv (uint32_t maxSize, uint32_t flags) { NS_LOG_FUNCTION_NOARGS (); if (m_deliveryQueue.empty() ) @@ -404,7 +404,7 @@ UdpSocket::Recv (uint32_t maxSize, uint32_t flags) } uint32_t -UdpSocket::GetRxAvailable (void) const +UdpSocketImpl::GetRxAvailable (void) const { NS_LOG_FUNCTION_NOARGS (); // We separately maintain this state to avoid walking the queue @@ -413,7 +413,7 @@ UdpSocket::GetRxAvailable (void) const } void -UdpSocket::ForwardUp (Ptr packet, Ipv4Address ipv4, uint16_t port) +UdpSocketImpl::ForwardUp (Ptr packet, Ipv4Address ipv4, uint16_t port) { NS_LOG_FUNCTION (this << packet << ipv4 << port); @@ -445,37 +445,37 @@ UdpSocket::ForwardUp (Ptr packet, Ipv4Address ipv4, uint16_t port) void -UdpSocket::SetRcvBufSize (uint32_t size) +UdpSocketImpl::SetRcvBufSize (uint32_t size) { m_rcvBufSize = size; } uint32_t -UdpSocket::GetRcvBufSize (void) const +UdpSocketImpl::GetRcvBufSize (void) const { return m_rcvBufSize; } void -UdpSocket::SetIpTtl (uint32_t ipTtl) +UdpSocketImpl::SetIpTtl (uint32_t ipTtl) { m_ipTtl = ipTtl; } uint32_t -UdpSocket::GetIpTtl (void) const +UdpSocketImpl::GetIpTtl (void) const { return m_ipTtl; } void -UdpSocket::SetIpMulticastTtl (uint32_t ipTtl) +UdpSocketImpl::SetIpMulticastTtl (uint32_t ipTtl) { m_ipMulticastTtl = ipTtl; } uint32_t -UdpSocket::GetIpMulticastTtl (void) const +UdpSocketImpl::GetIpMulticastTtl (void) const { return m_ipMulticastTtl; } @@ -497,14 +497,14 @@ UdpSocket::GetIpMulticastTtl (void) const namespace ns3 { -class UdpSocketTest: public Test +class UdpSocketImplTest: public Test { Ptr m_receivedPacket; Ptr m_receivedPacket2; public: virtual bool RunTests (void); - UdpSocketTest (); + UdpSocketImplTest (); void ReceivePacket (Ptr socket, Ptr packet, const Address &from); void ReceivePacket2 (Ptr socket, Ptr packet, const Address &from); @@ -513,29 +513,29 @@ public: }; -UdpSocketTest::UdpSocketTest () - : Test ("UdpSocket") +UdpSocketImplTest::UdpSocketImplTest () + : Test ("UdpSocketImpl") { } -void UdpSocketTest::ReceivePacket (Ptr socket, Ptr packet, const Address &from) +void UdpSocketImplTest::ReceivePacket (Ptr socket, Ptr packet, const Address &from) { m_receivedPacket = packet; } -void UdpSocketTest::ReceivePacket2 (Ptr socket, Ptr packet, const Address &from) +void UdpSocketImplTest::ReceivePacket2 (Ptr socket, Ptr packet, const Address &from) { m_receivedPacket2 = packet; } -void UdpSocketTest::ReceivePkt (Ptr socket) +void UdpSocketImplTest::ReceivePkt (Ptr socket) { uint32_t availableData = socket->GetRxAvailable (); m_receivedPacket = socket->Recv (std::numeric_limits::max(), 0); NS_ASSERT (availableData == m_receivedPacket->GetSize ()); } -void UdpSocketTest::ReceivePkt2 (Ptr socket) +void UdpSocketImplTest::ReceivePkt2 (Ptr socket) { uint32_t availableData = socket->GetRxAvailable (); m_receivedPacket2 = socket->Recv (std::numeric_limits::max(), 0); @@ -543,7 +543,7 @@ void UdpSocketTest::ReceivePkt2 (Ptr socket) } bool -UdpSocketTest::RunTests (void) +UdpSocketImplTest::RunTests (void) { bool result = true; @@ -615,10 +615,10 @@ UdpSocketTest::RunTests (void) Ptr rxSocketFactory = rxNode->GetObject (); Ptr rxSocket = rxSocketFactory->CreateSocket (); NS_TEST_ASSERT_EQUAL (rxSocket->Bind (InetSocketAddress (Ipv4Address ("10.0.0.1"), 1234)), 0); - rxSocket->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePkt, this)); + rxSocket->SetRecvCallback (MakeCallback (&UdpSocketImplTest::ReceivePkt, this)); Ptr rxSocket2 = rxSocketFactory->CreateSocket (); - rxSocket2->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePkt2, this)); + rxSocket2->SetRecvCallback (MakeCallback (&UdpSocketImplTest::ReceivePkt2, this)); NS_TEST_ASSERT_EQUAL (rxSocket2->Bind (InetSocketAddress (Ipv4Address ("10.0.1.1"), 1234)), 0); Ptr txSocketFactory = txNode->GetObject (); @@ -659,7 +659,7 @@ UdpSocketTest::RunTests (void) // the socket address matches. rxSocket2->Dispose (); rxSocket2 = rxSocketFactory->CreateSocket (); - rxSocket2->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePkt2, this)); + rxSocket2->SetRecvCallback (MakeCallback (&UdpSocketImplTest::ReceivePkt2, this)); NS_TEST_ASSERT_EQUAL (rxSocket2->Bind (InetSocketAddress (Ipv4Address ("0.0.0.0"), 1234)), 0); m_receivedPacket = Create (); @@ -678,7 +678,7 @@ InetSocketAddress (Ipv4Address("255.255.255.255"), 1234)), 123); return result; } -static UdpSocketTest gUdpSocketTest; +static UdpSocketImplTest gUdpSocketImplTest; }; // namespace ns3 diff --git a/src/internet-node/udp-socket-impl.h b/src/internet-node/udp-socket-impl.h index 97f24f95a..71bded586 100644 --- a/src/internet-node/udp-socket-impl.h +++ b/src/internet-node/udp-socket-impl.h @@ -17,8 +17,8 @@ * * Author: Mathieu Lacage */ -#ifndef UDP_SOCKET_H -#define UDP_SOCKET_H +#ifndef UDP_SOCKET_IMPL_H +#define UDP_SOCKET_IMPL_H #include #include @@ -27,7 +27,7 @@ #include "ns3/socket.h" #include "ns3/ptr.h" #include "ns3/ipv4-address.h" -#include "ns3/udp-socketx.h" +#include "ns3/udp-socket.h" namespace ns3 { @@ -36,15 +36,15 @@ class Node; class Packet; class UdpL4Protocol; -class UdpSocket : public UdpSocketx +class UdpSocketImpl : public UdpSocket { public: static TypeId GetTypeId (void); /** * Create an unbound udp socket. */ - UdpSocket (); - virtual ~UdpSocket (); + UdpSocketImpl (); + virtual ~UdpSocketImpl (); void SetNode (Ptr node); void SetUdp (Ptr udp); @@ -108,4 +108,4 @@ private: }//namespace ns3 -#endif /* UDP_SOCKET_H */ +#endif /* UDP_SOCKET_IMPL_H */ diff --git a/src/internet-node/wscript b/src/internet-node/wscript index abd8f471c..7b05bdaf0 100644 --- a/src/internet-node/wscript +++ b/src/internet-node/wscript @@ -22,7 +22,7 @@ def build(bld): 'arp-ipv4-interface.cc', 'arp-l3-protocol.cc', 'ipv4-loopback-interface.cc', - 'udp-socket.cc', + 'udp-socket-impl.cc', 'tcp-socket.cc', 'ipv4-end-point-demux.cc', 'ipv4-impl.cc', diff --git a/src/node/udp-socketx.cc b/src/node/udp-socket.cc similarity index 72% rename from src/node/udp-socketx.cc rename to src/node/udp-socket.cc index 3e7c0fd3f..8fc5ea8b1 100644 --- a/src/node/udp-socketx.cc +++ b/src/node/udp-socket.cc @@ -22,47 +22,47 @@ #include "ns3/log.h" #include "ns3/uinteger.h" #include "ns3/trace-source-accessor.h" -#include "udp-socketx.h" +#include "udp-socket.h" -NS_LOG_COMPONENT_DEFINE ("UdpSocketx"); +NS_LOG_COMPONENT_DEFINE ("UdpSocket"); namespace ns3 { -NS_OBJECT_ENSURE_REGISTERED (UdpSocketx); +NS_OBJECT_ENSURE_REGISTERED (UdpSocket); TypeId -UdpSocketx::GetTypeId (void) +UdpSocket::GetTypeId (void) { - static TypeId tid = TypeId ("ns3::UdpSocketx") + static TypeId tid = TypeId ("ns3::UdpSocket") .SetParent () .AddAttribute ("RcvBufSize", "UdpSocket maximum receive buffer size (bytes)", UintegerValue (0xffffffffl), - MakeUintegerAccessor (&UdpSocketx::GetRcvBufSize, - &UdpSocketx::SetRcvBufSize), + MakeUintegerAccessor (&UdpSocket::GetRcvBufSize, + &UdpSocket::SetRcvBufSize), MakeUintegerChecker ()) .AddAttribute ("IpTtl", "socket-specific TTL for unicast IP packets (if non-zero)", UintegerValue (0), - MakeUintegerAccessor (&UdpSocketx::GetIpTtl, - &UdpSocketx::SetIpTtl), + MakeUintegerAccessor (&UdpSocket::GetIpTtl, + &UdpSocket::SetIpTtl), MakeUintegerChecker ()) .AddAttribute ("IpMulticastTtl", "socket-specific TTL for multicast IP packets (if non-zero)", UintegerValue (0), - MakeUintegerAccessor (&UdpSocketx::GetIpMulticastTtl, - &UdpSocketx::SetIpMulticastTtl), + MakeUintegerAccessor (&UdpSocket::GetIpMulticastTtl, + &UdpSocket::SetIpMulticastTtl), MakeUintegerChecker ()) ; return tid; } -UdpSocketx::UdpSocketx () +UdpSocket::UdpSocket () { NS_LOG_FUNCTION_NOARGS (); } -UdpSocketx::~UdpSocketx () +UdpSocket::~UdpSocket () { NS_LOG_FUNCTION_NOARGS (); } diff --git a/src/node/udp-socketx.h b/src/node/udp-socket.h similarity index 94% rename from src/node/udp-socketx.h rename to src/node/udp-socket.h index 3731ee7e8..5f20fd7c0 100644 --- a/src/node/udp-socketx.h +++ b/src/node/udp-socket.h @@ -20,8 +20,8 @@ * Mathieu Lacage */ -#ifndef __UDP_SOCKETX_H__ -#define __UDP_SOCKETX_H__ +#ifndef __UDP_SOCKET_H__ +#define __UDP_SOCKET_H__ #include "socket.h" #include "ns3/traced-callback.h" @@ -40,13 +40,13 @@ class Packet; * This class exists solely for hosting UdpSocket attributes that can * be reused across different implementations. */ -class UdpSocketx : public Socket +class UdpSocket : public Socket { public: static TypeId GetTypeId (void); - UdpSocketx (void); - virtual ~UdpSocketx (void); + UdpSocket (void); + virtual ~UdpSocket (void); virtual enum Socket::SocketErrno GetErrno (void) const = 0; virtual Ptr GetNode (void) const = 0; diff --git a/src/node/wscript b/src/node/wscript index c1238b8b9..3f35ca216 100644 --- a/src/node/wscript +++ b/src/node/wscript @@ -25,7 +25,7 @@ def build(bld): 'socket-factory.cc', 'packet-socket-factory.cc', 'packet-socket.cc', - 'udp-socketx.cc', + 'udp-socket.cc', 'udp-socket-factory.cc', 'tcp.cc', 'ipv4.cc', @@ -58,7 +58,7 @@ def build(bld): 'socket.h', 'socket-factory.h', 'packet-socket-factory.h', - 'udp-socketx.h', + 'udp-socket.h', 'udp-socket-factory.h', 'tcp.h', 'ipv4.h',