[Spicy] Bump auxil/spicy/ to latest development snapshot.

This commit is contained in:
Benjamin Bannier 2025-07-03 19:04:12 +02:00 committed by Robin Sommer
parent 92868804b1
commit 2307c62a61
No known key found for this signature in database
GPG key ID: D8187293B3FFE5D0
6 changed files with 28 additions and 21 deletions

@ -1 +1 @@
Subproject commit c26202767742818a0ef0e5538ea7df5ca54620b1 Subproject commit f9cf2115cf330e7dff61f438ba04c96d9f1a132c

View file

@ -18,9 +18,9 @@ type ZeekTypeTag = enum {
} &cxxname="::zeek::spicy::rt::ZeekTypeTag"; } &cxxname="::zeek::spicy::rt::ZeekTypeTag";
declare public void register_spicy_module_begin(string name, string description) &cxxname="zeek::spicy::rt::register_spicy_module_begin"; declare public void register_spicy_module_begin(string name, string description) &cxxname="zeek::spicy::rt::register_spicy_module_begin";
declare public void register_protocol_analyzer(string name, hilti::Protocol protocol, vector<PortRange> ports, string parser_orig, string parser_resp, string replaces, string linker_scope) &cxxname="zeek::spicy::rt::register_protocol_analyzer" &have_prototype; declare public void register_protocol_analyzer(string name, hilti::Protocol protocol, vector<PortRange> ports, string parser_orig, string parser_resp, string replaces, uint<64> linker_scope) &cxxname="zeek::spicy::rt::register_protocol_analyzer" &have_prototype;
declare public void register_file_analyzer(string name, vector<string> mime_types, string parser, string replaces, string linker_scope) &cxxname="zeek::spicy::rt::register_file_analyzer" &have_prototype; declare public void register_file_analyzer(string name, vector<string> mime_types, string parser, string replaces, uint<64> linker_scope) &cxxname="zeek::spicy::rt::register_file_analyzer" &have_prototype;
declare public void register_packet_analyzer(string name, string parser, string replaces, string linker_scope) &cxxname="zeek::spicy::rt::register_packet_analyzer" &have_prototype; declare public void register_packet_analyzer(string name, string parser, string replaces, uint<64> linker_scope) &cxxname="zeek::spicy::rt::register_packet_analyzer" &have_prototype;
declare public void register_type(string ns, string id, BroType t) &cxxname="zeek::spicy::rt::register_type" &have_prototype; declare public void register_type(string ns, string id, BroType t) &cxxname="zeek::spicy::rt::register_type" &have_prototype;
declare public void register_spicy_module_end() &cxxname="zeek::spicy::rt::register_spicy_module_end"; declare public void register_spicy_module_end() &cxxname="zeek::spicy::rt::register_spicy_module_end";

View file

