zeek/src/Discard.h
Benjamin Bannier f5a76c1aed 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.
2023-10-30 09:40:55 +01:00

41 lines
792 B
C++

// See the file "COPYING" in the main distribution directory for copyright.
#pragma once
#include <sys/types.h> // for u_char
#include <memory>
#include "zeek/IntrusivePtr.h"
namespace zeek {
class IP_Hdr;
class Val;
class Func;
using FuncPtr = IntrusivePtr<Func>;
namespace detail {
class Discarder final {
public:
Discarder();
~Discarder() = default;
bool IsActive();
bool NextPacket(const std::shared_ptr<IP_Hdr>& ip, int len, int caplen);
protected:
Val* BuildData(const u_char* data, int hdrlen, int len, int caplen);
FuncPtr check_ip;
FuncPtr check_tcp;
FuncPtr check_udp;
FuncPtr check_icmp;
// Maximum amount of application data passed to filtering functions.
int discarder_maxlen;
};
} // namespace detail
} // namespace zeek