diff --git a/NEWS b/NEWS index fe2629d8a7..8e131e2838 100644 --- a/NEWS +++ b/NEWS @@ -180,6 +180,10 @@ Deprecated Functionality deprecated, but there's an equivalent name in ``zeek::BifType::`` of ``IntrusivePtr`` type to use instead. +- All generated ``BifConst::`` names are deprecated, but there's an + equivalent name now in ``zeek::BifCont::``, and changed to ``IntrusivePtr`` + if the old name was some ``Val*`` type. + Zeek 3.1.0 ========== diff --git a/aux/bifcl b/aux/bifcl index 5afd05f72b..7fdbbfdf5e 160000 --- a/aux/bifcl +++ b/aux/bifcl @@ -1 +1 @@ -Subproject commit 5afd05f72b52bd40637546203749fb7bed8dbc4d +Subproject commit 7fdbbfdf5ee3669a77f73360b86326344e15ea99 diff --git a/src/Hash.cc b/src/Hash.cc index 22249ad11d..a5a375750b 100644 --- a/src/Hash.cc +++ b/src/Hash.cc @@ -40,7 +40,7 @@ void KeyedHash::InitializeSeeds(const std::array& seed void KeyedHash::InitOptions() { - calculate_digest(Hash_SHA256, BifConst::digest_salt->Bytes(), BifConst::digest_salt->Len(), reinterpret_cast(cluster_highwayhash_key)); + calculate_digest(Hash_SHA256, zeek::BifConst::digest_salt->Bytes(), zeek::BifConst::digest_salt->Len(), reinterpret_cast(cluster_highwayhash_key)); } hash64_t KeyedHash::Hash64(const void* bytes, uint64_t size) diff --git a/src/ID.h b/src/ID.h index 7582dd5c81..065c144c89 100644 --- a/src/ID.h +++ b/src/ID.h @@ -212,6 +212,16 @@ IntrusivePtr lookup_val(std::string_view name) */ const IntrusivePtr& lookup_const(std::string_view name); +/** + * Lookup an ID by its name and return its value (as cast to @c T). + * A fatal occurs if the ID does not exist. + * @param name The identifier name to lookup + * @return The current value of the identifier. + */ +template +IntrusivePtr lookup_const(std::string_view name) + { return cast_intrusive(lookup_const(name)); } + /** * Lookup an ID by its name and return the function it references. * A fatal occurs if the ID does not exist or if it is not a function. diff --git a/src/Net.cc b/src/Net.cc index 9f8f28ba28..d7d6f59a14 100644 --- a/src/Net.cc +++ b/src/Net.cc @@ -283,7 +283,7 @@ void net_run() ready.reserve(iosource_mgr->TotalSize()); while ( iosource_mgr->Size() || - (BifConst::exit_only_after_terminate && ! terminating) ) + (zeek::BifConst::exit_only_after_terminate && ! terminating) ) { iosource_mgr->FindReadySources(&ready); @@ -314,8 +314,8 @@ void net_run() } } else if ( (have_pending_timers || communication_enabled || - BifConst::exit_only_after_terminate) && - ! pseudo_realtime ) + zeek::BifConst::exit_only_after_terminate) && + ! pseudo_realtime ) { // Take advantage of the lull to get up to // date on timers and events. Because we only diff --git a/src/Sessions.cc b/src/Sessions.cc index 8e04444298..56a40d0964 100644 --- a/src/Sessions.cc +++ b/src/Sessions.cc @@ -54,7 +54,7 @@ void IPTunnelTimer::Dispatch(double t, bool is_expire) double last_active = it->second.second; double inactive_time = t > last_active ? t - last_active : 0; - if ( inactive_time >= BifConst::Tunnel::ip_tunnel_timeout ) + if ( inactive_time >= zeek::BifConst::Tunnel::ip_tunnel_timeout ) // tunnel activity timed out, delete it from map sessions->ip_tunnels.erase(tunnel_idx); @@ -409,7 +409,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr case IPPROTO_GRE: { - if ( ! BifConst::Tunnel::enable_gre ) + if ( ! zeek::BifConst::Tunnel::enable_gre ) { Weird("GRE_tunnel", ip_hdr, encapsulation); return; @@ -561,14 +561,14 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr case IPPROTO_IPV4: case IPPROTO_IPV6: { - if ( ! BifConst::Tunnel::enable_ip ) + if ( ! zeek::BifConst::Tunnel::enable_ip ) { Weird("IP_tunnel", ip_hdr, encapsulation); return; } if ( encapsulation && - encapsulation->Depth() >= BifConst::Tunnel::max_depth ) + encapsulation->Depth() >= zeek::BifConst::Tunnel::max_depth ) { Weird("exceeded_tunnel_max_depth", ip_hdr, encapsulation); return; diff --git a/src/Sessions.h b/src/Sessions.h index 67589d8742..d5edf62291 100644 --- a/src/Sessions.h +++ b/src/Sessions.h @@ -243,7 +243,7 @@ protected: class IPTunnelTimer final : public Timer { public: IPTunnelTimer(double t, NetSessions::IPPair p) - : Timer(t + BifConst::Tunnel::ip_tunnel_timeout, + : Timer(t + zeek::BifConst::Tunnel::ip_tunnel_timeout, TIMER_IP_TUNNEL_INACTIVITY), tunnel_idx(p) {} ~IPTunnelTimer() override {} diff --git a/src/analyzer/protocol/ayiya/ayiya-analyzer.pac b/src/analyzer/protocol/ayiya/ayiya-analyzer.pac index 935e05d749..30a263d2bc 100644 --- a/src/analyzer/protocol/ayiya/ayiya-analyzer.pac +++ b/src/analyzer/protocol/ayiya/ayiya-analyzer.pac @@ -18,7 +18,7 @@ flow AYIYA_Flow Connection *c = connection()->bro_analyzer()->Conn(); const EncapsulationStack* e = c->GetEncapsulation(); - if ( e && e->Depth() >= BifConst::Tunnel::max_depth ) + if ( e && e->Depth() >= zeek::BifConst::Tunnel::max_depth ) { reporter->Weird(c, "tunnel_depth"); return false; diff --git a/src/analyzer/protocol/dce-rpc/dce_rpc-protocol.pac b/src/analyzer/protocol/dce-rpc/dce_rpc-protocol.pac index db1b487178..5263b20c93 100644 --- a/src/analyzer/protocol/dce-rpc/dce_rpc-protocol.pac +++ b/src/analyzer/protocol/dce-rpc/dce_rpc-protocol.pac @@ -210,14 +210,14 @@ flow DCE_RPC_Flow(is_orig: bool) { flowbuf->NewFrame(0, true); flowbuf->BufferData(frag.begin(), frag.end()); - if ( fb.size() > BifConst::DCE_RPC::max_cmd_reassembly ) + if ( fb.size() > zeek::BifConst::DCE_RPC::max_cmd_reassembly ) { reporter->Weird(connection()->bro_analyzer()->Conn(), "too_many_dce_rpc_msgs_in_reassembly"); connection()->bro_analyzer()->SetSkip(true); } - if ( flowbuf->data_length() > (int)BifConst::DCE_RPC::max_frag_data ) + if ( flowbuf->data_length() > (int)zeek::BifConst::DCE_RPC::max_frag_data ) { reporter->Weird(connection()->bro_analyzer()->Conn(), "too_much_dce_rpc_fragment_data"); @@ -233,7 +233,7 @@ flow DCE_RPC_Flow(is_orig: bool) { auto& flowbuf = it->second; flowbuf->BufferData(frag.begin(), frag.end()); - if ( flowbuf->data_length() > (int)BifConst::DCE_RPC::max_frag_data ) + if ( flowbuf->data_length() > (int)zeek::BifConst::DCE_RPC::max_frag_data ) { reporter->Weird(connection()->bro_analyzer()->Conn(), "too_much_dce_rpc_fragment_data"); diff --git a/src/analyzer/protocol/gtpv1/gtpv1-analyzer.pac b/src/analyzer/protocol/gtpv1/gtpv1-analyzer.pac index 6b06e0383a..e91d4499b3 100644 --- a/src/analyzer/protocol/gtpv1/gtpv1-analyzer.pac +++ b/src/analyzer/protocol/gtpv1/gtpv1-analyzer.pac @@ -652,7 +652,7 @@ flow GTPv1_Flow(is_orig: bool) connection()->set_valid(is_orig(), false); - if ( e && e->Depth() >= BifConst::Tunnel::max_depth ) + if ( e && e->Depth() >= zeek::BifConst::Tunnel::max_depth ) { reporter->Weird(c, "tunnel_depth"); return false; @@ -738,7 +738,7 @@ flow GTPv1_Flow(is_orig: bool) { connection()->set_valid(is_orig(), true); - if ( (! BifConst::Tunnel::delay_gtp_confirmation) || + if ( (! zeek::BifConst::Tunnel::delay_gtp_confirmation) || (connection()->valid(true) && connection()->valid(false)) ) a->ProtocolConfirmation(); } diff --git a/src/analyzer/protocol/http/HTTP.cc b/src/analyzer/protocol/http/HTTP.cc index f210f27644..875f371a43 100644 --- a/src/analyzer/protocol/http/HTTP.cc +++ b/src/analyzer/protocol/http/HTTP.cc @@ -810,7 +810,7 @@ void HTTP_Message::SetPlainDelivery(int64_t length) { content_line->SetPlainDelivery(length); - if ( length > 0 && BifConst::skip_http_data ) + if ( length > 0 && zeek::BifConst::skip_http_data ) content_line->SkipBytesAfterThisLine(length); } diff --git a/src/analyzer/protocol/krb/KRB.cc b/src/analyzer/protocol/krb/KRB.cc index da8af91e8e..5d66d7942a 100644 --- a/src/analyzer/protocol/krb/KRB.cc +++ b/src/analyzer/protocol/krb/KRB.cc @@ -35,10 +35,10 @@ static void warn_krb(const char* msg, krb5_context ctx, krb5_error_code code) void KRB_Analyzer::Initialize_Krb() { - if ( BifConst::KRB::keytab->Len() == 0 ) + if ( zeek::BifConst::KRB::keytab->Len() == 0 ) return; // no keytab set - const char* keytab_filename = BifConst::KRB::keytab->CheckString(); + const char* keytab_filename = zeek::BifConst::KRB::keytab->CheckString(); if ( access(keytab_filename, R_OK) != 0 ) { reporter->Warning("KRB: Can't access keytab (%s)", keytab_filename); diff --git a/src/analyzer/protocol/ncp/NCP.cc b/src/analyzer/protocol/ncp/NCP.cc index 31a39023e9..180d1164c9 100644 --- a/src/analyzer/protocol/ncp/NCP.cc +++ b/src/analyzer/protocol/ncp/NCP.cc @@ -129,7 +129,7 @@ int FrameBuffer::Deliver(int &len, const u_char* &data) if ( msg_len > buf_len ) { - if ( msg_len > BifConst::NCP::max_frame_size ) + if ( msg_len > zeek::BifConst::NCP::max_frame_size ) return 1; buf_len = msg_len; diff --git a/src/analyzer/protocol/rpc/NFS.cc b/src/analyzer/protocol/rpc/NFS.cc index c57e1eba38..3e343f2e73 100644 --- a/src/analyzer/protocol/rpc/NFS.cc +++ b/src/analyzer/protocol/rpc/NFS.cc @@ -302,15 +302,15 @@ StringVal* NFS_Interp::nfs3_file_data(const u_char*& buf, int& n, uint64_t offse const u_char *data = extract_XDR_opaque(buf, n, data_n, 1 << 30, true); // check whether we have to deliver data to the event - if ( ! BifConst::NFS3::return_data ) + if ( ! zeek::BifConst::NFS3::return_data ) return nullptr; - if ( BifConst::NFS3::return_data_first_only && offset != 0 ) + if ( zeek::BifConst::NFS3::return_data_first_only && offset != 0 ) return nullptr; // Ok, so we want to return some data data_n = std::min(data_n, size); - data_n = std::min(data_n, int(BifConst::NFS3::return_data_max)); + data_n = std::min(data_n, int(zeek::BifConst::NFS3::return_data_max)); if ( data && data_n > 0 ) return new StringVal(new BroString(data, data_n, false)); diff --git a/src/analyzer/protocol/smb/smb1-com-nt-create-andx.pac b/src/analyzer/protocol/smb/smb1-com-nt-create-andx.pac index 05fc5d3014..f07f9774e2 100644 --- a/src/analyzer/protocol/smb/smb1-com-nt-create-andx.pac +++ b/src/analyzer/protocol/smb/smb1-com-nt-create-andx.pac @@ -4,7 +4,7 @@ refine connection SMB_Conn += { auto filename = smb_string2stringval(${val.filename}); if ( ! ${header.is_pipe} && - BifConst::SMB::pipe_filenames->AsTable()->Lookup(filename->CheckString()) ) + zeek::BifConst::SMB::pipe_filenames->AsTable()->Lookup(filename->CheckString()) ) { set_tree_is_pipe(${header.tid}); diff --git a/src/analyzer/protocol/smb/smb2-com-create.pac b/src/analyzer/protocol/smb/smb2-com-create.pac index c8f8682b33..ff60931c9d 100644 --- a/src/analyzer/protocol/smb/smb2-com-create.pac +++ b/src/analyzer/protocol/smb/smb2-com-create.pac @@ -5,7 +5,7 @@ refine connection SMB_Conn += { auto filename = smb2_string2stringval(${val.filename}); if ( ! ${h.is_pipe} && - BifConst::SMB::pipe_filenames->AsTable()->Lookup(filename->CheckString()) ) + zeek::BifConst::SMB::pipe_filenames->AsTable()->Lookup(filename->CheckString()) ) { set_tree_is_pipe(${h.tree_id}); diff --git a/src/analyzer/protocol/ssl/dtls-protocol.pac b/src/analyzer/protocol/ssl/dtls-protocol.pac index 70897a585c..c54a62f251 100644 --- a/src/analyzer/protocol/ssl/dtls-protocol.pac +++ b/src/analyzer/protocol/ssl/dtls-protocol.pac @@ -73,11 +73,11 @@ refine connection SSL_Conn += { if ( bro_analyzer()->ProtocolConfirmed() ) { reported_errors_++; - if ( reported_errors_ <= BifConst::SSL::dtls_max_reported_version_errors ) + if ( reported_errors_ <= zeek::BifConst::SSL::dtls_max_reported_version_errors ) bro_analyzer()->ProtocolViolation(fmt("Invalid version in DTLS connection. Packet reported version: %d", version)); } - if ( invalid_version_count_ > BifConst::SSL::dtls_max_version_errors ) + if ( invalid_version_count_ > zeek::BifConst::SSL::dtls_max_version_errors ) bro_analyzer()->SetSkip(true); return false; } diff --git a/src/analyzer/protocol/tcp/TCP.cc b/src/analyzer/protocol/tcp/TCP.cc index 3522439cce..6233c3a0ad 100644 --- a/src/analyzer/protocol/tcp/TCP.cc +++ b/src/analyzer/protocol/tcp/TCP.cc @@ -2051,7 +2051,7 @@ bool TCPStats_Endpoint::DataSent(double /* t */, uint64_t seq, int len, int capl int64_t sequence_delta = top_seq - max_top_seq; if ( sequence_delta <= 0 ) { - if ( ! BifConst::ignore_keep_alive_rexmit || len > 1 || data_in_flight > 0 ) + if ( ! zeek::BifConst::ignore_keep_alive_rexmit || len > 1 || data_in_flight > 0 ) { ++num_rxmit; num_rxmit_bytes += len; diff --git a/src/analyzer/protocol/tcp/TCP_Reassembler.cc b/src/analyzer/protocol/tcp/TCP_Reassembler.cc index 9de7331255..1b251cfa10 100644 --- a/src/analyzer/protocol/tcp/TCP_Reassembler.cc +++ b/src/analyzer/protocol/tcp/TCP_Reassembler.cc @@ -135,7 +135,7 @@ static inline bool established_or_cleanly_closing(const TCP_Endpoint* a, static inline bool report_gap(const TCP_Endpoint* a, const TCP_Endpoint* b) { return content_gap && - ( BifConst::report_gaps_for_partial || + ( zeek::BifConst::report_gaps_for_partial || established_or_cleanly_closing(a, b) ); } @@ -210,7 +210,7 @@ void TCP_Reassembler::Undelivered(uint64_t up_to_seq) // to this method and only if this condition is not true). reporter->InternalError("Calling Undelivered for data that has already been delivered (or has already been marked as undelivered"); - if ( BifConst::detect_filtered_trace && last_reassem_seq == 1 && + if ( zeek::BifConst::detect_filtered_trace && last_reassem_seq == 1 && (endpoint->FIN_cnt > 0 || endpoint->RST_cnt > 0 || peer->FIN_cnt > 0 || peer->RST_cnt > 0) ) { @@ -539,7 +539,7 @@ void TCP_Reassembler::AckReceived(uint64_t seq) return; bool test_active = ! skip_deliveries && ! tcp_analyzer->Skipping() && - ( BifConst::report_gaps_for_partial || + ( zeek::BifConst::report_gaps_for_partial || (endp->state == TCP_ENDPOINT_ESTABLISHED && endp->peer->state == TCP_ENDPOINT_ESTABLISHED ) ); diff --git a/src/analyzer/protocol/teredo/Teredo.cc b/src/analyzer/protocol/teredo/Teredo.cc index fcd0f0323e..d5e8790fe3 100644 --- a/src/analyzer/protocol/teredo/Teredo.cc +++ b/src/analyzer/protocol/teredo/Teredo.cc @@ -161,7 +161,7 @@ void Teredo_Analyzer::DeliverPacket(int len, const u_char* data, bool orig, const EncapsulationStack* e = Conn()->GetEncapsulation(); - if ( e && e->Depth() >= BifConst::Tunnel::max_depth ) + if ( e && e->Depth() >= zeek::BifConst::Tunnel::max_depth ) { Weird("tunnel_depth", true); return; diff --git a/src/analyzer/protocol/teredo/Teredo.h b/src/analyzer/protocol/teredo/Teredo.h index 4abd9483e6..6b9975537c 100644 --- a/src/analyzer/protocol/teredo/Teredo.h +++ b/src/analyzer/protocol/teredo/Teredo.h @@ -42,7 +42,7 @@ public: */ void Confirm() { - if ( ! BifConst::Tunnel::delay_teredo_confirmation || + if ( ! zeek::BifConst::Tunnel::delay_teredo_confirmation || ( valid_orig && valid_resp ) ) ProtocolConfirmation(); } diff --git a/src/analyzer/protocol/udp/UDP.cc b/src/analyzer/protocol/udp/UDP.cc index 50c73fd51e..518050a1c7 100644 --- a/src/analyzer/protocol/udp/UDP.cc +++ b/src/analyzer/protocol/udp/UDP.cc @@ -81,7 +81,7 @@ void UDP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig, if ( chksum == 0 ) validate_checksum = false; else - validate_checksum = BifConst::Tunnel::validate_vxlan_checksums; + validate_checksum = zeek::BifConst::Tunnel::validate_vxlan_checksums; } } diff --git a/src/analyzer/protocol/vxlan/VXLAN.cc b/src/analyzer/protocol/vxlan/VXLAN.cc index eb4e0e5926..d633649ae6 100644 --- a/src/analyzer/protocol/vxlan/VXLAN.cc +++ b/src/analyzer/protocol/vxlan/VXLAN.cc @@ -48,7 +48,7 @@ void VXLAN_Analyzer::DeliverPacket(int len, const u_char* data, bool orig, const EncapsulationStack* estack = Conn()->GetEncapsulation(); - if ( estack && estack->Depth() >= BifConst::Tunnel::max_depth ) + if ( estack && estack->Depth() >= zeek::BifConst::Tunnel::max_depth ) { reporter->Weird(Conn(), "tunnel_depth"); return; diff --git a/src/input/Manager.cc b/src/input/Manager.cc index ed4701e127..e9f80cb6ad 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -405,7 +405,7 @@ bool Manager::CreateEventStream(RecordVal* fval) return false; } - allow_file_func = BifConst::Input::accept_unsupported_types; + allow_file_func = zeek::BifConst::Input::accept_unsupported_types; } @@ -637,7 +637,7 @@ bool Manager::CreateTableStream(RecordVal* fval) int idxfields = fieldsV.size(); if ( val ) // if we are not a set - status = status || ! UnrollRecordType(&fieldsV, val.get(), "", BifConst::Input::accept_unsupported_types); + status = status || ! UnrollRecordType(&fieldsV, val.get(), "", zeek::BifConst::Input::accept_unsupported_types); int valfields = fieldsV.size() - idxfields; diff --git a/src/input/readers/ascii/Ascii.cc b/src/input/readers/ascii/Ascii.cc index 3b108e365c..c3950cdc59 100644 --- a/src/input/readers/ascii/Ascii.cc +++ b/src/input/readers/ascii/Ascii.cc @@ -67,23 +67,23 @@ bool Ascii::DoInit(const ReaderInfo& info, int num_fields, const Field* const* f { StopWarningSuppression(); - separator.assign( (const char*) BifConst::InputAscii::separator->Bytes(), - BifConst::InputAscii::separator->Len()); + separator.assign( (const char*) zeek::BifConst::InputAscii::separator->Bytes(), + zeek::BifConst::InputAscii::separator->Len()); - set_separator.assign( (const char*) BifConst::InputAscii::set_separator->Bytes(), - BifConst::InputAscii::set_separator->Len()); + set_separator.assign( (const char*) zeek::BifConst::InputAscii::set_separator->Bytes(), + zeek::BifConst::InputAscii::set_separator->Len()); - empty_field.assign( (const char*) BifConst::InputAscii::empty_field->Bytes(), - BifConst::InputAscii::empty_field->Len()); + empty_field.assign( (const char*) zeek::BifConst::InputAscii::empty_field->Bytes(), + zeek::BifConst::InputAscii::empty_field->Len()); - unset_field.assign( (const char*) BifConst::InputAscii::unset_field->Bytes(), - BifConst::InputAscii::unset_field->Len()); + unset_field.assign( (const char*) zeek::BifConst::InputAscii::unset_field->Bytes(), + zeek::BifConst::InputAscii::unset_field->Len()); - fail_on_invalid_lines = BifConst::InputAscii::fail_on_invalid_lines; - fail_on_file_problem = BifConst::InputAscii::fail_on_file_problem; + fail_on_invalid_lines = zeek::BifConst::InputAscii::fail_on_invalid_lines; + fail_on_file_problem = zeek::BifConst::InputAscii::fail_on_file_problem; - path_prefix.assign((const char*) BifConst::InputAscii::path_prefix->Bytes(), - BifConst::InputAscii::path_prefix->Len()); + path_prefix.assign((const char*) zeek::BifConst::InputAscii::path_prefix->Bytes(), + zeek::BifConst::InputAscii::path_prefix->Len()); // Set per-filter configuration options. for ( ReaderInfo::config_map::const_iterator i = info.config.begin(); i != info.config.end(); i++ ) diff --git a/src/input/readers/benchmark/Benchmark.cc b/src/input/readers/benchmark/Benchmark.cc index a7b0cc7c44..26975ad411 100644 --- a/src/input/readers/benchmark/Benchmark.cc +++ b/src/input/readers/benchmark/Benchmark.cc @@ -18,15 +18,15 @@ using threading::Field; Benchmark::Benchmark(ReaderFrontend *frontend) : ReaderBackend(frontend) { num_lines = 0; - multiplication_factor = double(BifConst::InputBenchmark::factor); - autospread = double(BifConst::InputBenchmark::autospread); - spread = int(BifConst::InputBenchmark::spread); - add = int(BifConst::InputBenchmark::addfactor); + multiplication_factor = double(zeek::BifConst::InputBenchmark::factor); + autospread = double(zeek::BifConst::InputBenchmark::autospread); + spread = int(zeek::BifConst::InputBenchmark::spread); + add = int(zeek::BifConst::InputBenchmark::addfactor); autospread_time = 0; - stopspreadat = int(BifConst::InputBenchmark::stopspreadat); - timedspread = double(BifConst::InputBenchmark::timedspread); + stopspreadat = int(zeek::BifConst::InputBenchmark::stopspreadat); + timedspread = double(zeek::BifConst::InputBenchmark::timedspread); heartbeatstarttime = 0; - heartbeat_interval = double(BifConst::Threading::heartbeat_interval); + heartbeat_interval = double(zeek::BifConst::Threading::heartbeat_interval); ascii = new threading::formatter::Ascii(this, threading::formatter::Ascii::SeparatorInfo()); } diff --git a/src/input/readers/binary/Binary.cc b/src/input/readers/binary/Binary.cc index 9aa815cb47..77db68a80e 100644 --- a/src/input/readers/binary/Binary.cc +++ b/src/input/readers/binary/Binary.cc @@ -19,7 +19,7 @@ Binary::Binary(ReaderFrontend *frontend) { if ( ! chunk_size ) { - chunk_size = BifConst::InputBinary::chunk_size; + chunk_size = zeek::BifConst::InputBinary::chunk_size; if ( ! chunk_size ) chunk_size = 1024; @@ -82,8 +82,8 @@ bool Binary::DoInit(const ReaderInfo& info, int num_fields, ino = 0; firstrun = true; - path_prefix.assign((const char*) BifConst::InputBinary::path_prefix->Bytes(), - BifConst::InputBinary::path_prefix->Len()); + path_prefix.assign((const char*) zeek::BifConst::InputBinary::path_prefix->Bytes(), + zeek::BifConst::InputBinary::path_prefix->Len()); if ( ! info.source || strlen(info.source) == 0 ) { diff --git a/src/input/readers/config/Config.cc b/src/input/readers/config/Config.cc index 60437eb825..9ed946ba9b 100644 --- a/src/input/readers/config/Config.cc +++ b/src/input/readers/config/Config.cc @@ -63,13 +63,13 @@ void Config::DoClose() bool Config::DoInit(const ReaderInfo& info, int num_fields, const Field* const* fields) { - fail_on_file_problem = BifConst::InputConfig::fail_on_file_problem; + fail_on_file_problem = zeek::BifConst::InputConfig::fail_on_file_problem; - set_separator.assign( (const char*) BifConst::InputConfig::set_separator->Bytes(), - BifConst::InputConfig::set_separator->Len()); + set_separator.assign( (const char*) zeek::BifConst::InputConfig::set_separator->Bytes(), + zeek::BifConst::InputConfig::set_separator->Len()); - empty_field.assign( (const char*) BifConst::InputConfig::empty_field->Bytes(), - BifConst::InputConfig::empty_field->Len()); + empty_field.assign( (const char*) zeek::BifConst::InputConfig::empty_field->Bytes(), + zeek::BifConst::InputConfig::empty_field->Len()); formatter::Ascii::SeparatorInfo sep_info("\t", set_separator, "", empty_field); formatter = std::unique_ptr(new formatter::Ascii(this, sep_info)); diff --git a/src/input/readers/raw/Raw.cc b/src/input/readers/raw/Raw.cc index b8bfbdb1da..d1dd8c9aac 100644 --- a/src/input/readers/raw/Raw.cc +++ b/src/input/readers/raw/Raw.cc @@ -34,10 +34,10 @@ Raw::Raw(ReaderFrontend *frontend) : ReaderBackend(frontend), file(nullptr, fclo ino = 0; forcekill = false; offset = 0; - separator.assign( (const char*) BifConst::InputRaw::record_separator->Bytes(), - BifConst::InputRaw::record_separator->Len()); + separator.assign( (const char*) zeek::BifConst::InputRaw::record_separator->Bytes(), + zeek::BifConst::InputRaw::record_separator->Len()); - sep_length = BifConst::InputRaw::record_separator->Len(); + sep_length = zeek::BifConst::InputRaw::record_separator->Len(); bufpos = 0; diff --git a/src/input/readers/sqlite/SQLite.cc b/src/input/readers/sqlite/SQLite.cc index e5e3a133e4..fccb9a5b0b 100644 --- a/src/input/readers/sqlite/SQLite.cc +++ b/src/input/readers/sqlite/SQLite.cc @@ -24,18 +24,18 @@ SQLite::SQLite(ReaderFrontend *frontend) fields(), num_fields(), mode(), started(), query(), db(), st() { set_separator.assign( - (const char*) BifConst::LogSQLite::set_separator->Bytes(), - BifConst::InputSQLite::set_separator->Len() + (const char*) zeek::BifConst::LogSQLite::set_separator->Bytes(), + zeek::BifConst::InputSQLite::set_separator->Len() ); unset_field.assign( - (const char*) BifConst::LogSQLite::unset_field->Bytes(), - BifConst::InputSQLite::unset_field->Len() + (const char*) zeek::BifConst::LogSQLite::unset_field->Bytes(), + zeek::BifConst::InputSQLite::unset_field->Len() ); empty_field.assign( - (const char*) BifConst::LogAscii::empty_field->Bytes(), - BifConst::InputSQLite::empty_field->Len() + (const char*) zeek::BifConst::LogAscii::empty_field->Bytes(), + zeek::BifConst::InputSQLite::empty_field->Len() ); io = new threading::formatter::Ascii(this, threading::formatter::Ascii::SeparatorInfo(std::string(), set_separator, unset_field, empty_field)); diff --git a/src/iosource/Manager.cc b/src/iosource/Manager.cc index 6ffc924ab8..d97b585894 100644 --- a/src/iosource/Manager.cc +++ b/src/iosource/Manager.cc @@ -115,7 +115,7 @@ void Manager::FindReadySources(std::vector* ready) // If there aren't any sources and exit_only_after_terminate is false, just // return an empty set of sources. We want the main loop to end. - if ( Size() == 0 && ( ! BifConst::exit_only_after_terminate || terminating ) ) + if ( Size() == 0 && ( ! zeek::BifConst::exit_only_after_terminate || terminating ) ) return; double timeout = -1; diff --git a/src/iosource/PktSrc.cc b/src/iosource/PktSrc.cc index 0aa1a2568e..8c0432425b 100644 --- a/src/iosource/PktSrc.cc +++ b/src/iosource/PktSrc.cc @@ -271,7 +271,7 @@ bool PktSrc::PrecompileBPFFilter(int index, const std::string& filter) // Compile filter. BPF_Program* code = new BPF_Program(); - if ( ! code->Compile(BifConst::Pcap::snaplen, LinkType(), filter.c_str(), Netmask(), errbuf, sizeof(errbuf)) ) + if ( ! code->Compile(zeek::BifConst::Pcap::snaplen, LinkType(), filter.c_str(), Netmask(), errbuf, sizeof(errbuf)) ) { std::string msg = fmt("cannot compile BPF filter \"%s\"", filter.c_str()); diff --git a/src/iosource/pcap/Dumper.cc b/src/iosource/pcap/Dumper.cc index 5bbf12dfa6..d161adda88 100644 --- a/src/iosource/pcap/Dumper.cc +++ b/src/iosource/pcap/Dumper.cc @@ -27,7 +27,7 @@ void PcapDumper::Open() { int linktype = -1; - pd = pcap_open_dead(DLT_EN10MB, BifConst::Pcap::snaplen); + pd = pcap_open_dead(DLT_EN10MB, zeek::BifConst::Pcap::snaplen); if ( ! pd ) { diff --git a/src/iosource/pcap/Source.cc b/src/iosource/pcap/Source.cc index 31599139ac..8df5111da0 100644 --- a/src/iosource/pcap/Source.cc +++ b/src/iosource/pcap/Source.cc @@ -111,7 +111,7 @@ void PcapSource::OpenLive() return; } - if ( pcap_set_snaplen(pd, BifConst::Pcap::snaplen) ) + if ( pcap_set_snaplen(pd, zeek::BifConst::Pcap::snaplen) ) { PcapError("pcap_set_snaplen"); return; @@ -137,7 +137,7 @@ void PcapSource::OpenLive() return; } - if ( pcap_set_buffer_size(pd, BifConst::Pcap::bufsize * 1024 * 1024) ) + if ( pcap_set_buffer_size(pd, zeek::BifConst::Pcap::bufsize * 1024 * 1024) ) { PcapError("pcap_set_buffer_size"); return; diff --git a/src/logging/writers/ascii/Ascii.cc b/src/logging/writers/ascii/Ascii.cc index 8c502b498b..47cceeb738 100644 --- a/src/logging/writers/ascii/Ascii.cc +++ b/src/logging/writers/ascii/Ascii.cc @@ -35,47 +35,47 @@ Ascii::Ascii(WriterFrontend* frontend) : WriterBackend(frontend) void Ascii::InitConfigOptions() { - output_to_stdout = BifConst::LogAscii::output_to_stdout; - include_meta = BifConst::LogAscii::include_meta; - use_json = BifConst::LogAscii::use_json; - enable_utf_8 = BifConst::LogAscii::enable_utf_8; - gzip_level = BifConst::LogAscii::gzip_level; + output_to_stdout = zeek::BifConst::LogAscii::output_to_stdout; + include_meta = zeek::BifConst::LogAscii::include_meta; + use_json = zeek::BifConst::LogAscii::use_json; + enable_utf_8 = zeek::BifConst::LogAscii::enable_utf_8; + gzip_level = zeek::BifConst::LogAscii::gzip_level; separator.assign( - (const char*) BifConst::LogAscii::separator->Bytes(), - BifConst::LogAscii::separator->Len() + (const char*) zeek::BifConst::LogAscii::separator->Bytes(), + zeek::BifConst::LogAscii::separator->Len() ); set_separator.assign( - (const char*) BifConst::LogAscii::set_separator->Bytes(), - BifConst::LogAscii::set_separator->Len() + (const char*) zeek::BifConst::LogAscii::set_separator->Bytes(), + zeek::BifConst::LogAscii::set_separator->Len() ); empty_field.assign( - (const char*) BifConst::LogAscii::empty_field->Bytes(), - BifConst::LogAscii::empty_field->Len() + (const char*) zeek::BifConst::LogAscii::empty_field->Bytes(), + zeek::BifConst::LogAscii::empty_field->Len() ); unset_field.assign( - (const char*) BifConst::LogAscii::unset_field->Bytes(), - BifConst::LogAscii::unset_field->Len() + (const char*) zeek::BifConst::LogAscii::unset_field->Bytes(), + zeek::BifConst::LogAscii::unset_field->Len() ); meta_prefix.assign( - (const char*) BifConst::LogAscii::meta_prefix->Bytes(), - BifConst::LogAscii::meta_prefix->Len() + (const char*) zeek::BifConst::LogAscii::meta_prefix->Bytes(), + zeek::BifConst::LogAscii::meta_prefix->Len() ); ODesc tsfmt; - BifConst::LogAscii::json_timestamps->Describe(&tsfmt); + zeek::BifConst::LogAscii::json_timestamps->Describe(&tsfmt); json_timestamps.assign( (const char*) tsfmt.Bytes(), tsfmt.Len() ); gzip_file_extension.assign( - (const char*) BifConst::LogAscii::gzip_file_extension->Bytes(), - BifConst::LogAscii::gzip_file_extension->Len() + (const char*) zeek::BifConst::LogAscii::gzip_file_extension->Bytes(), + zeek::BifConst::LogAscii::gzip_file_extension->Len() ); } diff --git a/src/logging/writers/none/None.cc b/src/logging/writers/none/None.cc index a668dde3cc..3ab4f049aa 100644 --- a/src/logging/writers/none/None.cc +++ b/src/logging/writers/none/None.cc @@ -12,7 +12,7 @@ using namespace writer; bool None::DoInit(const WriterInfo& info, int num_fields, const threading::Field* const * fields) { - if ( BifConst::LogNone::debug ) + if ( zeek::BifConst::LogNone::debug ) { std::cout << "[logging::writer::None]" << std::endl; std::cout << " path=" << info.path << std::endl; diff --git a/src/logging/writers/sqlite/SQLite.cc b/src/logging/writers/sqlite/SQLite.cc index 5043ad75c6..b0ac37afa3 100644 --- a/src/logging/writers/sqlite/SQLite.cc +++ b/src/logging/writers/sqlite/SQLite.cc @@ -22,18 +22,18 @@ SQLite::SQLite(WriterFrontend* frontend) fields(), num_fields(), db(), st() { set_separator.assign( - (const char*) BifConst::LogSQLite::set_separator->Bytes(), - BifConst::LogSQLite::set_separator->Len() + (const char*) zeek::BifConst::LogSQLite::set_separator->Bytes(), + zeek::BifConst::LogSQLite::set_separator->Len() ); unset_field.assign( - (const char*) BifConst::LogSQLite::unset_field->Bytes(), - BifConst::LogSQLite::unset_field->Len() + (const char*) zeek::BifConst::LogSQLite::unset_field->Bytes(), + zeek::BifConst::LogSQLite::unset_field->Len() ); empty_field.assign( - (const char*) BifConst::LogSQLite::empty_field->Bytes(), - BifConst::LogSQLite::empty_field->Len() + (const char*) zeek::BifConst::LogSQLite::empty_field->Bytes(), + zeek::BifConst::LogSQLite::empty_field->Len() ); threading::formatter::Ascii::SeparatorInfo sep_info(string(), set_separator, unset_field, empty_field); diff --git a/src/main.cc b/src/main.cc index b107dd213c..3cd648a0aa 100644 --- a/src/main.cc +++ b/src/main.cc @@ -18,7 +18,7 @@ int main(int argc, char** argv) auto& options = setup_result.options; auto do_net_run = iosource_mgr->Size() > 0 || have_pending_timers || - BifConst::exit_only_after_terminate; + zeek::BifConst::exit_only_after_terminate; if ( do_net_run ) { diff --git a/src/threading/Manager.cc b/src/threading/Manager.cc index e5562a0ddd..d7d3676f95 100644 --- a/src/threading/Manager.cc +++ b/src/threading/Manager.cc @@ -125,7 +125,7 @@ void Manager::SendHeartbeats() void Manager::StartHeartbeatTimer() { heartbeat_timer_running = true; - timer_mgr->Add(new HeartbeatTimer(network_time + BifConst::Threading::heartbeat_interval)); + timer_mgr->Add(new HeartbeatTimer(network_time + zeek::BifConst::Threading::heartbeat_interval)); } void Manager::Flush() @@ -135,7 +135,7 @@ void Manager::Flush() if ( network_time && (network_time > next_beat || ! next_beat) ) { do_beat = true; - next_beat = ::network_time + BifConst::Threading::heartbeat_interval; + next_beat = ::network_time + zeek::BifConst::Threading::heartbeat_interval; } did_process = false;