don't use deprecated block helpers
refs #2950
Change-Id: Icd065b2daaad6faa0f0d876e14c317fc3d8645a8
diff --git a/src/clients/response.cpp b/src/clients/response.cpp
index 8aba4ba..3cc719b 100644
--- a/src/clients/response.cpp
+++ b/src/clients/response.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -26,7 +26,7 @@
Response::Response()
: m_ndnsType(NDNS_RAW)
, m_freshnessPeriod(DEFAULT_RR_FRESHNESS_PERIOD)
- , m_appContent(dataBlock(ndn::tlv::Content, reinterpret_cast<const uint8_t*>(0), 0))
+ , m_appContent(makeBinaryBlock(ndn::tlv::Content, reinterpret_cast<const uint8_t*>(0), 0))
{
}
@@ -35,7 +35,7 @@
, m_queryType(queryType)
, m_ndnsType(NDNS_RAW)
, m_freshnessPeriod(DEFAULT_RR_FRESHNESS_PERIOD)
- , m_appContent(dataBlock(ndn::tlv::Content, reinterpret_cast<const uint8_t*>(0), 0))
+ , m_appContent(makeBinaryBlock(ndn::tlv::Content, reinterpret_cast<const uint8_t*>(0), 0))
{
}
@@ -45,7 +45,7 @@
{
if (m_ndnsType == NDNS_RAW) {
// Raw application content
- return prependBlock(block, m_appContent);
+ return block.prependBlock(m_appContent);
}
// Content :: = CONTENT-TYPE TLV-LENGTH
@@ -54,7 +54,7 @@
size_t totalLength = 0;
for (std::vector<Block>::const_reverse_iterator iter = m_rrs.rbegin();
iter != m_rrs.rend(); ++iter) {
- totalLength += prependBlock(block, *iter);
+ totalLength += block.prependBlock(*iter);
}
totalLength += block.prependVarNumber(totalLength);
@@ -145,7 +145,7 @@
info.setFreshnessPeriod(m_freshnessPeriod);
if (m_ndnsType != NDNS_RAW) {
- info.addAppMetaInfo(nonNegativeIntegerBlock(ndns::tlv::NdnsType, m_ndnsType));
+ info.addAppMetaInfo(makeNonNegativeIntegerBlock(ndns::tlv::NdnsType, m_ndnsType));
data->setContent(this->wireEncode());
}
else {
@@ -167,7 +167,7 @@
Response&
Response::addRr(const std::string& rr)
{
- return this->addRr(dataBlock(ndns::tlv::RrData, rr.c_str(), rr.size()));
+ return this->addRr(makeBinaryBlock(ndns::tlv::RrData, rr.c_str(), rr.size()));
}
bool
diff --git a/src/daemon/name-server.cpp b/src/daemon/name-server.cpp
index 7411697..3170f79 100644
--- a/src/daemon/name-server.cpp
+++ b/src/daemon/name-server.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -104,7 +104,7 @@
}
else {
// no record, construct NACK
- Block block = nonNegativeIntegerBlock(::ndn::ndns::tlv::NdnsType, NDNS_NACK);
+ Block block = makeNonNegativeIntegerBlock(tlv::NdnsType, NDNS_NACK);
MetaInfo info;
info.addAppMetaInfo(block);
info.setFreshnessPeriod(this->getContentFreshness());
@@ -169,7 +169,7 @@
rrset.setLabel(re.rrLabel);
rrset.setType(re.rrType);
- Block ndnsType = nonNegativeIntegerBlock(::ndn::ndns::tlv::NdnsType, NDNS_RESP);
+ Block ndnsType = makeNonNegativeIntegerBlock(::ndn::ndns::tlv::NdnsType, NDNS_RESP);
MetaInfo info;
info.addAppMetaInfo(ndnsType);
info.setFreshnessPeriod(this->getContentFreshness());
@@ -187,13 +187,13 @@
rrset.setVersion(newVersion);
rrset.setData(data->wireEncode());
m_dbMgr.update(rrset);
- blk.push_back(nonNegativeIntegerBlock(ndn::ndns::tlv::UpdateReturnCode, UPDATE_OK));
+ blk.push_back(makeNonNegativeIntegerBlock(ndn::ndns::tlv::UpdateReturnCode, UPDATE_OK));
blk.encode(); // must
answer->setContent(blk);
NDNS_LOG_TRACE("replace old record and answer update with UPDATE_OK");
}
else {
- blk.push_back(nonNegativeIntegerBlock(ndn::ndns::tlv::UpdateReturnCode, UPDATE_FAILURE));
+ blk.push_back(makeNonNegativeIntegerBlock(ndn::ndns::tlv::UpdateReturnCode, UPDATE_FAILURE));
blk.encode();
answer->setContent(blk);
NDNS_LOG_TRACE("answer update with UPDATE_FAILURE");
@@ -205,14 +205,14 @@
rrset.setData(data->wireEncode());
rrset.setTtl(m_zone.getTtl());
m_dbMgr.insert(rrset);
- blk.push_back(nonNegativeIntegerBlock(ndn::ndns::tlv::UpdateReturnCode, UPDATE_OK));
+ blk.push_back(makeNonNegativeIntegerBlock(ndn::ndns::tlv::UpdateReturnCode, UPDATE_OK));
blk.encode();
answer->setContent(blk);
NDNS_LOG_TRACE("insert new record and answer update with UPDATE_OK");
}
}
catch (std::exception& e) {
- blk.push_back(nonNegativeIntegerBlock(ndn::ndns::tlv::UpdateReturnCode, UPDATE_FAILURE));
+ blk.push_back(makeNonNegativeIntegerBlock(ndn::ndns::tlv::UpdateReturnCode, UPDATE_FAILURE));
blk.encode(); // must
answer->setContent(blk);
NDNS_LOG_INFO("Error processing the update: " << e.what()
diff --git a/src/mgmt/management-tool.cpp b/src/mgmt/management-tool.cpp
index 6fe2311..ed7af04 100644
--- a/src/mgmt/management-tool.cpp
+++ b/src/mgmt/management-tool.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -265,7 +265,7 @@
//set content according to ndns type
if (ndnsType == NDNS_RAW) {
- Block tmp = ndn::dataBlock(ndn::tlv::Content, contents[0].c_str(), contents[0].length());
+ Block tmp = makeBinaryBlock(ndn::tlv::Content, contents[0].c_str(), contents[0].length());
re.setAppContent(tmp);
}
else if (ndnsType != NDNS_AUTH) {
diff --git a/tests/unit/clients/response.cpp b/tests/unit/clients/response.cpp
index 76798db..7332c35 100644
--- a/tests/unit/clients/response.cpp
+++ b/tests/unit/clients/response.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -50,7 +50,7 @@
BOOST_CHECK_EQUAL(r.getQueryType(), qType);
const std::string DATA1("some fake content");
- r.setAppContent(dataBlock(ndn::tlv::Content, DATA1.c_str(), DATA1.size()));
+ r.setAppContent(makeBinaryBlock(ndn::tlv::Content, DATA1.c_str(), DATA1.size()));
//const Block& block = r.wireEncode();
shared_ptr<Data> data = r.toData();
@@ -66,10 +66,10 @@
r4.setNdnsType(NDNS_RESP);
std::string str = "Just try it";
- Block s = dataBlock(ndns::tlv::RrData, str.c_str(), str.size());
+ Block s = makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size());
r4.addRr(s);
str = "Go to Hell";
- // Block s2 = dataBlock(ndns::tlv::RrData, str.c_str(), str.size());
+ // Block s2 = makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size());
r4.addRr(str);
BOOST_CHECK_NE(r2, r4);
diff --git a/tests/unit/daemon/db-mgr.cpp b/tests/unit/daemon/db-mgr.cpp
index be728d6..4b628b3 100644
--- a/tests/unit/daemon/db-mgr.cpp
+++ b/tests/unit/daemon/db-mgr.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -97,7 +97,7 @@
rrset1.setTtl(time::seconds(4600));
static const std::string DATA1 = "SOME DATA";
- rrset1.setData(dataBlock(ndn::tlv::Content, DATA1.c_str(), DATA1.size()));
+ rrset1.setData(makeBinaryBlock(ndn::tlv::Content, DATA1.c_str(), DATA1.size()));
BOOST_CHECK_EQUAL(rrset1.getId(), 0);
BOOST_CHECK_NO_THROW(session.insert(rrset1));
@@ -125,7 +125,7 @@
rrset1.setVersion(name::Component::fromVersion(890));
static const std::string DATA2 = "ANOTHER DATA";
- rrset1.setData(dataBlock(ndn::tlv::Content, DATA2.c_str(), DATA2.size()));
+ rrset1.setData(makeBinaryBlock(ndn::tlv::Content, DATA2.c_str(), DATA2.size()));
BOOST_CHECK_NO_THROW(session.update(rrset1));
@@ -217,7 +217,7 @@
rrset1.setTtl(time::seconds(4600));
static const std::string DATA1 = "SOME DATA";
- rrset1.setData(dataBlock(ndn::tlv::Content, DATA1.data(), DATA1.size()));
+ rrset1.setData(makeBinaryBlock(ndn::tlv::Content, DATA1.data(), DATA1.size()));
session.insert(rrset1);
Rrset rrset2(&zone);
@@ -226,7 +226,7 @@
rrset2.setVersion(name::Component::fromVersion(232));
rrset2.setTtl(time::seconds(2100));
std::string data2 = "host1.net";
- rrset2.setData(dataBlock(ndn::tlv::Content, data2.c_str(), data2.size()));
+ rrset2.setData(makeBinaryBlock(ndn::tlv::Content, data2.c_str(), data2.size()));
session.insert(rrset2);
std::vector<Rrset> vec = session.findRrsets(zone);
diff --git a/tests/unit/daemon/name-server.cpp b/tests/unit/daemon/name-server.cpp
index 8944759..6a9be97 100644
--- a/tests/unit/daemon/name-server.cpp
+++ b/tests/unit/daemon/name-server.cpp
@@ -170,9 +170,9 @@
re.setNdnsType(NDNS_RESP);
std::string str = "ns1.ndnsim.net";
- re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+ re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
str = "ns2.ndnsim.net";
- re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+ re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
shared_ptr<Data> data = re.toData();
m_keyChain.sign(*data, m_certName);
@@ -222,9 +222,9 @@
re.setNdnsType(NDNS_RESP);
std::string str = "ns1.ndnsim.net";
- re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+ re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
str = "ns2.ndnsim.net";
- re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+ re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
shared_ptr<Data> data = re.toData();
m_keyChain.sign(*data, m_certName);
@@ -298,9 +298,9 @@
re.setNdnsType(NDNS_RESP);
std::string str = "ns1.ndnsim.net";
- re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+ re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
str = "ns2.ndnsim.net";
- re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+ re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
shared_ptr<Data> data = re.toData();
m_keyChain.sign(*data, dskCert->getName());
@@ -401,9 +401,9 @@
re.setNdnsType(NDNS_RESP);
std::string str = "ns1.ndnsim.net";
- re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+ re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
str = "ns2.ndnsim.net";
- re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+ re.addRr(makeBinaryBlock(ndns::tlv::RrData, str.c_str(), str.size()));
shared_ptr<Data> data = re.toData();
m_keyChain.sign(*data, dskCert->getName());
diff --git a/tests/unit/database-test-data.cpp b/tests/unit/database-test-data.cpp
index df43338..077d09b 100644
--- a/tests/unit/database-test-data.cpp
+++ b/tests/unit/database-test-data.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -132,7 +132,7 @@
if (msg.size() > 0) {
if (type == label::CERT_RR_TYPE)
- re.setAppContent(dataBlock(ndn::tlv::Content, msg.c_str(), msg.size()));
+ re.setAppContent(makeBinaryBlock(ndn::tlv::Content, msg.c_str(), msg.size()));
else
re.addRr(msg);
}
diff --git a/tests/unit/mgmt/management-tool.cpp b/tests/unit/mgmt/management-tool.cpp
index 54ad7d2..ed8e02b 100644
--- a/tests/unit/mgmt/management-tool.cpp
+++ b/tests/unit/mgmt/management-tool.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -802,7 +802,7 @@
re2.setRrType(name::Component("USER-DEFINED"));
re2.setNdnsType(NDNS_RAW);
re2.setVersion(name::Component::fromVersion(1234567));
- re2.setAppContent(dataBlock(ndn::tlv::Content, "Hello", sizeof("Hello")));
+ re2.setAppContent(makeBinaryBlock(ndn::tlv::Content, "Hello", sizeof("Hello")));
shared_ptr<Data> data2 = re2.toData();
m_keyChain.sign(*data2, otherDsk);
ndn::io::save(*data2, output);
diff --git a/tools/ndns-update.cpp b/tools/ndns-update.cpp
index 10bab42..a99aeb3 100644
--- a/tools/ndns-update.cpp
+++ b/tools/ndns-update.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -335,7 +335,7 @@
re.setNdnsType(ndnsType);
for (const auto& content : contents) {
- re.addRr(ndn::dataBlock(ndn::ndns::tlv::RrData, content.c_str(), content.size()));
+ re.addRr(makeBinaryBlock(ndns::tlv::RrData, content.c_str(), content.size()));
// re.addRr(content);
}