pingserver: allow setting payload size
refs #2699
Change-Id: I45181845e196ea390f0b6b39165097df510f9116
diff --git a/tools/ping/server/ndn-ping-server.cpp b/tools/ping/server/ndn-ping-server.cpp
index 998c40d..a642ed1 100644
--- a/tools/ping/server/ndn-ping-server.cpp
+++ b/tools/ping/server/ndn-ping-server.cpp
@@ -86,6 +86,7 @@
options.shouldLimitSatisfied = false;
options.nMaxPings = 0;
options.shouldPrintTimestamp = false;
+ options.payloadSize = 0;
namespace po = boost::program_options;
@@ -98,6 +99,7 @@
std::to_string(getMinimumFreshnessPeriod().count()) + " ms)").c_str())
("satisfy,p", po::value<int>(&options.nMaxPings), "set maximum number of pings to be satisfied")
("timestamp,t", "log timestamp with responses")
+ ("size,s", po::value<int>(&options.payloadSize), "specify size of response payload")
;
po::options_description hiddenOptDesc("Hidden options");
hiddenOptDesc.add_options()
@@ -154,6 +156,13 @@
if (optVm.count("timestamp") > 0) {
options.shouldPrintTimestamp = true;
}
+
+ if (optVm.count("size") > 0) {
+ if (options.payloadSize < 0) {
+ std::cerr << "ERROR: Payload size must be greater than or equal to 0" << std::endl;
+ usage(visibleOptDesc);
+ }
+ }
}
catch (const po::error& e) {
std::cerr << "ERROR: " << e.what() << std::endl;