mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00

This commit marks (hopefully) ever one-parameter constructor as explicit. It also uses override in (hopefully) all circumstances where a virtual method is overridden. There are a very few other minor changes - most of them were necessary to get everything to compile (like one additional constructor). In one case I changed an implicit operation to an explicit string conversion - I think the automatically chosen conversion was much more convoluted. This took longer than I want to admit but not as long as I feared :)
42 lines
765 B
C++
42 lines
765 B
C++
// See the file "COPYING" in the main distribution directory for copyright.
|
|
|
|
#ifndef packetdumper_h
|
|
#define packetdumper_h
|
|
|
|
using namespace std;
|
|
|
|
#include <queue>
|
|
#include <set>
|
|
|
|
#include <pcap.h>
|
|
|
|
class PacketDumper {
|
|
public:
|
|
explicit PacketDumper(pcap_dumper_t* pkt_dump);
|
|
|
|
void DumpPacket(const struct pcap_pkthdr* hdr,
|
|
const u_char* pkt, int len);
|
|
|
|
protected:
|
|
pcap_dumper_t* pkt_dump;
|
|
struct timeval last_timestamp;
|
|
|
|
void SortTimeStamp(struct timeval* timestamp);
|
|
};
|
|
|
|
struct IP_ID {
|
|
uint32 ip, id;
|
|
};
|
|
|
|
struct ltipid {
|
|
bool operator()(IP_ID id1, IP_ID id2) const
|
|
{
|
|
return id1.ip != id2.ip ? (id1.ip < id2.ip) :
|
|
(id1.id < id2.id);
|
|
}
|
|
};
|
|
|
|
typedef set<IP_ID, ltipid> IP_IDSet;
|
|
uint16 NextIP_ID(const uint32 src_addr, const uint16 id);
|
|
|
|
#endif
|