@ -64,7 +64,8 @@ void Manager::registerSpicyModuleEnd() {
void Manager::registerProtocolAnalyzer(const std::string& name, hilti::rt::Protocol proto, void Manager::registerProtocolAnalyzer(const std::string& name, hilti::rt::Protocol proto,
const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports, const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports,
const std::string& parser_orig, const std::string& parser_resp, const std::string& parser_orig, const std::string& parser_resp,
const std::string& replaces, const std::string& linker_scope) { const std::string& replaces,
const hilti::rt::integer::safe<uint64_t>& linker_scope) {
SPICY_DEBUG(hilti::rt::fmt("Have Spicy protocol analyzer %s", name)); SPICY_DEBUG(hilti::rt::fmt("Have Spicy protocol analyzer %s", name));
ProtocolAnalyzerInfo info; ProtocolAnalyzerInfo info;
@ -125,7 +126,7 @@ void Manager::registerProtocolAnalyzer(const std::string& name, hilti::rt::Proto
void Manager::registerFileAnalyzer(const std::string& name, const hilti::rt::Vector<std::string>& mime_types, void Manager::registerFileAnalyzer(const std::string& name, const hilti::rt::Vector<std::string>& mime_types,
const std::string& parser, const std::string& replaces, const std::string& parser, const std::string& replaces,
const std::string& linker_scope) { const hilti::rt::integer::safe<uint64_t>& linker_scope) {
SPICY_DEBUG(hilti::rt::fmt("Have Spicy file analyzer %s", name)); SPICY_DEBUG(hilti::rt::fmt("Have Spicy file analyzer %s", name));
FileAnalyzerInfo info; FileAnalyzerInfo info;
@ -170,7 +171,7 @@ void Manager::registerFileAnalyzer(const std::string& name, const hilti::rt::Vec
} }
void Manager::registerPacketAnalyzer(const std::string& name, const std::string& parser, const std::string& replaces, void Manager::registerPacketAnalyzer(const std::string& name, const std::string& parser, const std::string& replaces,
const std::string& linker_scope) { const hilti::rt::integer::safe<uint64_t>& linker_scope) {
SPICY_DEBUG(hilti::rt::fmt("Have Spicy packet analyzer %s", name)); SPICY_DEBUG(hilti::rt::fmt("Have Spicy packet analyzer %s", name));
PacketAnalyzerInfo info; PacketAnalyzerInfo info;
@ -651,7 +652,7 @@ void Manager::InitPostScript() {
// Fill in the parser information now that we derived from the ASTs. // Fill in the parser information now that we derived from the ASTs.
auto find_parser = [](const std::string& analyzer, const std::string& parser, auto find_parser = [](const std::string& analyzer, const std::string& parser,
const std::string& linker_scope) -> const ::spicy::rt::Parser* { const auto& linker_scope) -> const ::spicy::rt::Parser* {
if ( parser.empty() ) if ( parser.empty() )
return nullptr; return nullptr;

View file

@ -2,15 +2,16 @@
#pragma once #pragma once
#include <cstdint>
#include <memory> #include <memory>
#include <set> #include <set>
#include <string> #include <string>
#include <tuple>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <hilti/rt/library.h> #include <hilti/rt/library.h>
#include <hilti/rt/logging.h> #include <hilti/rt/logging.h>
#include <hilti/rt/safe-int.h>
#include <hilti/rt/types/port.h> #include <hilti/rt/types/port.h>
#include "zeek/Scope.h" #include "zeek/Scope.h"
@ -99,7 +100,7 @@ public:
void registerProtocolAnalyzer(const std::string& name, hilti::rt::Protocol proto, void registerProtocolAnalyzer(const std::string& name, hilti::rt::Protocol proto,
const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports, const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports,
const std::string& parser_orig, const std::string& parser_resp, const std::string& parser_orig, const std::string& parser_resp,
const std::string& replaces, const std::string& linker_scope); const std::string& replaces, const hilti::rt::integer::safe<uint64_t>& linker_scope);
/** /**
* Runtime method to register a file analyzer with its Zeek-side * Runtime method to register a file analyzer with its Zeek-side
@ -117,7 +118,8 @@ public:
* registration * registration
*/ */
void registerFileAnalyzer(const std::string& name, const hilti::rt::Vector<std::string>& mime_types, void registerFileAnalyzer(const std::string& name, const hilti::rt::Vector<std::string>& mime_types,
const std::string& parser, const std::string& replaces, const std::string& linker_scope); const std::string& parser, const std::string& replaces,
const hilti::rt::integer::safe<uint64_t>& linker_scope);
/** /**
* Runtime method to register a packet analyzer with its Zeek-side * Runtime method to register a packet analyzer with its Zeek-side
@ -134,7 +136,7 @@ public:
* registration * registration
*/ */
void registerPacketAnalyzer(const std::string& name, const std::string& parser, const std::string& replaces, void registerPacketAnalyzer(const std::string& name, const std::string& parser, const std::string& replaces,
const std::string& linker_scope); const hilti::rt::integer::safe<uint64_t>& linker_scope);
/** /**
* Runtime method to register a Spicy-generated type with Zeek. The type * Runtime method to register a Spicy-generated type with Zeek. The type
@ -345,7 +347,7 @@ private:
std::string name_replaces; std::string name_replaces;
hilti::rt::Protocol protocol = hilti::rt::Protocol::Undef; hilti::rt::Protocol protocol = hilti::rt::Protocol::Undef;
std::vector<::zeek::spicy::rt::PortRange> ports; // we keep this sorted std::vector<::zeek::spicy::rt::PortRange> ports; // we keep this sorted
std::string linker_scope; hilti::rt::integer::safe<uint64_t> linker_scope;
// Computed and available once the analyzer has been registered. // Computed and available once the analyzer has been registered.
std::string name_zeek; std::string name_zeek;
@ -371,7 +373,7 @@ private:
std::string name_parser; std::string name_parser;
std::string name_replaces; std::string name_replaces;
hilti::rt::Vector<std::string> mime_types; hilti::rt::Vector<std::string> mime_types;
std::string linker_scope; hilti::rt::integer::safe<uint64_t> linker_scope;
// Computed and available once the analyzer has been registered. // Computed and available once the analyzer has been registered.
std::string name_zeek; std::string name_zeek;
@ -395,7 +397,7 @@ private:
std::string name_analyzer; std::string name_analyzer;
std::string name_parser; std::string name_parser;
std::string name_replaces; std::string name_replaces;
std::string linker_scope; hilti::rt::integer::safe<uint64_t> linker_scope;
// Computed and available once the analyzer has been registered. // Computed and available once the analyzer has been registered.
std::string name_zeek; std::string name_zeek;

View file

@ -29,20 +29,21 @@ void rt::register_spicy_module_end() { spicy_mgr->registerSpicyModuleEnd(); }
void rt::register_protocol_analyzer(const std::string& name, hilti::rt::Protocol proto, void rt::register_protocol_analyzer(const std::string& name, hilti::rt::Protocol proto,
const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports, const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports,
const std::string& parser_orig, const std::string& parser_resp, const std::string& parser_orig, const std::string& parser_resp,
const std::string& replaces, const std::string& linker_scope) { const std::string& replaces,
const hilti::rt::integer::safe<uint64_t>& linker_scope) {
auto _ = hilti::rt::profiler::start("zeek/rt/register_protocol_analyzer"); auto _ = hilti::rt::profiler::start("zeek/rt/register_protocol_analyzer");
spicy_mgr->registerProtocolAnalyzer(name, proto, ports, parser_orig, parser_resp, replaces, linker_scope); spicy_mgr->registerProtocolAnalyzer(name, proto, ports, parser_orig, parser_resp, replaces, linker_scope);
} }
void rt::register_file_analyzer(const std::string& name, const hilti::rt::Vector<std::string>& mime_types, void rt::register_file_analyzer(const std::string& name, const hilti::rt::Vector<std::string>& mime_types,
const std::string& parser, const std::string& replaces, const std::string& parser, const std::string& replaces,
const std::string& linker_scope) { const hilti::rt::integer::safe<uint64_t>& linker_scope) {
auto _ = hilti::rt::profiler::start("zeek/rt/register_file_analyzer"); auto _ = hilti::rt::profiler::start("zeek/rt/register_file_analyzer");
spicy_mgr->registerFileAnalyzer(name, mime_types, parser, replaces, linker_scope); spicy_mgr->registerFileAnalyzer(name, mime_types, parser, replaces, linker_scope);
} }
void rt::register_packet_analyzer(const std::string& name, const std::string& parser, const std::string& replaces, void rt::register_packet_analyzer(const std::string& name, const std::string& parser, const std::string& replaces,
const std::string& linker_scope) { const hilti::rt::integer::safe<uint64_t>& linker_scope) {
auto _ = hilti::rt::profiler::start("zeek/rt/register_packet_analyzer"); auto _ = hilti::rt::profiler::start("zeek/rt/register_packet_analyzer");
spicy_mgr->registerPacketAnalyzer(name, parser, replaces, linker_scope); spicy_mgr->registerPacketAnalyzer(name, parser, replaces, linker_scope);
} }

View file

@ -6,6 +6,7 @@
#pragma once #pragma once
#include <cstdint>
#include <optional> #include <optional>
#include <ostream> #include <ostream>
#include <string> #include <string>
@ -17,6 +18,7 @@
#include <hilti/rt/extension-points.h> #include <hilti/rt/extension-points.h>
#include <hilti/rt/fmt.h> #include <hilti/rt/fmt.h>
#include <hilti/rt/profiler.h> #include <hilti/rt/profiler.h>
#include <hilti/rt/safe-int.h>
#include <hilti/rt/type-info.h> #include <hilti/rt/type-info.h>
#include <hilti/rt/types/all.h> #include <hilti/rt/types/all.h>
#include <hilti/rt/util.h> #include <hilti/rt/util.h>
@ -111,14 +113,15 @@ void register_spicy_module_begin(const std::string& id, const std::string& descr
void register_protocol_analyzer(const std::string& id, hilti::rt::Protocol proto, void register_protocol_analyzer(const std::string& id, hilti::rt::Protocol proto,
const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports, const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports,
const std::string& parser_orig, const std::string& parser_resp, const std::string& parser_orig, const std::string& parser_resp,
const std::string& replaces, const std::string& linker_scope); const std::string& replaces, const hilti::rt::integer::safe<uint64_t>& linker_scope);
/** /**
* Registers a Spicy file analyzer with its EVT meta information with the * Registers a Spicy file analyzer with its EVT meta information with the
* plugin's runtime. * plugin's runtime.
*/ */
void register_file_analyzer(const std::string& id, const hilti::rt::Vector<std::string>& mime_types, void register_file_analyzer(const std::string& id, const hilti::rt::Vector<std::string>& mime_types,
const std::string& parser, const std::string& replaces, const std::string& linker_scope); const std::string& parser, const std::string& replaces,
const hilti::rt::integer::safe<uint64_t>& linker_scope);
/** Reports a Zeek-side "weird". */ /** Reports a Zeek-side "weird". */
void weird(const std::string& id, const std::string& addl); void weird(const std::string& id, const std::string& addl);
@ -128,7 +131,7 @@ void weird(const std::string& id, const std::string& addl);
* plugin's runtime. * plugin's runtime.
*/ */
void register_packet_analyzer(const std::string& id, const std::string& parser, const std::string& replaces, void register_packet_analyzer(const std::string& id, const std::string& parser, const std::string& replaces,
const std::string& linker_scope); const hilti::rt::integer::safe<uint64_t>& linker_scope);
/** Registers a Spicy-generated type to make it available inside Zeek. */ /** Registers a Spicy-generated type to make it available inside Zeek. */
void register_type(const std::string& ns, const std::string& id, const TypePtr& type); void register_type(const std::string& ns, const std::string& id, const TypePtr& type);