26#ifndef NFD_DAEMON_FACE_PCAP_HELPER_HPP
27#define NFD_DAEMON_FACE_PCAP_HELPER_HPP
31#ifndef NFD_HAVE_LIBPCAP
32#error "Cannot include this file when libpcap is not available"
47 class Error :
public std::runtime_error
50 using std::runtime_error::runtime_error;
125 std::tuple<span<const uint8_t>, std::
string>
Helper class for dealing with libpcap handles.
int getFd() const
Obtain a file descriptor that can be used in calls such as select(2) and poll(2).
std::string getLastError() const noexcept
Get last error message.
void activate(int dlt)
Start capturing packets.
size_t getNDropped() const
Get the number of packets dropped by the kernel, as reported by libpcap.
void setPacketFilter(const char *filter) const
Install a BPF filter on the receiving socket.
std::tuple< span< const uint8_t >, std::string > readNextPacket() const noexcept
Read the next packet captured on the interface.
void close() noexcept
Stop capturing and close the handle.