daemon+tests: avoid deprecated ndn-cxx functions
Change-Id: Idfa341629919d63fac140eda0b465f8f8abd38e6
This commit is contained in:
1 parent
1b22a8c156
commit
deb5427bb4
10 files changed
+30
-36
No files matched your search
@@ -83,7 +83,7 @@ WebSocketTransport::doSend(const Block& packet)
|
||||
NFD_LOG_FACE_TRACE(__func__);
|
||||
|
||||
websocketpp::lib::error_code error;
|
||||
m_server.send(m_handle, packet.wire(), packet.size(),
|
||||
m_server.send(m_handle, packet.data(), packet.size(),
|
||||
websocketpp::frame::opcode::binary, error);
|
||||
if (error)
|
||||
return processErrorCode(error);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2021, Regents of the University of California,
|
||||
* Copyright (c) 2014-2022, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -109,7 +109,7 @@ DeadNonceList::makeEntry(const Name& name, Interest::Nonce nonce)
|
||||
const auto& nameWire = name.wireEncode();
|
||||
uint32_t n;
|
||||
std::memcpy(&n, nonce.data(), sizeof(n));
|
||||
return CityHash64WithSeed(reinterpret_cast<const char*>(nameWire.wire()), nameWire.size(), n);
|
||||
return CityHash64WithSeed(reinterpret_cast<const char*>(nameWire.data()), nameWire.size(), n);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2019, Regents of the University of California,
|
||||
* Copyright (c) 2014-2022, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -64,7 +64,7 @@ computeHash(const Name& name, size_t prefixLen)
|
||||
HashValue h = 0;
|
||||
for (size_t i = 0, last = std::min(prefixLen, name.size()); i < last; ++i) {
|
||||
const name::Component& comp = name[i];
|
||||
h ^= HashFunc::compute(comp.wire(), comp.size());
|
||||
h ^= HashFunc::compute(comp.data(), comp.size());
|
||||
}
|
||||
return h;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ computeHashes(const Name& name, size_t prefixLen)
|
||||
|
||||
for (size_t i = 0; i < last; ++i) {
|
||||
const name::Component& comp = name[i];
|
||||
h ^= HashFunc::compute(comp.wire(), comp.size());
|
||||
h ^= HashFunc::compute(comp.data(), comp.size());
|
||||
seq.push_back(h);
|
||||
}
|
||||
return seq;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2021, Regents of the University of California,
|
||||
* Copyright (c) 2014-2022, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -93,7 +93,7 @@ protected:
|
||||
clientSendInterest(const Interest& interest)
|
||||
{
|
||||
const Block& payload = interest.wireEncode();
|
||||
client.send(clientHandle, payload.wire(), payload.size(), websocketpp::frame::opcode::binary);
|
||||
client.send(clientHandle, payload.data(), payload.size(), websocketpp::frame::opcode::binary);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2019, Regents of the University of California,
|
||||
* Copyright (c) 2014-2022, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -147,7 +147,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveNormal, T, WebSocketTransportFixtures, T
|
||||
TRANSPORT_TEST_INIT();
|
||||
|
||||
auto pkt1 = ndn::encoding::makeStringBlock(300, "hello");
|
||||
this->client.send(this->clientHdl, pkt1.wire(), pkt1.size(), websocketpp::frame::opcode::binary);
|
||||
this->client.send(this->clientHdl, pkt1.data(), pkt1.size(), websocketpp::frame::opcode::binary);
|
||||
BOOST_CHECK_EQUAL(this->limitedIo.run(1, // serverHandleMessage
|
||||
1_s), LimitedIo::EXCEED_OPS);
|
||||
|
||||
@@ -155,7 +155,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveNormal, T, WebSocketTransportFixtures, T
|
||||
BOOST_CHECK_EQUAL(this->transport->getCounters().nInBytes, pkt1.size());
|
||||
|
||||
auto pkt2 = ndn::encoding::makeStringBlock(301, "world!");
|
||||
this->client.send(this->clientHdl, pkt2.wire(), pkt2.size(), websocketpp::frame::opcode::binary);
|
||||
this->client.send(this->clientHdl, pkt2.data(), pkt2.size(), websocketpp::frame::opcode::binary);
|
||||
BOOST_CHECK_EQUAL(this->limitedIo.run(1, // serverHandleMessage
|
||||
1_s), LimitedIo::EXCEED_OPS);
|
||||
|
||||
@@ -175,7 +175,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveMalformed, T, WebSocketTransportFixtures
|
||||
TRANSPORT_TEST_INIT();
|
||||
|
||||
auto pkt1 = ndn::encoding::makeStringBlock(300, "hello");
|
||||
this->client.send(this->clientHdl, pkt1.wire(), pkt1.size() - 1, // truncated
|
||||
this->client.send(this->clientHdl, pkt1.data(), pkt1.size() - 1, // truncated
|
||||
websocketpp::frame::opcode::binary);
|
||||
BOOST_CHECK_EQUAL(this->limitedIo.run(1, // serverHandleMessage
|
||||
1_s), LimitedIo::EXCEED_OPS);
|
||||
@@ -185,7 +185,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(ReceiveMalformed, T, WebSocketTransportFixtures
|
||||
BOOST_CHECK_EQUAL(this->serverReceivedPackets->size(), 0);
|
||||
|
||||
auto pkt2 = ndn::encoding::makeStringBlock(301, "world!");
|
||||
this->client.send(this->clientHdl, pkt2.wire(), pkt2.size(), websocketpp::frame::opcode::binary);
|
||||
this->client.send(this->clientHdl, pkt2.data(), pkt2.size(), websocketpp::frame::opcode::binary);
|
||||
BOOST_CHECK_EQUAL(this->limitedIo.run(1, // serverHandleMessage
|
||||
1_s), LimitedIo::EXCEED_OPS);
|
||||
|
||||
|
||||
@@ -297,8 +297,7 @@ BOOST_AUTO_TEST_CASE(BadKeyLocator_MissingKeyLocator)
|
||||
BOOST_CHECK_EQUAL(authorize1(
|
||||
[] (Interest& interest) {
|
||||
ndn::SignatureInfo sigInfo(tlv::SignatureSha256WithRsa);
|
||||
setNameComponent(interest, ndn::signed_interest::POS_SIG_INFO,
|
||||
sigInfo.wireEncode().begin(), sigInfo.wireEncode().end());
|
||||
setNameComponent(interest, ndn::signed_interest::POS_SIG_INFO, ndn::make_span(sigInfo.wireEncode()));
|
||||
}
|
||||
), false);
|
||||
BOOST_CHECK(lastRejectReply == ndn::mgmt::RejectReply::SILENT);
|
||||
@@ -313,8 +312,7 @@ BOOST_AUTO_TEST_CASE(BadKeyLocator_BadKeyLocatorType)
|
||||
{0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD}));
|
||||
ndn::SignatureInfo sigInfo(tlv::SignatureSha256WithRsa);
|
||||
sigInfo.setKeyLocator(kl);
|
||||
setNameComponent(interest, ndn::signed_interest::POS_SIG_INFO,
|
||||
sigInfo.wireEncode().begin(), sigInfo.wireEncode().end());
|
||||
setNameComponent(interest, ndn::signed_interest::POS_SIG_INFO, ndn::make_span(sigInfo.wireEncode()));
|
||||
}
|
||||
), false);
|
||||
BOOST_CHECK(lastRejectReply == ndn::mgmt::RejectReply::SILENT);
|
||||
|
||||
@@ -216,18 +216,16 @@ BOOST_AUTO_TEST_CASE(FaceQuery)
|
||||
auto face2 = addFace(REMOVE_LAST_NOTIFICATION | SET_SCOPE_LOCAL); // dummy://, local
|
||||
auto face3 = addFace(REMOVE_LAST_NOTIFICATION | SET_URI_TEST); // test://
|
||||
|
||||
auto generateQuery = [] (const FaceQueryFilter& filter) {
|
||||
return Interest(Name("/localhost/nfd/faces/query")
|
||||
.append(filter.wireEncode().begin(), filter.wireEncode().end()))
|
||||
auto generateQuery = [] (const auto& filter) {
|
||||
return Interest(Name("/localhost/nfd/faces/query").append(tlv::GenericNameComponent, filter.wireEncode()))
|
||||
.setCanBePrefix(true);
|
||||
};
|
||||
|
||||
auto schemeQuery = generateQuery(FaceQueryFilter().setUriScheme("dummy"));
|
||||
auto idQuery = generateQuery(FaceQueryFilter().setFaceId(face1->getId()));
|
||||
auto scopeQuery = generateQuery(FaceQueryFilter().setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL));
|
||||
auto invalidContent = ndn::makeStringBlock(tlv::Content, "invalid");
|
||||
auto invalidQueryName = Name("/localhost/nfd/faces/query")
|
||||
.append(invalidContent.begin(), invalidContent.end());
|
||||
.append(tlv::GenericNameComponent, ndn::makeStringBlock(tlv::Content, "invalid"));
|
||||
auto invalidQuery = Interest(invalidQueryName).setCanBePrefix(true);
|
||||
|
||||
receiveInterest(schemeQuery); // face1 and face2 expected
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2021, Regents of the University of California,
|
||||
* Copyright (c) 2014-2022, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -47,7 +47,7 @@ CommandInterestSignerFixture::makeControlCommandRequest(Name commandName,
|
||||
const ControlParameters& params,
|
||||
const Name& identity)
|
||||
{
|
||||
commandName.append(params.wireEncode());
|
||||
commandName.append(tlv::GenericNameComponent, params.wireEncode());
|
||||
return this->makeCommandInterest(commandName, identity);
|
||||
}
|
||||
|
||||
@@ -155,12 +155,11 @@ ManagerCommonFixture::concatenateResponses(size_t startIndex, size_t nResponses)
|
||||
}
|
||||
|
||||
ndn::EncodingBuffer encoder;
|
||||
size_t valueLength = 0;
|
||||
size_t length = 0;
|
||||
for (size_t i = startIndex; i < endIndex ; i ++) {
|
||||
valueLength += encoder.appendByteArray(m_responses[i].getContent().value(),
|
||||
m_responses[i].getContent().value_size());
|
||||
length += encoder.appendBytes(m_responses[i].getContent().value_bytes());
|
||||
}
|
||||
encoder.prependVarNumber(valueLength);
|
||||
encoder.prependVarNumber(length);
|
||||
encoder.prependVarNumber(tlv::Content);
|
||||
return encoder.block();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2020, Regents of the University of California,
|
||||
* Copyright (c) 2014-2022, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -153,13 +153,11 @@ public:
|
||||
std::string
|
||||
getIdentityCertificateBase64(const Name& identity) const
|
||||
{
|
||||
auto cert = m_keyChain.getPib().getIdentity(identity).getDefaultKey().getDefaultCertificate();
|
||||
const auto& block = cert.wireEncode();
|
||||
|
||||
namespace tr = ndn::security::transform;
|
||||
std::ostringstream oss;
|
||||
tr::bufferSource(block.wire(), block.size()) >> tr::base64Encode(false) >> tr::streamSink(oss);
|
||||
|
||||
auto cert = m_keyChain.getPib().getIdentity(identity).getDefaultKey().getDefaultCertificate();
|
||||
std::ostringstream oss;
|
||||
tr::bufferSource(cert.wireEncode()) >> tr::base64Encode(false) >> tr::streamSink(oss);
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,9 @@ def configure(conf):
|
||||
conf.find_program('bash', var='BASH')
|
||||
conf.find_program('dot', var='DOT', mandatory=False)
|
||||
|
||||
conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX',
|
||||
pkg_config_path=os.environ.get('PKG_CONFIG_PATH', '%s/pkgconfig' % conf.env.LIBDIR))
|
||||
pkg_config_path = os.environ.get('PKG_CONFIG_PATH', f'{conf.env.LIBDIR}/pkgconfig')
|
||||
conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.0', '--cflags', '--libs'],
|
||||
uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)
|
||||
|
||||
if not conf.options.without_systemd:
|
||||
conf.check_cfg(package='libsystemd', args=['--cflags', '--libs'],
|
||||
|
||||
Reference in new issue
Block a user