Move NetVar.h to zeek namespace

This commit is contained in:
Tim Wojtulewicz 2020-08-05 13:57:25 -07:00
parent e7c6d51ae7
commit 289c03d386
3 changed files with 341 additions and 162 deletions

View file

@ -30,6 +30,84 @@ zeek::VectorType* index_vec;
zeek::VectorType* mime_matches;
zeek::RecordType* mime_match;
zeek::RecordType* socks_address;
zeek::TableVal* tcp_reassembler_ports_orig;
zeek::TableVal* tcp_reassembler_ports_resp;
zeek::TableVal* tcp_content_delivery_ports_orig;
zeek::TableVal* tcp_content_delivery_ports_resp;
zeek::TableVal* udp_content_delivery_ports_orig;
zeek::TableVal* udp_content_delivery_ports_resp;
zeek::TableVal* udp_content_ports;
zeek::RecordType* mime_header_rec;
zeek::TableType* mime_header_list;
zeek::RecordType* http_stats_rec;
zeek::RecordType* http_message_stat;
zeek::RecordType* pm_mapping;
zeek::TableType* pm_mappings;
zeek::RecordType* pm_port_request;
zeek::RecordType* pm_callit_request;
zeek::RecordType* geo_location;
zeek::RecordType* entropy_test_result;
zeek::RecordType* dns_msg;
zeek::RecordType* dns_answer;
zeek::RecordType* dns_soa;
zeek::RecordType* dns_edns_additional;
zeek::RecordType* dns_edns_ecs;
zeek::RecordType* dns_tsig_additional;
zeek::RecordType* dns_rrsig_rr;
zeek::RecordType* dns_dnskey_rr;
zeek::RecordType* dns_nsec3_rr;
zeek::RecordType* dns_ds_rr;
zeek::TableVal* dns_skip_auth;
zeek::TableVal* dns_skip_addl;
zeek::TableVal* stp_skip_src;
zeek::TableVal* preserve_orig_addr;
zeek::TableVal* preserve_resp_addr;
zeek::TableVal* preserve_other_addr;
zeek::RecordType* rotate_info;
zeek::StringVal* log_rotate_base_time;
zeek::StringVal* peer_description;
zeek::Val* profiling_file;
zeek::Val* pkt_profile_file;
zeek::TableType* irc_join_list;
zeek::RecordType* irc_join_info;
zeek::TableVal* likely_server_ports;
zeek::StringVal* trace_output_file;
zeek::RecordType* script_id;
zeek::TableType* id_table;
zeek::RecordType* record_field;
zeek::TableType* record_field_table;
zeek::RecordType* call_argument;
zeek::VectorType* call_argument_vector;
zeek::StringVal* cmd_line_bpf_filter;
zeek::StringVal* global_hash_seed;
// Because of how the BIF include files are built with namespaces already in them,
// these files need to be included separately before the namespace is opened below.
namespace zeek {
int watchdog_interval;
int max_timer_expires;
@ -56,8 +134,6 @@ int tcp_max_above_hole_without_any_acks;
int tcp_excessive_data_without_further_acks;
int tcp_max_old_segments;
zeek::RecordType* socks_address;
double non_analyzed_lifetime;
double tcp_inactivity_timeout;
double udp_inactivity_timeout;
@ -66,17 +142,8 @@ double icmp_inactivity_timeout;
int tcp_storm_thresh;
double tcp_storm_interarrival_thresh;
zeek::TableVal* tcp_reassembler_ports_orig;
zeek::TableVal* tcp_reassembler_ports_resp;
zeek::TableVal* tcp_content_delivery_ports_orig;
zeek::TableVal* tcp_content_delivery_ports_resp;
bool tcp_content_deliver_all_orig;
bool tcp_content_deliver_all_resp;
zeek::TableVal* udp_content_delivery_ports_orig;
zeek::TableVal* udp_content_delivery_ports_resp;
zeek::TableVal* udp_content_ports;
bool udp_content_deliver_all_orig;
bool udp_content_deliver_all_resp;
bool udp_content_delivery_ports_use_resp;
@ -86,42 +153,15 @@ double rpc_timeout;
int mime_segment_length;
int mime_segment_overlap_length;
zeek::RecordType* mime_header_rec;
zeek::TableType* mime_header_list;
int http_entity_data_delivery_size;
zeek::RecordType* http_stats_rec;
zeek::RecordType* http_message_stat;
int truncate_http_URI;
zeek::RecordType* pm_mapping;
zeek::TableType* pm_mappings;
zeek::RecordType* pm_port_request;
zeek::RecordType* pm_callit_request;
zeek::RecordType* geo_location;
zeek::RecordType* entropy_test_result;
zeek::RecordType* dns_msg;
zeek::RecordType* dns_answer;
zeek::RecordType* dns_soa;
zeek::RecordType* dns_edns_additional;
zeek::RecordType* dns_edns_ecs;
zeek::RecordType* dns_tsig_additional;
zeek::RecordType* dns_rrsig_rr;
zeek::RecordType* dns_dnskey_rr;
zeek::RecordType* dns_nsec3_rr;
zeek::RecordType* dns_ds_rr;
zeek::TableVal* dns_skip_auth;
zeek::TableVal* dns_skip_addl;
int dns_skip_all_auth;
int dns_skip_all_addl;
int dns_max_queries;
double stp_delta;
double stp_idle_min;
zeek::TableVal* stp_skip_src;
double table_expire_interval;
double table_expire_delay;
@ -131,22 +171,12 @@ double connection_status_update_interval;
int orig_addr_anonymization, resp_addr_anonymization;
int other_addr_anonymization;
zeek::TableVal* preserve_orig_addr;
zeek::TableVal* preserve_resp_addr;
zeek::TableVal* preserve_other_addr;
zeek::RecordType* rotate_info;
zeek::StringVal* log_rotate_base_time;
zeek::StringVal* peer_description;
zeek::Val* profiling_file;
double profiling_interval;
int expensive_profiling_multiple;
int segment_profiling;
int pkt_profile_mode;
double pkt_profile_freq;
zeek::Val* pkt_profile_file;
int load_sample_freq;
@ -154,47 +184,47 @@ int packet_filter_default;
int sig_max_group_size;
zeek::TableType* irc_join_list;
zeek::RecordType* irc_join_info;
int dpd_reassemble_first_packets;
int dpd_buffer_size;
int dpd_match_only_beginning;
int dpd_late_match_stop;
int dpd_ignore_ports;
zeek::TableVal* likely_server_ports;
int check_for_unused_event_handlers;
double timer_mgr_inactivity_timeout;
zeek::StringVal* trace_output_file;
int record_all_packets;
zeek::RecordType* script_id;
zeek::TableType* id_table;
zeek::RecordType* record_field;
zeek::TableType* record_field_table;
zeek::RecordType* call_argument;
zeek::VectorType* call_argument_vector;
zeek::StringVal* cmd_line_bpf_filter;
zeek::StringVal* global_hash_seed;
bro_uint_t bits_per_uid;
} // namespace zeek. The namespace has be closed here before we include the netvar_def files.
static void bif_init_event_handlers()
{
#include "event.bif.netvar_init"
}
static void bif_init_net_var()
{
#include "const.bif.netvar_init"
#include "types.bif.netvar_init"
#include "reporter.bif.netvar_init"
#include "supervisor.bif.netvar_init"
}
#include "const.bif.netvar_def"
#include "types.bif.netvar_def"
#include "event.bif.netvar_def"
#include "reporter.bif.netvar_def"
#include "supervisor.bif.netvar_def"
// Re-open the namespace now that the bif headers are all included.
namespace zeek {
void init_event_handlers()
{
#include "event.bif.netvar_init"
bif_init_event_handlers();
}
void init_general_global_var()
@ -213,10 +243,7 @@ extern void zeek_legacy_netvar_init();
void init_net_var()
{
#include "const.bif.netvar_init"
#include "types.bif.netvar_init"
#include "reporter.bif.netvar_init"
#include "supervisor.bif.netvar_init"
bif_init_net_var();
zeek::id::detail::init();
zeek_legacy_netvar_init();
@ -320,3 +347,71 @@ void init_net_var()
timer_mgr_inactivity_timeout = zeek::id::find_val("timer_mgr_inactivity_timeout")->AsInterval();
}
} // namespace zeek
// Remove in v4.1.
int& watchdog_interval = zeek::watchdog_interval;
int& max_timer_expires = zeek::max_timer_expires;
int& ignore_checksums = zeek::ignore_checksums;
int& partial_connection_ok = zeek::partial_connection_ok;
int& tcp_SYN_ack_ok = zeek::tcp_SYN_ack_ok;
int& tcp_match_undelivered = zeek::tcp_match_undelivered;
int& encap_hdr_size = zeek::encap_hdr_size;
double& frag_timeout = zeek::frag_timeout;
double& tcp_SYN_timeout = zeek::tcp_SYN_timeout;
double& tcp_session_timer = zeek::tcp_session_timer;
double& tcp_connection_linger = zeek::tcp_connection_linger;
double& tcp_attempt_delay = zeek::tcp_attempt_delay;
double& tcp_close_delay = zeek::tcp_close_delay;
double& tcp_partial_close_delay = zeek::tcp_partial_close_delay;
double& tcp_reset_delay = zeek::tcp_reset_delay;
int& tcp_max_initial_window = zeek::tcp_max_initial_window;
int& tcp_max_above_hole_without_any_acks = zeek::tcp_max_above_hole_without_any_acks;
int& tcp_excessive_data_without_further_acks = zeek::tcp_excessive_data_without_further_acks;
int& tcp_max_old_segments = zeek::tcp_max_old_segments;
double& non_analyzed_lifetime = zeek::non_analyzed_lifetime;
double& tcp_inactivity_timeout = zeek::tcp_inactivity_timeout;
double& udp_inactivity_timeout = zeek::udp_inactivity_timeout;
double& icmp_inactivity_timeout = zeek::icmp_inactivity_timeout;
int& tcp_storm_thresh = zeek::tcp_storm_thresh;
double& tcp_storm_interarrival_thresh = zeek::tcp_storm_interarrival_thresh;
bool& tcp_content_deliver_all_orig = zeek::tcp_content_deliver_all_orig;
bool& tcp_content_deliver_all_resp = zeek::tcp_content_deliver_all_resp;
bool& udp_content_deliver_all_orig = zeek::udp_content_deliver_all_orig;
bool& udp_content_deliver_all_resp = zeek::udp_content_deliver_all_resp;
bool& udp_content_delivery_ports_use_resp = zeek::udp_content_delivery_ports_use_resp;
double& dns_session_timeout = zeek::dns_session_timeout;
double& rpc_timeout = zeek::rpc_timeout;
int& mime_segment_length = zeek::mime_segment_length;
int& mime_segment_overlap_length = zeek::mime_segment_overlap_length;
int& http_entity_data_delivery_size = zeek::http_entity_data_delivery_size;
int& truncate_http_URI = zeek::truncate_http_URI;
int& dns_skip_all_auth = zeek::dns_skip_all_auth;
int& dns_skip_all_addl = zeek::dns_skip_all_addl;
int& dns_max_queries = zeek::dns_max_queries;
double& stp_delta = zeek::stp_delta;
double& stp_idle_min = zeek::stp_idle_min;
double& table_expire_interval = zeek::table_expire_interval;
double& table_expire_delay = zeek::table_expire_delay;
int& table_incremental_step = zeek::table_incremental_step;
int& orig_addr_anonymization = zeek::orig_addr_anonymization;
int& resp_addr_anonymization = zeek::resp_addr_anonymization;
int& other_addr_anonymization = zeek::other_addr_anonymization;
double& connection_status_update_interval = zeek::connection_status_update_interval;
double& profiling_interval = zeek::profiling_interval;
int& expensive_profiling_multiple = zeek::expensive_profiling_multiple;
int& segment_profiling = zeek::segment_profiling;
int& pkt_profile_mode = zeek::pkt_profile_mode;
double& pkt_profile_freq = zeek::pkt_profile_freq;
int& load_sample_freq = zeek::load_sample_freq;
int& packet_filter_default = zeek::packet_filter_default;
int& sig_max_group_size = zeek::sig_max_group_size;
int& dpd_reassemble_first_packets = zeek::dpd_reassemble_first_packets;
int& dpd_buffer_size = zeek::dpd_buffer_size;
int& dpd_match_only_beginning = zeek::dpd_match_only_beginning;
int& dpd_late_match_stop = zeek::dpd_late_match_stop;
int& dpd_ignore_ports = zeek::dpd_ignore_ports;
int& check_for_unused_event_handlers = zeek::check_for_unused_event_handlers;
double& timer_mgr_inactivity_timeout = zeek::timer_mgr_inactivity_timeout;
int& record_all_packets = zeek::record_all_packets;
bro_uint_t& bits_per_uid = zeek::bits_per_uid;