Bug 969 - No SocketList is present in UdpL4Protocol class

This commit is contained in:
Christian Facchini
2010-08-05 11:22:11 -04:00
parent 3fc200bded
commit 9b97d39c32
2 changed files with 17 additions and 0 deletions

View File

@@ -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<Ipv4L4Protocol> ()
.AddConstructor<UdpL4Protocol> ()
.AddAttribute ("SocketList", "The list of sockets associated to this protocol.",
ObjectVectorValue (),
MakeObjectVectorAccessor (&UdpL4Protocol::m_sockets),
MakeObjectVectorChecker<UdpSocketImpl> ())
;
return tid;
}
@@ -107,6 +112,12 @@ void
UdpL4Protocol::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
for (std::vector<Ptr<UdpSocketImpl> >::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<UdpSocketImpl> socket = CreateObject<UdpSocketImpl> ();
socket->SetNode (m_node);
socket->SetUdp (this);
m_sockets.push_back (socket);
return socket;
}

View File

@@ -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<Node> m_node;
Ipv4EndPointDemux *m_endPoints;
UdpL4Protocol (const UdpL4Protocol &o);
UdpL4Protocol &operator = (const UdpL4Protocol &o);
std::vector<Ptr<UdpSocketImpl> > m_sockets;
};
}; // namespace ns3