internet: (fixes #1006) Remove InetSocketAddress ToS functions and replace with attributes

This commit is contained in:
Tommaso Pecorella
2024-01-15 16:37:10 -06:00
parent c70cfd026e
commit ca83416d07
34 changed files with 170 additions and 110 deletions

View File

@@ -133,9 +133,9 @@ main(int argc, char* argv[])
ApplicationContainer apps;
InetSocketAddress rmt(interfaces.GetAddress(0), port);
rmt.SetTos(0xb8);
AddressValue remoteAddress(rmt);
onoff.SetAttribute("Remote", remoteAddress);
onoff.SetAttribute("Remote", AddressValue(rmt));
onoff.SetAttribute("Tos", UintegerValue(0xb8));
apps.Add(onoff.Install(nodes.Get(1)));
apps.Start(Seconds(1.0));
apps.Stop(Seconds(simulationTime + 0.1));

View File

@@ -174,9 +174,8 @@ main(int argc, char* argv[])
ApplicationContainer apps;
InetSocketAddress rmt(interfaces.GetAddress(0), port);
rmt.SetTos(0xb8);
AddressValue remoteAddress(rmt);
onoff.SetAttribute("Remote", remoteAddress);
onoff.SetAttribute("Remote", AddressValue(rmt));
onoff.SetAttribute("Tos", UintegerValue(0xb8));
apps.Add(onoff.Install(nodes.Get(1)));
apps.Start(Seconds(1.0));
apps.Stop(Seconds(simulationTime + 0.1));

View File

@@ -299,13 +299,13 @@ main(int argc, char* argv[])
serverAppA.Stop(Seconds(simulationTime + 1));
InetSocketAddress destA(ApInterfaceA.GetAddress(0), port);
destA.SetTos(0x70); // AC_BE
OnOffHelper clientA("ns3::UdpSocketFactory", destA);
clientA.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
clientA.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
clientA.SetAttribute("DataRate", StringValue("100000kb/s"));
clientA.SetAttribute("PacketSize", UintegerValue(payloadSize));
clientA.SetAttribute("Tos", UintegerValue(0x70)); // AC_BE
ApplicationContainer clientAppA = clientA.Install(wifiStaNodes.Get(0));
clientAppA.Start(Seconds(1.0));
@@ -317,13 +317,13 @@ main(int argc, char* argv[])
serverAppB.Stop(Seconds(simulationTime + 1));
InetSocketAddress destB(ApInterfaceB.GetAddress(0), port);
destB.SetTos(0x70); // AC_BE
OnOffHelper clientB("ns3::UdpSocketFactory", destB);
clientB.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
clientB.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
clientB.SetAttribute("DataRate", StringValue("100000kb/s"));
clientB.SetAttribute("PacketSize", UintegerValue(payloadSize));
clientB.SetAttribute("Tos", UintegerValue(0x70)); // AC_BE
ApplicationContainer clientAppB = clientB.Install(wifiStaNodes.Get(1));
clientAppB.Start(Seconds(1.0));
@@ -335,13 +335,13 @@ main(int argc, char* argv[])
serverAppC.Stop(Seconds(simulationTime + 1));
InetSocketAddress destC(ApInterfaceC.GetAddress(0), port);
destC.SetTos(0xb8); // AC_VI
OnOffHelper clientC("ns3::UdpSocketFactory", destC);
clientC.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
clientC.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
clientC.SetAttribute("DataRate", StringValue("100000kb/s"));
clientC.SetAttribute("PacketSize", UintegerValue(payloadSize));
clientC.SetAttribute("Tos", UintegerValue(0xb8)); // AC_VI
ApplicationContainer clientAppC = clientC.Install(wifiStaNodes.Get(2));
clientAppC.Start(Seconds(1.0));
@@ -353,13 +353,13 @@ main(int argc, char* argv[])
serverAppD.Stop(Seconds(simulationTime + 1));
InetSocketAddress destD(ApInterfaceD.GetAddress(0), port);
destD.SetTos(0xb8); // AC_VI
OnOffHelper clientD("ns3::UdpSocketFactory", destD);
clientD.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
clientD.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
clientD.SetAttribute("DataRate", StringValue("100000kb/s"));
clientD.SetAttribute("PacketSize", UintegerValue(payloadSize));
clientD.SetAttribute("Tos", UintegerValue(0xb8)); // AC_VI
ApplicationContainer clientAppD = clientD.Install(wifiStaNodes.Get(3));
clientAppD.Start(Seconds(1.0));

View File

@@ -151,7 +151,6 @@ main(int argc, char* argv[])
auto ipv4 = wifiApNode.Get(0)->GetObject<Ipv4>();
const auto address = ipv4->GetAddress(1, 0).GetLocal();
InetSocketAddress sinkSocket(address, portNumber++);
sinkSocket.SetTos(tosValue);
OnOffHelper onOffHelper("ns3::UdpSocketFactory", sinkSocket);
onOffHelper.SetAttribute("OnTime",
StringValue("ns3::ConstantRandomVariable[Constant=1]"));
@@ -159,6 +158,7 @@ main(int argc, char* argv[])
StringValue("ns3::ConstantRandomVariable[Constant=0]"));
onOffHelper.SetAttribute("DataRate", DataRateValue(50000000 / nWifi));
onOffHelper.SetAttribute("PacketSize", UintegerValue(1472)); // bytes
onOffHelper.SetAttribute("Tos", UintegerValue(tosValue));
sourceApplications.Add(onOffHelper.Install(wifiStaNodes.Get(index)));
PacketSinkHelper packetSinkHelper("ns3::UdpSocketFactory", sinkSocket);
sinkApplications.Add(packetSinkHelper.Install(wifiApNode.Get(0)));