From 33ec0cf9eb3ffb816a347199ee5794e1f2b3d0b9 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Thu, 12 Sep 2024 19:31:55 -0700 Subject: [PATCH] fix missing command line parameters in corrupt-rate scenario (#139) --- .../corrupt-rate/corrupt-rate-error-model.cc | 4 ++++ sim/scenarios/corrupt-rate/corrupt-rate.cc | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sim/scenarios/corrupt-rate/corrupt-rate-error-model.cc b/sim/scenarios/corrupt-rate/corrupt-rate-error-model.cc index bd963e4..e417301 100644 --- a/sim/scenarios/corrupt-rate/corrupt-rate-error-model.cc +++ b/sim/scenarios/corrupt-rate/corrupt-rate-error-model.cc @@ -103,3 +103,7 @@ bool CorruptRateErrorModel::DoCorrupt(Ptr p) { void CorruptRateErrorModel::SetCorruptRate(int rate_in) { rate = rate_in; } + +void CorruptRateErrorModel::SetMaxCorruptBurst(int burst_in) { + burst = burst_in; +} diff --git a/sim/scenarios/corrupt-rate/corrupt-rate.cc b/sim/scenarios/corrupt-rate/corrupt-rate.cc index 2fbf821..e58ff88 100644 --- a/sim/scenarios/corrupt-rate/corrupt-rate.cc +++ b/sim/scenarios/corrupt-rate/corrupt-rate.cc @@ -12,7 +12,8 @@ using namespace std; NS_LOG_COMPONENT_DEFINE("ns3 simulator"); int main(int argc, char *argv[]) { - std::string delay, bandwidth, queue, client_rate, server_rate; + std::string delay, bandwidth, queue, client_rate, server_rate, + client_burst, server_burst; std::random_device rand_dev; std::mt19937 generator(rand_dev()); // Seed random number generator first Ptr client_corrupts = CreateObject(); @@ -24,6 +25,12 @@ int main(int argc, char *argv[]) { cmd.AddValue("queue", "queue size of the p2p link (in packets)", queue); cmd.AddValue("rate_to_client", "packet corruption rate (towards client)", client_rate); cmd.AddValue("rate_to_server", "packet corruption rate (towards server)", server_rate); + cmd.AddValue("burst_to_client", + "max. packet corruption burst length (towards client)", + client_burst); + cmd.AddValue("burst_to_server", + "max. packet corruption burst length (towards server)", + server_burst); cmd.Parse (argc, argv); NS_ABORT_MSG_IF(delay.length() == 0, "Missing parameter: delay"); @@ -34,7 +41,11 @@ int main(int argc, char *argv[]) { // Set client and server corruption rates. client_corrupts->SetCorruptRate(stoi(client_rate)); + if (client_burst.length() > 0) + client_corrupts->SetMaxCorruptBurst(stoi(client_burst)); server_corrupts->SetCorruptRate(stoi(server_rate)); + if (server_burst.length() > 0) + server_corrupts->SetMaxCorruptBurst(stoi(server_burst)); QuicNetworkSimulatorHelper sim;