26 #ifndef NFD_DAEMON_FACE_PCAP_HELPER_HPP 27 #define NFD_DAEMON_FACE_PCAP_HELPER_HPP 32 #error "Cannot include this file when libpcap is not available" 48 class Error :
public std::runtime_error
53 :
std::runtime_error(what)
131 std::tuple<const uint8_t*, size_t, std::string>
146 #endif // NFD_DAEMON_FACE_PCAP_HELPER_HPP PcapHelper(const std::string &interfaceName)
Create a libpcap context for live packet capture on a network interface.
Error(const std::string &what)
size_t getNDropped() const
Get the number of packets dropped by the kernel, as reported by libpcap.
std::string getLastError() const
Get last error message.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
std::tuple< const uint8_t *, size_t, std::string > readNextPacket() const
Read the next packet captured on the interface.
void activate(int dlt)
Start capturing packets.
int getFd() const
Obtain a file descriptor that can be used in calls such as select(2) and poll(2). ...
void close()
Stop capturing and close the handle.
void setPacketFilter(const char *filter) const
Install a BPF filter on the receiving socket.
Helper class for dealing with libpcap handles.