diff -r cd04d218ba62 src/internet-stack/udp-l4-protocol.cc --- a/src/internet-stack/udp-l4-protocol.cc Tue Jul 27 14:34:47 2010 -0400 +++ b/src/internet-stack/udp-l4-protocol.cc Thu Jul 29 14:13:08 2010 +0200 @@ -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 @@ 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 @@ 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 @@ Ptr socket = CreateObject (); socket->SetNode (m_node); socket->SetUdp (this); + m_sockets.push_back (socket); return socket; } diff -r cd04d218ba62 src/internet-stack/udp-l4-protocol.h --- a/src/internet-stack/udp-l4-protocol.h Tue Jul 27 14:34:47 2010 -0400 +++ b/src/internet-stack/udp-l4-protocol.h Thu Jul 29 14:13:08 2010 +0200 @@ -34,6 +34,7 @@ class Socket; class Ipv4Route; class Ipv4EndPointDemux; +class UdpSocketImpl; class Ipv4EndPoint; /** * \ingroup udp @@ -117,6 +118,7 @@ private: Ptr m_node; Ipv4EndPointDemux *m_endPoints; + std::vector > m_sockets; }; }; // namespace ns3