77 bool OpenLive(
const std::string & device,
int snaplen,
78 bool promisc,
int timeout_msecs);
91 bool SetFilter(
const std::string & filter,
bool optimize);
96 int Dispatch(
int count, pcap_handler callback, uint8_t *user);
101 int Loop(
int count, pcap_handler callback, uint8_t *user);
124 static std::map<int,int> _dataLinkOffsets;
132 #endif // _DWMPCAP_HH_ int Loop(int count, pcap_handler callback, uint8_t *user)
A wrapper for pcap_loop(). See the pcap(3) manpage.
bool SetFilter(const std::string &filter, bool optimize)
Sets the filter for the capture device.
const std::string & LastError() const
Returns the last error string from a failed OpenLive() or OpenOffline() call.
bool Close()
Closes the capture device.
Definition: DwmBZ2IO.hh:67
~Pcap()
Destructor. Will close the contained pcap device if it's open.
int DataLinkOffset() const
Returns the length of the link layer header for the capture device.
bool OpenOffline(const std::string &fname)
Opens the file fname for reading.
int Dispatch(int count, pcap_handler callback, uint8_t *user)
A wrapper for pcap_dispatch(). See the pcap(3) manpage.
bool OpenLive(const std::string &device, int snaplen, bool promisc, int timeout_msecs)
Open device for live packet capture.
This is a pcap wrapper/utility class.
Definition: DwmPcap.hh:57