@@ -92,6 +92,30 @@ namespace pcpp
92
92
static IFileReaderDevice* getReader (const std::string& fileName);
93
93
};
94
94
95
+ // / @class IFileWriterDevice
96
+ // / An abstract class (cannot be instantiated, has a private c'tor) which is the parent class for file writer
97
+ // / devices
98
+ class IFileWriterDevice : public IFileDevice
99
+ {
100
+ protected:
101
+ uint32_t m_NumOfPacketsWritten;
102
+ uint32_t m_NumOfPacketsNotWritten;
103
+
104
+ IFileWriterDevice (const std::string& fileName);
105
+
106
+ public:
107
+ // / A destructor for this class
108
+ virtual ~IFileWriterDevice ()
109
+ {}
110
+
111
+ virtual bool writePacket (RawPacket const & packet) = 0;
112
+
113
+ virtual bool writePackets (const RawPacketVector& packets) = 0;
114
+
115
+ using IFileDevice::open;
116
+ virtual bool open (bool appendMode) = 0;
117
+ };
118
+
95
119
// / @class PcapFileReaderDevice
96
120
// / A class for opening a pcap file in read-only mode. This class enable to open the file and read all packets,
97
121
// / packet-by-packet
@@ -312,30 +336,6 @@ namespace pcpp
312
336
void close ();
313
337
};
314
338
315
- // / @class IFileWriterDevice
316
- // / An abstract class (cannot be instantiated, has a private c'tor) which is the parent class for file writer
317
- // / devices
318
- class IFileWriterDevice : public IFileDevice
319
- {
320
- protected:
321
- uint32_t m_NumOfPacketsWritten;
322
- uint32_t m_NumOfPacketsNotWritten;
323
-
324
- IFileWriterDevice (const std::string& fileName);
325
-
326
- public:
327
- // / A destructor for this class
328
- virtual ~IFileWriterDevice ()
329
- {}
330
-
331
- virtual bool writePacket (RawPacket const & packet) = 0;
332
-
333
- virtual bool writePackets (const RawPacketVector& packets) = 0;
334
-
335
- using IFileDevice::open;
336
- virtual bool open (bool appendMode) = 0;
337
- };
338
-
339
339
// / @class PcapFileWriterDevice
340
340
// / A class for opening a pcap file for writing or create a new pcap file and write packets to it. This class adds
341
341
// / a unique capability that isn't supported in WinPcap and in older libpcap versions which is to open a pcap file
0 commit comments