PcapPlusPlus
Next
|
#include <PcapFileDevice.h>
Public Member Functions | |
virtual | ~IFileReaderDevice ()=default |
A destructor for this class. | |
uint64_t | getFileSize () const |
int | getNextPackets (RawPacketVector &packetVec, int numOfPacketsToRead=-1) |
![]() | |
std::string | getFileName () const |
void | close () override |
Close the file. | |
bool | isOpened () const override |
void | getStatistics (PcapStats &stats) const override |
Get the statistics for this device. More... | |
![]() | |
bool | setFilter (std::string filterAsString) override |
bool | clearFilter () override |
virtual bool | setFilter (GeneralFilter &filter) |
virtual bool | setFilter (std::string filterAsString)=0 |
![]() | |
virtual bool | open ()=0 |
![]() | |
virtual bool | setFilter (GeneralFilter &filter) |
![]() | |
PcapStats | getStatistics () const |
Get statistics from the device. More... | |
Static Public Member Functions | |
static IFileReaderDevice * | getReader (const std::string &fileName) |
![]() | |
static std::string | getPcapLibVersionInfo () |
static bool | matchPacketWithFilter (GeneralFilter &filter, RawPacket *rawPacket) |
Protected Member Functions | |
IFileReaderDevice (const std::string &fileName) | |
![]() | |
void | reportPacketProcessed (uint64_t numPackets=1) |
Report that packets were processed (read or written, depending on the device type). More... | |
void | reportPacketDropped (uint64_t numPackets=1) |
Report that packets were dropped (not read or not written, depending on the device type). More... | |
void | resetStatisticCounters () |
Reset the internal statistic counters to zero. | |
An abstract class (cannot be instantiated, has a private c'tor) which is the parent class for file reader devices
|
protected |
A constructor for this class that gets the pcap full path file name to open. Notice that after calling this constructor the file isn't opened yet, so reading packets will fail. For opening the file call open()
[in] | fileName | The full path of the file to read |
uint64_t pcpp::IFileReaderDevice::getFileSize | ( | ) | const |
int pcpp::IFileReaderDevice::getNextPackets | ( | RawPacketVector & | packetVec, |
int | numOfPacketsToRead = -1 |
||
) |
Read the next N packets into a raw packet vector
[out] | packetVec | The raw packet vector to read packets into |
[in] | numOfPacketsToRead | Number of packets to read. If value <0 all remaining packets in the file will be read into the raw packet vector (this is the default value) |
|
static |
A static method that creates an instance of the reader best fit to read the file. It decides by the file extension: for .pcapng files it returns an instance of PcapNgFileReaderDevice and for all other extensions it returns an instance of PcapFileReaderDevice
[in] | fileName | The file name to open |