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) {