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.
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.
Error(const std::string &what)
std::tuple< const uint8_t *, size_t, std::string > readNextPacket() const
Read the next packet captured on the interface.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
std::string getLastError() const
Get last error message.
int getFd() const
Obtain a file descriptor that can be used in calls such as select(2) and poll(2). ...
void activate(int dlt)
Start capturing packets.
void close()
Stop capturing and close the handle.
Helper class for dealing with libpcap handles.