mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/timw/clang-tidy-fixups'
* origin/topic/timw/clang-tidy-fixups: Remove unused state_label() method from ssl analyzer binpac files Mark some overridden functions with override keyword Use emplace_back over push_back where appropriate packet_analysis: Define all plugin type as final Use std::make_unique in one place instead of declaring unique_ptr directly Avoid unnecessary type names in return statements Simplify type trait usage (remove ::value usage) A handful of int-to-bool conversions Replace empty destructor bodies with =default definitions Reduce amount of files passed to clang-tidy
This commit is contained in:
commit
c23ee30542
148 changed files with 311 additions and 384 deletions
22
CHANGES
22
CHANGES
|
@ -1,3 +1,25 @@
|
|||
6.1.0-dev.190 | 2023-07-07 09:56:56 -0700
|
||||
|
||||
* Remove unused state_label() method from ssl analyzer binpac files (Tim Wojtulewicz)
|
||||
|
||||
* Mark some overridden functions with override keyword (Tim Wojtulewicz)
|
||||
|
||||
* Use emplace_back over push_back where appropriate (Tim Wojtulewicz)
|
||||
|
||||
* packet_analysis: Define all plugin type as final (Tim Wojtulewicz)
|
||||
|
||||
* Use std::make_unique in one place instead of declaring unique_ptr directly (Tim Wojtulewicz)
|
||||
|
||||
* Avoid unnecessary type names in return statements (Tim Wojtulewicz)
|
||||
|
||||
* Simplify type trait usage (remove ::value usage) (Tim Wojtulewicz)
|
||||
|
||||
* A handful of int-to-bool conversions (Tim Wojtulewicz)
|
||||
|
||||
* Replace empty destructor bodies with =default definitions (Tim Wojtulewicz)
|
||||
|
||||
* Reduce amount of files passed to clang-tidy (Tim Wojtulewicz)
|
||||
|
||||
6.1.0-dev.179 | 2023-07-07 11:45:53 +0200
|
||||
|
||||
* GH-3157: [Spicy] Support `switch` fields when exporting Spicy types to Zeek. (Robin Sommer, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
6.1.0-dev.179
|
||||
6.1.0-dev.190
|
||||
|
|
|
@ -502,10 +502,14 @@ set(zeek_SRCS
|
|||
${FLEX_Scanner_INPUT}
|
||||
${BISON_Parser_INPUT}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ZAM-MethodDecls.h
|
||||
${THIRD_PARTY_SRCS}
|
||||
${HH_SRCS}
|
||||
${MAIN_SRCS})
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ZAM-MethodDecls.h)
|
||||
|
||||
# Add the above files to the list of clang tidy sources before adding the third party and HH
|
||||
# sources. Also, the main_SRCS will get added to that list separately.
|
||||
add_clang_tidy_files(${zeek_SRCS})
|
||||
list(APPEND zeek_SRCS ${THIRD_PARTY_SRCS})
|
||||
list(APPEND zeek_SRCS ${HH_SRCS})
|
||||
list(APPEND zeek_SRCS ${MAIN_SRCS})
|
||||
|
||||
collect_headers(zeek_HEADERS ${zeek_SRCS})
|
||||
|
||||
|
@ -515,7 +519,6 @@ set_target_properties(zeek_objs PROPERTIES CXX_EXTENSIONS OFF)
|
|||
target_link_libraries(zeek_objs PRIVATE $<BUILD_INTERFACE:zeek_internal>)
|
||||
target_compile_definitions(zeek_objs PRIVATE ZEEK_CONFIG_SKIP_VERSION_H)
|
||||
add_dependencies(zeek_objs zeek_autogen_files)
|
||||
add_clang_tidy_files(${zeek_SRCS})
|
||||
zeek_target_link_libraries(zeek_objs)
|
||||
|
||||
if (HAVE_SPICY)
|
||||
|
|
|
@ -929,7 +929,7 @@ bool CompositeHash::ReserveSingleTypeKeySize(HashKey& hk, Type* bt, const Val* v
|
|||
{
|
||||
reporter->InternalError(
|
||||
"bad index type in CompositeHash::ReserveSingleTypeKeySize");
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ DNS_Mapping::DNS_Mapping(FILE* f)
|
|||
else
|
||||
req_addr = IPAddr(req_buf);
|
||||
|
||||
names.push_back(name_buf);
|
||||
names.emplace_back(name_buf);
|
||||
|
||||
for ( int i = 0; i < num_addrs; ++i )
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ DNS_Mapping::DNS_Mapping(FILE* f)
|
|||
if ( newline )
|
||||
*newline = '\0';
|
||||
|
||||
addrs.emplace_back(IPAddr(buf));
|
||||
addrs.emplace_back(buf);
|
||||
}
|
||||
|
||||
init_failed = false;
|
||||
|
@ -134,16 +134,16 @@ void DNS_Mapping::Init(struct hostent* h)
|
|||
if ( h->h_name )
|
||||
// for now, just use the official name
|
||||
// TODO: this could easily be expanded to include all of the aliases as well
|
||||
names.push_back(h->h_name);
|
||||
names.emplace_back(h->h_name);
|
||||
|
||||
if ( h->h_addr_list )
|
||||
{
|
||||
for ( int i = 0; h->h_addr_list[i] != NULL; ++i )
|
||||
{
|
||||
if ( h->h_addrtype == AF_INET )
|
||||
addrs.push_back(IPAddr(IPv4, (uint32_t*)h->h_addr_list[i], IPAddr::Network));
|
||||
addrs.emplace_back(IPv4, (uint32_t*)h->h_addr_list[i], IPAddr::Network);
|
||||
else if ( h->h_addrtype == AF_INET6 )
|
||||
addrs.push_back(IPAddr(IPv6, (uint32_t*)h->h_addr_list[i], IPAddr::Network));
|
||||
addrs.emplace_back(IPv6, (uint32_t*)h->h_addr_list[i], IPAddr::Network);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ class DNS_Request
|
|||
public:
|
||||
DNS_Request(std::string host, int request_type, bool async = false);
|
||||
DNS_Request(const IPAddr& addr, bool async = false);
|
||||
~DNS_Request();
|
||||
~DNS_Request() = default;
|
||||
|
||||
std::string Host() const { return host; }
|
||||
const IPAddr& Addr() const { return addr; }
|
||||
|
@ -241,8 +241,6 @@ DNS_Request::DNS_Request(const IPAddr& addr, bool async) : addr(addr), async(asy
|
|||
request_type = T_PTR;
|
||||
}
|
||||
|
||||
DNS_Request::~DNS_Request() { }
|
||||
|
||||
void DNS_Request::MakeRequest(ares_channel channel, DNS_Mgr* mgr)
|
||||
{
|
||||
// This needs to get deleted at the end of the callback method.
|
||||
|
@ -1612,7 +1610,7 @@ class TestDNS_Mgr final : public DNS_Mgr
|
|||
{
|
||||
public:
|
||||
explicit TestDNS_Mgr(DNS_MgrMode mode) : DNS_Mgr(mode) { }
|
||||
void Process();
|
||||
void Process() override;
|
||||
};
|
||||
|
||||
void TestDNS_Mgr::Process()
|
||||
|
|
|
@ -342,7 +342,7 @@ static void parse_function_name(vector<ParseLocationRec>& result, ParseLocationR
|
|||
vector<ParseLocationRec> parse_location_string(const string& s)
|
||||
{
|
||||
vector<ParseLocationRec> result;
|
||||
result.push_back(ParseLocationRec());
|
||||
result.emplace_back();
|
||||
ParseLocationRec& plr = result[0];
|
||||
|
||||
// If PLR_FILE_AND_LINE, set this to the filename you want; for
|
||||
|
@ -531,7 +531,7 @@ void tokenize(const char* cstr, string& operation, vector<string>& arguments)
|
|||
if ( ! num_tokens )
|
||||
operation = string(str, start, len);
|
||||
else
|
||||
arguments.push_back(string(str, start, len));
|
||||
arguments.emplace_back(str, start, len);
|
||||
|
||||
++num_tokens;
|
||||
}
|
||||
|
|
|
@ -388,10 +388,10 @@ int dbg_cmd_break(DebugCmd cmd, const vector<string>& args)
|
|||
vector<ID*> choices;
|
||||
choose_global_symbols_regex(args[0], choices, true);
|
||||
for ( unsigned int i = 0; i < choices.size(); ++i )
|
||||
locstrings.push_back(choices[i]->Name());
|
||||
locstrings.emplace_back(choices[i]->Name());
|
||||
}
|
||||
else
|
||||
locstrings.push_back(args[0].c_str());
|
||||
locstrings.push_back(args[0]);
|
||||
|
||||
for ( unsigned int strindex = 0; strindex < locstrings.size(); ++strindex )
|
||||
{
|
||||
|
|
16
src/Desc.cc
16
src/Desc.cc
|
@ -267,28 +267,26 @@ size_t ODesc::StartsWithEscapeSequence(const char* start, const char* end)
|
|||
|
||||
std::pair<const char*, size_t> ODesc::FirstEscapeLoc(const char* bytes, size_t n)
|
||||
{
|
||||
using escape_pos = std::pair<const char*, size_t>;
|
||||
|
||||
if ( IsBinary() )
|
||||
return escape_pos(0, 0);
|
||||
return {nullptr, 0};
|
||||
|
||||
for ( size_t i = 0; i < n; ++i )
|
||||
{
|
||||
auto printable = isprint(bytes[i]);
|
||||
|
||||
if ( ! printable && ! utf8 )
|
||||
return escape_pos(bytes + i, 1);
|
||||
return {bytes + i, 1};
|
||||
|
||||
if ( bytes[i] == '\\' )
|
||||
return escape_pos(bytes + i, 1);
|
||||
return {bytes + i, 1};
|
||||
|
||||
size_t len = StartsWithEscapeSequence(bytes + i, bytes + n);
|
||||
|
||||
if ( len )
|
||||
return escape_pos(bytes + i, len);
|
||||
return {bytes + i, len};
|
||||
}
|
||||
|
||||
return escape_pos(nullptr, 0);
|
||||
return {nullptr, 0};
|
||||
}
|
||||
|
||||
void ODesc::AddBytes(const void* bytes, unsigned int n)
|
||||
|
@ -429,7 +427,7 @@ std::string obj_desc(const Obj* o)
|
|||
d.SP();
|
||||
o->GetLocationInfo()->Describe(&d);
|
||||
|
||||
return std::string(d.Description());
|
||||
return d.Description();
|
||||
}
|
||||
|
||||
std::string obj_desc_short(const Obj* o)
|
||||
|
@ -440,7 +438,7 @@ std::string obj_desc_short(const Obj* o)
|
|||
d.Clear();
|
||||
o->Describe(&d);
|
||||
|
||||
return std::string(d.Description());
|
||||
return d.Description();
|
||||
}
|
||||
|
||||
} // namespace zeek
|
||||
|
|
|
@ -340,7 +340,7 @@ class DictTestDummy
|
|||
{
|
||||
public:
|
||||
DictTestDummy(int v) : v(v) { }
|
||||
~DictTestDummy() { }
|
||||
~DictTestDummy() = default;
|
||||
int v = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@ Discarder::Discarder()
|
|||
discarder_maxlen = static_cast<int>(id::find_val("discarder_maxlen")->AsCount());
|
||||
}
|
||||
|
||||
Discarder::~Discarder() { }
|
||||
|
||||
bool Discarder::IsActive()
|
||||
{
|
||||
return check_ip || check_tcp || check_udp || check_icmp;
|
||||
|
|
|
@ -18,11 +18,11 @@ using FuncPtr = IntrusivePtr<Func>;
|
|||
namespace detail
|
||||
{
|
||||
|
||||
class Discarder
|
||||
class Discarder final
|
||||
{
|
||||
public:
|
||||
Discarder();
|
||||
~Discarder();
|
||||
~Discarder() = default;
|
||||
|
||||
bool IsActive();
|
||||
|
||||
|
|
|
@ -169,8 +169,6 @@ EventGroupPtr EventRegistry::LookupGroup(EventGroupKind kind, std::string_view n
|
|||
|
||||
EventGroup::EventGroup(EventGroupKind kind, std::string_view name) : kind(kind), name(name) { }
|
||||
|
||||
EventGroup::~EventGroup() noexcept { }
|
||||
|
||||
// Run through all ScriptFunc instances associated with this group and
|
||||
// update their bodies after a group's enable/disable state has changed.
|
||||
// Once that has completed, also update the Func's has_enabled_bodies
|
||||
|
|
|
@ -37,7 +37,7 @@ using ScriptFuncPtr = zeek::IntrusivePtr<ScriptFunc>;
|
|||
}
|
||||
|
||||
// The registry keeps track of all events that we provide or handle.
|
||||
class EventRegistry
|
||||
class EventRegistry final
|
||||
{
|
||||
public:
|
||||
EventRegistry();
|
||||
|
@ -135,11 +135,11 @@ private:
|
|||
* bodies of the tracked ScriptFuncs and updates them to reflect the current
|
||||
* group state.
|
||||
*/
|
||||
class EventGroup
|
||||
class EventGroup final
|
||||
{
|
||||
public:
|
||||
EventGroup(EventGroupKind kind, std::string_view name);
|
||||
~EventGroup() noexcept;
|
||||
~EventGroup() noexcept = default;
|
||||
EventGroup(const EventGroup& g) = delete;
|
||||
EventGroup& operator=(const EventGroup&) = delete;
|
||||
|
||||
|
|
|
@ -101,8 +101,6 @@ ValTrace::ValTrace(const ValPtr& _v) : v(_v)
|
|||
}
|
||||
}
|
||||
|
||||
ValTrace::~ValTrace() { }
|
||||
|
||||
bool ValTrace::operator==(const ValTrace& vt) const
|
||||
{
|
||||
auto& vt_v = vt.GetVal();
|
||||
|
|
|
@ -47,7 +47,7 @@ class ValTrace
|
|||
{
|
||||
public:
|
||||
ValTrace(const ValPtr& v);
|
||||
~ValTrace();
|
||||
~ValTrace() = default;
|
||||
|
||||
const ValPtr& GetVal() const { return v; }
|
||||
const TypePtr& GetType() const { return t; }
|
||||
|
|
|
@ -4237,8 +4237,6 @@ TableCoerceExpr::TableCoerceExpr(ExprPtr arg_op, TableTypePtr tt, bool type_chec
|
|||
ExprError("coercion of non-table/set to table/set");
|
||||
}
|
||||
|
||||
TableCoerceExpr::~TableCoerceExpr() { }
|
||||
|
||||
ValPtr TableCoerceExpr::Fold(Val* v) const
|
||||
{
|
||||
TableVal* tv = v->AsTableVal();
|
||||
|
@ -4264,8 +4262,6 @@ VectorCoerceExpr::VectorCoerceExpr(ExprPtr arg_op, VectorTypePtr v)
|
|||
ExprError("coercion of non-vector to vector");
|
||||
}
|
||||
|
||||
VectorCoerceExpr::~VectorCoerceExpr() { }
|
||||
|
||||
ValPtr VectorCoerceExpr::Fold(Val* v) const
|
||||
{
|
||||
VectorVal* vv = v->AsVectorVal();
|
||||
|
@ -4281,8 +4277,6 @@ ScheduleTimer::ScheduleTimer(const EventHandlerPtr& arg_event, Args arg_args, do
|
|||
{
|
||||
}
|
||||
|
||||
ScheduleTimer::~ScheduleTimer() { }
|
||||
|
||||
void ScheduleTimer::Dispatch(double /* t */, bool /* is_expire */)
|
||||
{
|
||||
if ( event )
|
||||
|
|
|
@ -1330,7 +1330,7 @@ class TableCoerceExpr final : public UnaryExpr
|
|||
{
|
||||
public:
|
||||
TableCoerceExpr(ExprPtr op, TableTypePtr r, bool type_check = true);
|
||||
~TableCoerceExpr() override;
|
||||
~TableCoerceExpr() override = default;
|
||||
|
||||
// Optimization-related:
|
||||
ExprPtr Duplicate() override;
|
||||
|
@ -1343,7 +1343,7 @@ class VectorCoerceExpr final : public UnaryExpr
|
|||
{
|
||||
public:
|
||||
VectorCoerceExpr(ExprPtr op, VectorTypePtr v);
|
||||
~VectorCoerceExpr() override;
|
||||
~VectorCoerceExpr() override = default;
|
||||
|
||||
// Optimization-related:
|
||||
ExprPtr Duplicate() override;
|
||||
|
@ -1356,7 +1356,7 @@ class ScheduleTimer final : public Timer
|
|||
{
|
||||
public:
|
||||
ScheduleTimer(const EventHandlerPtr& event, zeek::Args args, double t);
|
||||
~ScheduleTimer() override;
|
||||
~ScheduleTimer() override = default;
|
||||
|
||||
void Dispatch(double t, bool is_expire) override;
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ bool File::Open(FILE* file, const char* mode)
|
|||
}
|
||||
|
||||
is_open = true;
|
||||
open_files.emplace_back(std::make_pair(name, this));
|
||||
open_files.emplace_back(name, this);
|
||||
|
||||
RaiseOpenEvent();
|
||||
|
||||
|
|
|
@ -801,8 +801,6 @@ BuiltinFunc::BuiltinFunc(built_in_func arg_func, const char* arg_name, bool arg_
|
|||
id->SetConst();
|
||||
}
|
||||
|
||||
BuiltinFunc::~BuiltinFunc() { }
|
||||
|
||||
bool BuiltinFunc::IsPure() const
|
||||
{
|
||||
return is_pure;
|
||||
|
|
|
@ -336,7 +336,7 @@ class BuiltinFunc final : public Func
|
|||
{
|
||||
public:
|
||||
BuiltinFunc(built_in_func func, const char* name, bool is_pure);
|
||||
~BuiltinFunc() override;
|
||||
~BuiltinFunc() override = default;
|
||||
|
||||
bool IsPure() const override;
|
||||
ValPtr Invoke(zeek::Args* args, Frame* parent) const override;
|
||||
|
|
13
src/Hash.cc
13
src/Hash.cc
|
@ -27,20 +27,19 @@ alignas(16) unsigned long long KeyedHash::shared_siphash_key[2];
|
|||
|
||||
// we use the following lines to not pull in the highwayhash headers in Hash.h - but to check the
|
||||
// types did not change underneath us.
|
||||
static_assert(std::is_same<hash64_t, highwayhash::HHResult64>::value,
|
||||
static_assert(std::is_same_v<hash64_t, highwayhash::HHResult64>,
|
||||
"Highwayhash return values must match hash_x_t");
|
||||
static_assert(std::is_same<hash128_t, highwayhash::HHResult128>::value,
|
||||
static_assert(std::is_same_v<hash128_t, highwayhash::HHResult128>,
|
||||
"Highwayhash return values must match hash_x_t");
|
||||
static_assert(std::is_same<hash256_t, highwayhash::HHResult256>::value,
|
||||
static_assert(std::is_same_v<hash256_t, highwayhash::HHResult256>,
|
||||
"Highwayhash return values must match hash_x_t");
|
||||
|
||||
void KeyedHash::InitializeSeeds(const std::array<uint32_t, SEED_INIT_SIZE>& seed_data)
|
||||
{
|
||||
static_assert(std::is_same<decltype(KeyedHash::shared_siphash_key),
|
||||
highwayhash::SipHashState::Key>::value,
|
||||
"Highwayhash Key is not unsigned long long[2]");
|
||||
static_assert(
|
||||
std::is_same<decltype(KeyedHash::shared_highwayhash_key), highwayhash::HHKey>::value,
|
||||
std::is_same_v<decltype(KeyedHash::shared_siphash_key), highwayhash::SipHashState::Key>,
|
||||
"Highwayhash Key is not unsigned long long[2]");
|
||||
static_assert(std::is_same_v<decltype(KeyedHash::shared_highwayhash_key), highwayhash::HHKey>,
|
||||
"Highwayhash HHKey is not uint64_t[4]");
|
||||
if ( seeds_initialized )
|
||||
return;
|
||||
|
|
13
src/IP.cc
13
src/IP.cc
|
@ -612,28 +612,29 @@ bool IPv6_Hdr_Chain::IsFragment() const
|
|||
IPAddr IPv6_Hdr_Chain::SrcAddr() const
|
||||
{
|
||||
if ( homeAddr )
|
||||
return IPAddr(*homeAddr);
|
||||
return {*homeAddr};
|
||||
|
||||
if ( chain.empty() )
|
||||
{
|
||||
reporter->InternalWarning("empty IPv6 header chain");
|
||||
return IPAddr();
|
||||
return {};
|
||||
}
|
||||
|
||||
return IPAddr(((const struct ip6_hdr*)(chain[0]->Data()))->ip6_src);
|
||||
return IPAddr{((const struct ip6_hdr*)(chain[0]->Data()))->ip6_src};
|
||||
}
|
||||
|
||||
IPAddr IPv6_Hdr_Chain::DstAddr() const
|
||||
{
|
||||
if ( finalDst )
|
||||
return IPAddr(*finalDst);
|
||||
return {*finalDst};
|
||||
|
||||
if ( chain.empty() )
|
||||
{
|
||||
reporter->InternalWarning("empty IPv6 header chain");
|
||||
return IPAddr();
|
||||
return {};
|
||||
}
|
||||
|
||||
return IPAddr(((const struct ip6_hdr*)(chain[0]->Data()))->ip6_dst);
|
||||
return IPAddr{((const struct ip6_hdr*)(chain[0]->Data()))->ip6_dst};
|
||||
}
|
||||
|
||||
void IPv6_Hdr_Chain::ProcessRoutingHeader(const struct ip6_rthdr* r, uint16_t len)
|
||||
|
|
|
@ -50,8 +50,6 @@ OpaqueMgr* OpaqueMgr::mgr()
|
|||
|
||||
OpaqueVal::OpaqueVal(OpaqueTypePtr t) : Val(std::move(t)) { }
|
||||
|
||||
OpaqueVal::~OpaqueVal() { }
|
||||
|
||||
const std::string& OpaqueMgr::TypeID(const OpaqueVal* v) const
|
||||
{
|
||||
auto x = _types.find(v->OpaqueName());
|
||||
|
|
|
@ -118,7 +118,7 @@ class OpaqueVal : public Val
|
|||
{
|
||||
public:
|
||||
explicit OpaqueVal(OpaqueTypePtr t);
|
||||
~OpaqueVal() override;
|
||||
~OpaqueVal() override = default;
|
||||
|
||||
/**
|
||||
* Serializes the value into a Broker representation.
|
||||
|
|
|
@ -79,7 +79,7 @@ std::list<std::tuple<IPPrefix, void*>> PrefixTable::FindAll(const IPAddr& addr,
|
|||
patricia_search_all(tree, prefix, &list, &elems);
|
||||
|
||||
for ( int i = 0; i < elems; ++i )
|
||||
out.push_back(std::make_tuple(PrefixToIPPrefix(list[i]->prefix), list[i]->data));
|
||||
out.emplace_back(PrefixToIPPrefix(list[i]->prefix), list[i]->data);
|
||||
|
||||
Deref_Prefix(prefix);
|
||||
free(list);
|
||||
|
|
|
@ -203,7 +203,7 @@ std::string Specific_RE_Matcher::LookupDef(const std::string& def)
|
|||
if ( iter != defs.end() )
|
||||
return iter->second;
|
||||
|
||||
return std::string();
|
||||
return {};
|
||||
}
|
||||
|
||||
bool Specific_RE_Matcher::MatchAll(const char* s)
|
||||
|
|
|
@ -24,12 +24,12 @@ void ScriptCoverageManager::AddStmt(Stmt* s)
|
|||
if ( ignoring != 0 )
|
||||
return;
|
||||
|
||||
stmts.push_back({NewRef{}, s});
|
||||
stmts.emplace_back(NewRef{}, s);
|
||||
}
|
||||
|
||||
void ScriptCoverageManager::AddFunction(IDPtr func_id, StmtPtr body)
|
||||
{
|
||||
func_instances.push_back({func_id, body});
|
||||
func_instances.emplace_back(func_id, body);
|
||||
}
|
||||
|
||||
bool ScriptCoverageManager::ReadStats()
|
||||
|
|
|
@ -14,7 +14,7 @@ class BreakNextScriptValidation : public TraversalCallback
|
|||
public:
|
||||
BreakNextScriptValidation(bool _report) : report(_report) { }
|
||||
|
||||
TraversalCode PreStmt(const Stmt* stmt)
|
||||
TraversalCode PreStmt(const Stmt* stmt) override
|
||||
{
|
||||
if ( ! StmtIsRelevant(stmt) )
|
||||
return TC_CONTINUE;
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
return TC_CONTINUE;
|
||||
}
|
||||
|
||||
TraversalCode PostStmt(const Stmt* stmt)
|
||||
TraversalCode PostStmt(const Stmt* stmt) override
|
||||
{
|
||||
if ( ! StmtIsRelevant(stmt) )
|
||||
return TC_CONTINUE;
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
return TC_CONTINUE;
|
||||
}
|
||||
|
||||
TraversalCode PreFunction(const zeek::Func* func)
|
||||
TraversalCode PreFunction(const zeek::Func* func) override
|
||||
{
|
||||
if ( func->Flavor() == zeek::FUNC_FLAVOR_HOOK )
|
||||
++hook_depth;
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
return TC_CONTINUE;
|
||||
}
|
||||
|
||||
TraversalCode PostFunction(const zeek::Func* func)
|
||||
TraversalCode PostFunction(const zeek::Func* func) override
|
||||
{
|
||||
if ( func->Flavor() == zeek::FUNC_FLAVOR_HOOK )
|
||||
--hook_depth;
|
||||
|
|
|
@ -103,10 +103,6 @@ bool SerializationFormat::WriteData(const void* b, size_t count)
|
|||
return true;
|
||||
}
|
||||
|
||||
BinarySerializationFormat::BinarySerializationFormat() { }
|
||||
|
||||
BinarySerializationFormat::~BinarySerializationFormat() { }
|
||||
|
||||
bool BinarySerializationFormat::Read(int* v, const char* tag)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
|
|
@ -106,8 +106,8 @@ protected:
|
|||
class BinarySerializationFormat final : public SerializationFormat
|
||||
{
|
||||
public:
|
||||
BinarySerializationFormat();
|
||||
~BinarySerializationFormat() override;
|
||||
BinarySerializationFormat() = default;
|
||||
~BinarySerializationFormat() override = default;
|
||||
|
||||
bool Read(int* v, const char* tag) override;
|
||||
bool Read(uint16_t* v, const char* tag) override;
|
||||
|
|
|
@ -37,7 +37,7 @@ const Substring& Substring::operator=(const Substring& bst)
|
|||
|
||||
void Substring::AddAlignment(const String* str, int index)
|
||||
{
|
||||
_aligns.push_back(BSSAlign(str, index));
|
||||
_aligns.emplace_back(str, index);
|
||||
}
|
||||
|
||||
bool Substring::DoesCover(const Substring* bst) const
|
||||
|
|
|
@ -2085,7 +2085,7 @@ void WhenInfo::BuildProfile()
|
|||
if ( ! is_present )
|
||||
{
|
||||
IDPtr wl_ptr = {NewRef{}, const_cast<ID*>(wl)};
|
||||
cl->emplace_back(FuncType::Capture{wl_ptr, false});
|
||||
cl->emplace_back(wl_ptr, false);
|
||||
}
|
||||
|
||||
// In addition, don't treat them as external locals that
|
||||
|
@ -2098,7 +2098,7 @@ void WhenInfo::BuildProfile()
|
|||
// We need IDPtr versions of the locals so we can manipulate
|
||||
// them during script optimization.
|
||||
auto non_const_w = const_cast<ID*>(w);
|
||||
when_expr_locals.push_back({NewRef{}, non_const_w});
|
||||
when_expr_locals.emplace_back(NewRef{}, non_const_w);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual TraversalCode PreExpr(const Expr*) override;
|
||||
TraversalCode PreExpr(const Expr*) override;
|
||||
|
||||
private:
|
||||
IDSet& globals;
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
time = run_state::network_time;
|
||||
}
|
||||
|
||||
~TriggerTimer() { Unref(trigger); }
|
||||
~TriggerTimer() override { Unref(trigger); }
|
||||
|
||||
void Dispatch(double t, bool is_expire) override
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ void Trigger::Register(const ID* const_id)
|
|||
notifier::detail::registry.Register(id, this);
|
||||
|
||||
Ref(id);
|
||||
objs.push_back({id, id});
|
||||
objs.emplace_back(id, id);
|
||||
}
|
||||
|
||||
void Trigger::Register(Val* val)
|
||||
|
|
|
@ -1024,7 +1024,7 @@ class DirectManagedFieldInit final : public FieldInit
|
|||
{
|
||||
public:
|
||||
DirectManagedFieldInit(ZVal _init_val) : init_val(_init_val) { }
|
||||
~DirectManagedFieldInit() { ZVal::DeleteManagedType(init_val); }
|
||||
~DirectManagedFieldInit() override { ZVal::DeleteManagedType(init_val); }
|
||||
|
||||
ZVal Generate() const override
|
||||
{
|
||||
|
@ -1196,7 +1196,7 @@ void RecordType::AddField(unsigned int field, const TypeDecl* td)
|
|||
else
|
||||
{
|
||||
auto efi = std::make_unique<detail::ExprFieldInit>(def_expr, type);
|
||||
creation_inits.emplace_back(std::make_pair(field, std::move(efi)));
|
||||
creation_inits.emplace_back(field, std::move(efi));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1793,7 +1793,7 @@ EnumType::enum_name_list EnumType::Names() const
|
|||
{
|
||||
enum_name_list n;
|
||||
for ( NameMap::const_iterator iter = names.begin(); iter != names.end(); ++iter )
|
||||
n.push_back(std::make_pair(iter->first, iter->second));
|
||||
n.emplace_back(iter->first, iter->second);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -956,13 +956,13 @@ const char* StringVal::CheckString() const
|
|||
string StringVal::ToStdString() const
|
||||
{
|
||||
auto* bs = AsString();
|
||||
return string((char*)bs->Bytes(), bs->Len());
|
||||
return {(char*)bs->Bytes(), static_cast<size_t>(bs->Len())};
|
||||
}
|
||||
|
||||
string_view StringVal::ToStdStringView() const
|
||||
{
|
||||
auto* bs = AsString();
|
||||
return string_view((char*)bs->Bytes(), bs->Len());
|
||||
return {(char*)bs->Bytes(), static_cast<size_t>(bs->Len())};
|
||||
}
|
||||
|
||||
StringVal* StringVal::ToUpper()
|
||||
|
@ -1012,7 +1012,7 @@ StringValPtr StringVal::Replace(RE_Matcher* re, const String& repl, bool do_all)
|
|||
break;
|
||||
|
||||
// s[offset .. offset+end_of_match-1] matches re.
|
||||
cut_points.push_back({offset, offset + end_of_match});
|
||||
cut_points.emplace_back(offset, offset + end_of_match);
|
||||
|
||||
offset += end_of_match;
|
||||
n -= end_of_match;
|
||||
|
@ -1563,8 +1563,6 @@ ListVal::ListVal(TypeTag t) : Val(make_intrusive<TypeList>(t == TYPE_ANY ? nullp
|
|||
tag = t;
|
||||
}
|
||||
|
||||
ListVal::~ListVal() { }
|
||||
|
||||
ValPtr ListVal::SizeVal() const
|
||||
{
|
||||
return val_mgr->Count(vals.size());
|
||||
|
|
|
@ -663,7 +663,7 @@ class ListVal final : public Val
|
|||
public:
|
||||
explicit ListVal(TypeTag t);
|
||||
|
||||
~ListVal() override;
|
||||
~ListVal() override = default;
|
||||
|
||||
TypeTag BaseTag() const { return tag; }
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
AnalyzerTimer(Analyzer* arg_analyzer, analyzer_timer_func arg_timer, double arg_t,
|
||||
int arg_do_expire, zeek::detail::TimerType arg_type);
|
||||
|
||||
virtual ~AnalyzerTimer();
|
||||
~AnalyzerTimer() override;
|
||||
|
||||
void Dispatch(double t, bool is_expire) override;
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ ConnSize_Analyzer::ConnSize_Analyzer(Connection* c)
|
|||
start_time = c->StartTime();
|
||||
}
|
||||
|
||||
ConnSize_Analyzer::~ConnSize_Analyzer() { }
|
||||
|
||||
void ConnSize_Analyzer::Init()
|
||||
{
|
||||
Analyzer::Init();
|
||||
|
|
|
@ -12,7 +12,7 @@ class ConnSize_Analyzer : public analyzer::Analyzer
|
|||
{
|
||||
public:
|
||||
explicit ConnSize_Analyzer(Connection* c);
|
||||
~ConnSize_Analyzer() override;
|
||||
~ConnSize_Analyzer() override = default;
|
||||
|
||||
void Init() override;
|
||||
void Done() override;
|
||||
|
|
|
@ -403,8 +403,6 @@ DNP3_TCP_Analyzer::DNP3_TCP_Analyzer(Connection* c)
|
|||
{
|
||||
}
|
||||
|
||||
DNP3_TCP_Analyzer::~DNP3_TCP_Analyzer() { }
|
||||
|
||||
void DNP3_TCP_Analyzer::Done()
|
||||
{
|
||||
TCP_ApplicationAnalyzer::Done();
|
||||
|
@ -444,8 +442,6 @@ void DNP3_TCP_Analyzer::EndpointEOF(bool is_orig)
|
|||
|
||||
DNP3_UDP_Analyzer::DNP3_UDP_Analyzer(Connection* c) : DNP3_Base(this), Analyzer("DNP3_UDP", c) { }
|
||||
|
||||
DNP3_UDP_Analyzer::~DNP3_UDP_Analyzer() { }
|
||||
|
||||
void DNP3_UDP_Analyzer::DeliverPacket(int len, const u_char* data, bool orig, uint64_t seq,
|
||||
const IP_Hdr* ip, int caplen)
|
||||
{
|
||||
|
|
|
@ -71,7 +71,7 @@ class DNP3_TCP_Analyzer : public detail::DNP3_Base, public analyzer::tcp::TCP_Ap
|
|||
{
|
||||
public:
|
||||
explicit DNP3_TCP_Analyzer(Connection* conn);
|
||||
~DNP3_TCP_Analyzer() override;
|
||||
~DNP3_TCP_Analyzer() override = default;
|
||||
|
||||
void Done() override;
|
||||
void DeliverStream(int len, const u_char* data, bool orig) override;
|
||||
|
@ -85,7 +85,7 @@ class DNP3_UDP_Analyzer : public detail::DNP3_Base, public analyzer::Analyzer
|
|||
{
|
||||
public:
|
||||
explicit DNP3_UDP_Analyzer(Connection* conn);
|
||||
~DNP3_UDP_Analyzer() override;
|
||||
~DNP3_UDP_Analyzer() override = default;
|
||||
|
||||
void DeliverPacket(int len, const u_char* data, bool orig, uint64_t seq, const IP_Hdr* ip,
|
||||
int caplen) override;
|
||||
|
|
|
@ -30,8 +30,6 @@ Contents_Rsh_Analyzer::Contents_Rsh_Analyzer(Connection* conn, bool orig,
|
|||
}
|
||||
}
|
||||
|
||||
Contents_Rsh_Analyzer::~Contents_Rsh_Analyzer() { }
|
||||
|
||||
void Contents_Rsh_Analyzer::DoDeliver(int len, const u_char* data)
|
||||
{
|
||||
int endp_state;
|
||||
|
|
|
@ -28,7 +28,7 @@ class Contents_Rsh_Analyzer final : public analyzer::tcp::ContentLine_Analyzer
|
|||
{
|
||||
public:
|
||||
Contents_Rsh_Analyzer(Connection* conn, bool orig, Rsh_Analyzer* analyzer);
|
||||
~Contents_Rsh_Analyzer() override;
|
||||
~Contents_Rsh_Analyzer() override = default;
|
||||
|
||||
rsh_state RshSaveState() const { return save_state; }
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@ Contents_Rlogin_Analyzer::Contents_Rlogin_Analyzer(Connection* conn, bool orig,
|
|||
state = save_state = RLOGIN_SERVER_ACK;
|
||||
}
|
||||
|
||||
Contents_Rlogin_Analyzer::~Contents_Rlogin_Analyzer() { }
|
||||
|
||||
void Contents_Rlogin_Analyzer::DoDeliver(int len, const u_char* data)
|
||||
{
|
||||
int endp_state;
|
||||
|
|
|
@ -36,7 +36,7 @@ class Contents_Rlogin_Analyzer final : public analyzer::tcp::ContentLine_Analyze
|
|||
{
|
||||
public:
|
||||
Contents_Rlogin_Analyzer(Connection* conn, bool orig, Rlogin_Analyzer* analyzer);
|
||||
~Contents_Rlogin_Analyzer() override;
|
||||
~Contents_Rlogin_Analyzer() override = default;
|
||||
|
||||
void SetPeer(Contents_Rlogin_Analyzer* arg_peer) { peer = arg_peer; }
|
||||
|
||||
|
|
|
@ -169,8 +169,6 @@ Contents_NCP_Analyzer::Contents_NCP_Analyzer(Connection* conn, bool orig,
|
|||
resync_set = false;
|
||||
}
|
||||
|
||||
Contents_NCP_Analyzer::~Contents_NCP_Analyzer() { }
|
||||
|
||||
void Contents_NCP_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
||||
{
|
||||
analyzer::tcp::TCP_SupportAnalyzer::DeliverStream(len, data, orig);
|
||||
|
|
|
@ -91,7 +91,7 @@ class Contents_NCP_Analyzer : public analyzer::tcp::TCP_SupportAnalyzer
|
|||
{
|
||||
public:
|
||||
Contents_NCP_Analyzer(Connection* conn, bool orig, detail::NCP_Session* session);
|
||||
~Contents_NCP_Analyzer() override;
|
||||
~Contents_NCP_Analyzer() override = default;
|
||||
|
||||
protected:
|
||||
void DeliverStream(int len, const u_char* data, bool orig) override;
|
||||
|
|
|
@ -52,8 +52,6 @@ POP3_Analyzer::POP3_Analyzer(Connection* conn)
|
|||
AddSupportAnalyzer(cl_resp);
|
||||
}
|
||||
|
||||
POP3_Analyzer::~POP3_Analyzer() { }
|
||||
|
||||
void POP3_Analyzer::Done()
|
||||
{
|
||||
analyzer::tcp::TCP_ApplicationAnalyzer::Done();
|
||||
|
@ -224,7 +222,7 @@ void POP3_Analyzer::ProcessRequest(int length, const char* line)
|
|||
// Some clients pipeline their commands (i.e., keep sending
|
||||
// without waiting for a server's responses). Therefore we
|
||||
// keep a list of pending commands.
|
||||
cmds.push_back(std::string(line));
|
||||
cmds.emplace_back(line);
|
||||
|
||||
if ( cmds.size() == 1 )
|
||||
// Not waiting for another server response,
|
||||
|
|
|
@ -74,7 +74,7 @@ class POP3_Analyzer final : public analyzer::tcp::TCP_ApplicationAnalyzer
|
|||
{
|
||||
public:
|
||||
explicit POP3_Analyzer(Connection* conn);
|
||||
~POP3_Analyzer() override;
|
||||
~POP3_Analyzer() override = default;
|
||||
|
||||
void Done() override;
|
||||
void DeliverStream(int len, const u_char* data, bool orig) override;
|
||||
|
|
|
@ -297,8 +297,6 @@ Portmapper_Analyzer::Portmapper_Analyzer(Connection* conn)
|
|||
orig_rpc = resp_rpc = nullptr;
|
||||
}
|
||||
|
||||
Portmapper_Analyzer::~Portmapper_Analyzer() { }
|
||||
|
||||
void Portmapper_Analyzer::Init()
|
||||
{
|
||||
RPC_Analyzer::Init();
|
||||
|
|
|
@ -33,7 +33,7 @@ class Portmapper_Analyzer : public RPC_Analyzer
|
|||
{
|
||||
public:
|
||||
explicit Portmapper_Analyzer(Connection* conn);
|
||||
~Portmapper_Analyzer() override;
|
||||
~Portmapper_Analyzer() override = default;
|
||||
void Init() override;
|
||||
|
||||
static analyzer::Analyzer* Instantiate(Connection* conn)
|
||||
|
|
|
@ -423,8 +423,6 @@ void Contents_RPC::Init()
|
|||
analyzer::tcp::TCP_SupportAnalyzer::Init();
|
||||
}
|
||||
|
||||
Contents_RPC::~Contents_RPC() { }
|
||||
|
||||
void Contents_RPC::Undelivered(uint64_t seq, int len, bool orig)
|
||||
{
|
||||
analyzer::tcp::TCP_SupportAnalyzer::Undelivered(seq, len, orig);
|
||||
|
|
|
@ -212,7 +212,7 @@ class Contents_RPC final : public analyzer::tcp::TCP_SupportAnalyzer
|
|||
{
|
||||
public:
|
||||
Contents_RPC(Connection* conn, bool orig, detail::RPC_Interpreter* interp);
|
||||
~Contents_RPC() override;
|
||||
~Contents_RPC() override = default;
|
||||
|
||||
protected:
|
||||
enum state_t
|
||||
|
|
|
@ -71,7 +71,7 @@ refine flow SIP_Flow += {
|
|||
|
||||
if ( build_headers )
|
||||
{
|
||||
headers.push_back({zeek::AdoptRef{}, build_sip_header_val(name, value)});
|
||||
headers.emplace_back(zeek::AdoptRef{}, build_sip_header_val(name, value));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -24,7 +24,7 @@ type uint48 = record {
|
|||
%code{
|
||||
string orig_label(bool is_orig)
|
||||
{
|
||||
return string(is_orig ? "originator" :"responder");
|
||||
return is_orig ? "originator" :"responder";
|
||||
}
|
||||
%}
|
||||
|
||||
|
@ -42,8 +42,6 @@ string orig_label(bool is_orig)
|
|||
((uint64)num->byte4() << 16) | ((uint64)num->byte5() << 8) | (uint64)num->byte6();
|
||||
}
|
||||
};
|
||||
|
||||
string state_label(int state_nr);
|
||||
%}
|
||||
|
||||
extern type to_int;
|
||||
|
|
|
@ -21,22 +21,6 @@ enum AnalyzerState {
|
|||
STATE_ENCRYPTED
|
||||
};
|
||||
|
||||
%code{
|
||||
string state_label(int state_nr)
|
||||
{
|
||||
switch ( state_nr ) {
|
||||
case STATE_CLEAR:
|
||||
return string("CLEAR");
|
||||
|
||||
case STATE_ENCRYPTED:
|
||||
return string("ENCRYPTED");
|
||||
|
||||
default:
|
||||
return string(zeek::util::fmt("UNKNOWN (%d)", state_nr));
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
######################################################################
|
||||
# Change Cipher Spec Protocol (7.1.)
|
||||
######################################################################
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace zeek::analyzer::xmpp
|
|||
XMPP_Analyzer::XMPP_Analyzer(Connection* conn)
|
||||
: analyzer::tcp::TCP_ApplicationAnalyzer("XMPP", conn)
|
||||
{
|
||||
interp = unique_ptr<binpac::XMPP::XMPP_Conn>(new binpac::XMPP::XMPP_Conn(this));
|
||||
interp = std::make_unique<binpac::XMPP::XMPP_Conn>(this);
|
||||
had_gap = false;
|
||||
tls_active = false;
|
||||
}
|
||||
|
|
|
@ -889,7 +889,7 @@ broker::expected<broker::data> val_to_data(const Val* v)
|
|||
std::string name(f->Name());
|
||||
|
||||
broker::vector rval;
|
||||
rval.push_back(name);
|
||||
rval.emplace_back(name);
|
||||
|
||||
if ( name.find("lambda_<") == 0 )
|
||||
{
|
||||
|
|
|
@ -246,8 +246,6 @@ Manager::Manager(bool arg_use_real_time)
|
|||
writer_id_type = nullptr;
|
||||
}
|
||||
|
||||
Manager::~Manager() { }
|
||||
|
||||
void Manager::InitPostScript()
|
||||
{
|
||||
DBG_LOG(DBG_BROKER, "Initializing");
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~Manager() override;
|
||||
~Manager() override = default;
|
||||
|
||||
/**
|
||||
* Initialization of the manager. This is called late during Zeek's
|
||||
|
|
|
@ -23,8 +23,6 @@ void Component::Initialize()
|
|||
file_mgr->RegisterComponent(this, "ANALYZER_");
|
||||
}
|
||||
|
||||
Component::~Component() { }
|
||||
|
||||
void Component::DoDescribe(ODesc* d) const
|
||||
{
|
||||
if ( factory_func )
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~Component() override;
|
||||
~Component() override = default;
|
||||
|
||||
/**
|
||||
* Initialization function. This function has to be called before any
|
||||
|
|
|
@ -21,8 +21,6 @@ void Component::Initialize()
|
|||
input_mgr->RegisterComponent(this, "READER_");
|
||||
}
|
||||
|
||||
Component::~Component() { }
|
||||
|
||||
void Component::DoDescribe(ODesc* d) const
|
||||
{
|
||||
d->Add("Input::READER_");
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~Component() override;
|
||||
~Component() override = default;
|
||||
|
||||
/**
|
||||
* Initialization function. This function has to be called before any
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
string file_id;
|
||||
|
||||
AnalysisStream();
|
||||
~AnalysisStream() override;
|
||||
~AnalysisStream() override = default;
|
||||
};
|
||||
|
||||
Manager::TableStream::TableStream()
|
||||
|
@ -177,8 +177,6 @@ Manager::TableStream::~TableStream()
|
|||
|
||||
Manager::AnalysisStream::AnalysisStream() : Manager::Stream::Stream(ANALYSIS_STREAM), file_id() { }
|
||||
|
||||
Manager::AnalysisStream::~AnalysisStream() { }
|
||||
|
||||
Manager::Manager() : plugin::ComponentManager<input::Component>("Input", "Reader")
|
||||
{
|
||||
end_of_data = event_registry->Register("Input::end_of_data");
|
||||
|
|
|
@ -44,7 +44,7 @@ FieldMapping::FieldMapping(const FieldMapping& arg)
|
|||
|
||||
FieldMapping FieldMapping::subType()
|
||||
{
|
||||
return FieldMapping(name, subtype, position);
|
||||
return {name, subtype, position};
|
||||
}
|
||||
|
||||
FieldMapping& FieldMapping::operator=(const FieldMapping& arg)
|
||||
|
|
|
@ -54,8 +54,6 @@ Config::Config(ReaderFrontend* frontend) : ReaderBackend(frontend)
|
|||
}
|
||||
}
|
||||
|
||||
Config::~Config() { }
|
||||
|
||||
void Config::DoClose() { }
|
||||
|
||||
bool Config::DoInit(const ReaderInfo& info, int num_fields, const Field* const* fields)
|
||||
|
|
|
@ -23,7 +23,7 @@ class Config : public ReaderBackend
|
|||
{
|
||||
public:
|
||||
explicit Config(ReaderFrontend* frontend);
|
||||
~Config() override;
|
||||
~Config() override = default;
|
||||
|
||||
// prohibit copying and moving
|
||||
Config(const Config&) = delete;
|
||||
|
|
|
@ -7,8 +7,6 @@ namespace zeek::plugin::detail::Zeek_RawReader
|
|||
|
||||
Plugin plugin;
|
||||
|
||||
Plugin::Plugin() { }
|
||||
|
||||
zeek::plugin::Configuration Plugin::Configure()
|
||||
{
|
||||
AddComponent(new zeek::input::Component("Raw", zeek::input::reader::detail::Raw::Instantiate));
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace zeek::plugin::detail::Zeek_RawReader
|
|||
class Plugin : public plugin::Plugin
|
||||
{
|
||||
public:
|
||||
Plugin();
|
||||
Plugin() = default;
|
||||
|
||||
plugin::Configuration Configure() override;
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@ Component::Component(plugin::component::Type type, const std::string& name)
|
|||
{
|
||||
}
|
||||
|
||||
Component::~Component() { }
|
||||
|
||||
PktSrcComponent::PktSrcComponent(const std::string& arg_name, const std::string& arg_prefix,
|
||||
InputType arg_type, factory_callback arg_factory)
|
||||
: Component(plugin::component::PKTSRC, arg_name)
|
||||
|
@ -28,8 +26,6 @@ PktSrcComponent::PktSrcComponent(const std::string& arg_name, const std::string&
|
|||
factory = arg_factory;
|
||||
}
|
||||
|
||||
PktSrcComponent::~PktSrcComponent() { }
|
||||
|
||||
const std::vector<std::string>& PktSrcComponent::Prefixes() const
|
||||
{
|
||||
return prefixes;
|
||||
|
@ -110,8 +106,6 @@ PktDumperComponent::PktDumperComponent(const std::string& name, const std::strin
|
|||
factory = arg_factory;
|
||||
}
|
||||
|
||||
PktDumperComponent::~PktDumperComponent() { }
|
||||
|
||||
PktDumperComponent::factory_callback PktDumperComponent::Factory() const
|
||||
{
|
||||
return factory;
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~Component() override;
|
||||
~Component() override = default;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~PktSrcComponent() override;
|
||||
~PktSrcComponent() override = default;
|
||||
|
||||
/**
|
||||
* Returns the prefix(es) passed to the constructor.
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~PktDumperComponent() override;
|
||||
~PktDumperComponent() override = default;
|
||||
|
||||
/**
|
||||
* Returns the prefix(es) passed to the constructor.
|
||||
|
|
|
@ -16,8 +16,6 @@ PktDumper::PktDumper()
|
|||
errmsg = "";
|
||||
}
|
||||
|
||||
PktDumper::~PktDumper() { }
|
||||
|
||||
void PktDumper::Init()
|
||||
{
|
||||
Open();
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~PktDumper();
|
||||
virtual ~PktDumper() = default;
|
||||
|
||||
/**
|
||||
* Returns the path associated with the dumper.
|
||||
|
|
|
@ -20,8 +20,6 @@ PcapDumper::PcapDumper(const std::string& path, bool arg_append)
|
|||
pd = nullptr;
|
||||
}
|
||||
|
||||
PcapDumper::~PcapDumper() { }
|
||||
|
||||
void PcapDumper::Open()
|
||||
{
|
||||
int linktype = -1;
|
||||
|
|
|
@ -18,7 +18,7 @@ class PcapDumper : public PktDumper
|
|||
{
|
||||
public:
|
||||
PcapDumper(const std::string& path, bool append);
|
||||
~PcapDumper() override;
|
||||
~PcapDumper() override = default;
|
||||
|
||||
static PktDumper* Instantiate(const std::string& path, bool append);
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ void Component::Initialize()
|
|||
log_mgr->RegisterComponent(this, "WRITER_");
|
||||
}
|
||||
|
||||
Component::~Component() { }
|
||||
|
||||
void Component::DoDescribe(ODesc* d) const
|
||||
{
|
||||
d->Add("Log::WRITER_");
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~Component() override;
|
||||
~Component() override = default;
|
||||
|
||||
/**
|
||||
* Initialization function. This function has to be called before any
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual ~RotateMessage() { delete[] rotated_path; }
|
||||
~RotateMessage() override { delete[] rotated_path; }
|
||||
|
||||
bool Process() override { return Object()->Rotate(rotated_path, open, close, terminating); }
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ bool None::DoInit(const WriterInfo& info, int num_fields, const threading::Field
|
|||
|
||||
for ( WriterInfo::config_map::const_iterator i = info.config.begin();
|
||||
i != info.config.end(); i++ )
|
||||
keys.push_back(std::make_pair(i->first, i->second));
|
||||
keys.emplace_back(i->first, i->second);
|
||||
|
||||
std::sort(keys.begin(), keys.end());
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ string extract_module_name(const char* name)
|
|||
string::size_type pos = module_name.rfind("::");
|
||||
|
||||
if ( pos == string::npos )
|
||||
return string(GLOBAL_MODULE_NAME);
|
||||
return GLOBAL_MODULE_NAME;
|
||||
|
||||
module_name.erase(pos);
|
||||
|
||||
|
@ -63,7 +63,7 @@ string extract_var_name(const char* name)
|
|||
return var_name;
|
||||
|
||||
if ( pos + 2 > var_name.size() )
|
||||
return string("");
|
||||
return "";
|
||||
|
||||
return var_name.substr(pos + 2);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ string normalized_module_name(const char* module_name)
|
|||
if ( (mod_len = strlen(module_name)) >= 2 && streq(module_name + mod_len - 2, "::") )
|
||||
mod_len -= 2;
|
||||
|
||||
return string(module_name, mod_len);
|
||||
return {module_name, static_cast<size_t>(mod_len)};
|
||||
}
|
||||
|
||||
TEST_CASE("module_util make_full_var_name")
|
||||
|
@ -103,7 +103,7 @@ string make_full_var_name(const char* module_name, const char* var_name)
|
|||
if ( streq(GLOBAL_MODULE_NAME, extract_module_name(var_name).c_str()) )
|
||||
return extract_var_name(var_name);
|
||||
|
||||
return string(var_name);
|
||||
return var_name;
|
||||
}
|
||||
|
||||
string full_name = normalized_module_name(module_name);
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_ARP
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"ARP", zeek::packet_analysis::ARP::ARPAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_AYIYA
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"AYIYA", zeek::packet_analysis::AYIYA::AYIYAAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_Ethernet
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"Ethernet", zeek::packet_analysis::Ethernet::EthernetAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_FDDI
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"FDDI", zeek::packet_analysis::FDDI::FDDIAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_Geneve
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"Geneve", zeek::packet_analysis::Geneve::GeneveAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_GRE
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"GRE", zeek::packet_analysis::GRE::GREAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace zeek::plugin::detail::Zeek_GTPv1
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure() override
|
||||
|
|
|
@ -335,8 +335,9 @@ zeek::RecordValPtr ICMPAnalyzer::ExtractICMP4Context(int len, const u_char*& dat
|
|||
{
|
||||
// We don't have an entire IP header.
|
||||
bad_hdr_len = true;
|
||||
bad_checksum = false;
|
||||
ip_len = frag_offset = 0;
|
||||
DF = MF = bad_checksum = 0;
|
||||
DF = MF = 0;
|
||||
src_port = dst_port = 0;
|
||||
}
|
||||
|
||||
|
@ -370,7 +371,7 @@ zeek::RecordValPtr ICMPAnalyzer::ExtractICMP4Context(int len, const u_char*& dat
|
|||
// 4 above is the magic number meaning that both
|
||||
// port numbers are included in the ICMP.
|
||||
src_port = dst_port = 0;
|
||||
bad_hdr_len = 1;
|
||||
bad_hdr_len = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,7 +501,7 @@ void ICMPAnalyzer::RouterAdvert(double t, const struct icmp* icmpp, int len, int
|
|||
int opt_offset = sizeof(reachable) + sizeof(retrans);
|
||||
|
||||
adapter->EnqueueConnEvent(
|
||||
f, adapter->ConnVal(), BuildInfo(icmpp, len, 1, ip_hdr),
|
||||
f, adapter->ConnVal(), BuildInfo(icmpp, len, true, ip_hdr),
|
||||
val_mgr->Count(icmpp->icmp_num_addrs), // Cur Hop Limit
|
||||
val_mgr->Bool(icmpp->icmp_wpa & 0x80), // Managed
|
||||
val_mgr->Bool(icmpp->icmp_wpa & 0x40), // Other
|
||||
|
@ -530,7 +531,7 @@ void ICMPAnalyzer::NeighborAdvert(double t, const struct icmp* icmpp, int len, i
|
|||
|
||||
int opt_offset = sizeof(in6_addr);
|
||||
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, 1, ip_hdr),
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, true, ip_hdr),
|
||||
val_mgr->Bool(icmpp->icmp_num_addrs & 0x80), // Router
|
||||
val_mgr->Bool(icmpp->icmp_num_addrs & 0x40), // Solicited
|
||||
val_mgr->Bool(icmpp->icmp_num_addrs & 0x20), // Override
|
||||
|
@ -554,7 +555,7 @@ void ICMPAnalyzer::NeighborSolicit(double t, const struct icmp* icmpp, int len,
|
|||
|
||||
int opt_offset = sizeof(in6_addr);
|
||||
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, 1, ip_hdr),
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, true, ip_hdr),
|
||||
make_intrusive<AddrVal>(tgtaddr),
|
||||
BuildNDOptionsVal(caplen - opt_offset, data + opt_offset, adapter));
|
||||
}
|
||||
|
@ -577,7 +578,7 @@ void ICMPAnalyzer::Redirect(double t, const struct icmp* icmpp, int len, int cap
|
|||
|
||||
int opt_offset = 2 * sizeof(in6_addr);
|
||||
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, 1, ip_hdr),
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, true, ip_hdr),
|
||||
make_intrusive<AddrVal>(tgtaddr), make_intrusive<AddrVal>(dstaddr),
|
||||
BuildNDOptionsVal(caplen - opt_offset, data + opt_offset, adapter));
|
||||
}
|
||||
|
@ -591,7 +592,7 @@ void ICMPAnalyzer::RouterSolicit(double t, const struct icmp* icmpp, int len, in
|
|||
if ( ! f )
|
||||
return;
|
||||
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, 1, ip_hdr),
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, true, ip_hdr),
|
||||
BuildNDOptionsVal(caplen, data, adapter));
|
||||
}
|
||||
|
||||
|
@ -612,7 +613,7 @@ void ICMPAnalyzer::Context4(double t, const struct icmp* icmpp, int len, int cap
|
|||
}
|
||||
|
||||
if ( f )
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, 0, ip_hdr),
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, false, ip_hdr),
|
||||
val_mgr->Count(icmpp->icmp_code),
|
||||
ExtractICMP4Context(caplen, data));
|
||||
}
|
||||
|
@ -646,7 +647,7 @@ void ICMPAnalyzer::Context6(double t, const struct icmp* icmpp, int len, int cap
|
|||
}
|
||||
|
||||
if ( f )
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, 1, ip_hdr),
|
||||
adapter->EnqueueConnEvent(f, adapter->ConnVal(), BuildInfo(icmpp, len, true, ip_hdr),
|
||||
val_mgr->Count(icmpp->icmp_code),
|
||||
ExtractICMP6Context(caplen, data));
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
namespace zeek::plugin::Zeek_ICMP
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"ICMP", zeek::packet_analysis::ICMP::ICMPAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_IEEE802_11
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"IEEE802_11", zeek::packet_analysis::IEEE802_11::IEEE802_11Analyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_IEEE802_11_Radio
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"IEEE802_11_Radio",
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_IP
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"IP", zeek::packet_analysis::IP::IPAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_IPTunnel
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"IPTunnel", zeek::packet_analysis::IPTunnel::IPTunnelAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_LinuxSLL
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"LinuxSLL", zeek::packet_analysis::LinuxSLL::LinuxSLLAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_LinuxSLL2
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"LinuxSLL2", zeek::packet_analysis::LinuxSLL2::LinuxSLL2Analyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_LLC
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"LLC", zeek::packet_analysis::LLC::LLCAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_MPLS
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"MPLS", zeek::packet_analysis::MPLS::MPLSAnalyzer::Instantiate));
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
namespace zeek::plugin::Zeek_NFLog
|
||||
{
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
class Plugin final : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
zeek::plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"NFLog", zeek::packet_analysis::NFLog::NFLogAnalyzer::Instantiate));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue