9 typedef struct pcap_dumper pcap_dumper_t;
41 std::string m_FileName;
67 uint32_t m_NumOfPacketsRead;
68 uint32_t m_NumOfPacketsNotParsed;
89 virtual bool getNextPacket(
RawPacket& rawPacket) = 0;
147 return m_PcapLinkLayerType;
205 uint64_t identification_pattern;
206 uint32_t version_number;
207 uint32_t datalink_type;
208 } snoop_file_header_t;
215 uint32_t original_length;
216 uint32_t included_length;
217 uint32_t packet_record_length;
218 uint32_t ndrops_cumulative;
221 } snoop_packet_header_t;
225 std::ifstream m_snoopFile;
251 return m_PcapLinkLayerType;
402 uint32_t m_NumOfPacketsWritten;
403 uint32_t m_NumOfPacketsNotWritten;
414 virtual bool writePacket(
RawPacket const& packet) = 0;
419 virtual bool open(
bool appendMode) = 0;
431 pcap_dumper_t* m_PcapDumpHandler;
455 bool nanosecondsPrecision =
false);
517 bool open(
bool appendMode)
override;
547 int m_CompressionLevel;
588 bool open(
const std::string& os,
const std::string& hardware,
const std::string& captureApp,
589 const std::string& fileComment);
Definition: PcapFilter.h:92
Definition: PcapFileDevice.h:39
std::string getFileName() const
Definition: PcapFileDevice.h:65
int getNextPackets(RawPacketVector &packetVec, int numOfPacketsToRead=-1)
uint64_t getFileSize() const
static IFileReaderDevice * getReader(const std::string &fileName)
IFileReaderDevice(const std::string &fileName)
virtual ~IFileReaderDevice()
Definition: PcapFileDevice.h:81
Definition: PcapFileDevice.h:400
virtual ~IFileWriterDevice()
Definition: PcapFileDevice.h:411
Definition: PcapDevice.h:114
Definition: PcapFileDevice.h:116
PcapFileReaderDevice(const std::string &fileName)
Definition: PcapFileDevice.h:131
static bool isNanoSecondPrecisionSupported()
FileTimestampPrecision getTimestampPrecision() const
Definition: PcapFileDevice.h:155
virtual ~PcapFileReaderDevice()
Definition: PcapFileDevice.h:139
void getStatistics(PcapStats &stats) const
LinkLayerType getLinkLayerType() const
Definition: PcapFileDevice.h:145
bool getNextPacket(RawPacket &rawPacket)
Definition: PcapFileDevice.h:429
bool open(bool appendMode) override
void getStatistics(PcapStats &stats) const override
PcapFileWriterDevice(const std::string &fileName, LinkLayerType linkLayerType=LINKTYPE_ETHERNET, bool nanosecondsPrecision=false)
bool writePacket(RawPacket const &packet) override
~PcapFileWriterDevice()
Definition: PcapFileDevice.h:460
static bool isNanoSecondPrecisionSupported()
FileTimestampPrecision getTimestampPrecision() const
Definition: PcapFileDevice.h:486
bool writePackets(const RawPacketVector &packets) override
Definition: PcapFileDevice.h:290
std::string getOS() const
virtual ~PcapNgFileReaderDevice()
Definition: PcapFileDevice.h:310
void getStatistics(PcapStats &stats) const
std::string getCaptureApplication() const
bool getNextPacket(RawPacket &rawPacket, std::string &packetComment)
std::string getCaptureFileComment() const
bool getNextPacket(RawPacket &rawPacket)
PcapNgFileReaderDevice(const std::string &fileName)
std::string getHardware() const
bool setFilter(std::string filterAsString)
Definition: PcapFileDevice.h:544
bool writePackets(const RawPacketVector &packets)
bool writePacket(RawPacket const &packet)
bool setFilter(std::string filterAsString)
void getStatistics(PcapStats &stats) const
bool open(const std::string &os, const std::string &hardware, const std::string &captureApp, const std::string &fileComment)
bool open(bool appendMode)
PcapNgFileWriterDevice(const std::string &fileName, int compressionLevel=0)
virtual ~PcapNgFileWriterDevice()
Definition: PcapFileDevice.h:568
bool writePacket(RawPacket const &packet, const std::string &comment)
Definition: PointerVector.h:29
Definition: RawPacket.h:269
Definition: PcapFileDevice.h:197
SnoopFileReaderDevice(const std::string &fileName)
Definition: PcapFileDevice.h:237
LinkLayerType getLinkLayerType() const
Definition: PcapFileDevice.h:249
virtual ~SnoopFileReaderDevice()
void getStatistics(PcapStats &stats) const
bool getNextPacket(RawPacket &rawPacket)
The main namespace for the PcapPlusPlus lib.
FileTimestampPrecision
Definition: PcapFileDevice.h:25
@ Microseconds
Precision is in microseconds.
@ Unknown
Precision is unknown or not set/determined.
@ Nanoseconds
Precision is in nanoseconds.
LinkLayerType
Definition: RawPacket.h:25
@ LINKTYPE_ETHERNET
Definition: RawPacket.h:29
Definition: PcapDevice.h:128