Convert to span and avoid deprecated ndn-cxx functions
Change-Id: I45c50527fe53498b53a3d951458bdff8e7d7778c
diff --git a/daemon/face/pcap-helper.hpp b/daemon/face/pcap-helper.hpp
index 1f08d85..30a8deb 100644
--- a/daemon/face/pcap-helper.hpp
+++ b/daemon/face/pcap-helper.hpp
@@ -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,
@@ -79,7 +79,7 @@
* @sa pcap_close(3pcap)
*/
void
- close();
+ close() noexcept;
/**
* @brief Obtain a file descriptor that can be used in calls such as select(2) and poll(2).
@@ -98,7 +98,7 @@
* @sa pcap_geterr(3pcap)
*/
std::string
- getLastError() const;
+ getLastError() const noexcept;
/**
* @brief Get the number of packets dropped by the kernel, as reported by libpcap.
@@ -120,18 +120,17 @@
/**
* @brief Read the next packet captured on the interface.
- * @return If successful, returns a tuple containing a pointer to the received packet
- * (including the link-layer header) and the size of the packet; the third
- * element must be ignored. On failure, returns a tuple containing nullptr,
- * 0, and the reason for the failure.
- * @warning The returned pointer must not be freed by the caller, and is valid only
- * until the next call to this function.
+ * @return If successful, returns a tuple containing a read-only view of the received
+ * packet bytes (including the link-layer header) and a second element that
+ * must be ignored. On failure, returns a tuple containing an empty span and
+ * the reason for the failure.
+ * @warning The returned span is valid only until the next call to this function.
* @sa pcap_next_ex(3pcap)
*/
- std::tuple<const uint8_t*, size_t, std::string>
- readNextPacket() const;
+ std::tuple<span<const uint8_t>, std::string>
+ readNextPacket() const noexcept;
- operator pcap_t*() const
+ operator pcap_t*() const noexcept
{
return m_pcap;
}