diff --git a/RELEASE_NOTES b/RELEASE_NOTES index ff515cc5a..97e25b8b2 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -94,6 +94,7 @@ Bugs fixed - Bug 2454 - DsrRouting::NotifyDataReceipt is also triggered for wifi management packets - Bug 2468 - Simulation with A-MPDU enabled hangs when fragmentation threshold is smaller than MSDU size - Bug 2469 - send Block Ack Request upon short/long retry failures +- Bug 2474 - UdpEchoClient does not call Connect with addresses of type Inet[6]SocketAddress - Bug 2479 - Flow monitor does not a have a "DROP_QUEUE_DISC" drop reason - Bug 2484 - Corrected the exit from CA_LOSS state in TCP - Bug 2486 - NextTxSequence was not traced back from TCB diff --git a/src/applications/helper/udp-client-server-helper.cc b/src/applications/helper/udp-client-server-helper.cc index a367a87a1..4b719a318 100644 --- a/src/applications/helper/udp-client-server-helper.cc +++ b/src/applications/helper/udp-client-server-helper.cc @@ -75,18 +75,10 @@ UdpClientHelper::UdpClientHelper (Address address, uint16_t port) SetAttribute ("RemotePort", UintegerValue (port)); } -UdpClientHelper::UdpClientHelper (Ipv4Address address, uint16_t port) +UdpClientHelper::UdpClientHelper (Address address) { m_factory.SetTypeId (UdpClient::GetTypeId ()); - SetAttribute ("RemoteAddress", AddressValue (Address(address))); - SetAttribute ("RemotePort", UintegerValue (port)); -} - -UdpClientHelper::UdpClientHelper (Ipv6Address address, uint16_t port) -{ - m_factory.SetTypeId (UdpClient::GetTypeId ()); - SetAttribute ("RemoteAddress", AddressValue (Address(address))); - SetAttribute ("RemotePort", UintegerValue (port)); + SetAttribute ("RemoteAddress", AddressValue (address)); } void @@ -121,19 +113,10 @@ UdpTraceClientHelper::UdpTraceClientHelper (Address address, uint16_t port, std: SetAttribute ("TraceFilename", StringValue (filename)); } -UdpTraceClientHelper::UdpTraceClientHelper (Ipv4Address address, uint16_t port, std::string filename) +UdpTraceClientHelper::UdpTraceClientHelper (Address address, std::string filename) { m_factory.SetTypeId (UdpTraceClient::GetTypeId ()); - SetAttribute ("RemoteAddress", AddressValue (Address (address))); - SetAttribute ("RemotePort", UintegerValue (port)); - SetAttribute ("TraceFilename", StringValue (filename)); -} - -UdpTraceClientHelper::UdpTraceClientHelper (Ipv6Address address, uint16_t port, std::string filename) -{ - m_factory.SetTypeId (UdpTraceClient::GetTypeId ()); - SetAttribute ("RemoteAddress", AddressValue (Address (address))); - SetAttribute ("RemotePort", UintegerValue (port)); + SetAttribute ("RemoteAddress", AddressValue (address)); SetAttribute ("TraceFilename", StringValue (filename)); } diff --git a/src/applications/helper/udp-client-server-helper.h b/src/applications/helper/udp-client-server-helper.h index 81de69828..ea42ff9fd 100644 --- a/src/applications/helper/udp-client-server-helper.h +++ b/src/applications/helper/udp-client-server-helper.h @@ -103,31 +103,25 @@ public: /** * Create UdpClientHelper which will make life easier for people trying - * to set up simulations with udp-client-server. - * - * \param ip The IPv4 address of the remote UDP server - * \param port The port number of the remote UDP server - */ - - UdpClientHelper (Ipv4Address ip, uint16_t port); - /** - * Create UdpClientHelper which will make life easier for people trying - * to set up simulations with udp-client-server. - * - * \param ip The IPv6 address of the remote UDP server - * \param port The port number of the remote UDP server - */ - - UdpClientHelper (Ipv6Address ip, uint16_t port); - /** - * Create UdpClientHelper which will make life easier for people trying - * to set up simulations with udp-client-server. + * to set up simulations with udp-client-server. Use this variant with + * addresses that do not include a port value (e.g., Ipv4Address and + * Ipv6Address). * * \param ip The IP address of the remote UDP server * \param port The port number of the remote UDP server */ UdpClientHelper (Address ip, uint16_t port); + /** + * Create UdpClientHelper which will make life easier for people trying + * to set up simulations with udp-client-server. Use this variant with + * addresses that do include a port value (e.g., InetSocketAddress and + * Inet6SocketAddress). + * + * \param addr The address of the remote UDP server + */ + + UdpClientHelper (Address addr); /** * Record an attribute to be set in each Application after it is is created. @@ -173,7 +167,9 @@ public: /** * Create UdpTraceClientHelper which will make life easier for people trying - * to set up simulations with udp-client-server. + * to set up simulations with udp-client-server. Use this variant with + * addresses that do not include a port value (e.g., Ipv4Address and + * Ipv6Address). * * \param ip The IP address of the remote UDP server * \param port The port number of the remote UDP server @@ -182,22 +178,14 @@ public: UdpTraceClientHelper (Address ip, uint16_t port, std::string filename); /** * Create UdpTraceClientHelper which will make life easier for people trying - * to set up simulations with udp-client-server. + * to set up simulations with udp-client-server. Use this variant with + * addresses that do include a port value (e.g., InetSocketAddress and + * Inet6SocketAddress). * - * \param ip The IPv4 address of the remote UDP server - * \param port The port number of the remote UDP server + * \param addr The address of the remote UDP server * \param filename the file from which packet traces will be loaded */ - UdpTraceClientHelper (Ipv4Address ip, uint16_t port, std::string filename); - /** - * Create UdpTraceClientHelper which will make life easier for people trying - * to set up simulations with udp-client-server. - * - * \param ip The IPv6 address of the remote UDP server - * \param port The port number of the remote UDP server - * \param filename the file from which packet traces will be loaded - */ - UdpTraceClientHelper (Ipv6Address ip, uint16_t port, std::string filename); + UdpTraceClientHelper (Address addr, std::string filename); /** * Record an attribute to be set in each Application after it is is created. diff --git a/src/applications/helper/udp-echo-helper.cc b/src/applications/helper/udp-echo-helper.cc index 90ae47123..b2449408c 100644 --- a/src/applications/helper/udp-echo-helper.cc +++ b/src/applications/helper/udp-echo-helper.cc @@ -80,18 +80,10 @@ UdpEchoClientHelper::UdpEchoClientHelper (Address address, uint16_t port) SetAttribute ("RemotePort", UintegerValue (port)); } -UdpEchoClientHelper::UdpEchoClientHelper (Ipv4Address address, uint16_t port) +UdpEchoClientHelper::UdpEchoClientHelper (Address address) { m_factory.SetTypeId (UdpEchoClient::GetTypeId ()); - SetAttribute ("RemoteAddress", AddressValue (Address(address))); - SetAttribute ("RemotePort", UintegerValue (port)); -} - -UdpEchoClientHelper::UdpEchoClientHelper (Ipv6Address address, uint16_t port) -{ - m_factory.SetTypeId (UdpEchoClient::GetTypeId ()); - SetAttribute ("RemoteAddress", AddressValue (Address(address))); - SetAttribute ("RemotePort", UintegerValue (port)); + SetAttribute ("RemoteAddress", AddressValue (address)); } void diff --git a/src/applications/helper/udp-echo-helper.h b/src/applications/helper/udp-echo-helper.h index 47fb652a9..a5daf71e4 100644 --- a/src/applications/helper/udp-echo-helper.h +++ b/src/applications/helper/udp-echo-helper.h @@ -108,7 +108,8 @@ class UdpEchoClientHelper public: /** * Create UdpEchoClientHelper which will make life easier for people trying - * to set up simulations with echos. + * to set up simulations with echos. Use this variant with addresses that do + * not include a port value (e.g., Ipv4Address and Ipv6Address). * * \param ip The IP address of the remote udp echo server * \param port The port number of the remote udp echo server @@ -116,20 +117,12 @@ public: UdpEchoClientHelper (Address ip, uint16_t port); /** * Create UdpEchoClientHelper which will make life easier for people trying - * to set up simulations with echos. + * to set up simulations with echos. Use this variant with addresses that do + * include a port value (e.g., InetSocketAddress and Inet6SocketAddress). * - * \param ip The IPv4 address of the remote udp echo server - * \param port The port number of the remote udp echo server + * \param addr The address of the remote udp echo server */ - UdpEchoClientHelper (Ipv4Address ip, uint16_t port); - /** - * Create UdpEchoClientHelper which will make life easier for people trying - * to set up simulations with echos. - * - * \param ip The IPv6 address of the remote udp echo server - * \param port The port number of the remote udp echo server - */ - UdpEchoClientHelper (Ipv6Address ip, uint16_t port); + UdpEchoClientHelper (Address addr); /** * Record an attribute to be set in each Application after it is is created. diff --git a/src/applications/model/udp-client.cc b/src/applications/model/udp-client.cc index 01b074e9a..3919857e2 100644 --- a/src/applications/model/udp-client.cc +++ b/src/applications/model/udp-client.cc @@ -86,22 +86,6 @@ UdpClient::~UdpClient () NS_LOG_FUNCTION (this); } -void -UdpClient::SetRemote (Ipv4Address ip, uint16_t port) -{ - NS_LOG_FUNCTION (this << ip << port); - m_peerAddress = Address(ip); - m_peerPort = port; -} - -void -UdpClient::SetRemote (Ipv6Address ip, uint16_t port) -{ - NS_LOG_FUNCTION (this << ip << port); - m_peerAddress = Address(ip); - m_peerPort = port; -} - void UdpClient::SetRemote (Address ip, uint16_t port) { @@ -110,6 +94,13 @@ UdpClient::SetRemote (Address ip, uint16_t port) m_peerPort = port; } +void +UdpClient::SetRemote (Address addr) +{ + NS_LOG_FUNCTION (this << addr); + m_peerAddress = addr; +} + void UdpClient::DoDispose (void) { @@ -136,6 +127,20 @@ UdpClient::StartApplication (void) m_socket->Bind6 (); m_socket->Connect (Inet6SocketAddress (Ipv6Address::ConvertFrom(m_peerAddress), m_peerPort)); } + else if (InetSocketAddress::IsMatchingType (m_peerAddress) == true) + { + m_socket->Bind (); + m_socket->Connect (m_peerAddress); + } + else if (Inet6SocketAddress::IsMatchingType (m_peerAddress) == true) + { + m_socket->Bind6 (); + m_socket->Connect (m_peerAddress); + } + else + { + NS_ASSERT_MSG (false, "Incompatible address type: " << m_peerAddress); + } } m_socket->SetRecvCallback (MakeNullCallback > ()); diff --git a/src/applications/model/udp-client.h b/src/applications/model/udp-client.h index f763fd427..9a9dd5e95 100644 --- a/src/applications/model/udp-client.h +++ b/src/applications/model/udp-client.h @@ -53,24 +53,17 @@ public: virtual ~UdpClient (); - /** - * \brief set the remote address and port - * \param ip remote IPv4 address - * \param port remote port - */ - void SetRemote (Ipv4Address ip, uint16_t port); - /** - * \brief set the remote address and port - * \param ip remote IPv6 address - * \param port remote port - */ - void SetRemote (Ipv6Address ip, uint16_t port); /** * \brief set the remote address and port * \param ip remote IP address * \param port remote port */ void SetRemote (Address ip, uint16_t port); + /** + * \brief set the remote address + * \param addr remote address + */ + void SetRemote (Address addr); protected: virtual void DoDispose (void); diff --git a/src/applications/model/udp-echo-client.cc b/src/applications/model/udp-echo-client.cc index 0b44b5277..06711b287 100644 --- a/src/applications/model/udp-echo-client.cc +++ b/src/applications/model/udp-echo-client.cc @@ -103,19 +103,10 @@ UdpEchoClient::SetRemote (Address ip, uint16_t port) } void -UdpEchoClient::SetRemote (Ipv4Address ip, uint16_t port) +UdpEchoClient::SetRemote (Address addr) { - NS_LOG_FUNCTION (this << ip << port); - m_peerAddress = Address (ip); - m_peerPort = port; -} - -void -UdpEchoClient::SetRemote (Ipv6Address ip, uint16_t port) -{ - NS_LOG_FUNCTION (this << ip << port); - m_peerAddress = Address (ip); - m_peerPort = port; + NS_LOG_FUNCTION (this << addr); + m_peerAddress = addr; } void @@ -144,6 +135,20 @@ UdpEchoClient::StartApplication (void) m_socket->Bind6(); m_socket->Connect (Inet6SocketAddress (Ipv6Address::ConvertFrom(m_peerAddress), m_peerPort)); } + else if (InetSocketAddress::IsMatchingType (m_peerAddress) == true) + { + m_socket->Bind (); + m_socket->Connect (m_peerAddress); + } + else if (Inet6SocketAddress::IsMatchingType (m_peerAddress) == true) + { + m_socket->Bind6 (); + m_socket->Connect (m_peerAddress); + } + else + { + NS_ASSERT_MSG (false, "Incompatible address type: " << m_peerAddress); + } } m_socket->SetRecvCallback (MakeCallback (&UdpEchoClient::HandleRead, this)); @@ -324,6 +329,16 @@ UdpEchoClient::Send (void) NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s client sent " << m_size << " bytes to " << Ipv6Address::ConvertFrom (m_peerAddress) << " port " << m_peerPort); } + else if (InetSocketAddress::IsMatchingType (m_peerAddress)) + { + NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s client sent " << m_size << " bytes to " << + InetSocketAddress::ConvertFrom (m_peerAddress).GetIpv4 () << " port " << InetSocketAddress::ConvertFrom (m_peerAddress).GetPort ()); + } + else if (Inet6SocketAddress::IsMatchingType (m_peerAddress)) + { + NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s client sent " << m_size << " bytes to " << + Inet6SocketAddress::ConvertFrom (m_peerAddress).GetIpv6 () << " port " << Inet6SocketAddress::ConvertFrom (m_peerAddress).GetPort ()); + } if (m_sent < m_count) { diff --git a/src/applications/model/udp-echo-client.h b/src/applications/model/udp-echo-client.h index 43274c4fd..6bcd448bd 100644 --- a/src/applications/model/udp-echo-client.h +++ b/src/applications/model/udp-echo-client.h @@ -49,24 +49,17 @@ public: virtual ~UdpEchoClient (); - /** - * \brief set the remote address and port - * \param ip remote IPv4 address - * \param port remote port - */ - void SetRemote (Ipv4Address ip, uint16_t port); - /** - * \brief set the remote address and port - * \param ip remote IPv6 address - * \param port remote port - */ - void SetRemote (Ipv6Address ip, uint16_t port); /** * \brief set the remote address and port * \param ip remote IP address * \param port remote port */ void SetRemote (Address ip, uint16_t port); + /** + * \brief set the remote address + * \param addr remote address + */ + void SetRemote (Address addr); /** * Set the data size of the packet (the number of bytes that are sent as data diff --git a/src/applications/model/udp-trace-client.cc b/src/applications/model/udp-trace-client.cc index 214e9fb4f..160c4e2fd 100644 --- a/src/applications/model/udp-trace-client.cc +++ b/src/applications/model/udp-trace-client.cc @@ -131,21 +131,11 @@ UdpTraceClient::SetRemote (Address ip, uint16_t port) } void -UdpTraceClient::SetRemote (Ipv4Address ip, uint16_t port) +UdpTraceClient::SetRemote (Address addr) { - NS_LOG_FUNCTION (this << ip << port); + NS_LOG_FUNCTION (this << addr); m_entries.clear (); - m_peerAddress = Address (ip); - m_peerPort = port; -} - -void -UdpTraceClient::SetRemote (Ipv6Address ip, uint16_t port) -{ - NS_LOG_FUNCTION (this << ip << port); - m_entries.clear (); - m_peerAddress = Address (ip); - m_peerPort = port; + m_peerAddress = addr; } void @@ -260,6 +250,20 @@ UdpTraceClient::StartApplication (void) m_socket->Bind6 (); m_socket->Connect (Inet6SocketAddress (Ipv6Address::ConvertFrom (m_peerAddress), m_peerPort)); } + else if (InetSocketAddress::IsMatchingType (m_peerAddress) == true) + { + m_socket->Bind (); + m_socket->Connect (m_peerAddress); + } + else if (Inet6SocketAddress::IsMatchingType (m_peerAddress) == true) + { + m_socket->Bind6 (); + m_socket->Connect (m_peerAddress); + } + else + { + NS_ASSERT_MSG (false, "Incompatible address type: " << m_peerAddress); + } } m_socket->SetRecvCallback (MakeNullCallback > ()); m_socket->SetAllowBroadcast (true); diff --git a/src/applications/model/udp-trace-client.h b/src/applications/model/udp-trace-client.h index dd4c7f5ed..ca96c3998 100644 --- a/src/applications/model/udp-trace-client.h +++ b/src/applications/model/udp-trace-client.h @@ -76,24 +76,17 @@ public: UdpTraceClient (Ipv4Address ip, uint16_t port, char *traceFile); ~UdpTraceClient (); - /** - * \brief set the remote address and port - * \param ip remote IPv4 address - * \param port remote port - */ - void SetRemote (Ipv4Address ip, uint16_t port); - /** - * \brief set the remote address and port - * \param ip remote IPv6 address - * \param port remote port - */ - void SetRemote (Ipv6Address ip, uint16_t port); /** * \brief set the remote address and port * \param ip remote IP address * \param port remote port */ void SetRemote (Address ip, uint16_t port); + /** + * \brief set the remote address + * \param addr remote address + */ + void SetRemote (Address addr); /** * \brief Set the trace file to be used by the application