catchunks: add --no-version-discovery option
Refs: #5021
Change-Id: I37bb1f86c1a6d63ab28fbe116e75d1047c110217
diff --git a/tools/chunks/catchunks/discover-version.cpp b/tools/chunks/catchunks/discover-version.cpp
index 6bedd05..1efe3b2 100644
--- a/tools/chunks/catchunks/discover-version.cpp
+++ b/tools/chunks/catchunks/discover-version.cpp
@@ -44,7 +44,7 @@
void
DiscoverVersion::run()
{
- if (!m_prefix.empty() && m_prefix[-1].isVersion()) {
+ if (m_options.disableVersionDiscovery || (!m_prefix.empty() && m_prefix[-1].isVersion())) {
onDiscoverySuccess(m_prefix);
return;
}
diff --git a/tools/chunks/catchunks/main.cpp b/tools/chunks/catchunks/main.cpp
index 1af58e6..39b808c 100644
--- a/tools/chunks/catchunks/main.cpp
+++ b/tools/chunks/catchunks/main.cpp
@@ -60,11 +60,14 @@
("help,h", "print this help message and exit")
("pipeline-type,p", po::value<std::string>(&pipelineType)->default_value(pipelineType),
"type of Interest pipeline to use; valid values are: 'fixed', 'aimd', 'cubic'")
- ("fresh,f", po::bool_switch(&options.mustBeFresh), "only return fresh content")
+ ("fresh,f", po::bool_switch(&options.mustBeFresh),
+ "only return fresh content (set MustBeFresh on all outgoing Interests)")
("lifetime,l", po::value<time::milliseconds::rep>()->default_value(options.interestLifetime.count()),
"lifetime of expressed Interests, in milliseconds")
("retries,r", po::value<int>(&options.maxRetriesOnTimeoutOrNack)->default_value(options.maxRetriesOnTimeoutOrNack),
"maximum number of retries in case of Nack or timeout (-1 = no limit)")
+ ("no-version-discovery,D", po::bool_switch(&options.disableVersionDiscovery),
+ "skip version discovery, even if the supplied name does not end with a version component")
("quiet,q", po::bool_switch(&options.isQuiet), "suppress all diagnostic output, except fatal errors")
("verbose,v", po::bool_switch(&options.isVerbose), "turn on verbose output (per segment information")
("version,V", "print program version and exit")
@@ -79,7 +82,7 @@
po::options_description adaptivePipeDesc("Adaptive pipeline options (AIMD & CUBIC)");
adaptivePipeDesc.add_options()
("ignore-marks", po::bool_switch(&options.ignoreCongMarks),
- "do not decrease the window after receiving a congestion mark")
+ "do not reduce the window after receiving a congestion mark")
("disable-cwa", po::bool_switch(&options.disableCwa),
"disable Conservative Window Adaptation, i.e., reduce the window on "
"each timeout or congestion mark instead of at most once per RTT")
diff --git a/tools/chunks/catchunks/options.hpp b/tools/chunks/catchunks/options.hpp
index 70bedee..0f432b3 100644
--- a/tools/chunks/catchunks/options.hpp
+++ b/tools/chunks/catchunks/options.hpp
@@ -37,6 +37,7 @@
// Common options
time::milliseconds interestLifetime = DEFAULT_INTEREST_LIFETIME;
int maxRetriesOnTimeoutOrNack = 15;
+ bool disableVersionDiscovery = false;
bool mustBeFresh = false;
bool isQuiet = false;
bool isVerbose = false;
diff --git a/tools/chunks/catchunks/pipeline-interests.cpp b/tools/chunks/catchunks/pipeline-interests.cpp
index d86f155..ad8b818 100644
--- a/tools/chunks/catchunks/pipeline-interests.cpp
+++ b/tools/chunks/catchunks/pipeline-interests.cpp
@@ -51,8 +51,10 @@
void
PipelineInterests::run(const Name& versionedName, DataCallback dataCb, FailureCallback failureCb)
{
- BOOST_ASSERT(!versionedName.empty() && versionedName[-1].isVersion());
+ BOOST_ASSERT(m_options.disableVersionDiscovery ||
+ (!versionedName.empty() && versionedName[-1].isVersion()));
BOOST_ASSERT(dataCb != nullptr);
+
m_prefix = versionedName;
m_onData = std::move(dataCb);
m_onFailure = std::move(failureCb);