applications: (merges !995) Unify handling of 'MaxPackets attribute is zero'
Treat zero max packets as infinite as PacketSocketClient already does.
This commit is contained in:
committed by
Tom Henderson
parent
40ec1d7a21
commit
adcc13e93c
@@ -28,6 +28,8 @@ Changes from ns-3.37 to ns-3.38
|
||||
|
||||
### Changed behavior
|
||||
|
||||
* (applications) **UdpClient** and **UdpEchoClient** MaxPackets attribute is aligned with other applications, in that the value zero means infinite packets.
|
||||
|
||||
Changes from ns-3.36 to ns-3.37
|
||||
-------------------------------
|
||||
|
||||
|
||||
@@ -50,11 +50,12 @@ UdpClient::GetTypeId()
|
||||
.SetParent<Application>()
|
||||
.SetGroupName("Applications")
|
||||
.AddConstructor<UdpClient>()
|
||||
.AddAttribute("MaxPackets",
|
||||
"The maximum number of packets the application will send",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&UdpClient::m_count),
|
||||
MakeUintegerChecker<uint32_t>())
|
||||
.AddAttribute(
|
||||
"MaxPackets",
|
||||
"The maximum number of packets the application will send (zero means infinite)",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&UdpClient::m_count),
|
||||
MakeUintegerChecker<uint32_t>())
|
||||
.AddAttribute("Interval",
|
||||
"The time to wait between packets",
|
||||
TimeValue(Seconds(1.0)),
|
||||
@@ -223,7 +224,7 @@ UdpClient::Send()
|
||||
}
|
||||
#endif // NS3_LOG_ENABLE
|
||||
|
||||
if (m_sent < m_count)
|
||||
if (m_sent < m_count || m_count == 0)
|
||||
{
|
||||
m_sendEvent = Simulator::Schedule(m_interval, &UdpClient::Send, this);
|
||||
}
|
||||
|
||||
@@ -44,11 +44,12 @@ UdpEchoClient::GetTypeId()
|
||||
.SetParent<Application>()
|
||||
.SetGroupName("Applications")
|
||||
.AddConstructor<UdpEchoClient>()
|
||||
.AddAttribute("MaxPackets",
|
||||
"The maximum number of packets the application will send",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&UdpEchoClient::m_count),
|
||||
MakeUintegerChecker<uint32_t>())
|
||||
.AddAttribute(
|
||||
"MaxPackets",
|
||||
"The maximum number of packets the application will send (zero means infinite)",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&UdpEchoClient::m_count),
|
||||
MakeUintegerChecker<uint32_t>())
|
||||
.AddAttribute("Interval",
|
||||
"The time to wait between packets",
|
||||
TimeValue(Seconds(1.0)),
|
||||
@@ -391,7 +392,7 @@ UdpEchoClient::Send()
|
||||
<< Inet6SocketAddress::ConvertFrom(m_peerAddress).GetPort());
|
||||
}
|
||||
|
||||
if (m_sent < m_count)
|
||||
if (m_sent < m_count || m_count == 0)
|
||||
{
|
||||
ScheduleTransmit(m_interval);
|
||||
}
|
||||
|
||||
@@ -42,35 +42,37 @@ NS_OBJECT_ENSURE_REGISTERED(Ping6);
|
||||
TypeId
|
||||
Ping6::GetTypeId()
|
||||
{
|
||||
static TypeId tid = TypeId("ns3::Ping6")
|
||||
.SetParent<Application>()
|
||||
.SetGroupName("Internet-Apps")
|
||||
.AddConstructor<Ping6>()
|
||||
.AddAttribute("MaxPackets",
|
||||
"The maximum number of packets the application will send",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&Ping6::m_count),
|
||||
MakeUintegerChecker<uint32_t>())
|
||||
.AddAttribute("Interval",
|
||||
"The time to wait between packets",
|
||||
TimeValue(Seconds(1.0)),
|
||||
MakeTimeAccessor(&Ping6::m_interval),
|
||||
MakeTimeChecker())
|
||||
.AddAttribute("RemoteIpv6",
|
||||
"The Ipv6Address of the outbound packets",
|
||||
Ipv6AddressValue(),
|
||||
MakeIpv6AddressAccessor(&Ping6::m_peerAddress),
|
||||
MakeIpv6AddressChecker())
|
||||
.AddAttribute("LocalIpv6",
|
||||
"Local Ipv6Address of the sender",
|
||||
Ipv6AddressValue(),
|
||||
MakeIpv6AddressAccessor(&Ping6::m_localAddress),
|
||||
MakeIpv6AddressChecker())
|
||||
.AddAttribute("PacketSize",
|
||||
"Size of packets generated",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&Ping6::m_size),
|
||||
MakeUintegerChecker<uint32_t>());
|
||||
static TypeId tid =
|
||||
TypeId("ns3::Ping6")
|
||||
.SetParent<Application>()
|
||||
.SetGroupName("Internet-Apps")
|
||||
.AddConstructor<Ping6>()
|
||||
.AddAttribute(
|
||||
"MaxPackets",
|
||||
"The maximum number of packets the application will send (zero means infinite)",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&Ping6::m_count),
|
||||
MakeUintegerChecker<uint32_t>())
|
||||
.AddAttribute("Interval",
|
||||
"The time to wait between packets",
|
||||
TimeValue(Seconds(1.0)),
|
||||
MakeTimeAccessor(&Ping6::m_interval),
|
||||
MakeTimeChecker())
|
||||
.AddAttribute("RemoteIpv6",
|
||||
"The Ipv6Address of the outbound packets",
|
||||
Ipv6AddressValue(),
|
||||
MakeIpv6AddressAccessor(&Ping6::m_peerAddress),
|
||||
MakeIpv6AddressChecker())
|
||||
.AddAttribute("LocalIpv6",
|
||||
"Local Ipv6Address of the sender",
|
||||
Ipv6AddressValue(),
|
||||
MakeIpv6AddressAccessor(&Ping6::m_localAddress),
|
||||
MakeIpv6AddressChecker())
|
||||
.AddAttribute("PacketSize",
|
||||
"Size of packets generated",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&Ping6::m_size),
|
||||
MakeUintegerChecker<uint32_t>());
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -246,7 +248,7 @@ Ping6::Send()
|
||||
|
||||
NS_LOG_INFO("Sent " << p->GetSize() << " bytes to " << m_peerAddress);
|
||||
|
||||
if (m_sent < m_count)
|
||||
if (m_sent < m_count || m_count == 0)
|
||||
{
|
||||
ScheduleTransmit(m_interval);
|
||||
}
|
||||
|
||||
@@ -125,11 +125,12 @@ EpsBearerTagUdpClient::GetTypeId()
|
||||
TypeId("ns3::EpsBearerTagUdpClient")
|
||||
.SetParent<Application>()
|
||||
.AddConstructor<EpsBearerTagUdpClient>()
|
||||
.AddAttribute("MaxPackets",
|
||||
"The maximum number of packets the application will send",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&EpsBearerTagUdpClient::m_count),
|
||||
MakeUintegerChecker<uint32_t>())
|
||||
.AddAttribute(
|
||||
"MaxPackets",
|
||||
"The maximum number of packets the application will send (zero means infinite)",
|
||||
UintegerValue(100),
|
||||
MakeUintegerAccessor(&EpsBearerTagUdpClient::m_count),
|
||||
MakeUintegerChecker<uint32_t>())
|
||||
.AddAttribute("Interval",
|
||||
"The time to wait between packets",
|
||||
TimeValue(Seconds(1.0)),
|
||||
@@ -241,7 +242,7 @@ EpsBearerTagUdpClient::Send()
|
||||
NS_LOG_INFO("Error while sending " << m_size << " bytes to " << m_peerAddress);
|
||||
}
|
||||
|
||||
if (m_sent < m_count)
|
||||
if (m_sent < m_count || m_count == 0)
|
||||
{
|
||||
m_sendEvent = Simulator::Schedule(m_interval, &EpsBearerTagUdpClient::Send, this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user