Move API for socket factory to a Socket::CreateSocket () factory method

This commit is contained in:
Tom Henderson
2008-05-12 06:39:00 -07:00
parent 3ebec1046c
commit a042d0bbef
11 changed files with 38 additions and 27 deletions

View File

@@ -22,7 +22,9 @@
#include "ns3/log.h"
#include "ns3/packet.h"
#include "node.h"
#include "socket.h"
#include "socket-factory.h"
NS_LOG_COMPONENT_DEFINE ("Socket");
@@ -83,6 +85,16 @@ Socket::~Socket ()
NS_LOG_FUNCTION_NOARGS ();
}
Ptr<Socket>
Socket::CreateSocket (Ptr<Node> node, TypeId tid)
{
Ptr<Socket> s;
Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory> (tid);
s = socketFactory->CreateSocket ();
NS_ASSERT (s != 0);
return s;
}
void
Socket::SetCloseCallback (Callback<void,Ptr<Socket> > closeCompleted)
{