From 9b97d39c3209681f50128d29a4c8aa0778558fe0 Mon Sep 17 00:00:00 2001 From: Christian Facchini Date: Thu, 5 Aug 2010 11:22:11 -0400 Subject: [PATCH] Bug 969 - No SocketList is present in UdpL4Protocol class --- src/internet-stack/udp-l4-protocol.cc | 12 ++++++++++++ src/internet-stack/udp-l4-protocol.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/internet-stack/udp-l4-protocol.cc b/src/internet-stack/udp-l4-protocol.cc index c2fd98af3..7e194a056 100644 --- a/src/internet-stack/udp-l4-protocol.cc +++ b/src/internet-stack/udp-l4-protocol.cc @@ -23,6 +23,7 @@ #include "ns3/packet.h" #include "ns3/node.h" #include "ns3/boolean.h" +#include "ns3/object-vector.h" #include "ns3/ipv4-route.h" #include "udp-l4-protocol.h" @@ -48,6 +49,10 @@ UdpL4Protocol::GetTypeId (void) static TypeId tid = TypeId ("ns3::UdpL4Protocol") .SetParent () .AddConstructor () + .AddAttribute ("SocketList", "The list of sockets associated to this protocol.", + ObjectVectorValue (), + MakeObjectVectorAccessor (&UdpL4Protocol::m_sockets), + MakeObjectVectorChecker ()) ; return tid; } @@ -107,6 +112,12 @@ void UdpL4Protocol::DoDispose (void) { NS_LOG_FUNCTION_NOARGS (); + for (std::vector >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++) + { + *i = 0; + } + m_sockets.clear (); + if (m_endPoints != 0) { delete m_endPoints; @@ -123,6 +134,7 @@ UdpL4Protocol::CreateSocket (void) Ptr socket = CreateObject (); socket->SetNode (m_node); socket->SetUdp (this); + m_sockets.push_back (socket); return socket; } diff --git a/src/internet-stack/udp-l4-protocol.h b/src/internet-stack/udp-l4-protocol.h index 5b85f8446..226634a11 100644 --- a/src/internet-stack/udp-l4-protocol.h +++ b/src/internet-stack/udp-l4-protocol.h @@ -35,6 +35,8 @@ class Socket; class Ipv4Route; class Ipv4EndPointDemux; class Ipv4EndPoint; +class UdpSocketImpl; + /** * \ingroup udp * \brief Implementation of the UDP protocol @@ -117,6 +119,9 @@ protected: private: Ptr m_node; Ipv4EndPointDemux *m_endPoints; + UdpL4Protocol (const UdpL4Protocol &o); + UdpL4Protocol &operator = (const UdpL4Protocol &o); + std::vector > m_sockets; }; }; // namespace ns3