mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The one place where we deviate is header include order since Zeek depends on headers being included in a certain order.
This commit is contained in:
parent
7b8e7ed72c
commit
f5a76c1aed
786 changed files with 131714 additions and 153609 deletions
|
@ -6,48 +6,45 @@
|
|||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#include <pcap.h>
|
||||
}
|
||||
}
|
||||
|
||||
#include "zeek/iosource/PktSrc.h"
|
||||
|
||||
namespace zeek::iosource::pcap
|
||||
{
|
||||
namespace zeek::iosource::pcap {
|
||||
|
||||
class PcapSource : public PktSrc
|
||||
{
|
||||
class PcapSource : public PktSrc {
|
||||
public:
|
||||
PcapSource(const std::string& path, bool is_live);
|
||||
~PcapSource() override;
|
||||
PcapSource(const std::string& path, bool is_live);
|
||||
~PcapSource() override;
|
||||
|
||||
static PktSrc* Instantiate(const std::string& path, bool is_live);
|
||||
static PktSrc* Instantiate(const std::string& path, bool is_live);
|
||||
|
||||
protected:
|
||||
// PktSrc interface.
|
||||
void Open() override;
|
||||
void Close() override;
|
||||
bool ExtractNextPacket(Packet* pkt) override;
|
||||
void DoneWithPacket() override;
|
||||
bool SetFilter(int index) override;
|
||||
void Statistics(Stats* stats) override;
|
||||
// PktSrc interface.
|
||||
void Open() override;
|
||||
void Close() override;
|
||||
bool ExtractNextPacket(Packet* pkt) override;
|
||||
void DoneWithPacket() override;
|
||||
bool SetFilter(int index) override;
|
||||
void Statistics(Stats* stats) override;
|
||||
|
||||
detail::BPF_Program* CompileFilter(const std::string& filter) override;
|
||||
detail::BPF_Program* CompileFilter(const std::string& filter) override;
|
||||
|
||||
private:
|
||||
void OpenLive();
|
||||
void OpenOffline();
|
||||
void PcapError(const char* where = nullptr);
|
||||
void OpenLive();
|
||||
void OpenOffline();
|
||||
void PcapError(const char* where = nullptr);
|
||||
|
||||
Properties props;
|
||||
Stats stats;
|
||||
Properties props;
|
||||
Stats stats;
|
||||
|
||||
pcap_t* pd;
|
||||
struct pcap_stat prev_pstat = {0};
|
||||
pcap_t* pd;
|
||||
struct pcap_stat prev_pstat = {0};
|
||||
|
||||
// Buffer provided to setvbuf() when reading from a PCAP file.
|
||||
std::vector<char> iobuf;
|
||||
};
|
||||
// Buffer provided to setvbuf() when reading from a PCAP file.
|
||||
std::vector<char> iobuf;
|
||||
};
|
||||
|
||||
} // namespace zeek::iosource::pcap
|
||||
} // namespace zeek::iosource::pcap
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue