Skip to content

Commit ce906dc

Browse files
authored
Port Pcap++ code to use override, part of #977 (#1369)
1 parent 5a2c294 commit ce906dc

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

Pcap++/header/DpdkDevice.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -754,12 +754,12 @@ namespace pcpp
754754
* @return True if the device was opened successfully, false if device is already opened, if RX/TX queues configuration failed or of DPDK port
755755
* configuration and startup failed
756756
*/
757-
bool open() { return openMultiQueues(1, 1); };
757+
bool open() override { return openMultiQueues(1, 1); };
758758

759759
/**
760760
* Close the DpdkDevice. When device is closed it's not possible work with it
761761
*/
762-
void close();
762+
void close() override;
763763

764764
private:
765765

Pcap++/header/MBufRawPacket.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ namespace pcpp
143143
/**
144144
* @return MBufRawPacket object type
145145
*/
146-
virtual inline uint8_t getObjectType() const { return MBUFRAWPACKET_OBJECT_TYPE; }
146+
inline uint8_t getObjectType() const override { return MBUFRAWPACKET_OBJECT_TYPE; }
147147

148148
/**
149149
* An assignment operator for this class. Copies the data from the mbuf attached to the other MBufRawPacket to the mbuf

Pcap++/header/PcapFileDevice.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace pcpp
4242
/**
4343
* Close the file
4444
*/
45-
virtual void close();
45+
void close() override;
4646
};
4747

4848

@@ -414,7 +414,7 @@ namespace pcpp
414414
* or if the packet link layer type is different than the one defined for the file
415415
* (in all cases, an error will be printed to log)
416416
*/
417-
bool writePacket(RawPacket const& packet);
417+
bool writePacket(RawPacket const& packet) override;
418418

419419
/**
420420
* Write multiple RawPacket to the file. Before using this method please verify the file is opened using open(). This method won't change
@@ -423,7 +423,7 @@ namespace pcpp
423423
* @return True if all packets were written successfully to the file. False will be returned if the file isn't opened (also, an error
424424
* log will be printed) or if at least one of the packets wasn't written successfully to the file
425425
*/
426-
bool writePackets(const RawPacketVector& packets);
426+
bool writePackets(const RawPacketVector& packets) override;
427427

428428
//override methods
429429

@@ -433,7 +433,7 @@ namespace pcpp
433433
* @return True if file was opened/created successfully or if file is already opened. False if opening the file failed for some reason
434434
* (an error will be printed to log)
435435
*/
436-
virtual bool open();
436+
bool open() override;
437437

438438
/**
439439
* Same as open(), but enables to open the file in append mode in which packets will be appended to the file
@@ -445,12 +445,12 @@ namespace pcpp
445445
* different from current file link type. In case appendMode is set to false, please refer to open() for return
446446
* values
447447
*/
448-
bool open(bool appendMode);
448+
bool open(bool appendMode) override;
449449

450450
/**
451451
* Flush and close the pacp file
452452
*/
453-
virtual void close();
453+
void close() override;
454454

455455
/**
456456
* Flush packets to disk.
@@ -461,7 +461,7 @@ namespace pcpp
461461
* Get statistics of packets written so far.
462462
* @param[out] stats The stats struct where stats are returned
463463
*/
464-
virtual void getStatistics(PcapStats& stats) const;
464+
void getStatistics(PcapStats& stats) const override;
465465
};
466466

467467

Pcap++/header/PcapLiveDevice.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ namespace pcpp
257257
/**
258258
* A destructor for this class
259259
*/
260-
virtual ~PcapLiveDevice();
260+
~PcapLiveDevice() override;
261261

262262
/**
263263
* @return The type of the device (libPcap, WinPcap/Npcap or a remote device)
@@ -554,7 +554,7 @@ namespace pcpp
554554
* @return True if the device was opened successfully, false otherwise. When opening the device fails an error will be printed to log
555555
* as well
556556
*/
557-
bool open();
557+
bool open() override;
558558

559559
/**
560560
* Enables to open a device in a non-default configuration. Configuration has parameters like packet buffer timeout & size, open in
@@ -564,15 +564,15 @@ namespace pcpp
564564
*/
565565
bool open(const DeviceConfiguration& config);
566566

567-
void close();
567+
void close() override;
568568

569569
/**
570570
* Clones the current device class
571571
* @return Pointer to the copied class
572572
*/
573573
PcapLiveDevice* clone();
574574

575-
virtual void getStatistics(IPcapDevice::PcapStats& stats) const;
575+
void getStatistics(IPcapDevice::PcapStats& stats) const override;
576576

577577
protected:
578578
pcap_t* doOpen(const DeviceConfiguration& config);

Pcap++/header/RawSocketDevice.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ namespace pcpp
135135
* Open the device by creating a raw socket and binding it to the network interface specified in the c'tor
136136
* @return True if device was opened successfully, false otherwise with a corresponding error log message
137137
*/
138-
virtual bool open();
138+
bool open() override;
139139

140140
/**
141141
* Close the raw socket
142142
*/
143-
virtual void close();
143+
void close() override;
144144

145145
private:
146146

0 commit comments

Comments
 (0)