internet: (fixes #2762) BindToNetDevice change for NSC TCP sockets
addendum to changeset 12958:6e192ac0b562
This commit is contained in:
@@ -309,25 +309,27 @@ NscTcpL4Protocol::Allocate (Ipv4Address address)
|
||||
}
|
||||
|
||||
Ipv4EndPoint *
|
||||
NscTcpL4Protocol::Allocate (uint16_t port)
|
||||
NscTcpL4Protocol::Allocate (Ptr<NetDevice> boundNetDevice, uint16_t port)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << port);
|
||||
return m_endPoints->Allocate (port);
|
||||
NS_LOG_FUNCTION (this << boundNetDevice << port);
|
||||
return m_endPoints->Allocate (boundNetDevice, port);
|
||||
}
|
||||
|
||||
Ipv4EndPoint *
|
||||
NscTcpL4Protocol::Allocate (Ipv4Address address, uint16_t port)
|
||||
NscTcpL4Protocol::Allocate (Ptr<NetDevice> boundNetDevice, Ipv4Address address, uint16_t port)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address << port);
|
||||
return m_endPoints->Allocate (address, port);
|
||||
NS_LOG_FUNCTION (this << boundNetDevice << address << port);
|
||||
return m_endPoints->Allocate (boundNetDevice, address, port);
|
||||
}
|
||||
|
||||
Ipv4EndPoint *
|
||||
NscTcpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort,
|
||||
NscTcpL4Protocol::Allocate (Ptr<NetDevice> boundNetDevice,
|
||||
Ipv4Address localAddress, uint16_t localPort,
|
||||
Ipv4Address peerAddress, uint16_t peerPort)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << localAddress << localPort << peerAddress << peerPort);
|
||||
return m_endPoints->Allocate (localAddress, localPort,
|
||||
NS_LOG_FUNCTION (this << boundNetDevice << localAddress << localPort << peerAddress << peerPort);
|
||||
return m_endPoints->Allocate (boundNetDevice,
|
||||
localAddress, localPort,
|
||||
peerAddress, peerPort);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ class Ipv4Interface;
|
||||
class NscTcpSocketImpl;
|
||||
class Ipv4EndPoint;
|
||||
class NscInterfaceImpl;
|
||||
class NetDevice;
|
||||
|
||||
/**
|
||||
* \ingroup nsctcp
|
||||
@@ -99,26 +100,30 @@ public:
|
||||
Ipv4EndPoint *Allocate (Ipv4Address address);
|
||||
/**
|
||||
* \brief Allocate an IPv4 Endpoint
|
||||
* \param boundNetDevice Bound NetDevice (if any)
|
||||
* \param port port to use
|
||||
* \return the Endpoint
|
||||
*/
|
||||
Ipv4EndPoint *Allocate (uint16_t port);
|
||||
Ipv4EndPoint *Allocate (Ptr<NetDevice> boundNetDevice, uint16_t port);
|
||||
/**
|
||||
* \brief Allocate an IPv4 Endpoint
|
||||
* \param boundNetDevice Bound NetDevice (if any)
|
||||
* \param address address to use
|
||||
* \param port port to use
|
||||
* \return the Endpoint
|
||||
*/
|
||||
Ipv4EndPoint *Allocate (Ipv4Address address, uint16_t port);
|
||||
Ipv4EndPoint *Allocate (Ptr<NetDevice> boundNetDevice, Ipv4Address address, uint16_t port);
|
||||
/**
|
||||
* \brief Allocate an IPv4 Endpoint
|
||||
* \param boundNetDevice Bound NetDevice (if any)
|
||||
* \param localAddress local address to use
|
||||
* \param localPort local port to use
|
||||
* \param peerAddress remote address to use
|
||||
* \param peerPort remote port to use
|
||||
* \return the Endpoint
|
||||
*/
|
||||
Ipv4EndPoint *Allocate (Ipv4Address localAddress, uint16_t localPort,
|
||||
Ipv4EndPoint *Allocate (Ptr<NetDevice> boundNetDevice,
|
||||
Ipv4Address localAddress, uint16_t localPort,
|
||||
Ipv4Address peerAddress, uint16_t peerPort);
|
||||
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ NscTcpSocketImpl::Bind (const Address &address)
|
||||
}
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (port);
|
||||
m_endPoint = m_tcp->Allocate (GetBoundNetDevice (), port);
|
||||
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
@@ -260,7 +260,7 @@ NscTcpSocketImpl::Bind (const Address &address)
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4, port);
|
||||
m_endPoint = m_tcp->Allocate (GetBoundNetDevice (), ipv4, port);
|
||||
NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
|
||||
}
|
||||
|
||||
@@ -268,6 +268,19 @@ NscTcpSocketImpl::Bind (const Address &address)
|
||||
return FinishBind ();
|
||||
}
|
||||
|
||||
/* Inherit from Socket class: Bind this socket to the specified NetDevice */
|
||||
void
|
||||
NscTcpSocketImpl::BindToNetDevice (Ptr<NetDevice> netdevice)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << netdevice);
|
||||
Socket::BindToNetDevice (netdevice); // Includes sanity check
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
m_endPoint->BindToNetDevice (netdevice);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
NscTcpSocketImpl::ShutdownSend (void)
|
||||
{
|
||||
|
||||
@@ -105,6 +105,7 @@ public:
|
||||
virtual int GetSockName (Address &address) const;
|
||||
virtual bool SetAllowBroadcast (bool allowBroadcast);
|
||||
virtual bool GetAllowBroadcast () const;
|
||||
virtual void BindToNetDevice (Ptr<NetDevice> netdevice); // NetDevice with my m_endPoint
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user