Avoid deprecated ndn-cxx functions
Change-Id: I5d9ac045740267db783ff724c938b659b49c40ee
diff --git a/tests/dump/ndndump.t.cpp b/tests/dump/ndndump.t.cpp
index f266d92..217dc10 100644
--- a/tests/dump/ndndump.t.cpp
+++ b/tests/dump/ndndump.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, University of Memphis,
+ * Copyright (c) 2014-2022, University of Memphis,
* University Pierre & Marie Curie, Sorbonne University.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
@@ -87,9 +87,9 @@
ethernet::Address host;
// Ethernet header
- buffer.prependByteArray(reinterpret_cast<const uint8_t*>(ðertype), ethernet::TYPE_LEN);
- buffer.prependByteArray(host.data(), host.size());
- buffer.prependByteArray(host.data(), host.size());
+ buffer.prependBytes({reinterpret_cast<const uint8_t*>(ðertype), ethernet::TYPE_LEN});
+ buffer.prependBytes(host);
+ buffer.prependBytes(host);
// pcap header
pcap_pkthdr pkthdr{};
@@ -97,28 +97,28 @@
{
StdCoutRedirector redirect(output);
- dump.printPacket(&pkthdr, buffer.buf());
+ dump.printPacket(&pkthdr, buffer.data());
}
}
void
receiveIp4(EncodingBuffer& buffer, const ip* ipHeader)
{
- buffer.prependByteArray(reinterpret_cast<const uint8_t*>(ipHeader), sizeof(ip));
+ buffer.prependBytes({reinterpret_cast<const uint8_t*>(ipHeader), sizeof(ip)});
receiveEthernet(buffer, s_ethertypeIp4);
}
void
receiveIp6(EncodingBuffer& buffer, const ip6_hdr* ip6Header)
{
- buffer.prependByteArray(reinterpret_cast<const uint8_t*>(ip6Header), sizeof(ip6_hdr));
+ buffer.prependBytes({reinterpret_cast<const uint8_t*>(ip6Header), sizeof(ip6_hdr)});
receiveEthernet(buffer, s_ethertypeIp6);
}
void
receiveTcp4(EncodingBuffer& buffer, const tcphdr* tcpHeader)
{
- buffer.prependByteArray(reinterpret_cast<const uint8_t*>(tcpHeader), sizeof(tcphdr));
+ buffer.prependBytes({reinterpret_cast<const uint8_t*>(tcpHeader), sizeof(tcphdr)});
ip ipHeader{};
ipHeader.ip_v = 4;
@@ -133,7 +133,7 @@
void
receiveUdp4(EncodingBuffer& buffer, const udphdr* udpHeader)
{
- buffer.prependByteArray(reinterpret_cast<const uint8_t*>(udpHeader), sizeof(udphdr));
+ buffer.prependBytes({reinterpret_cast<const uint8_t*>(udpHeader), sizeof(udphdr)});
ip ipHeader{};
ipHeader.ip_v = 4;
@@ -238,7 +238,7 @@
0x00, 0x00, 0x00, 0x01
};
EncodingBuffer buffer;
- buffer.prependByteArray(interest, 4);
+ buffer.prependBytes(make_span(interest).first(4));
this->receiveEthernet(buffer);
BOOST_CHECK(output.is_equal("0.000000 Ethernet, NDN truncated packet, length 4\n"));
@@ -268,7 +268,7 @@
uint8_t theAnswer = 42;
EncodingBuffer pkt1;
- pkt1.prependByte(theAnswer);
+ pkt1.prependBytes({theAnswer});
this->receiveEthernet(pkt1, s_ethertypeIp4);
BOOST_CHECK(output.is_equal("IP truncated header, length 1\n"));
@@ -315,7 +315,7 @@
uint8_t theAnswer = 42;
EncodingBuffer pkt1;
- pkt1.prependByte(theAnswer);
+ pkt1.prependBytes({theAnswer});
this->receiveEthernet(pkt1, s_ethertypeIp6);
BOOST_CHECK(output.is_equal("IP6 truncated header, length 1\n"));