mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Deprecate internal_type(), replace with zeek::lookup_type()
This commit is contained in:
parent
32b895f4ba
commit
ac06259eec
44 changed files with 218 additions and 182 deletions
2
NEWS
2
NEWS
|
@ -159,6 +159,8 @@ Deprecated Functionality
|
||||||
|
|
||||||
- ``ID::ID_Val()`` is deprecated, use ``ID::GetVal()``.
|
- ``ID::ID_Val()`` is deprecated, use ``ID::GetVal()``.
|
||||||
|
|
||||||
|
- ``internal_type()`` is deprecated, use ``zeek::lookup_type()``.
|
||||||
|
|
||||||
Zeek 3.1.0
|
Zeek 3.1.0
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9d6a296d283cfccf2c28a9181d9cee2760229fcb
|
Subproject commit 2d9b8606d5d7e4ec4a67cc11a72d38c2241ee871
|
|
@ -341,7 +341,7 @@ BroString::Vec* BroString::Split(const BroString::IdxVec& indices) const
|
||||||
VectorVal* BroString:: VecToPolicy(Vec* vec)
|
VectorVal* BroString:: VecToPolicy(Vec* vec)
|
||||||
{
|
{
|
||||||
VectorVal* result =
|
VectorVal* result =
|
||||||
new VectorVal(internal_type("string_vec")->AsVectorType());
|
new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
if ( ! result )
|
if ( ! result )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
|
@ -462,7 +462,7 @@ void DNS_Mgr::InitPostScript()
|
||||||
dns_mapping_name_changed = internal_handler("dns_mapping_name_changed");
|
dns_mapping_name_changed = internal_handler("dns_mapping_name_changed");
|
||||||
dns_mapping_altered = internal_handler("dns_mapping_altered");
|
dns_mapping_altered = internal_handler("dns_mapping_altered");
|
||||||
|
|
||||||
dm_rec = internal_type("dns_mapping")->AsRecordType();
|
dm_rec = zeek::lookup_type("dns_mapping")->AsRecordType();
|
||||||
|
|
||||||
// Registering will call Init()
|
// Registering will call Init()
|
||||||
iosource_mgr->Register(this, true);
|
iosource_mgr->Register(this, true);
|
||||||
|
|
30
src/Func.cc
30
src/Func.cc
|
@ -54,6 +54,8 @@
|
||||||
#include "iosource/PktSrc.h"
|
#include "iosource/PktSrc.h"
|
||||||
#include "iosource/PktDumper.h"
|
#include "iosource/PktDumper.h"
|
||||||
|
|
||||||
|
using namespace zeek;
|
||||||
|
|
||||||
extern RETSIGTYPE sig_handler(int signo);
|
extern RETSIGTYPE sig_handler(int signo);
|
||||||
|
|
||||||
std::vector<CallInfo> call_stack;
|
std::vector<CallInfo> call_stack;
|
||||||
|
@ -748,21 +750,21 @@ void builtin_error(const char* msg, BroObj* arg)
|
||||||
|
|
||||||
void init_builtin_funcs()
|
void init_builtin_funcs()
|
||||||
{
|
{
|
||||||
ProcStats = internal_type("ProcStats")->AsRecordType();
|
ProcStats = lookup_type("ProcStats")->AsRecordType();
|
||||||
NetStats = internal_type("NetStats")->AsRecordType();
|
NetStats = lookup_type("NetStats")->AsRecordType();
|
||||||
MatcherStats = internal_type("MatcherStats")->AsRecordType();
|
MatcherStats = lookup_type("MatcherStats")->AsRecordType();
|
||||||
ConnStats = internal_type("ConnStats")->AsRecordType();
|
ConnStats = lookup_type("ConnStats")->AsRecordType();
|
||||||
ReassemblerStats = internal_type("ReassemblerStats")->AsRecordType();
|
ReassemblerStats = lookup_type("ReassemblerStats")->AsRecordType();
|
||||||
DNSStats = internal_type("DNSStats")->AsRecordType();
|
DNSStats = lookup_type("DNSStats")->AsRecordType();
|
||||||
GapStats = internal_type("GapStats")->AsRecordType();
|
GapStats = lookup_type("GapStats")->AsRecordType();
|
||||||
EventStats = internal_type("EventStats")->AsRecordType();
|
EventStats = lookup_type("EventStats")->AsRecordType();
|
||||||
TimerStats = internal_type("TimerStats")->AsRecordType();
|
TimerStats = lookup_type("TimerStats")->AsRecordType();
|
||||||
FileAnalysisStats = internal_type("FileAnalysisStats")->AsRecordType();
|
FileAnalysisStats = lookup_type("FileAnalysisStats")->AsRecordType();
|
||||||
ThreadStats = internal_type("ThreadStats")->AsRecordType();
|
ThreadStats = lookup_type("ThreadStats")->AsRecordType();
|
||||||
BrokerStats = internal_type("BrokerStats")->AsRecordType();
|
BrokerStats = lookup_type("BrokerStats")->AsRecordType();
|
||||||
ReporterStats = internal_type("ReporterStats")->AsRecordType();
|
ReporterStats = lookup_type("ReporterStats")->AsRecordType();
|
||||||
|
|
||||||
var_sizes = internal_type("var_sizes")->AsTableType();
|
var_sizes = lookup_type("var_sizes")->AsTableType();
|
||||||
|
|
||||||
#include "zeek.bif.func_init"
|
#include "zeek.bif.func_init"
|
||||||
#include "stats.bif.func_init"
|
#include "stats.bif.func_init"
|
||||||
|
|
34
src/IP.cc
34
src/IP.cc
|
@ -13,6 +13,8 @@
|
||||||
#include "BroString.h"
|
#include "BroString.h"
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
|
|
||||||
|
using namespace zeek;
|
||||||
|
|
||||||
static RecordType* ip4_hdr_type = nullptr;
|
static RecordType* ip4_hdr_type = nullptr;
|
||||||
static RecordType* ip6_hdr_type = nullptr;
|
static RecordType* ip6_hdr_type = nullptr;
|
||||||
static RecordType* ip6_ext_hdr_type = nullptr;
|
static RecordType* ip6_ext_hdr_type = nullptr;
|
||||||
|
@ -37,14 +39,14 @@ static RecordType* ip6_mob_be_type = nullptr;
|
||||||
static inline RecordType* hdrType(RecordType*& type, const char* name)
|
static inline RecordType* hdrType(RecordType*& type, const char* name)
|
||||||
{
|
{
|
||||||
if ( ! type )
|
if ( ! type )
|
||||||
type = internal_type(name)->AsRecordType();
|
type = lookup_type(name)->AsRecordType();
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IntrusivePtr<VectorVal> BuildOptionsVal(const u_char* data, int len)
|
static IntrusivePtr<VectorVal> BuildOptionsVal(const u_char* data, int len)
|
||||||
{
|
{
|
||||||
auto vv = make_intrusive<VectorVal>(internal_type("ip6_options")->AsVectorType());
|
auto vv = make_intrusive<VectorVal>(lookup_type("ip6_options")->AsVectorType());
|
||||||
|
|
||||||
while ( len > 0 )
|
while ( len > 0 )
|
||||||
{
|
{
|
||||||
|
@ -95,7 +97,7 @@ IntrusivePtr<RecordVal> IPv6_Hdr::ToVal(IntrusivePtr<VectorVal> chain) const
|
||||||
rv->Assign(6, make_intrusive<AddrVal>(IPAddr(ip6->ip6_dst)));
|
rv->Assign(6, make_intrusive<AddrVal>(IPAddr(ip6->ip6_dst)));
|
||||||
if ( ! chain )
|
if ( ! chain )
|
||||||
chain = make_intrusive<VectorVal>(
|
chain = make_intrusive<VectorVal>(
|
||||||
internal_type("ip6_ext_hdr_chain")->AsVectorType());
|
lookup_type("ip6_ext_hdr_chain")->AsVectorType());
|
||||||
rv->Assign(7, std::move(chain));
|
rv->Assign(7, std::move(chain));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -367,7 +369,7 @@ IntrusivePtr<RecordVal> IP_Hdr::ToPktHdrVal() const
|
||||||
static RecordType* pkt_hdr_type = nullptr;
|
static RecordType* pkt_hdr_type = nullptr;
|
||||||
|
|
||||||
if ( ! pkt_hdr_type )
|
if ( ! pkt_hdr_type )
|
||||||
pkt_hdr_type = internal_type("pkt_hdr")->AsRecordType();
|
pkt_hdr_type = lookup_type("pkt_hdr")->AsRecordType();
|
||||||
|
|
||||||
return ToPktHdrVal(make_intrusive<RecordVal>(pkt_hdr_type), 0);
|
return ToPktHdrVal(make_intrusive<RecordVal>(pkt_hdr_type), 0);
|
||||||
}
|
}
|
||||||
|
@ -385,9 +387,9 @@ IntrusivePtr<RecordVal> IP_Hdr::ToPktHdrVal(IntrusivePtr<RecordVal> pkt_hdr, int
|
||||||
|
|
||||||
if ( ! tcp_hdr_type )
|
if ( ! tcp_hdr_type )
|
||||||
{
|
{
|
||||||
tcp_hdr_type = internal_type("tcp_hdr")->AsRecordType();
|
tcp_hdr_type = lookup_type("tcp_hdr")->AsRecordType();
|
||||||
udp_hdr_type = internal_type("udp_hdr")->AsRecordType();
|
udp_hdr_type = lookup_type("udp_hdr")->AsRecordType();
|
||||||
icmp_hdr_type = internal_type("icmp_hdr")->AsRecordType();
|
icmp_hdr_type = lookup_type("icmp_hdr")->AsRecordType();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ip4 )
|
if ( ip4 )
|
||||||
|
@ -697,18 +699,18 @@ IntrusivePtr<VectorVal> IPv6_Hdr_Chain::ToVal() const
|
||||||
{
|
{
|
||||||
if ( ! ip6_ext_hdr_type )
|
if ( ! ip6_ext_hdr_type )
|
||||||
{
|
{
|
||||||
ip6_ext_hdr_type = internal_type("ip6_ext_hdr")->AsRecordType();
|
ip6_ext_hdr_type = lookup_type("ip6_ext_hdr")->AsRecordType();
|
||||||
ip6_hopopts_type = internal_type("ip6_hopopts")->AsRecordType();
|
ip6_hopopts_type = lookup_type("ip6_hopopts")->AsRecordType();
|
||||||
ip6_dstopts_type = internal_type("ip6_dstopts")->AsRecordType();
|
ip6_dstopts_type = lookup_type("ip6_dstopts")->AsRecordType();
|
||||||
ip6_routing_type = internal_type("ip6_routing")->AsRecordType();
|
ip6_routing_type = lookup_type("ip6_routing")->AsRecordType();
|
||||||
ip6_fragment_type = internal_type("ip6_fragment")->AsRecordType();
|
ip6_fragment_type = lookup_type("ip6_fragment")->AsRecordType();
|
||||||
ip6_ah_type = internal_type("ip6_ah")->AsRecordType();
|
ip6_ah_type = lookup_type("ip6_ah")->AsRecordType();
|
||||||
ip6_esp_type = internal_type("ip6_esp")->AsRecordType();
|
ip6_esp_type = lookup_type("ip6_esp")->AsRecordType();
|
||||||
ip6_mob_type = internal_type("ip6_mobility_hdr")->AsRecordType();
|
ip6_mob_type = lookup_type("ip6_mobility_hdr")->AsRecordType();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto rval = make_intrusive<VectorVal>(
|
auto rval = make_intrusive<VectorVal>(
|
||||||
internal_type("ip6_ext_hdr_chain")->AsVectorType());
|
lookup_type("ip6_ext_hdr_chain")->AsVectorType());
|
||||||
|
|
||||||
for ( size_t i = 1; i < chain.size(); ++i )
|
for ( size_t i = 1; i < chain.size(); ++i )
|
||||||
{
|
{
|
||||||
|
|
100
src/NetVar.cc
100
src/NetVar.cc
|
@ -7,6 +7,8 @@
|
||||||
#include "EventHandler.h"
|
#include "EventHandler.h"
|
||||||
#include "Val.h"
|
#include "Val.h"
|
||||||
|
|
||||||
|
using namespace zeek;
|
||||||
|
|
||||||
RecordType* conn_id;
|
RecordType* conn_id;
|
||||||
RecordType* endpoint;
|
RecordType* endpoint;
|
||||||
RecordType* endpoint_stats;
|
RecordType* endpoint_stats;
|
||||||
|
@ -213,7 +215,7 @@ void init_general_global_var()
|
||||||
table_expire_delay = opt_internal_double("table_expire_delay");
|
table_expire_delay = opt_internal_double("table_expire_delay");
|
||||||
table_incremental_step = opt_internal_int("table_incremental_step");
|
table_incremental_step = opt_internal_int("table_incremental_step");
|
||||||
|
|
||||||
rotate_info = internal_type("rotate_info")->AsRecordType();
|
rotate_info = lookup_type("rotate_info")->AsRecordType();
|
||||||
log_rotate_base_time = opt_internal_string("log_rotate_base_time");
|
log_rotate_base_time = opt_internal_string("log_rotate_base_time");
|
||||||
|
|
||||||
peer_description =
|
peer_description =
|
||||||
|
@ -247,26 +249,26 @@ void init_net_var()
|
||||||
#include "reporter.bif.netvar_init"
|
#include "reporter.bif.netvar_init"
|
||||||
#include "supervisor.bif.netvar_init"
|
#include "supervisor.bif.netvar_init"
|
||||||
|
|
||||||
conn_id = internal_type("conn_id")->AsRecordType();
|
conn_id = lookup_type("conn_id")->AsRecordType();
|
||||||
endpoint = internal_type("endpoint")->AsRecordType();
|
endpoint = lookup_type("endpoint")->AsRecordType();
|
||||||
endpoint_stats = internal_type("endpoint_stats")->AsRecordType();
|
endpoint_stats = lookup_type("endpoint_stats")->AsRecordType();
|
||||||
connection_type = internal_type("connection")->AsRecordType();
|
connection_type = lookup_type("connection")->AsRecordType();
|
||||||
fa_file_type = internal_type("fa_file")->AsRecordType();
|
fa_file_type = lookup_type("fa_file")->AsRecordType();
|
||||||
fa_metadata_type = internal_type("fa_metadata")->AsRecordType();
|
fa_metadata_type = lookup_type("fa_metadata")->AsRecordType();
|
||||||
icmp_conn = internal_type("icmp_conn")->AsRecordType();
|
icmp_conn = lookup_type("icmp_conn")->AsRecordType();
|
||||||
icmp_context = internal_type("icmp_context")->AsRecordType();
|
icmp_context = lookup_type("icmp_context")->AsRecordType();
|
||||||
signature_state = internal_type("signature_state")->AsRecordType();
|
signature_state = lookup_type("signature_state")->AsRecordType();
|
||||||
SYN_packet = internal_type("SYN_packet")->AsRecordType();
|
SYN_packet = lookup_type("SYN_packet")->AsRecordType();
|
||||||
pcap_packet = internal_type("pcap_packet")->AsRecordType();
|
pcap_packet = lookup_type("pcap_packet")->AsRecordType();
|
||||||
raw_pkt_hdr_type = internal_type("raw_pkt_hdr")->AsRecordType();
|
raw_pkt_hdr_type = lookup_type("raw_pkt_hdr")->AsRecordType();
|
||||||
l2_hdr_type = internal_type("l2_hdr")->AsRecordType();
|
l2_hdr_type = lookup_type("l2_hdr")->AsRecordType();
|
||||||
transport_proto = internal_type("transport_proto")->AsEnumType();
|
transport_proto = lookup_type("transport_proto")->AsEnumType();
|
||||||
string_set = internal_type("string_set")->AsTableType();
|
string_set = lookup_type("string_set")->AsTableType();
|
||||||
string_array = internal_type("string_array")->AsTableType();
|
string_array = lookup_type("string_array")->AsTableType();
|
||||||
string_vec = internal_type("string_vec")->AsVectorType();
|
string_vec = lookup_type("string_vec")->AsVectorType();
|
||||||
index_vec = internal_type("index_vec")->AsVectorType();
|
index_vec = lookup_type("index_vec")->AsVectorType();
|
||||||
mime_match = internal_type("mime_match")->AsRecordType();
|
mime_match = lookup_type("mime_match")->AsRecordType();
|
||||||
mime_matches = internal_type("mime_matches")->AsVectorType();
|
mime_matches = lookup_type("mime_matches")->AsVectorType();
|
||||||
|
|
||||||
ignore_checksums = opt_internal_int("ignore_checksums");
|
ignore_checksums = opt_internal_int("ignore_checksums");
|
||||||
partial_connection_ok = opt_internal_int("partial_connection_ok");
|
partial_connection_ok = opt_internal_int("partial_connection_ok");
|
||||||
|
@ -292,7 +294,7 @@ void init_net_var()
|
||||||
opt_internal_int("tcp_excessive_data_without_further_acks");
|
opt_internal_int("tcp_excessive_data_without_further_acks");
|
||||||
tcp_max_old_segments = opt_internal_int("tcp_max_old_segments");
|
tcp_max_old_segments = opt_internal_int("tcp_max_old_segments");
|
||||||
|
|
||||||
socks_address = internal_type("SOCKS::Address")->AsRecordType();
|
socks_address = lookup_type("SOCKS::Address")->AsRecordType();
|
||||||
|
|
||||||
non_analyzed_lifetime = opt_internal_double("non_analyzed_lifetime");
|
non_analyzed_lifetime = opt_internal_double("non_analyzed_lifetime");
|
||||||
tcp_inactivity_timeout = opt_internal_double("tcp_inactivity_timeout");
|
tcp_inactivity_timeout = opt_internal_double("tcp_inactivity_timeout");
|
||||||
|
@ -347,34 +349,34 @@ void init_net_var()
|
||||||
|
|
||||||
mime_segment_length = opt_internal_int("mime_segment_length");
|
mime_segment_length = opt_internal_int("mime_segment_length");
|
||||||
mime_segment_overlap_length = opt_internal_int("mime_segment_overlap_length");
|
mime_segment_overlap_length = opt_internal_int("mime_segment_overlap_length");
|
||||||
mime_header_rec = internal_type("mime_header_rec")->AsRecordType();
|
mime_header_rec = lookup_type("mime_header_rec")->AsRecordType();
|
||||||
mime_header_list = internal_type("mime_header_list")->AsTableType();
|
mime_header_list = lookup_type("mime_header_list")->AsTableType();
|
||||||
|
|
||||||
http_entity_data_delivery_size = opt_internal_int("http_entity_data_delivery_size");
|
http_entity_data_delivery_size = opt_internal_int("http_entity_data_delivery_size");
|
||||||
http_stats_rec = internal_type("http_stats_rec")->AsRecordType();
|
http_stats_rec = lookup_type("http_stats_rec")->AsRecordType();
|
||||||
http_message_stat = internal_type("http_message_stat")->AsRecordType();
|
http_message_stat = lookup_type("http_message_stat")->AsRecordType();
|
||||||
truncate_http_URI = opt_internal_int("truncate_http_URI");
|
truncate_http_URI = opt_internal_int("truncate_http_URI");
|
||||||
|
|
||||||
pm_mapping = internal_type("pm_mapping")->AsRecordType();
|
pm_mapping = lookup_type("pm_mapping")->AsRecordType();
|
||||||
pm_mappings = internal_type("pm_mappings")->AsTableType();
|
pm_mappings = lookup_type("pm_mappings")->AsTableType();
|
||||||
pm_port_request = internal_type("pm_port_request")->AsRecordType();
|
pm_port_request = lookup_type("pm_port_request")->AsRecordType();
|
||||||
pm_callit_request = internal_type("pm_callit_request")->AsRecordType();
|
pm_callit_request = lookup_type("pm_callit_request")->AsRecordType();
|
||||||
|
|
||||||
geo_location = internal_type("geo_location")->AsRecordType();
|
geo_location = lookup_type("geo_location")->AsRecordType();
|
||||||
|
|
||||||
entropy_test_result = internal_type("entropy_test_result")->AsRecordType();
|
entropy_test_result = lookup_type("entropy_test_result")->AsRecordType();
|
||||||
|
|
||||||
dns_msg = internal_type("dns_msg")->AsRecordType();
|
dns_msg = lookup_type("dns_msg")->AsRecordType();
|
||||||
dns_answer = internal_type("dns_answer")->AsRecordType();
|
dns_answer = lookup_type("dns_answer")->AsRecordType();
|
||||||
dns_soa = internal_type("dns_soa")->AsRecordType();
|
dns_soa = lookup_type("dns_soa")->AsRecordType();
|
||||||
dns_edns_additional =
|
dns_edns_additional =
|
||||||
internal_type("dns_edns_additional")->AsRecordType();
|
lookup_type("dns_edns_additional")->AsRecordType();
|
||||||
dns_tsig_additional =
|
dns_tsig_additional =
|
||||||
internal_type("dns_tsig_additional")->AsRecordType();
|
lookup_type("dns_tsig_additional")->AsRecordType();
|
||||||
dns_rrsig_rr = internal_type("dns_rrsig_rr")->AsRecordType();
|
dns_rrsig_rr = lookup_type("dns_rrsig_rr")->AsRecordType();
|
||||||
dns_dnskey_rr = internal_type("dns_dnskey_rr")->AsRecordType();
|
dns_dnskey_rr = lookup_type("dns_dnskey_rr")->AsRecordType();
|
||||||
dns_nsec3_rr = internal_type("dns_nsec3_rr")->AsRecordType();
|
dns_nsec3_rr = lookup_type("dns_nsec3_rr")->AsRecordType();
|
||||||
dns_ds_rr = internal_type("dns_ds_rr")->AsRecordType();
|
dns_ds_rr = lookup_type("dns_ds_rr")->AsRecordType();
|
||||||
dns_skip_auth = internal_val("dns_skip_auth")->AsTableVal();
|
dns_skip_auth = internal_val("dns_skip_auth")->AsTableVal();
|
||||||
dns_skip_addl = internal_val("dns_skip_addl")->AsTableVal();
|
dns_skip_addl = internal_val("dns_skip_addl")->AsTableVal();
|
||||||
dns_skip_all_auth = opt_internal_int("dns_skip_all_auth");
|
dns_skip_all_auth = opt_internal_int("dns_skip_all_auth");
|
||||||
|
@ -410,8 +412,8 @@ void init_net_var()
|
||||||
|
|
||||||
gap_report_freq = opt_internal_double("gap_report_freq");
|
gap_report_freq = opt_internal_double("gap_report_freq");
|
||||||
|
|
||||||
irc_join_info = internal_type("irc_join_info")->AsRecordType();
|
irc_join_info = lookup_type("irc_join_info")->AsRecordType();
|
||||||
irc_join_list = internal_type("irc_join_list")->AsTableType();
|
irc_join_list = lookup_type("irc_join_list")->AsTableType();
|
||||||
|
|
||||||
dpd_reassemble_first_packets =
|
dpd_reassemble_first_packets =
|
||||||
opt_internal_int("dpd_reassemble_first_packets");
|
opt_internal_int("dpd_reassemble_first_packets");
|
||||||
|
@ -425,10 +427,10 @@ void init_net_var()
|
||||||
timer_mgr_inactivity_timeout =
|
timer_mgr_inactivity_timeout =
|
||||||
opt_internal_double("timer_mgr_inactivity_timeout");
|
opt_internal_double("timer_mgr_inactivity_timeout");
|
||||||
|
|
||||||
script_id = internal_type("script_id")->AsRecordType();
|
script_id = lookup_type("script_id")->AsRecordType();
|
||||||
id_table = internal_type("id_table")->AsTableType();
|
id_table = lookup_type("id_table")->AsTableType();
|
||||||
record_field = internal_type("record_field")->AsRecordType();
|
record_field = lookup_type("record_field")->AsRecordType();
|
||||||
record_field_table = internal_type("record_field_table")->AsTableType();
|
record_field_table = lookup_type("record_field_table")->AsTableType();
|
||||||
call_argument_vector = internal_type("call_argument_vector")->AsVectorType();
|
call_argument_vector = lookup_type("call_argument_vector")->AsVectorType();
|
||||||
call_argument = internal_type("call_argument")->AsRecordType();
|
call_argument = lookup_type("call_argument")->AsRecordType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -981,7 +981,7 @@ ParaglobVal::ParaglobVal(std::unique_ptr<paraglob::Paraglob> p)
|
||||||
|
|
||||||
IntrusivePtr<VectorVal> ParaglobVal::Get(StringVal* &pattern)
|
IntrusivePtr<VectorVal> ParaglobVal::Get(StringVal* &pattern)
|
||||||
{
|
{
|
||||||
auto rval = make_intrusive<VectorVal>(internal_type("string_vec")->AsVectorType());
|
auto rval = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
std::string string_pattern (reinterpret_cast<const char*>(pattern->Bytes()), pattern->Len());
|
std::string string_pattern (reinterpret_cast<const char*>(pattern->Bytes()), pattern->Len());
|
||||||
|
|
||||||
std::vector<std::string> matches = this->internal_paraglob->get(string_pattern);
|
std::vector<std::string> matches = this->internal_paraglob->get(string_pattern);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "Scope.h"
|
#include "Scope.h"
|
||||||
#include "Func.h"
|
#include "Func.h"
|
||||||
#include "Val.h"
|
#include "Val.h"
|
||||||
#include "Var.h" // for internal_type()
|
#include "Var.h"
|
||||||
|
|
||||||
static inline bool is_established(const analyzer::tcp::TCP_Endpoint* e)
|
static inline bool is_established(const analyzer::tcp::TCP_Endpoint* e)
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ RuleConditionEval::RuleConditionEval(const char* func)
|
||||||
rules_error("eval function type must yield a 'bool'", func);
|
rules_error("eval function type must yield a 'bool'", func);
|
||||||
|
|
||||||
TypeList tl;
|
TypeList tl;
|
||||||
tl.Append({NewRef{}, internal_type("signature_state")});
|
tl.Append(zeek::lookup_type("signature_state"));
|
||||||
tl.Append(base_type(TYPE_STRING));
|
tl.Append(base_type(TYPE_STRING));
|
||||||
|
|
||||||
if ( ! f->CheckArgs(tl.Types()) )
|
if ( ! f->CheckArgs(tl.Types()) )
|
||||||
|
|
|
@ -59,22 +59,22 @@ bool BroSubstring::DoesCover(const BroSubstring* bst) const
|
||||||
VectorVal* BroSubstring::VecToPolicy(Vec* vec)
|
VectorVal* BroSubstring::VecToPolicy(Vec* vec)
|
||||||
{
|
{
|
||||||
RecordType* sw_substring_type =
|
RecordType* sw_substring_type =
|
||||||
internal_type("sw_substring")->AsRecordType();
|
zeek::lookup_type("sw_substring")->AsRecordType();
|
||||||
if ( ! sw_substring_type )
|
if ( ! sw_substring_type )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
RecordType* sw_align_type =
|
RecordType* sw_align_type =
|
||||||
internal_type("sw_align")->AsRecordType();
|
zeek::lookup_type("sw_align")->AsRecordType();
|
||||||
if ( ! sw_align_type )
|
if ( ! sw_align_type )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
VectorType* sw_align_vec_type =
|
VectorType* sw_align_vec_type =
|
||||||
internal_type("sw_align_vec")->AsVectorType();
|
zeek::lookup_type("sw_align_vec")->AsVectorType();
|
||||||
if ( ! sw_align_vec_type )
|
if ( ! sw_align_vec_type )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
VectorVal* result =
|
VectorVal* result =
|
||||||
new VectorVal(internal_type("sw_substring_vec")->AsVectorType());
|
new VectorVal(zeek::lookup_type("sw_substring_vec")->AsVectorType());
|
||||||
if ( ! result )
|
if ( ! result )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Net.h"
|
#include "Net.h"
|
||||||
#include "NetVar.h"
|
#include "NetVar.h"
|
||||||
#include "Var.h" // for internal_type()
|
#include "Var.h"
|
||||||
#include "Sessions.h"
|
#include "Sessions.h"
|
||||||
#include "Scope.h"
|
#include "Scope.h"
|
||||||
#include "DNS_Mgr.h"
|
#include "DNS_Mgr.h"
|
||||||
|
@ -342,7 +342,7 @@ SampleLogger::SampleLogger()
|
||||||
static TableType* load_sample_info = nullptr;
|
static TableType* load_sample_info = nullptr;
|
||||||
|
|
||||||
if ( ! load_sample_info )
|
if ( ! load_sample_info )
|
||||||
load_sample_info = internal_type("load_sample_info")->AsTableType();
|
load_sample_info = zeek::lookup_type("load_sample_info")->AsTableType();
|
||||||
|
|
||||||
load_samples = new TableVal({NewRef{}, load_sample_info});
|
load_samples = new TableVal({NewRef{}, load_sample_info});
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,8 +201,8 @@ static IntrusivePtr<EnumVal> lookup_enum_val(const char* module_name, const char
|
||||||
static void print_log(const std::vector<IntrusivePtr<Val>>& vals)
|
static void print_log(const std::vector<IntrusivePtr<Val>>& vals)
|
||||||
{
|
{
|
||||||
auto plval = lookup_enum_val("Log", "PRINTLOG");
|
auto plval = lookup_enum_val("Log", "PRINTLOG");
|
||||||
auto record = make_intrusive<RecordVal>(internal_type("Log::PrintLogInfo")->AsRecordType());
|
auto record = make_intrusive<RecordVal>(zeek::lookup_type("Log::PrintLogInfo")->AsRecordType());
|
||||||
auto vec = make_intrusive<VectorVal>(internal_type("string_vec")->AsVectorType());
|
auto vec = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
for ( const auto& val : vals )
|
for ( const auto& val : vals )
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "IntrusivePtr.h"
|
#include "IntrusivePtr.h"
|
||||||
#include "NetVar.h"
|
#include "NetVar.h"
|
||||||
#include "IPAddr.h"
|
#include "IPAddr.h"
|
||||||
#include "Var.h" // for internal_type()
|
#include "Var.h"
|
||||||
#include "UID.h"
|
#include "UID.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -198,7 +198,7 @@ public:
|
||||||
IntrusivePtr<VectorVal> ToVal() const
|
IntrusivePtr<VectorVal> ToVal() const
|
||||||
{
|
{
|
||||||
auto vv = make_intrusive<VectorVal>(
|
auto vv = make_intrusive<VectorVal>(
|
||||||
internal_type("EncapsulatingConnVector")->AsVectorType());
|
zeek::lookup_type("EncapsulatingConnVector")->AsVectorType());
|
||||||
|
|
||||||
if ( conns )
|
if ( conns )
|
||||||
{
|
{
|
||||||
|
|
|
@ -796,7 +796,7 @@ static string container_type_name(const BroType* ft)
|
||||||
|
|
||||||
IntrusivePtr<TableVal> RecordType::GetRecordFieldsVal(const RecordVal* rv) const
|
IntrusivePtr<TableVal> RecordType::GetRecordFieldsVal(const RecordVal* rv) const
|
||||||
{
|
{
|
||||||
auto rval = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, internal_type("record_field_table")->AsTableType()});
|
auto rval = make_intrusive<TableVal>(zeek::lookup_type<TableType>("record_field_table"));
|
||||||
|
|
||||||
for ( int i = 0; i < NumFields(); ++i )
|
for ( int i = 0; i < NumFields(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -812,7 +812,7 @@ IntrusivePtr<TableVal> RecordType::GetRecordFieldsVal(const RecordVal* rv) const
|
||||||
|
|
||||||
bool logged = (fd->attrs && fd->FindAttr(ATTR_LOG) != nullptr);
|
bool logged = (fd->attrs && fd->FindAttr(ATTR_LOG) != nullptr);
|
||||||
|
|
||||||
auto nr = make_intrusive<RecordVal>(internal_type("record_field")->AsRecordType());
|
auto nr = make_intrusive<RecordVal>(zeek::lookup_type("record_field")->AsRecordType());
|
||||||
|
|
||||||
string s = container_type_name(ft.get());
|
string s = container_type_name(ft.get());
|
||||||
nr->Assign(0, make_intrusive<StringVal>(s));
|
nr->Assign(0, make_intrusive<StringVal>(s));
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "Conn.h"
|
#include "Conn.h"
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
#include "IPAddr.h"
|
#include "IPAddr.h"
|
||||||
#include "Var.h" // for internal_type()
|
#include "Var.h"
|
||||||
|
|
||||||
#include "broker/Data.h"
|
#include "broker/Data.h"
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ IntrusivePtr<TableVal> Val::GetRecordFields()
|
||||||
if ( t->Tag() != TYPE_RECORD && t->Tag() != TYPE_TYPE )
|
if ( t->Tag() != TYPE_RECORD && t->Tag() != TYPE_TYPE )
|
||||||
{
|
{
|
||||||
reporter->Error("non-record value/type passed to record_fields");
|
reporter->Error("non-record value/type passed to record_fields");
|
||||||
return make_intrusive<TableVal>(IntrusivePtr{NewRef{}, internal_type("record_field_table")->AsTableType()});
|
return make_intrusive<TableVal>(zeek::lookup_type<TableType>("record_field_table"));
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordType* rt = nullptr;
|
RecordType* rt = nullptr;
|
||||||
|
@ -435,7 +435,7 @@ IntrusivePtr<TableVal> Val::GetRecordFields()
|
||||||
if ( t->Tag() != TYPE_RECORD )
|
if ( t->Tag() != TYPE_RECORD )
|
||||||
{
|
{
|
||||||
reporter->Error("non-record value/type passed to record_fields");
|
reporter->Error("non-record value/type passed to record_fields");
|
||||||
return make_intrusive<TableVal>(IntrusivePtr{NewRef{}, internal_type("record_field_table")->AsTableType()});
|
return make_intrusive<TableVal>(zeek::lookup_type<TableType>("record_field_table"));
|
||||||
}
|
}
|
||||||
|
|
||||||
rt = t->AsRecordType();
|
rt = t->AsRecordType();
|
||||||
|
@ -1933,7 +1933,7 @@ IntrusivePtr<VectorVal> TableVal::LookupSubnets(const SubNetVal* search)
|
||||||
if ( ! subnets )
|
if ( ! subnets )
|
||||||
reporter->InternalError("LookupSubnets called on wrong table type");
|
reporter->InternalError("LookupSubnets called on wrong table type");
|
||||||
|
|
||||||
auto result = make_intrusive<VectorVal>(internal_type("subnet_vec")->AsVectorType());
|
auto result = make_intrusive<VectorVal>(zeek::lookup_type("subnet_vec")->AsVectorType());
|
||||||
|
|
||||||
auto matches = subnets->FindAll(search);
|
auto matches = subnets->FindAll(search);
|
||||||
for ( auto element : matches )
|
for ( auto element : matches )
|
||||||
|
|
|
@ -761,12 +761,17 @@ ListVal* internal_list_val(const char* name)
|
||||||
}
|
}
|
||||||
|
|
||||||
BroType* internal_type(const char* name)
|
BroType* internal_type(const char* name)
|
||||||
|
{
|
||||||
|
return zeek::lookup_type(name).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const IntrusivePtr<BroType>& zeek::lookup_type(const char* name)
|
||||||
{
|
{
|
||||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||||
if ( ! id )
|
if ( ! id )
|
||||||
reporter->InternalError("internal type %s missing", name);
|
reporter->InternalError("Failed to find type named: %s", name);
|
||||||
|
|
||||||
return id->GetType().get();
|
return id->GetType();
|
||||||
}
|
}
|
||||||
|
|
||||||
Func* internal_func(const char* name)
|
Func* internal_func(const char* name)
|
||||||
|
|
25
src/Var.h
25
src/Var.h
|
@ -49,8 +49,33 @@ extern bro_uint_t opt_internal_unsigned(const char* name);
|
||||||
extern StringVal* opt_internal_string(const char* name);
|
extern StringVal* opt_internal_string(const char* name);
|
||||||
extern TableVal* opt_internal_table(const char* name); // nil if not defined
|
extern TableVal* opt_internal_table(const char* name); // nil if not defined
|
||||||
extern ListVal* internal_list_val(const char* name);
|
extern ListVal* internal_list_val(const char* name);
|
||||||
|
|
||||||
|
[[deprecated("Remove in v4.1. Use zeek::lookup_type().")]]
|
||||||
extern BroType* internal_type(const char* name);
|
extern BroType* internal_type(const char* name);
|
||||||
|
|
||||||
extern Func* internal_func(const char* name);
|
extern Func* internal_func(const char* name);
|
||||||
extern EventHandlerPtr internal_handler(const char* name);
|
extern EventHandlerPtr internal_handler(const char* name);
|
||||||
|
|
||||||
extern int signal_val; // 0 if no signal pending
|
extern int signal_val; // 0 if no signal pending
|
||||||
|
|
||||||
|
namespace zeek {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup an ID by its name and return its type. A fatal occurs if the ID
|
||||||
|
* does not exist.
|
||||||
|
* @param name The identifier name to lookup
|
||||||
|
* @return The type of the identifier.
|
||||||
|
*/
|
||||||
|
const IntrusivePtr<BroType>& lookup_type(const char* name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup an ID by its name and return its type (as cast to @c T).
|
||||||
|
* A fatal occurs if the ID does not exist.
|
||||||
|
* @param name The identifier name to lookup
|
||||||
|
* @return The type of the identifier.
|
||||||
|
*/
|
||||||
|
template<class T>
|
||||||
|
IntrusivePtr<T> lookup_type(const char* name)
|
||||||
|
{ return cast_intrusive<T>(lookup_type(name)); }
|
||||||
|
|
||||||
|
} // namespace zeek
|
||||||
|
|
|
@ -27,15 +27,15 @@ BitTorrentTracker_Analyzer::BitTorrentTracker_Analyzer(Connection* c)
|
||||||
if ( ! bt_tracker_headers )
|
if ( ! bt_tracker_headers )
|
||||||
{
|
{
|
||||||
bt_tracker_headers =
|
bt_tracker_headers =
|
||||||
internal_type("bt_tracker_headers")->AsTableType();
|
zeek::lookup_type("bt_tracker_headers")->AsTableType();
|
||||||
bittorrent_peer =
|
bittorrent_peer =
|
||||||
internal_type("bittorrent_peer")->AsRecordType();
|
zeek::lookup_type("bittorrent_peer")->AsRecordType();
|
||||||
bittorrent_peer_set =
|
bittorrent_peer_set =
|
||||||
internal_type("bittorrent_peer_set")->AsTableType();
|
zeek::lookup_type("bittorrent_peer_set")->AsTableType();
|
||||||
bittorrent_benc_value =
|
bittorrent_benc_value =
|
||||||
internal_type("bittorrent_benc_value")->AsRecordType();
|
zeek::lookup_type("bittorrent_benc_value")->AsRecordType();
|
||||||
bittorrent_benc_dir =
|
bittorrent_benc_dir =
|
||||||
internal_type("bittorrent_benc_dir")->AsTableType();
|
zeek::lookup_type("bittorrent_benc_dir")->AsTableType();
|
||||||
}
|
}
|
||||||
|
|
||||||
keep_alive = false;
|
keep_alive = false;
|
||||||
|
|
|
@ -726,13 +726,13 @@ IntrusivePtr<VectorVal> ICMP_Analyzer::BuildNDOptionsVal(int caplen, const u_cha
|
||||||
|
|
||||||
if ( ! icmp6_nd_option_type )
|
if ( ! icmp6_nd_option_type )
|
||||||
{
|
{
|
||||||
icmp6_nd_option_type = internal_type("icmp6_nd_option")->AsRecordType();
|
icmp6_nd_option_type = zeek::lookup_type("icmp6_nd_option")->AsRecordType();
|
||||||
icmp6_nd_prefix_info_type =
|
icmp6_nd_prefix_info_type =
|
||||||
internal_type("icmp6_nd_prefix_info")->AsRecordType();
|
zeek::lookup_type("icmp6_nd_prefix_info")->AsRecordType();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vv = make_intrusive<VectorVal>(
|
auto vv = make_intrusive<VectorVal>(
|
||||||
internal_type("icmp6_nd_options")->AsVectorType());
|
zeek::lookup_type("icmp6_nd_options")->AsVectorType());
|
||||||
|
|
||||||
while ( caplen > 0 )
|
while ( caplen > 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ refine connection IMAP_Conn += {
|
||||||
if ( ! imap_capabilities )
|
if ( ! imap_capabilities )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto capv = make_intrusive<VectorVal>(internal_type("string_vec")->AsVectorType());
|
auto capv = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
for ( unsigned int i = 0; i< capabilities->size(); i++ )
|
for ( unsigned int i = 0; i< capabilities->size(); i++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ VectorVal* proc_padata(const KRB_PA_Data_Sequence* data, const BroAnalyzer bro_a
|
||||||
%code{
|
%code{
|
||||||
VectorVal* proc_padata(const KRB_PA_Data_Sequence* data, const BroAnalyzer bro_analyzer, bool is_error)
|
VectorVal* proc_padata(const KRB_PA_Data_Sequence* data, const BroAnalyzer bro_analyzer, bool is_error)
|
||||||
{
|
{
|
||||||
VectorVal* vv = new VectorVal(internal_type("KRB::Type_Value_Vector")->AsVectorType());
|
VectorVal* vv = new VectorVal(zeek::lookup_type("KRB::Type_Value_Vector")->AsVectorType());
|
||||||
|
|
||||||
if ( ! data->data()->has_padata() )
|
if ( ! data->data()->has_padata() )
|
||||||
return vv;
|
return vv;
|
||||||
|
|
|
@ -27,7 +27,7 @@ IntrusivePtr<Val> GetStringFromPrincipalName(const KRB_Principal_Name* pname)
|
||||||
|
|
||||||
VectorVal* proc_cipher_list(const Array* list)
|
VectorVal* proc_cipher_list(const Array* list)
|
||||||
{
|
{
|
||||||
VectorVal* ciphers = new VectorVal(internal_type("index_vec")->AsVectorType());
|
VectorVal* ciphers = new VectorVal(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
for ( uint i = 0; i < list->data()->size(); ++i )
|
for ( uint i = 0; i < list->data()->size(); ++i )
|
||||||
ciphers->Assign(ciphers->Size(), asn1_integer_to_val((*list->data())[i], TYPE_COUNT));
|
ciphers->Assign(ciphers->Size(), asn1_integer_to_val((*list->data())[i], TYPE_COUNT));
|
||||||
return ciphers;
|
return ciphers;
|
||||||
|
@ -35,7 +35,7 @@ VectorVal* proc_cipher_list(const Array* list)
|
||||||
|
|
||||||
VectorVal* proc_host_address_list(const BroAnalyzer a, const KRB_Host_Addresses* list)
|
VectorVal* proc_host_address_list(const BroAnalyzer a, const KRB_Host_Addresses* list)
|
||||||
{
|
{
|
||||||
VectorVal* addrs = new VectorVal(internal_type("KRB::Host_Address_Vector")->AsVectorType());
|
VectorVal* addrs = new VectorVal(zeek::lookup_type("KRB::Host_Address_Vector")->AsVectorType());
|
||||||
|
|
||||||
for ( uint i = 0; i < list->addresses()->size(); ++i )
|
for ( uint i = 0; i < list->addresses()->size(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@ RecordVal* proc_host_address(const BroAnalyzer a, const KRB_Host_Address* addr)
|
||||||
|
|
||||||
IntrusivePtr<VectorVal> proc_tickets(const KRB_Ticket_Sequence* list)
|
IntrusivePtr<VectorVal> proc_tickets(const KRB_Ticket_Sequence* list)
|
||||||
{
|
{
|
||||||
auto tickets = make_intrusive<VectorVal>(internal_type("KRB::Ticket_Vector")->AsVectorType());
|
auto tickets = make_intrusive<VectorVal>(zeek::lookup_type("KRB::Ticket_Vector")->AsVectorType());
|
||||||
|
|
||||||
for ( uint i = 0; i < list->tickets()->size(); ++i )
|
for ( uint i = 0; i < list->tickets()->size(); ++i )
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,7 +82,7 @@ refine flow MySQL_Flow += {
|
||||||
if ( ! mysql_result_row )
|
if ( ! mysql_result_row )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto vt = internal_type("string_vec")->AsVectorType();
|
auto vt = zeek::lookup_type("string_vec")->AsVectorType();
|
||||||
auto vv = make_intrusive<VectorVal>(vt);
|
auto vv = make_intrusive<VectorVal>(vt);
|
||||||
|
|
||||||
auto& bstring = ${msg.row.first_field.val};
|
auto& bstring = ${msg.row.first_field.val};
|
||||||
|
|
|
@ -192,7 +192,7 @@ zeek::Args MOUNT_Interp::event_common_vl(RPC_CallInfo *c,
|
||||||
zeek::Args vl;
|
zeek::Args vl;
|
||||||
vl.reserve(2 + extra_elements);
|
vl.reserve(2 + extra_elements);
|
||||||
vl.emplace_back(analyzer->ConnVal());
|
vl.emplace_back(analyzer->ConnVal());
|
||||||
auto auxgids = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto auxgids = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
for (size_t i = 0; i < c->AuxGIDs().size(); ++i)
|
for (size_t i = 0; i < c->AuxGIDs().size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -328,7 +328,7 @@ zeek::Args NFS_Interp::event_common_vl(RPC_CallInfo *c, BifEnum::rpc_status rpc_
|
||||||
zeek::Args vl;
|
zeek::Args vl;
|
||||||
vl.reserve(2 + extra_elements);
|
vl.reserve(2 + extra_elements);
|
||||||
vl.emplace_back(analyzer->ConnVal());
|
vl.emplace_back(analyzer->ConnVal());
|
||||||
auto auxgids = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto auxgids = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
for ( size_t i = 0; i < c->AuxGIDs().size(); ++i )
|
for ( size_t i = 0; i < c->AuxGIDs().size(); ++i )
|
||||||
auxgids->Assign(i, val_mgr->Count(c->AuxGIDs()[i]));
|
auxgids->Assign(i, val_mgr->Count(c->AuxGIDs()[i]));
|
||||||
|
|
|
@ -68,7 +68,7 @@ IntrusivePtr<RecordVal> BuildSMB2ContextVal(SMB3_negotiate_context_value* ncv)
|
||||||
rpreauth->Assign(0, val_mgr->Count(${ncv.preauth_integrity_capabilities.hash_alg_count}));
|
rpreauth->Assign(0, val_mgr->Count(${ncv.preauth_integrity_capabilities.hash_alg_count}));
|
||||||
rpreauth->Assign(1, val_mgr->Count(${ncv.preauth_integrity_capabilities.salt_length}));
|
rpreauth->Assign(1, val_mgr->Count(${ncv.preauth_integrity_capabilities.salt_length}));
|
||||||
|
|
||||||
auto ha = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto ha = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
for ( int i = 0; i < ${ncv.preauth_integrity_capabilities.hash_alg_count}; ++i )
|
for ( int i = 0; i < ${ncv.preauth_integrity_capabilities.hash_alg_count}; ++i )
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ IntrusivePtr<RecordVal> BuildSMB2ContextVal(SMB3_negotiate_context_value* ncv)
|
||||||
auto rencr = make_intrusive<RecordVal>(BifType::Record::SMB2::EncryptionCapabilities);
|
auto rencr = make_intrusive<RecordVal>(BifType::Record::SMB2::EncryptionCapabilities);
|
||||||
rencr->Assign(0, val_mgr->Count(${ncv.encryption_capabilities.cipher_count}));
|
rencr->Assign(0, val_mgr->Count(${ncv.encryption_capabilities.cipher_count}));
|
||||||
|
|
||||||
auto c = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto c = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
for ( int i = 0; i < ${ncv.encryption_capabilities.cipher_count}; ++i )
|
for ( int i = 0; i < ${ncv.encryption_capabilities.cipher_count}; ++i )
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ IntrusivePtr<RecordVal> BuildSMB2ContextVal(SMB3_negotiate_context_value* ncv)
|
||||||
auto rcomp = make_intrusive<RecordVal>(BifType::Record::SMB2::CompressionCapabilities);
|
auto rcomp = make_intrusive<RecordVal>(BifType::Record::SMB2::CompressionCapabilities);
|
||||||
rcomp->Assign(0, val_mgr->Count(${ncv.compression_capabilities.alg_count}));
|
rcomp->Assign(0, val_mgr->Count(${ncv.compression_capabilities.alg_count}));
|
||||||
|
|
||||||
auto c = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto c = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
for ( int i = 0; i < ${ncv.compression_capabilities.alg_count}; ++i )
|
for ( int i = 0; i < ${ncv.compression_capabilities.alg_count}; ++i )
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ VectorVal* name_list_to_vector(const bytestring& nl);
|
||||||
// Copied from IRC_Analyzer::SplitWords
|
// Copied from IRC_Analyzer::SplitWords
|
||||||
VectorVal* name_list_to_vector(const bytestring& nl)
|
VectorVal* name_list_to_vector(const bytestring& nl)
|
||||||
{
|
{
|
||||||
VectorVal* vv = new VectorVal(internal_type("string_vec")->AsVectorType());
|
VectorVal* vv = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
string name_list = std_str(nl);
|
string name_list = std_str(nl);
|
||||||
if ( name_list.size() < 1 )
|
if ( name_list.size() < 1 )
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
else
|
else
|
||||||
std::transform(cipher_suites24->begin(), cipher_suites24->end(), std::back_inserter(cipher_suites), to_int());
|
std::transform(cipher_suites24->begin(), cipher_suites24->end(), std::back_inserter(cipher_suites), to_int());
|
||||||
|
|
||||||
auto cipher_vec = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto cipher_vec = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < cipher_suites.size(); ++i )
|
for ( unsigned int i = 0; i < cipher_suites.size(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
cipher_vec->Assign(i, ciph);
|
cipher_vec->Assign(i, ciph);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto comp_vec = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto comp_vec = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( compression_methods )
|
if ( compression_methods )
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_ec_point_formats )
|
if ( ! ssl_extension_ec_point_formats )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto points = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto points = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( point_format_list )
|
if ( point_format_list )
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_elliptic_curves )
|
if ( ! ssl_extension_elliptic_curves )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto curves = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto curves = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( list )
|
if ( list )
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_key_share )
|
if ( ! ssl_extension_key_share )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto nglist = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto nglist = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( keyshare )
|
if ( keyshare )
|
||||||
{
|
{
|
||||||
|
@ -131,7 +131,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_key_share )
|
if ( ! ssl_extension_key_share )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto nglist = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto nglist = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
nglist->Assign(0u, val_mgr->Count(keyshare->namedgroup()));
|
nglist->Assign(0u, val_mgr->Count(keyshare->namedgroup()));
|
||||||
BifEvent::enqueue_ssl_extension_key_share(bro_analyzer(), bro_analyzer()->Conn(), ${rec.is_orig}, std::move(nglist));
|
BifEvent::enqueue_ssl_extension_key_share(bro_analyzer(), bro_analyzer()->Conn(), ${rec.is_orig}, std::move(nglist));
|
||||||
|
@ -143,7 +143,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_key_share )
|
if ( ! ssl_extension_key_share )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto nglist = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto nglist = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
nglist->Assign(0u, val_mgr->Count(namedgroup));
|
nglist->Assign(0u, val_mgr->Count(namedgroup));
|
||||||
BifEvent::enqueue_ssl_extension_key_share(bro_analyzer(), bro_analyzer()->Conn(), ${rec.is_orig}, std::move(nglist));
|
BifEvent::enqueue_ssl_extension_key_share(bro_analyzer(), bro_analyzer()->Conn(), ${rec.is_orig}, std::move(nglist));
|
||||||
|
@ -155,7 +155,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_signature_algorithm )
|
if ( ! ssl_extension_signature_algorithm )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto slist = make_intrusive<VectorVal>(internal_type("signature_and_hashalgorithm_vec")->AsVectorType());
|
auto slist = make_intrusive<VectorVal>(zeek::lookup_type("signature_and_hashalgorithm_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( supported_signature_algorithms )
|
if ( supported_signature_algorithms )
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_application_layer_protocol_negotiation )
|
if ( ! ssl_extension_application_layer_protocol_negotiation )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto plist = make_intrusive<VectorVal>(internal_type("string_vec")->AsVectorType());
|
auto plist = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( protocols )
|
if ( protocols )
|
||||||
{
|
{
|
||||||
|
@ -194,7 +194,7 @@ refine connection Handshake_Conn += {
|
||||||
|
|
||||||
function proc_server_name(rec: HandshakeRecord, list: ServerName[]) : bool
|
function proc_server_name(rec: HandshakeRecord, list: ServerName[]) : bool
|
||||||
%{
|
%{
|
||||||
auto servers = make_intrusive<VectorVal>(internal_type("string_vec")->AsVectorType());
|
auto servers = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( list )
|
if ( list )
|
||||||
{
|
{
|
||||||
|
@ -226,7 +226,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_supported_versions )
|
if ( ! ssl_extension_supported_versions )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto versions = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto versions = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( versions_list )
|
if ( versions_list )
|
||||||
{
|
{
|
||||||
|
@ -245,7 +245,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_supported_versions )
|
if ( ! ssl_extension_supported_versions )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto versions = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto versions = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
versions->Assign(0u, val_mgr->Count(version));
|
versions->Assign(0u, val_mgr->Count(version));
|
||||||
|
|
||||||
BifEvent::enqueue_ssl_extension_supported_versions(bro_analyzer(), bro_analyzer()->Conn(),
|
BifEvent::enqueue_ssl_extension_supported_versions(bro_analyzer(), bro_analyzer()->Conn(),
|
||||||
|
@ -259,7 +259,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_psk_key_exchange_modes )
|
if ( ! ssl_extension_psk_key_exchange_modes )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto modes = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto modes = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( mode_list )
|
if ( mode_list )
|
||||||
{
|
{
|
||||||
|
@ -492,7 +492,7 @@ refine connection Handshake_Conn += {
|
||||||
if ( ! ssl_extension_pre_shared_key_server_hello )
|
if ( ! ssl_extension_pre_shared_key_server_hello )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto slist = make_intrusive<VectorVal>(internal_type("psk_identity_vec")->AsVectorType());
|
auto slist = make_intrusive<VectorVal>(zeek::lookup_type("psk_identity_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( identities && identities->identities() )
|
if ( identities && identities->identities() )
|
||||||
{
|
{
|
||||||
|
@ -505,7 +505,7 @@ refine connection Handshake_Conn += {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto blist = make_intrusive<VectorVal>(internal_type("string_vec")->AsVectorType());
|
auto blist = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( binders && binders->binders() )
|
if ( binders && binders->binders() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1421,7 +1421,7 @@ int TCP_Analyzer::ParseTCPOptions(const struct tcphdr* tcp, bool is_orig)
|
||||||
{
|
{
|
||||||
auto p = reinterpret_cast<const uint32_t*>(o + 2);
|
auto p = reinterpret_cast<const uint32_t*>(o + 2);
|
||||||
auto num_pointers = (length - 2) / 4;
|
auto num_pointers = (length - 2) / 4;
|
||||||
auto vt = internal_type("index_vec")->AsVectorType();
|
auto vt = zeek::lookup_type("index_vec")->AsVectorType();
|
||||||
auto sack = new VectorVal(vt);
|
auto sack = new VectorVal(vt);
|
||||||
|
|
||||||
for ( auto i = 0; i < num_pointers; ++i )
|
for ( auto i = 0; i < num_pointers; ++i )
|
||||||
|
|
|
@ -104,9 +104,9 @@ IntrusivePtr<RecordVal> TeredoEncapsulation::BuildVal(const IP_Hdr* inner) const
|
||||||
|
|
||||||
if ( ! teredo_hdr_type )
|
if ( ! teredo_hdr_type )
|
||||||
{
|
{
|
||||||
teredo_hdr_type = internal_type("teredo_hdr")->AsRecordType();
|
teredo_hdr_type = zeek::lookup_type("teredo_hdr")->AsRecordType();
|
||||||
teredo_auth_type = internal_type("teredo_auth")->AsRecordType();
|
teredo_auth_type = zeek::lookup_type("teredo_auth")->AsRecordType();
|
||||||
teredo_origin_type = internal_type("teredo_origin")->AsRecordType();
|
teredo_origin_type = zeek::lookup_type("teredo_origin")->AsRecordType();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto teredo_hdr = make_intrusive<RecordVal>(teredo_hdr_type);
|
auto teredo_hdr = make_intrusive<RecordVal>(teredo_hdr_type);
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
#include "NetVar.h"
|
#include "NetVar.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
#include "Var.h" // for internal_type()
|
#include "Var.h"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "Desc.h"
|
#include "Desc.h"
|
||||||
#include "IntrusivePtr.h"
|
#include "IntrusivePtr.h"
|
||||||
#include "RE.h"
|
#include "RE.h"
|
||||||
#include "Var.h" // for internal_type()
|
#include "Var.h"
|
||||||
#include "Scope.h"
|
#include "Scope.h"
|
||||||
#include "module_util.h"
|
#include "module_util.h"
|
||||||
#include "3rdparty/doctest.h"
|
#include "3rdparty/doctest.h"
|
||||||
|
@ -1154,7 +1154,7 @@ IntrusivePtr<Val> bro_broker::DataVal::castTo(BroType* t)
|
||||||
BroType* bro_broker::DataVal::ScriptDataType()
|
BroType* bro_broker::DataVal::ScriptDataType()
|
||||||
{
|
{
|
||||||
if ( ! script_data_type )
|
if ( ! script_data_type )
|
||||||
script_data_type = internal_type("Broker::Data");
|
script_data_type = zeek::lookup_type("Broker::Data").get();
|
||||||
|
|
||||||
return script_data_type;
|
return script_data_type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,8 +149,8 @@ void Manager::InitPostScript()
|
||||||
default_log_topic_prefix =
|
default_log_topic_prefix =
|
||||||
get_option("Broker::default_log_topic_prefix")->AsString()->CheckString();
|
get_option("Broker::default_log_topic_prefix")->AsString()->CheckString();
|
||||||
log_topic_func = get_option("Broker::log_topic")->AsFunc();
|
log_topic_func = get_option("Broker::log_topic")->AsFunc();
|
||||||
log_id_type = internal_type("Log::ID")->AsEnumType();
|
log_id_type = zeek::lookup_type("Log::ID")->AsEnumType();
|
||||||
writer_id_type = internal_type("Log::Writer")->AsEnumType();
|
writer_id_type = zeek::lookup_type("Log::Writer")->AsEnumType();
|
||||||
|
|
||||||
opaque_of_data_type = new OpaqueType("Broker::Data");
|
opaque_of_data_type = new OpaqueType("Broker::Data");
|
||||||
opaque_of_set_iterator = new OpaqueType("Broker::SetIterator");
|
opaque_of_set_iterator = new OpaqueType("Broker::SetIterator");
|
||||||
|
@ -158,7 +158,7 @@ void Manager::InitPostScript()
|
||||||
opaque_of_vector_iterator = new OpaqueType("Broker::VectorIterator");
|
opaque_of_vector_iterator = new OpaqueType("Broker::VectorIterator");
|
||||||
opaque_of_record_iterator = new OpaqueType("Broker::RecordIterator");
|
opaque_of_record_iterator = new OpaqueType("Broker::RecordIterator");
|
||||||
opaque_of_store_handle = new OpaqueType("Broker::Store");
|
opaque_of_store_handle = new OpaqueType("Broker::Store");
|
||||||
vector_of_data_type = new VectorType({NewRef{}, internal_type("Broker::Data")});
|
vector_of_data_type = new VectorType(zeek::lookup_type("Broker::Data"));
|
||||||
|
|
||||||
// Register as a "dont-count" source first, we may change that later.
|
// Register as a "dont-count" source first, we may change that later.
|
||||||
iosource_mgr->Register(this, true);
|
iosource_mgr->Register(this, true);
|
||||||
|
@ -1246,13 +1246,13 @@ void Manager::ProcessStatus(broker::status stat)
|
||||||
if ( ! event )
|
if ( ! event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto ei = internal_type("Broker::EndpointInfo")->AsRecordType();
|
auto ei = zeek::lookup_type("Broker::EndpointInfo")->AsRecordType();
|
||||||
auto endpoint_info = make_intrusive<RecordVal>(ei);
|
auto endpoint_info = make_intrusive<RecordVal>(ei);
|
||||||
|
|
||||||
if ( ctx )
|
if ( ctx )
|
||||||
{
|
{
|
||||||
endpoint_info->Assign(0, make_intrusive<StringVal>(to_string(ctx->node)));
|
endpoint_info->Assign(0, make_intrusive<StringVal>(to_string(ctx->node)));
|
||||||
auto ni = internal_type("Broker::NetworkInfo")->AsRecordType();
|
auto ni = zeek::lookup_type("Broker::NetworkInfo")->AsRecordType();
|
||||||
auto network_info = make_intrusive<RecordVal>(ni);
|
auto network_info = make_intrusive<RecordVal>(ni);
|
||||||
|
|
||||||
if ( ctx->network )
|
if ( ctx->network )
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Store.h"
|
#include "Store.h"
|
||||||
#include "Desc.h"
|
#include "Desc.h"
|
||||||
#include "Var.h" // for internal_type()
|
#include "Var.h"
|
||||||
#include "broker/Manager.h"
|
#include "broker/Manager.h"
|
||||||
|
|
||||||
namespace bro_broker {
|
namespace bro_broker {
|
||||||
|
@ -15,7 +15,7 @@ EnumVal* query_status(bool success)
|
||||||
|
|
||||||
if ( ! store_query_status )
|
if ( ! store_query_status )
|
||||||
{
|
{
|
||||||
store_query_status = internal_type("Broker::QueryStatus")->AsEnumType();
|
store_query_status = zeek::lookup_type("Broker::QueryStatus")->AsEnumType();
|
||||||
success_val = store_query_status->Lookup("Broker", "SUCCESS");
|
success_val = store_query_status->Lookup("Broker", "SUCCESS");
|
||||||
failure_val = store_query_status->Lookup("Broker", "FAILURE");
|
failure_val = store_query_status->Lookup("Broker", "FAILURE");
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,14 +94,14 @@ function Broker::__unpeer%(a: string, p: port%): bool
|
||||||
function Broker::__peers%(%): PeerInfos
|
function Broker::__peers%(%): PeerInfos
|
||||||
%{
|
%{
|
||||||
bro_broker::Manager::ScriptScopeGuard ssg;
|
bro_broker::Manager::ScriptScopeGuard ssg;
|
||||||
auto rval = make_intrusive<VectorVal>(internal_type("Broker::PeerInfos")->AsVectorType());
|
auto rval = make_intrusive<VectorVal>(zeek::lookup_type("Broker::PeerInfos")->AsVectorType());
|
||||||
auto i = 0;
|
auto i = 0;
|
||||||
|
|
||||||
for ( auto& p : broker_mgr->Peers() )
|
for ( auto& p : broker_mgr->Peers() )
|
||||||
{
|
{
|
||||||
auto pi = internal_type("Broker::PeerInfo")->AsRecordType();
|
auto pi = zeek::lookup_type("Broker::PeerInfo")->AsRecordType();
|
||||||
auto ei = internal_type("Broker::EndpointInfo")->AsRecordType();
|
auto ei = zeek::lookup_type("Broker::EndpointInfo")->AsRecordType();
|
||||||
auto ni = internal_type("Broker::NetworkInfo")->AsRecordType();
|
auto ni = zeek::lookup_type("Broker::NetworkInfo")->AsRecordType();
|
||||||
auto peer_info = new RecordVal(pi);
|
auto peer_info = new RecordVal(pi);
|
||||||
auto endpoint_info = new RecordVal(ei);
|
auto endpoint_info = new RecordVal(ei);
|
||||||
auto network_info = new RecordVal(ni);
|
auto network_info = new RecordVal(ni);
|
||||||
|
|
|
@ -11,7 +11,7 @@ VectorVal* process_rvas(const RVAS* rvas);
|
||||||
%code{
|
%code{
|
||||||
VectorVal* process_rvas(const RVAS* rva_table)
|
VectorVal* process_rvas(const RVAS* rva_table)
|
||||||
{
|
{
|
||||||
VectorVal* rvas = new VectorVal(internal_type("index_vec")->AsVectorType());
|
VectorVal* rvas = new VectorVal(zeek::lookup_type("index_vec")->AsVectorType());
|
||||||
for ( uint16 i=0; i < rva_table->rvas()->size(); ++i )
|
for ( uint16 i=0; i < rva_table->rvas()->size(); ++i )
|
||||||
rvas->Assign(i, val_mgr->Count((*rva_table->rvas())[i]->size()));
|
rvas->Assign(i, val_mgr->Count((*rva_table->rvas())[i]->size()));
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ refine flow File += {
|
||||||
function characteristics_to_bro(c: uint32, len: uint8): TableVal
|
function characteristics_to_bro(c: uint32, len: uint8): TableVal
|
||||||
%{
|
%{
|
||||||
uint64 mask = (len==16) ? 0xFFFF : 0xFFFFFFFF;
|
uint64 mask = (len==16) ? 0xFFFF : 0xFFFFFFFF;
|
||||||
TableVal* char_set = new TableVal({NewRef{}, internal_type("count_set")->AsTableType()});
|
TableVal* char_set = new TableVal(zeek::lookup_type<TableType>("count_set"));
|
||||||
for ( uint16 i=0; i < len; ++i )
|
for ( uint16 i=0; i < len; ++i )
|
||||||
{
|
{
|
||||||
if ( ((c >> i) & 0x1) == 1 )
|
if ( ((c >> i) & 0x1) == 1 )
|
||||||
|
|
|
@ -634,7 +634,7 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
//ocsp_resp_record->Assign(7, make_intrusive<StringVal>(len, buf));
|
//ocsp_resp_record->Assign(7, make_intrusive<StringVal>(len, buf));
|
||||||
//BIO_reset(bio);
|
//BIO_reset(bio);
|
||||||
|
|
||||||
certs_vector = new VectorVal(internal_type("x509_opaque_vector")->AsVectorType());
|
certs_vector = new VectorVal(zeek::lookup_type("x509_opaque_vector")->AsVectorType());
|
||||||
vl.emplace_back(AdoptRef{}, certs_vector);
|
vl.emplace_back(AdoptRef{}, certs_vector);
|
||||||
|
|
||||||
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
||||||
|
|
|
@ -367,21 +367,21 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
|
||||||
{
|
{
|
||||||
case GEN_DNS:
|
case GEN_DNS:
|
||||||
if ( names == nullptr )
|
if ( names == nullptr )
|
||||||
names = new VectorVal(internal_type("string_vec")->AsVectorType());
|
names = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
names->Assign(names->Size(), bs);
|
names->Assign(names->Size(), bs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GEN_URI:
|
case GEN_URI:
|
||||||
if ( uris == nullptr )
|
if ( uris == nullptr )
|
||||||
uris = new VectorVal(internal_type("string_vec")->AsVectorType());
|
uris = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
uris->Assign(uris->Size(), bs);
|
uris->Assign(uris->Size(), bs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GEN_EMAIL:
|
case GEN_EMAIL:
|
||||||
if ( emails == nullptr )
|
if ( emails == nullptr )
|
||||||
emails = new VectorVal(internal_type("string_vec")->AsVectorType());
|
emails = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
emails->Assign(emails->Size(), bs);
|
emails->Assign(emails->Size(), bs);
|
||||||
break;
|
break;
|
||||||
|
@ -391,7 +391,7 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
|
||||||
else if ( gen->type == GEN_IPADD )
|
else if ( gen->type == GEN_IPADD )
|
||||||
{
|
{
|
||||||
if ( ips == nullptr )
|
if ( ips == nullptr )
|
||||||
ips = new VectorVal(internal_type("addr_vec")->AsVectorType());
|
ips = new VectorVal(zeek::lookup_type("addr_vec")->AsVectorType());
|
||||||
|
|
||||||
uint32_t* addr = (uint32_t*) gen->d.ip->data;
|
uint32_t* addr = (uint32_t*) gen->d.ip->data;
|
||||||
|
|
||||||
|
|
|
@ -556,7 +556,7 @@ function x509_verify%(certs: x509_opaque_vector, root_certs: table_string_of_str
|
||||||
}
|
}
|
||||||
|
|
||||||
int num_certs = sk_X509_num(chain);
|
int num_certs = sk_X509_num(chain);
|
||||||
chainVector = new VectorVal(internal_type("x509_opaque_vector")->AsVectorType());
|
chainVector = new VectorVal(zeek::lookup_type("x509_opaque_vector")->AsVectorType());
|
||||||
|
|
||||||
for ( int i = 0; i < num_certs; i++ )
|
for ( int i = 0; i < num_certs; i++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1276,7 +1276,7 @@ bool Manager::WriteFromRemote(EnumVal* id, EnumVal* writer, const string& path,
|
||||||
|
|
||||||
void Manager::SendAllWritersTo(const broker::endpoint_info& ei)
|
void Manager::SendAllWritersTo(const broker::endpoint_info& ei)
|
||||||
{
|
{
|
||||||
auto et = internal_type("Log::Writer")->AsEnumType();
|
auto et = zeek::lookup_type("Log::Writer")->AsEnumType();
|
||||||
|
|
||||||
for ( vector<Stream *>::iterator s = streams.begin(); s != streams.end(); ++s )
|
for ( vector<Stream *>::iterator s = streams.begin(); s != streams.end(); ++s )
|
||||||
{
|
{
|
||||||
|
|
|
@ -470,7 +470,7 @@ function get_reporter_stats%(%): ReporterStats
|
||||||
auto r = make_intrusive<RecordVal>(ReporterStats);
|
auto r = make_intrusive<RecordVal>(ReporterStats);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
TableVal* weirds_by_type = new TableVal({NewRef{}, internal_type("table_string_of_count")->AsTableType()});
|
auto weirds_by_type = make_intrusive<TableVal>(zeek::lookup_type<TableType>("table_string_of_count"));
|
||||||
|
|
||||||
for ( auto& kv : reporter->GetWeirdsByType() )
|
for ( auto& kv : reporter->GetWeirdsByType() )
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ function get_reporter_stats%(%): ReporterStats
|
||||||
}
|
}
|
||||||
|
|
||||||
r->Assign(n++, val_mgr->Count(reporter->GetWeirdCount()));
|
r->Assign(n++, val_mgr->Count(reporter->GetWeirdCount()));
|
||||||
r->Assign(n++, weirds_by_type);
|
r->Assign(n++, std::move(weirds_by_type));
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -204,7 +204,7 @@ static IntrusivePtr<VectorVal> do_split_string(StringVal* str_val,
|
||||||
int max_num_sep)
|
int max_num_sep)
|
||||||
{
|
{
|
||||||
// string_vec is used early in the version script - do not use the NetVar.
|
// string_vec is used early in the version script - do not use the NetVar.
|
||||||
auto rval = make_intrusive<VectorVal>(internal_type("string_vec")->AsVectorType());
|
auto rval = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
const u_char* s = str_val->Bytes();
|
const u_char* s = str_val->Bytes();
|
||||||
int n = str_val->Len();
|
int n = str_val->Len();
|
||||||
const u_char* end_of_s = s + n;
|
const u_char* end_of_s = s + n;
|
||||||
|
@ -714,7 +714,7 @@ function str_split%(s: string, idx: index_vec%): string_vec
|
||||||
|
|
||||||
BroString::Vec* result = s->AsString()->Split(indices);
|
BroString::Vec* result = s->AsString()->Split(indices);
|
||||||
auto result_v = make_intrusive<VectorVal>(
|
auto result_v = make_intrusive<VectorVal>(
|
||||||
internal_type("string_vec")->AsVectorType());
|
zeek::lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( result )
|
if ( result )
|
||||||
{
|
{
|
||||||
|
|
20
src/zeek.bif
20
src/zeek.bif
|
@ -30,6 +30,7 @@
|
||||||
#include "Hash.h"
|
#include "Hash.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace zeek;
|
||||||
|
|
||||||
TableType* var_sizes;
|
TableType* var_sizes;
|
||||||
|
|
||||||
|
@ -1470,7 +1471,7 @@ function sort%(v: any, ...%) : any
|
||||||
function order%(v: any, ...%) : index_vec
|
function order%(v: any, ...%) : index_vec
|
||||||
%{
|
%{
|
||||||
auto result_v = make_intrusive<VectorVal>(
|
auto result_v = make_intrusive<VectorVal>(
|
||||||
internal_type("index_vec")->AsVectorType());
|
lookup_type("index_vec")->AsVectorType());
|
||||||
|
|
||||||
if ( v->Type()->Tag() != TYPE_VECTOR )
|
if ( v->Type()->Tag() != TYPE_VECTOR )
|
||||||
{
|
{
|
||||||
|
@ -1824,15 +1825,12 @@ function zeek_version%(%): string
|
||||||
function record_type_to_vector%(rt: string%): string_vec
|
function record_type_to_vector%(rt: string%): string_vec
|
||||||
%{
|
%{
|
||||||
auto result =
|
auto result =
|
||||||
make_intrusive<VectorVal>(internal_type("string_vec")->AsVectorType());
|
make_intrusive<VectorVal>(lookup_type("string_vec")->AsVectorType());
|
||||||
|
|
||||||
RecordType *type = internal_type(rt->CheckString())->AsRecordType();
|
RecordType* type = lookup_type(rt->CheckString())->AsRecordType();
|
||||||
|
|
||||||
if ( type )
|
|
||||||
{
|
|
||||||
for ( int i = 0; i < type->NumFields(); ++i )
|
for ( int i = 0; i < type->NumFields(); ++i )
|
||||||
result->Assign(i+1, make_intrusive<StringVal>(type->FieldName(i)));
|
result->Assign(i+1, make_intrusive<StringVal>(type->FieldName(i)));
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
%}
|
%}
|
||||||
|
@ -1856,7 +1854,7 @@ function type_name%(t: any%): string
|
||||||
## Returns: list of command-line arguments (``argv``) used to run Zeek.
|
## Returns: list of command-line arguments (``argv``) used to run Zeek.
|
||||||
function zeek_args%(%): string_vec
|
function zeek_args%(%): string_vec
|
||||||
%{
|
%{
|
||||||
auto sv = internal_type("string_vec")->AsVectorType();
|
auto sv = lookup_type("string_vec")->AsVectorType();
|
||||||
auto rval = make_intrusive<VectorVal>(sv);
|
auto rval = make_intrusive<VectorVal>(sv);
|
||||||
|
|
||||||
for ( auto i = 0; i < bro_argc; ++i )
|
for ( auto i = 0; i < bro_argc; ++i )
|
||||||
|
@ -1894,7 +1892,7 @@ function reading_traces%(%): bool
|
||||||
## .. zeek:see:: reading_live_traffic reading_traces
|
## .. zeek:see:: reading_live_traffic reading_traces
|
||||||
function packet_source%(%): PacketSource
|
function packet_source%(%): PacketSource
|
||||||
%{
|
%{
|
||||||
auto ps_type = internal_type("PacketSource")->AsRecordType();
|
auto ps_type = lookup_type("PacketSource")->AsRecordType();
|
||||||
auto ps = iosource_mgr->GetPktSrc();
|
auto ps = iosource_mgr->GetPktSrc();
|
||||||
auto r = make_intrusive<RecordVal>(ps_type);
|
auto r = make_intrusive<RecordVal>(ps_type);
|
||||||
|
|
||||||
|
@ -2002,7 +2000,7 @@ function record_fields%(rec: any%): record_field_table
|
||||||
if ( ! id || ! id->IsType() || id->GetType()->Tag() != TYPE_RECORD )
|
if ( ! id || ! id->IsType() || id->GetType()->Tag() != TYPE_RECORD )
|
||||||
{
|
{
|
||||||
reporter->Error("record_fields string argument does not name a record type");
|
reporter->Error("record_fields string argument does not name a record type");
|
||||||
IntrusivePtr<TableType> tt{NewRef{}, internal_type("record_field_table")->AsTableType()};
|
auto tt = lookup_type<TableType>("record_field_table");
|
||||||
return make_intrusive<TableVal>(std::move(tt));
|
return make_intrusive<TableVal>(std::move(tt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2189,7 +2187,7 @@ function is_v6_subnet%(s: subnet%): bool
|
||||||
## Returns: The vector of addresses contained in the routing header data.
|
## Returns: The vector of addresses contained in the routing header data.
|
||||||
function routing0_data_to_addrs%(s: string%): addr_vec
|
function routing0_data_to_addrs%(s: string%): addr_vec
|
||||||
%{
|
%{
|
||||||
auto rval = make_intrusive<VectorVal>(internal_type("addr_vec")->AsVectorType());
|
auto rval = make_intrusive<VectorVal>(lookup_type("addr_vec")->AsVectorType());
|
||||||
|
|
||||||
int len = s->Len();
|
int len = s->Len();
|
||||||
const u_char* bytes = s->Bytes();
|
const u_char* bytes = s->Bytes();
|
||||||
|
@ -2220,7 +2218,7 @@ function routing0_data_to_addrs%(s: string%): addr_vec
|
||||||
## .. zeek:see:: counts_to_addr
|
## .. zeek:see:: counts_to_addr
|
||||||
function addr_to_counts%(a: addr%): index_vec
|
function addr_to_counts%(a: addr%): index_vec
|
||||||
%{
|
%{
|
||||||
auto rval = make_intrusive<VectorVal>(internal_type("index_vec")->AsVectorType());
|
auto rval = make_intrusive<VectorVal>(lookup_type("index_vec")->AsVectorType());
|
||||||
const uint32_t* bytes;
|
const uint32_t* bytes;
|
||||||
int len = a->AsAddr().GetBytes(&bytes);
|
int len = a->AsAddr().GetBytes(&bytes);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue