remove Node::GetUdp

Mathieu Lacage 2007-05-03 14:23:41 +02:00
parent b1eccbe7bf
commit 2f1189d766
7 changed files with 5 additions and 29 deletions

View File

@ -94,12 +94,6 @@ InternetNode::CreateTraceResolver (TraceContext const &context)
InternetNode::ARP); InternetNode::ARP);
arp->Unref (); arp->Unref ();
Udp *udp = GetUdp ();
resolver->Add ("udp",
MakeCallback (&Udp::CreateTraceResolver, udp),
InternetNode::UDP);
udp->Unref ();
return resolver; return resolver;
} }
@ -118,15 +112,6 @@ InternetNode::GetIpv4 (void) const
ipv4->Ref (); ipv4->Ref ();
return ipv4; return ipv4;
} }
Udp *
InternetNode::GetUdp (void) const
{
Ipv4L4Demux *demux = QueryInterface<Ipv4L4Demux> (Ipv4L4Demux::iid);
Udp *udp = static_cast<Udp*> (demux->PeekProtocol (Udp::PROT_NUMBER));
demux->Unref ();
udp->Ref ();
return udp;
}
Arp * Arp *
InternetNode::GetArp (void) const InternetNode::GetArp (void) const

View File

@ -38,7 +38,6 @@ class InternetNode : public Node
public: public:
enum TraceType { enum TraceType {
IPV4, IPV4,
UDP,
ARP, ARP,
}; };
InternetNode(); InternetNode();
@ -46,7 +45,6 @@ public:
virtual TraceResolver *CreateTraceResolver (TraceContext const &context); virtual TraceResolver *CreateTraceResolver (TraceContext const &context);
// Capability access // Capability access
virtual Ipv4 * GetIpv4 (void) const; virtual Ipv4 * GetIpv4 (void) const;
virtual Udp * GetUdp (void) const;
virtual Arp * GetArp (void) const; virtual Arp * GetArp (void) const;
void SetName(std::string name); void SetName(std::string name);

View File

@ -107,11 +107,6 @@ Node::GetIpv4 (void) const
{ {
return 0; return 0;
} }
Udp *
Node::GetUdp (void) const
{
return 0;
}
Arp * Arp *
Node::GetArp (void) const Node::GetArp (void) const

View File

@ -32,7 +32,6 @@
namespace ns3 { namespace ns3 {
class Ipv4; class Ipv4;
class Udp;
class Arp; class Arp;
class TraceContext; class TraceContext;
@ -72,7 +71,6 @@ public:
// of the correct type if one exists, or the nil pointer if no // of the correct type if one exists, or the nil pointer if no
// null capability exists. // null capability exists.
virtual Ipv4 * GetIpv4 (void) const; virtual Ipv4 * GetIpv4 (void) const;
virtual Udp * GetUdp (void) const;
virtual Arp * GetArp (void) const; virtual Arp * GetArp (void) const;
private: private:

View File

@ -26,16 +26,16 @@
namespace ns3 { namespace ns3 {
UdpSocket::UdpSocket (Node *node) UdpSocket::UdpSocket (Node *node, Udp *udp)
: m_endPoint (0), : m_endPoint (0),
m_node (node), m_node (node),
m_udp (udp),
m_errno (ENOTERROR), m_errno (ENOTERROR),
m_shutdownSend (false), m_shutdownSend (false),
m_shutdownRecv (false), m_shutdownRecv (false),
m_connected (false) m_connected (false)
{ {
m_udp = m_node->GetUdp (); m_udp->Ref ();
NS_ASSERT (m_udp != 0);
m_node->Ref (); m_node->Ref ();
} }
UdpSocket::~UdpSocket () UdpSocket::~UdpSocket ()

View File

@ -38,7 +38,7 @@ public:
/** /**
* Create an unbound udp socket. * Create an unbound udp socket.
*/ */
UdpSocket (Node *node); UdpSocket (Node *node, Udp *udp);
virtual ~UdpSocket (); virtual ~UdpSocket ();
virtual enum SocketErrno GetErrno (void) const; virtual enum SocketErrno GetErrno (void) const;

View File

@ -73,7 +73,7 @@ Udp::DoDispose (void)
Socket * Socket *
Udp::CreateSocket (void) Udp::CreateSocket (void)
{ {
return new UdpSocket (m_node); return new UdpSocket (m_node, this);
} }
Ipv4EndPoint * Ipv4EndPoint *