chunks+peek: stop using deprecated {get,set}FinalBlockId
Change-Id: I64ae1c33a6f83af34b3db3d5f48cee3f3e7b7cb1
Refs: #4526
diff --git a/tools/peek/ndn-poke.cpp b/tools/peek/ndn-poke.cpp
index adfe93e..ceb49b3 100644
--- a/tools/peek/ndn-poke.cpp
+++ b/tools/peek/ndn-poke.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -21,29 +21,6 @@
*
* You should have received a copy of the GNU General Public License along with
* ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-/**
- * Copyright (c) 2014, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
* @author Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
*/
@@ -59,11 +36,11 @@
{
public:
explicit
- NdnPoke(char* programName)
+ NdnPoke(const char* programName)
: m_programName(programName)
- , m_isForceDataSet(false)
- , m_isUseDigestSha256Set(false)
- , m_isLastAsFinalBlockIdSet(false)
+ , m_wantForceData(false)
+ , m_wantDigestSha256(false)
+ , m_wantFinalBlockId(false)
, m_freshnessPeriod(-1)
, m_timeout(-1)
, m_isDataSent(false)
@@ -93,17 +70,17 @@
void
setForceData()
{
- m_isForceDataSet = true;
+ m_wantForceData = true;
}
void
setUseDigestSha256()
{
- m_isUseDigestSha256Set = true;
+ m_wantDigestSha256 = true;
}
void
- setIdentityName(char* identityName)
+ setIdentityName(const char* identityName)
{
m_identityName = make_shared<Name>(identityName);
}
@@ -111,7 +88,7 @@
void
setLastAsFinalBlockId()
{
- m_isLastAsFinalBlockIdSet = true;
+ m_wantFinalBlockId = true;
}
void
@@ -133,7 +110,7 @@
}
void
- setPrefixName(char* prefixName)
+ setPrefixName(const char* prefixName)
{
m_prefixName = Name(prefixName);
}
@@ -157,16 +134,16 @@
if (m_freshnessPeriod >= time::milliseconds::zero())
dataPacket->setFreshnessPeriod(m_freshnessPeriod);
- if (m_isLastAsFinalBlockIdSet) {
+ if (m_wantFinalBlockId) {
if (!m_prefixName.empty())
- dataPacket->setFinalBlockId(m_prefixName.get(-1));
+ dataPacket->setFinalBlock(m_prefixName.get(-1));
else {
std::cerr << "Name Provided Has 0 Components" << std::endl;
exit(1);
}
}
- if (m_isUseDigestSha256Set) {
+ if (m_wantDigestSha256) {
m_keyChain.sign(*dataPacket, signingWithSha256());
}
else {
@@ -182,11 +159,9 @@
}
void
- onInterest(const Name& name,
- const Interest& interest,
- shared_ptr<Data> dataPacket)
+ onInterest(const Name& name, const Interest& interest, const shared_ptr<Data>& data)
{
- m_face.put(*dataPacket);
+ m_face.put(*data);
m_isDataSent = true;
m_face.shutdown();
}
@@ -203,7 +178,7 @@
{
try {
shared_ptr<Data> dataPacket = createDataPacket();
- if (m_isForceDataSet) {
+ if (m_wantForceData) {
m_face.put(*dataPacket);
m_isDataSent = true;
}
@@ -234,10 +209,10 @@
private:
KeyChain m_keyChain;
std::string m_programName;
- bool m_isForceDataSet;
- bool m_isUseDigestSha256Set;
+ bool m_wantForceData;
+ bool m_wantDigestSha256;
shared_ptr<Name> m_identityName;
- bool m_isLastAsFinalBlockIdSet;
+ bool m_wantFinalBlockId;
time::milliseconds m_freshnessPeriod;
time::milliseconds m_timeout;
Name m_prefixName;
@@ -248,8 +223,9 @@
int
main(int argc, char* argv[])
{
- int option;
NdnPoke program(argv[0]);
+
+ int option;
while ((option = getopt(argc, argv, "hfDi:Fx:w:V")) != -1) {
switch (option) {
case 'h':
@@ -285,7 +261,7 @@
argc -= optind;
argv += optind;
- if (argv[0] == 0)
+ if (!argv[0])
program.usage();
program.setPrefixName(argv[0]);
@@ -301,7 +277,7 @@
} // namespace ndn
int
-main(int argc, char** argv)
+main(int argc, char* argv[])
{
return ndn::peek::main(argc, argv);
}