69 int SetBufferSize(
int bufferSize);
78 bool OpenLive(
const std::string & device,
int snaplen,
79 bool promisc,
int timeout_msecs);
100 bool SetFilter(
const std::string & filter,
bool optimize);
105 int Dispatch(
int count, pcap_handler callback, uint8_t *user);
110 int Loop(
int count, pcap_handler callback, uint8_t *user);
138 static std::map<int,int> _dataLinkOffsets;
This is a pcap wrapper/utility class.
Definition DwmPcap.hh:57
bool OpenOffline(const std::string &fname)
Opens the file fname for reading.
int Loop(int count, pcap_handler callback, uint8_t *user)
A wrapper for pcap_loop(). See the pcap(3) manpage.
bool Close()
Closes the capture device.
const std::string & LastError() const
Returns the last error string from a failed OpenLive() or OpenOffline() call.
~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 SetFilter(const std::string &filter, bool optimize)
Sets the filter for the capture device.
bool SetDirection(pcap_direction_t direction)
Specify whether to capture incoming packets, outgoing packets, or both.
bool OpenLive(const std::string &device, int snaplen, bool promisc, int timeout_msecs)
Open device for live packet capture.
int Dispatch(int count, pcap_handler callback, uint8_t *user)
A wrapper for pcap_dispatch(). See the pcap(3) manpage.
void BreakLoop()
A wrapper for pcap_breakloop().