5 #include "IFileDevice.h"
6 #include "PcapCommon.h"
144 return m_File.is_open();
174 std::ifstream m_File;
179 uint32_t byteOrderMagic;
181 uint16_t majorVersion;
183 uint16_t minorVersion;
189 uint8_t timestampResolution;
193 std::string hardware;
195 std::string captureApplication;
197 std::string fileComment;
201 std::vector<SectionInfo> m_Sections;
203 size_t m_CurrentSection;
205 std::vector<uint8_t> m_ReadBuffer;
231 RawPacket& rawPacket, std::string* packetComment =
nullptr);
246 size_t readOptions(
const uint8_t* data,
size_t length, SectionInfo& sectionInfo);
250 static bool isLittleEndian();
255 static uint16_t swap16(uint16_t value);
260 static uint32_t swap32(uint32_t value);
265 static uint64_t swap64(uint64_t value);
Definition: PcapFileDevice.h:89
PcapNG file reader device.
Definition: PcapNgFileReaderDevice.h:119
bool open() override
Open the file.
std::string getOS() const
Get OS information from file metadata.
bool isOpened() const override
Get file position.
Definition: PcapNgFileReaderDevice.h:142
std::string getCaptureApplication() const
Get capture application information from file metadata.
bool getNextPacket(RawPacket &rawPacket, std::string &packetComment)
Get next packet with comment.
bool getNextPacket(RawPacket &rawPacket) override
Get next packet from file.
~PcapNgFileReaderDevice() override
Destructor.
std::string getCaptureFileComment() const
Get file comment.
PcapNgFileReaderDevice(const std::string &fileName)
Constructor.
std::string getHardware() const
Get hardware information from file metadata.
void close() override
Close the file.
Definition: RawPacket.h:290
The main namespace for the PcapPlusPlus lib.
Definition: AssertionUtils.h:19
PcapNgBlockType
PcapNG block types.
Definition: PcapNgFileReaderDevice.h:18
@ NameResolution
Name Resolution Block (NRB)
@ CustomReserved
Custom Block that rewrites existing data.
@ InterfaceDescription
Interface Description Block (IDB)
@ InterfaceStatistics
Interface Statistics Block (ISB)
@ SimplePacket
Simple Packet Block (SPB)
@ SectionHeader
Section Header Block (SHB)
@ EnhancedPacket
Enhanced Packet Block (EPB)
Enhanced Packet Block (EPB)
Definition: PcapNgFileReaderDevice.h:81
uint32_t timestampLow
Timestamp (low part)
Definition: PcapNgFileReaderDevice.h:89
uint32_t capturedLen
Captured packet length.
Definition: PcapNgFileReaderDevice.h:91
PcapNgBlockHeader blockHeader
Block header.
Definition: PcapNgFileReaderDevice.h:83
uint32_t timestampHigh
Timestamp (high part)
Definition: PcapNgFileReaderDevice.h:87
uint32_t interfaceId
Interface ID.
Definition: PcapNgFileReaderDevice.h:85
uint32_t originalLen
Original packet length.
Definition: PcapNgFileReaderDevice.h:93
Interface Description Block (IDB)
Definition: PcapNgFileReaderDevice.h:67
uint16_t reserved
Reserved field.
Definition: PcapNgFileReaderDevice.h:73
uint32_t snapLen
Snap length.
Definition: PcapNgFileReaderDevice.h:75
uint16_t linkType
Link type.
Definition: PcapNgFileReaderDevice.h:71
PcapNgBlockHeader blockHeader
Block header.
Definition: PcapNgFileReaderDevice.h:69
Simple Packet Block (SPB)
Definition: PcapNgFileReaderDevice.h:99
uint32_t originalLen
Original packet length.
Definition: PcapNgFileReaderDevice.h:103
PcapNgBlockHeader blockHeader
Block header.
Definition: PcapNgFileReaderDevice.h:101