pcpp::IFileReaderDevice Class Referenceabstract

#include <PcapFileDevice.h>

Inheritance diagram for pcpp::IFileReaderDevice:
pcpp::IFileDevice pcpp::IPcapDevice pcpp::PcapFileReaderDevice pcpp::PcapNgFileReaderDevice

Public Member Functions

virtual ~IFileReaderDevice ()
uint64_t getFileSize ()
- Public Member Functions inherited from pcpp::IFileDevice
std::string getFileName ()
virtual void close ()
- Public Member Functions inherited from pcpp::IPcapDevice
virtual bool open ()=0
bool isOpened ()
virtual void getStatistics (pcap_stat &stats)=0
bool setFilter (GeneralFilter &filter)
virtual bool setFilter (std::string filterAsString)
void clearFilter ()

Static Public Member Functions

static IFileReaderDevicegetReader (const char *fileName)
- Static Public Member Functions inherited from pcpp::IPcapDevice
static bool verifyFilter (std::string filterAsString)
static bool matchPakcetWithFilter (std::string filterAsString, RawPacket *rawPacket)

Protected Member Functions

 IFileReaderDevice (const char *fileName)

Detailed Description

An abstract class (cannot be instantiated, has a private c'tor) which is the parent class for file reader devices

Constructor & Destructor Documentation

pcpp::IFileReaderDevice::IFileReaderDevice ( const char *  fileName)

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]fileNameThe full path of the file to read
virtual pcpp::IFileReaderDevice::~IFileReaderDevice ( )

A destructor for this class

Member Function Documentation

uint64_t pcpp::IFileReaderDevice::getFileSize ( )
The file size in bytes
static IFileReaderDevice* pcpp::IFileReaderDevice::getReader ( const char *  fileName)

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]fileNameThe file name to open
An instance of the reader to read the file. Notice you should free this instance when done using it