get rid of CreateObjectWith
This commit is contained in:
@@ -40,7 +40,8 @@ PacketSocketFactory::PacketSocketFactory ()
|
||||
Ptr<Socket> PacketSocketFactory::CreateSocket (void)
|
||||
{
|
||||
Ptr<Node> node = GetObject<Node> ();
|
||||
Ptr<PacketSocket> socket = CreateObject<PacketSocket> (node);
|
||||
Ptr<PacketSocket> socket = CreateObject<PacketSocket> ();
|
||||
socket->SetNode (node);
|
||||
return socket;
|
||||
}
|
||||
} // namespace ns3
|
||||
|
||||
@@ -29,16 +29,9 @@ NS_LOG_COMPONENT_DEFINE ("PacketSocket");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
PacketSocket::PacketSocket (Ptr<Node> node)
|
||||
: m_node (node)
|
||||
PacketSocket::PacketSocket ()
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
Init();
|
||||
}
|
||||
|
||||
void
|
||||
PacketSocket::Init()
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
m_state = STATE_OPEN;
|
||||
m_shutdownSend = false;
|
||||
@@ -46,6 +39,12 @@ PacketSocket::Init()
|
||||
m_errno = ERROR_NOTERROR;
|
||||
}
|
||||
|
||||
void
|
||||
PacketSocket::SetNode (Ptr<Node> node)
|
||||
{
|
||||
m_node = node;
|
||||
}
|
||||
|
||||
PacketSocket::~PacketSocket ()
|
||||
{
|
||||
NS_LOG_FUNCTION;
|
||||
|
||||
@@ -71,9 +71,11 @@ class PacketSocketAddress;
|
||||
class PacketSocket : public Socket
|
||||
{
|
||||
public:
|
||||
PacketSocket (Ptr<Node> node);
|
||||
PacketSocket ();
|
||||
virtual ~PacketSocket ();
|
||||
|
||||
void SetNode (Ptr<Node> node);
|
||||
|
||||
virtual enum SocketErrno GetErrno (void) const;
|
||||
virtual Ptr<Node> GetNode (void) const;
|
||||
virtual int Bind (void);
|
||||
@@ -87,9 +89,6 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
void Init (void);
|
||||
void ForwardUp (Ptr<NetDevice> device, Ptr<Packet> packet,
|
||||
uint16_t protocol, const Address &from);
|
||||
int DoBind (const PacketSocketAddress &address);
|
||||
|
||||
Reference in New Issue
Block a user