diff --git a/auxil/spicy b/auxil/spicy index c262027677..f9cf2115cf 160000 --- a/auxil/spicy +++ b/auxil/spicy @@ -1 +1 @@ -Subproject commit c26202767742818a0ef0e5538ea7df5ca54620b1 +Subproject commit f9cf2115cf330e7dff61f438ba04c96d9f1a132c diff --git a/scripts/spicy/zeek_rt.hlt b/scripts/spicy/zeek_rt.hlt index 46906d8079..860dd22e68 100644 --- a/scripts/spicy/zeek_rt.hlt +++ b/scripts/spicy/zeek_rt.hlt @@ -18,9 +18,9 @@ type ZeekTypeTag = enum { } &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_protocol_analyzer(string name, hilti::Protocol protocol, vector 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_file_analyzer(string name, vector mime_types, string parser, string replaces, string 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_protocol_analyzer(string name, hilti::Protocol protocol, vector 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 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, 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_spicy_module_end() &cxxname="zeek::spicy::rt::register_spicy_module_end"; diff --git a/src/spicy/manager.cc b/src/spicy/manager.cc index d28e811559..ef51535297 100644 --- a/src/spicy/manager.cc +++ b/src/spicy/manager.cc @@ -64,7 +64,8 @@ void Manager::registerSpicyModuleEnd() { void Manager::registerProtocolAnalyzer(const std::string& name, hilti::rt::Protocol proto, const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports, 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& linker_scope) { SPICY_DEBUG(hilti::rt::fmt("Have Spicy protocol analyzer %s", name)); 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& mime_types, const std::string& parser, const std::string& replaces, - const std::string& linker_scope) { + const hilti::rt::integer::safe& linker_scope) { SPICY_DEBUG(hilti::rt::fmt("Have Spicy file analyzer %s", name)); 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, - const std::string& linker_scope) { + const hilti::rt::integer::safe& linker_scope) { SPICY_DEBUG(hilti::rt::fmt("Have Spicy packet analyzer %s", name)); PacketAnalyzerInfo info; @@ -651,7 +652,7 @@ void Manager::InitPostScript() { // Fill in the parser information now that we derived from the ASTs. 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() ) return nullptr; diff --git a/src/spicy/manager.h b/src/spicy/manager.h index 9ebc2aceb7..a456b62612 100644 --- a/src/spicy/manager.h +++ b/src/spicy/manager.h @@ -2,15 +2,16 @@ #pragma once +#include #include #include #include -#include #include #include #include #include +#include #include #include "zeek/Scope.h" @@ -99,7 +100,7 @@ public: void registerProtocolAnalyzer(const std::string& name, hilti::rt::Protocol proto, const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports, 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& linker_scope); /** * Runtime method to register a file analyzer with its Zeek-side @@ -117,7 +118,8 @@ public: * registration */ void registerFileAnalyzer(const std::string& name, const hilti::rt::Vector& 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& linker_scope); /** * Runtime method to register a packet analyzer with its Zeek-side @@ -134,7 +136,7 @@ public: * registration */ void registerPacketAnalyzer(const std::string& name, const std::string& parser, const std::string& replaces, - const std::string& linker_scope); + const hilti::rt::integer::safe& linker_scope); /** * Runtime method to register a Spicy-generated type with Zeek. The type @@ -345,7 +347,7 @@ private: std::string name_replaces; hilti::rt::Protocol protocol = hilti::rt::Protocol::Undef; std::vector<::zeek::spicy::rt::PortRange> ports; // we keep this sorted - std::string linker_scope; + hilti::rt::integer::safe linker_scope; // Computed and available once the analyzer has been registered. std::string name_zeek; @@ -371,7 +373,7 @@ private: std::string name_parser; std::string name_replaces; hilti::rt::Vector mime_types; - std::string linker_scope; + hilti::rt::integer::safe linker_scope; // Computed and available once the analyzer has been registered. std::string name_zeek; @@ -395,7 +397,7 @@ private: std::string name_analyzer; std::string name_parser; std::string name_replaces; - std::string linker_scope; + hilti::rt::integer::safe linker_scope; // Computed and available once the analyzer has been registered. std::string name_zeek; diff --git a/src/spicy/runtime-support.cc b/src/spicy/runtime-support.cc index 76cf8c1f59..a9faf37438 100644 --- a/src/spicy/runtime-support.cc +++ b/src/spicy/runtime-support.cc @@ -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, const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports, 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& linker_scope) { auto _ = hilti::rt::profiler::start("zeek/rt/register_protocol_analyzer"); 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& mime_types, const std::string& parser, const std::string& replaces, - const std::string& linker_scope) { + const hilti::rt::integer::safe& linker_scope) { auto _ = hilti::rt::profiler::start("zeek/rt/register_file_analyzer"); 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, - const std::string& linker_scope) { + const hilti::rt::integer::safe& linker_scope) { auto _ = hilti::rt::profiler::start("zeek/rt/register_packet_analyzer"); spicy_mgr->registerPacketAnalyzer(name, parser, replaces, linker_scope); } diff --git a/src/spicy/runtime-support.h b/src/spicy/runtime-support.h index fef0957824..be6fcc56e7 100644 --- a/src/spicy/runtime-support.h +++ b/src/spicy/runtime-support.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -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, const hilti::rt::Vector<::zeek::spicy::rt::PortRange>& ports, 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& linker_scope); /** * Registers a Spicy file analyzer with its EVT meta information with the * plugin's runtime. */ void register_file_analyzer(const std::string& id, const hilti::rt::Vector& 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& linker_scope); /** Reports a Zeek-side "weird". */ 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. */ 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& linker_scope); /** 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);