diff --git a/src/Func.cc b/src/Func.cc index e71e431904..d7fa698e8a 100644 --- a/src/Func.cc +++ b/src/Func.cc @@ -321,7 +321,7 @@ IntrusivePtr BroFunc::Call(const zeek::Args& args, Frame* parent) const { // Can only happen for events and hooks. assert(Flavor() == FUNC_FLAVOR_EVENT || Flavor() == FUNC_FLAVOR_HOOK); - return Flavor() == FUNC_FLAVOR_HOOK ? IntrusivePtr{AdoptRef{}, val_mgr->GetTrue()} : nullptr; + return Flavor() == FUNC_FLAVOR_HOOK ? val_mgr->True() : nullptr; } auto f = make_intrusive(frame_size, this, &args); @@ -407,7 +407,7 @@ IntrusivePtr BroFunc::Call(const zeek::Args& args, Frame* parent) const if ( flow == FLOW_BREAK ) { // Short-circuit execution of remaining hook handler bodies. - result = {AdoptRef{}, val_mgr->GetFalse()}; + result = val_mgr->False(); break; } } @@ -418,7 +418,7 @@ IntrusivePtr BroFunc::Call(const zeek::Args& args, Frame* parent) const if ( Flavor() == FUNC_FLAVOR_HOOK ) { if ( ! result ) - result = {AdoptRef{}, val_mgr->GetTrue()}; + result = val_mgr->True(); } // Warn if the function returns something, but we returned from diff --git a/src/analyzer/analyzer.bif b/src/analyzer/analyzer.bif index f4c69fba91..83e0602db5 100644 --- a/src/analyzer/analyzer.bif +++ b/src/analyzer/analyzer.bif @@ -36,7 +36,7 @@ function Analyzer::__schedule_analyzer%(orig: addr, resp: addr, resp_p: port, analyzer: Analyzer::Tag, tout: interval%) : bool %{ analyzer_mgr->ScheduleAnalyzer(orig->AsAddr(), resp->AsAddr(), resp_p, analyzer->AsEnumVal(), tout); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function __name%(atype: Analyzer::Tag%) : string diff --git a/src/analyzer/protocol/conn-size/functions.bif b/src/analyzer/protocol/conn-size/functions.bif index f6da9c61a8..d31cb5e434 100644 --- a/src/analyzer/protocol/conn-size/functions.bif +++ b/src/analyzer/protocol/conn-size/functions.bif @@ -35,11 +35,11 @@ function set_current_conn_bytes_threshold%(cid: conn_id, threshold: count, is_or %{ analyzer::Analyzer* a = GetConnsizeAnalyzer(cid); if ( ! a ) - return val_mgr->GetFalse(); + return val_mgr->False(); static_cast(a)->SetByteAndPacketThreshold(threshold, true, is_orig); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Sets a threshold for connection packets, overwtiting any potential old thresholds. @@ -59,11 +59,11 @@ function set_current_conn_packets_threshold%(cid: conn_id, threshold: count, is_ %{ analyzer::Analyzer* a = GetConnsizeAnalyzer(cid); if ( ! a ) - return val_mgr->GetFalse(); + return val_mgr->False(); static_cast(a)->SetByteAndPacketThreshold(threshold, false, is_orig); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Sets the current duration threshold for connection, overwriting any potential old @@ -81,11 +81,11 @@ function set_current_conn_duration_threshold%(cid: conn_id, threshold: interval% %{ analyzer::Analyzer* a = GetConnsizeAnalyzer(cid); if ( ! a ) - return val_mgr->GetFalse(); + return val_mgr->False(); static_cast(a)->SetDurationThreshold(threshold); - return val_mgr->GetTrue(); + return val_mgr->True(); %} # Gets the current byte threshold size for a connection. diff --git a/src/analyzer/protocol/ftp/functions.bif b/src/analyzer/protocol/ftp/functions.bif index 4207ff3e13..46a53d146c 100644 --- a/src/analyzer/protocol/ftp/functions.bif +++ b/src/analyzer/protocol/ftp/functions.bif @@ -41,7 +41,7 @@ static Val* parse_port(const char* line) { r->Assign(0, make_intrusive(uint32_t(0))); r->Assign(1, val_mgr->GetPort(0, TRANSPORT_TCP)); - r->Assign(2, val_mgr->GetFalse()); + r->Assign(2, val_mgr->False()); } return r; diff --git a/src/analyzer/protocol/icmp/ICMP.cc b/src/analyzer/protocol/icmp/ICMP.cc index bb3b4fcedd..96bc7d9ef9 100644 --- a/src/analyzer/protocol/icmp/ICMP.cc +++ b/src/analyzer/protocol/icmp/ICMP.cc @@ -424,7 +424,7 @@ RecordVal* ICMP_Analyzer::ExtractICMP6Context(int len, const u_char*& data) iprec->Assign(3, val_mgr->GetCount(frag_offset)); iprec->Assign(4, val_mgr->GetBool(bad_hdr_len)); // bad_checksum is always false since IPv6 layer doesn't have a checksum. - iprec->Assign(5, val_mgr->GetFalse()); + iprec->Assign(5, val_mgr->False()); iprec->Assign(6, val_mgr->GetBool(MF)); iprec->Assign(7, val_mgr->GetBool(DF)); diff --git a/src/analyzer/protocol/login/RSH.cc b/src/analyzer/protocol/login/RSH.cc index 4b5b81d3c7..0bafcd206c 100644 --- a/src/analyzer/protocol/login/RSH.cc +++ b/src/analyzer/protocol/login/RSH.cc @@ -190,9 +190,9 @@ void Rsh_Analyzer::DeliverStream(int len, const u_char* data, bool orig) { if ( contents_orig->RshSaveState() == RSH_SERVER_USER_NAME ) // First input - vl.emplace_back(AdoptRef{}, val_mgr->GetTrue()); + vl.emplace_back(val_mgr->True()); else - vl.emplace_back(AdoptRef{}, val_mgr->GetFalse()); + vl.emplace_back(val_mgr->False()); EnqueueConnEvent(rsh_request, std::move(vl)); } diff --git a/src/analyzer/protocol/login/functions.bif b/src/analyzer/protocol/login/functions.bif index 99a4cac6ff..abb42f9689 100644 --- a/src/analyzer/protocol/login/functions.bif +++ b/src/analyzer/protocol/login/functions.bif @@ -28,11 +28,11 @@ function get_login_state%(cid: conn_id%): count %{ Connection* c = sessions->FindConnection(cid); if ( ! c ) - return val_mgr->GetFalse(); + return val_mgr->False(); analyzer::Analyzer* la = c->FindAnalyzer("Login"); if ( ! la ) - return val_mgr->GetFalse(); + return val_mgr->False(); return val_mgr->GetCount(int(static_cast(la)->LoginState())); %} @@ -52,12 +52,12 @@ function set_login_state%(cid: conn_id, new_state: count%): bool %{ Connection* c = sessions->FindConnection(cid); if ( ! c ) - return val_mgr->GetFalse(); + return val_mgr->False(); analyzer::Analyzer* la = c->FindAnalyzer("Login"); if ( ! la ) - return val_mgr->GetFalse(); + return val_mgr->False(); static_cast(la)->SetLoginState(analyzer::login::login_state(new_state)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} diff --git a/src/analyzer/protocol/tcp/functions.bif b/src/analyzer/protocol/tcp/functions.bif index 7b0e2b6876..2eb3aa4f60 100644 --- a/src/analyzer/protocol/tcp/functions.bif +++ b/src/analyzer/protocol/tcp/functions.bif @@ -99,10 +99,10 @@ function set_contents_file%(cid: conn_id, direction: count, f: file%): bool %{ Connection* c = sessions->FindConnection(cid); if ( ! c ) - return val_mgr->GetFalse(); + return val_mgr->False(); c->GetRootAnalyzer()->SetContentsFile(direction, f); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Returns the file handle of the contents file of a connection. diff --git a/src/broker/comm.bif b/src/broker/comm.bif index 8748788622..8810a7be11 100644 --- a/src/broker/comm.bif +++ b/src/broker/comm.bif @@ -70,11 +70,11 @@ function Broker::__peer%(a: string, p: port, retry: interval%): bool if ( ! p->IsTCP() ) { builtin_error("remote connection port must use tcp"); - return val_mgr->GetFalse(); + return val_mgr->False(); } broker_mgr->Peer(a->CheckString(), p->Port(), retry); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__unpeer%(a: string, p: port%): bool @@ -84,11 +84,11 @@ function Broker::__unpeer%(a: string, p: port%): bool if ( ! p->IsTCP() ) { builtin_error("remote connection port must use tcp"); - return val_mgr->GetFalse(); + return val_mgr->False(); } broker_mgr->Unpeer(a->CheckString(), p->Port()); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__peers%(%): PeerInfos diff --git a/src/broker/data.bif b/src/broker/data.bif index 7daca31b14..79d87bb76d 100644 --- a/src/broker/data.bif +++ b/src/broker/data.bif @@ -49,7 +49,7 @@ function Broker::__opaque_clone_through_serialization%(d: any%): any if ( ! x ) { builtin_error("cannot serialize object to clone"); - return val_mgr->GetFalse(); + return val_mgr->False(); } return OpaqueVal::Unserialize(std::move(*x)).release(); @@ -65,7 +65,7 @@ function Broker::__set_clear%(s: Broker::Data%): bool auto& v = bro_broker::require_data_type(s->AsRecordVal(), TYPE_TABLE, frame); v.clear(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__set_size%(s: Broker::Data%): count @@ -84,7 +84,7 @@ function Broker::__set_contains%(s: Broker::Data, key: any%): bool if ( ! k ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } return val_mgr->GetBool(v.find(*k) != v.end()); @@ -100,7 +100,7 @@ function Broker::__set_insert%(s: Broker::Data, key: any%): bool if ( ! k ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } return val_mgr->GetBool(v.insert(std::move(*k)).second); @@ -115,7 +115,7 @@ function Broker::__set_remove%(s: Broker::Data, key: any%): bool if ( ! k ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } return val_mgr->GetBool(v.erase(*k) > 0); @@ -137,7 +137,7 @@ function Broker::__set_iterator_next%(it: opaque of Broker::SetIterator%): bool auto set_it = static_cast(it); if ( set_it->it == set_it->dat.end() ) - return val_mgr->GetFalse(); + return val_mgr->False(); ++set_it->it; return val_mgr->GetBool(set_it->it != set_it->dat.end()); @@ -168,7 +168,7 @@ function Broker::__table_clear%(t: Broker::Data%): bool auto& v = bro_broker::require_data_type(t->AsRecordVal(), TYPE_TABLE, frame); v.clear(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__table_size%(t: Broker::Data%): count @@ -188,7 +188,7 @@ function Broker::__table_contains%(t: Broker::Data, key: any%): bool if ( ! k ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } return val_mgr->GetBool(v.find(*k) != v.end()); @@ -291,7 +291,7 @@ function Broker::__table_iterator_next%(it: opaque of Broker::TableIterator%): b auto ti = static_cast(it); if ( ti->it == ti->dat.end() ) - return val_mgr->GetFalse(); + return val_mgr->False(); ++ti->it; return val_mgr->GetBool(ti->it != ti->dat.end()); @@ -327,7 +327,7 @@ function Broker::__vector_clear%(v: Broker::Data%): bool auto& vec = bro_broker::require_data_type(v->AsRecordVal(), TYPE_VECTOR, frame); vec.clear(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__vector_size%(v: Broker::Data%): count @@ -346,12 +346,12 @@ function Broker::__vector_insert%(v: Broker::Data, idx:count, d: any%): bool if ( ! item ) { builtin_error("invalid Broker data conversion for item argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } idx = min(idx, static_cast(vec.size())); vec.insert(vec.begin() + idx, std::move(*item)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__vector_replace%(v: Broker::Data, idx: count, d: any%): Broker::Data @@ -363,7 +363,7 @@ function Broker::__vector_replace%(v: Broker::Data, idx: count, d: any%): Broker if ( ! item ) { builtin_error("invalid Broker data conversion for item argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( idx >= vec.size() ) @@ -414,7 +414,7 @@ function Broker::__vector_iterator_next%(it: opaque of Broker::VectorIterator%): auto vi = static_cast(it); if ( vi->it == vi->dat.end() ) - return val_mgr->GetFalse(); + return val_mgr->False(); ++vi->it; return val_mgr->GetBool(vi->it != vi->dat.end()); @@ -452,18 +452,18 @@ function Broker::__record_assign%(r: Broker::Data, idx: count, d: any%): bool auto& v = bro_broker::require_data_type(r->AsRecordVal(), TYPE_RECORD, frame); if ( idx >= v.size() ) - return val_mgr->GetFalse(); + return val_mgr->False(); auto item = bro_broker::val_to_data(d); if ( ! item ) { builtin_error("invalid Broker data conversion for item argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } v[idx] = std::move(*item); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__record_lookup%(r: Broker::Data, idx: count%): Broker::Data @@ -493,7 +493,7 @@ function Broker::__record_iterator_next%(it: opaque of Broker::RecordIterator%): auto ri = static_cast(it); if ( ri->it == ri->dat.end() ) - return val_mgr->GetFalse(); + return val_mgr->False(); ++ri->it; return val_mgr->GetBool(ri->it != ri->dat.end()); diff --git a/src/broker/messaging.bif b/src/broker/messaging.bif index 125710865a..97cf4ea321 100644 --- a/src/broker/messaging.bif +++ b/src/broker/messaging.bif @@ -192,7 +192,7 @@ function Cluster::publish_rr%(pool: Pool, key: string, ...%): bool auto topic = topic_func->Call(vl); if ( ! topic->AsString()->Len() ) - return val_mgr->GetFalse(); + return val_mgr->False(); const auto& bif_args = @ARGS@; val_list args(bif_args->size() - 2); @@ -229,7 +229,7 @@ function Cluster::publish_hrw%(pool: Pool, key: any, ...%): bool auto topic = topic_func->Call(vl); if ( ! topic->AsString()->Len() ) - return val_mgr->GetFalse(); + return val_mgr->False(); const auto& bif_args = @ARGS@; val_list args(bif_args->size() - 2); diff --git a/src/broker/store.bif b/src/broker/store.bif index 9458a74345..514dcff4be 100644 --- a/src/broker/store.bif +++ b/src/broker/store.bif @@ -94,7 +94,7 @@ function Broker::__is_closed%(h: opaque of Broker::Store%): bool if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -108,7 +108,7 @@ function Broker::__close%(h: opaque of Broker::Store%): bool if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -133,7 +133,7 @@ function Broker::__exists%(h: opaque of Broker::Store, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -178,7 +178,7 @@ function Broker::__get%(h: opaque of Broker::Store, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -223,7 +223,7 @@ function Broker::__put_unique%(h: opaque of Broker::Store, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -277,7 +277,7 @@ function Broker::__get_index_from_value%(h: opaque of Broker::Store, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -330,7 +330,7 @@ function Broker::__keys%(h: opaque of Broker::Store%): Broker::QueryResult if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -368,7 +368,7 @@ function Broker::__put%(h: opaque of Broker::Store, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -378,17 +378,17 @@ function Broker::__put%(h: opaque of Broker::Store, if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! val ) { builtin_error("invalid Broker data conversion for value argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.put(std::move(*key), std::move(*val), prepare_expiry(e)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__erase%(h: opaque of Broker::Store, k: any%): bool @@ -396,7 +396,7 @@ function Broker::__erase%(h: opaque of Broker::Store, k: any%): bool if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -405,11 +405,11 @@ function Broker::__erase%(h: opaque of Broker::Store, k: any%): bool if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.erase(std::move(*key)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__increment%(h: opaque of Broker::Store, k: any, a: any, @@ -418,7 +418,7 @@ function Broker::__increment%(h: opaque of Broker::Store, k: any, a: any, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -428,18 +428,18 @@ function Broker::__increment%(h: opaque of Broker::Store, k: any, a: any, if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! amount ) { builtin_error("invalid Broker data conversion for amount argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.increment(std::move(*key), std::move(*amount), prepare_expiry(e)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__decrement%(h: opaque of Broker::Store, k: any, a: any, @@ -448,7 +448,7 @@ function Broker::__decrement%(h: opaque of Broker::Store, k: any, a: any, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -458,17 +458,17 @@ function Broker::__decrement%(h: opaque of Broker::Store, k: any, a: any, if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! amount ) { builtin_error("invalid Broker data conversion for amount argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.decrement(std::move(*key), std::move(*amount), prepare_expiry(e)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__append%(h: opaque of Broker::Store, k: any, s: any, @@ -477,7 +477,7 @@ function Broker::__append%(h: opaque of Broker::Store, k: any, s: any, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -487,17 +487,17 @@ function Broker::__append%(h: opaque of Broker::Store, k: any, s: any, if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! str ) { builtin_error("invalid Broker data conversion for str argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.append(std::move(*key), std::move(*str), prepare_expiry(e)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__insert_into_set%(h: opaque of Broker::Store, k: any, i: any, @@ -506,7 +506,7 @@ function Broker::__insert_into_set%(h: opaque of Broker::Store, k: any, i: any, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -516,18 +516,18 @@ function Broker::__insert_into_set%(h: opaque of Broker::Store, k: any, i: any, if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! idx ) { builtin_error("invalid Broker data conversion for index argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.insert_into(std::move(*key), std::move(*idx), prepare_expiry(e)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__insert_into_table%(h: opaque of Broker::Store, k: any, @@ -536,7 +536,7 @@ function Broker::__insert_into_table%(h: opaque of Broker::Store, k: any, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -547,24 +547,24 @@ function Broker::__insert_into_table%(h: opaque of Broker::Store, k: any, if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! idx ) { builtin_error("invalid Broker data conversion for index argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! val ) { builtin_error("invalid Broker data conversion for value argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.insert_into(std::move(*key), std::move(*idx), std::move(*val), prepare_expiry(e)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__remove_from%(h: opaque of Broker::Store, k: any, i: any, @@ -573,7 +573,7 @@ function Broker::__remove_from%(h: opaque of Broker::Store, k: any, i: any, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -583,18 +583,18 @@ function Broker::__remove_from%(h: opaque of Broker::Store, k: any, i: any, if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! idx ) { builtin_error("invalid Broker data conversion for index argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.remove_from(std::move(*key), std::move(*idx), prepare_expiry(e)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__push%(h: opaque of Broker::Store, k: any, v: any, @@ -603,7 +603,7 @@ function Broker::__push%(h: opaque of Broker::Store, k: any, v: any, if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -613,17 +613,17 @@ function Broker::__push%(h: opaque of Broker::Store, k: any, v: any, if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! val ) { builtin_error("invalid Broker data conversion for value argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.push(std::move(*key), std::move(*val), prepare_expiry(e)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__pop%(h: opaque of Broker::Store, k: any, e: interval%): bool @@ -631,7 +631,7 @@ function Broker::__pop%(h: opaque of Broker::Store, k: any, e: interval%): bool if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); @@ -640,11 +640,11 @@ function Broker::__pop%(h: opaque of Broker::Store, k: any, e: interval%): bool if ( ! key ) { builtin_error("invalid Broker data conversion for key argument"); - return val_mgr->GetFalse(); + return val_mgr->False(); } handle->store.pop(std::move(*key), prepare_expiry(e)); - return val_mgr->GetTrue(); + return val_mgr->True(); %} function Broker::__clear%(h: opaque of Broker::Store%): bool @@ -652,11 +652,11 @@ function Broker::__clear%(h: opaque of Broker::Store%): bool if ( ! h ) { builtin_error("invalid Broker store handle"); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto handle = static_cast(h); handle->store.clear(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} diff --git a/src/file_analysis/File.cc b/src/file_analysis/File.cc index a8420e85c5..e0c8f02d8d 100644 --- a/src/file_analysis/File.cc +++ b/src/file_analysis/File.cc @@ -301,7 +301,7 @@ bool File::SetMime(const std::string& mime_type) auto meta = make_intrusive(fa_metadata_type); meta->Assign(meta_mime_type_idx, make_intrusive(mime_type)); - meta->Assign(meta_inferred_idx, val_mgr->GetFalse()); + meta->Assign(meta_inferred_idx, val_mgr->False()); FileEvent(file_sniff, {IntrusivePtr{NewRef{}, val}, std::move(meta)}); return true; diff --git a/src/file_analysis/analyzer/x509/functions.bif b/src/file_analysis/analyzer/x509/functions.bif index c881e9afdb..aa621fe5ea 100644 --- a/src/file_analysis/analyzer/x509/functions.bif +++ b/src/file_analysis/analyzer/x509/functions.bif @@ -623,7 +623,7 @@ function sct_verify%(cert: opaque of x509, logid: string, log_key: string, signa if ( precert && issuer_key_hash->Len() != 32) { reporter->Error("Invalid issuer_key_hash length"); - return val_mgr->GetFalse(); + return val_mgr->False(); } std::string data; @@ -647,7 +647,7 @@ function sct_verify%(cert: opaque of x509, logid: string, log_key: string, signa if ( pos < 0 ) { reporter->Error("NID_ct_precert_scts not found"); - return val_mgr->GetFalse(); + return val_mgr->False(); } #else int num_ext = X509_get_ext_count(x); @@ -751,7 +751,7 @@ sct_verify_err: EVP_PKEY_free(key); reporter->Error("%s", errstr.c_str()); - return val_mgr->GetFalse(); + return val_mgr->False(); %} @@ -902,7 +902,7 @@ function x509_set_certificate_cache%(tbl: string_any_table%) : bool %{ file_analysis::X509::SetCertificateCache({NewRef{}, tbl->AsTableVal()}); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## This function sets up the callback that is called when an entry is matched against the table set @@ -920,5 +920,5 @@ function x509_set_certificate_cache_hit_callback%(f: string_any_file_hook%) : bo %{ file_analysis::X509::SetCertificateCacheHitCallback({NewRef{}, f->AsFunc()}); - return val_mgr->GetTrue(); + return val_mgr->True(); %} diff --git a/src/file_analysis/file_analysis.bif b/src/file_analysis/file_analysis.bif index bd7cd72a02..f7f27cca08 100644 --- a/src/file_analysis/file_analysis.bif +++ b/src/file_analysis/file_analysis.bif @@ -75,9 +75,9 @@ function Files::__analyzer_name%(tag: Files::Tag%) : string function Files::__file_exists%(fuid: string%): bool %{ if ( file_mgr->LookupFile(fuid->CheckString()) != nullptr ) - return val_mgr->GetTrue(); + return val_mgr->True(); else - return val_mgr->GetFalse(); + return val_mgr->False(); %} ## :zeek:see:`Files::lookup_file`. diff --git a/src/iosource/pcap/pcap.bif b/src/iosource/pcap/pcap.bif index 5aa7f2bcf2..3094b4cc07 100644 --- a/src/iosource/pcap/pcap.bif +++ b/src/iosource/pcap/pcap.bif @@ -34,7 +34,7 @@ function precompile_pcap_filter%(id: PcapFilterID, s: string%): bool // lookups and limit the ID space so that that doesn't grow too // large. builtin_error(fmt("PCAP filter ids must remain below 100 (is %" PRId64 ")", id->AsInt())); - return val_mgr->GetFalse(); + return val_mgr->False(); } bool success = true; diff --git a/src/logging/Manager.cc b/src/logging/Manager.cc index 5d9075ba37..22a6829201 100644 --- a/src/logging/Manager.cc +++ b/src/logging/Manager.cc @@ -289,7 +289,7 @@ bool Manager::CreateStream(EnumVal* id, RecordVal* sval) if ( ! same_type((*args)[0], columns) ) { reporter->Error("stream event's argument type does not match column record type"); - return val_mgr->GetFalse(); + return false; } } diff --git a/src/option.bif b/src/option.bif index 471eb2d7e7..066dd7a7c2 100644 --- a/src/option.bif +++ b/src/option.bif @@ -63,20 +63,20 @@ function Option::set%(ID: string, val: any, location: string &default=""%): bool if ( ! i ) { builtin_error(fmt("Could not find ID named '%s'", ID->CheckString())); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! i->HasVal() ) { // should be impossible because initialization is enforced builtin_error(fmt("ID '%s' has no value", ID->CheckString())); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! i->IsOption() ) { builtin_error(fmt("ID '%s' is not an option", ID->CheckString())); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( same_type(val->Type(), bro_broker::DataVal::ScriptDataType()) ) @@ -88,7 +88,7 @@ function Option::set%(ID: string, val: any, location: string &default=""%): bool { builtin_error(fmt("Incompatible type for set of ID '%s': got broker data '%s', need '%s'", ID->CheckString(), dv->data.get_type_name(), type_name(i->Type()->Tag()))); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto rval = call_option_handlers_and_set_value(ID, i, std::move(val_from_data), location); @@ -111,7 +111,7 @@ function Option::set%(ID: string, val: any, location: string &default=""%): bool builtin_error(fmt("Incompatible type for set of ID '%s': got '%s', need '%s'", ID->CheckString(), type_name(val->Type()->Tag()), type_name(i->Type()->Tag()))); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto rval = call_option_handlers_and_set_value(ID, i, {NewRef{}, val}, location); @@ -148,26 +148,26 @@ function Option::set_change_handler%(ID: string, on_change: any, priority: int & if ( ! i ) { builtin_error(fmt("Could not find ID named '%s'", ID->CheckString())); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! i->IsOption() ) { builtin_error(fmt("ID '%s' is not an option", ID->CheckString())); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( on_change->Type()->Tag() != TYPE_FUNC ) { builtin_error(fmt("Option::on_change needs function argument; got '%s' for ID '%s'", type_name(on_change->Type()->Tag()), ID->CheckString())); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( on_change->Type()->AsFuncType()->Flavor() != FUNC_FLAVOR_FUNCTION ) { builtin_error("Option::on_change needs function argument; not hook or event"); - return val_mgr->GetFalse(); + return val_mgr->False(); } const type_list* args = on_change->Type()->AsFuncType()->ArgTypes()->Types(); @@ -175,38 +175,38 @@ function Option::set_change_handler%(ID: string, on_change: any, priority: int & { builtin_error(fmt("Wrong number of arguments for passed function in Option::on_change for ID '%s'; expected 2 or 3, got %d", ID->CheckString(), args->length())); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( (*args)[0]->Tag() != TYPE_STRING ) { builtin_error(fmt("First argument of passed function has to be string in Option::on_change for ID '%s'; got '%s'", ID->CheckString(), type_name((*args)[0]->Tag()))); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! same_type((*args)[1], i->Type()) ) { builtin_error(fmt("Second argument of passed function has to be %s in Option::on_change for ID '%s'; got '%s'", type_name(i->Type()->Tag()), ID->CheckString(), type_name((*args)[1]->Tag()))); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( args->length() == 3 && (*args)[2]->Tag() != TYPE_STRING ) { builtin_error(fmt("Third argument of passed function has to be string in Option::on_change for ID '%s'; got '%s'", ID->CheckString(), type_name((*args)[2]->Tag()))); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( ! same_type(on_change->Type()->AsFuncType()->YieldType(), i->Type()) ) { builtin_error(fmt("Passed function needs to return type '%s' for ID '%s'; got '%s'", type_name(i->Type()->Tag()), ID->CheckString(), type_name(on_change->Type()->AsFuncType()->YieldType()->Tag()))); - return val_mgr->GetFalse(); + return val_mgr->False(); } auto* func = on_change->AsFunc(); i->AddOptionHandler({NewRef{}, func}, -priority); - return val_mgr->GetTrue(); + return val_mgr->True(); %} diff --git a/src/parse.y b/src/parse.y index 5b1c20bb22..87fd642f9d 100644 --- a/src/parse.y +++ b/src/parse.y @@ -481,7 +481,7 @@ expr: { set_location(@2, @4); $$ = add_and_assign_local({AdoptRef{}, $2}, {AdoptRef{}, $4}, - {AdoptRef{}, val_mgr->GetTrue()}).release(); + val_mgr->True()).release(); } | expr '[' expr_list ']' diff --git a/src/probabilistic/cardinality-counter.bif b/src/probabilistic/cardinality-counter.bif index d1e1a2836b..3946b96c8c 100644 --- a/src/probabilistic/cardinality-counter.bif +++ b/src/probabilistic/cardinality-counter.bif @@ -45,17 +45,17 @@ function hll_cardinality_add%(handle: opaque of cardinality, elem: any%): bool if ( ! cv->Type() && ! cv->Typify(elem->Type()) ) { reporter->Error("failed to set HLL type"); - return val_mgr->GetFalse(); + return val_mgr->False(); } else if ( ! same_type(cv->Type(), elem->Type()) ) { reporter->Error("incompatible HLL data type"); - return val_mgr->GetFalse(); + return val_mgr->False(); } cv->Add(elem); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Merges a HLL cardinality counter into another. @@ -82,7 +82,7 @@ function hll_cardinality_merge_into%(handle1: opaque of cardinality, handle2: op ! same_type(v1->Type(), v2->Type()) ) { reporter->Error("incompatible HLL types"); - return val_mgr->GetFalse(); + return val_mgr->False(); } CardinalityCounter* h1 = v1->Get(); @@ -92,10 +92,10 @@ function hll_cardinality_merge_into%(handle1: opaque of cardinality, handle2: op if ( ! res ) { reporter->Error("Cardinality counters with different parameters cannot be merged"); - return val_mgr->GetFalse(); + return val_mgr->False(); } - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Estimate the current cardinality of an HLL cardinality counter. diff --git a/src/reporter.bif b/src/reporter.bif index 70857856d1..56c11dab7d 100644 --- a/src/reporter.bif +++ b/src/reporter.bif @@ -25,7 +25,7 @@ function Reporter::info%(msg: string%): bool reporter->PushLocation(frame->GetCall()->GetLocationInfo()); reporter->Info("%s", msg->CheckString()); reporter->PopLocation(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Generates a message that warns of a potential problem. @@ -40,7 +40,7 @@ function Reporter::warning%(msg: string%): bool reporter->PushLocation(frame->GetCall()->GetLocationInfo()); reporter->Warning("%s", msg->CheckString()); reporter->PopLocation(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Generates a non-fatal error indicative of a definite problem that should @@ -56,7 +56,7 @@ function Reporter::error%(msg: string%): bool reporter->PushLocation(frame->GetCall()->GetLocationInfo()); reporter->Error("%s", msg->CheckString()); reporter->PopLocation(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Generates a fatal error on stderr and terminates program execution. @@ -69,7 +69,7 @@ function Reporter::fatal%(msg: string%): bool reporter->PushLocation(frame->GetCall()->GetLocationInfo()); reporter->FatalError("%s", msg->CheckString()); reporter->PopLocation(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Generates a fatal error on stderr and terminates program execution @@ -83,7 +83,7 @@ function Reporter::fatal_error_with_core%(msg: string%): bool reporter->PushLocation(frame->GetCall()->GetLocationInfo()); reporter->FatalErrorWithCore("%s", msg->CheckString()); reporter->PopLocation(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Generates a "net" weird. @@ -94,7 +94,7 @@ function Reporter::fatal_error_with_core%(msg: string%): bool function Reporter::net_weird%(name: string%): bool %{ reporter->Weird(name->CheckString()); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Generates a "flow" weird. @@ -109,7 +109,7 @@ function Reporter::net_weird%(name: string%): bool function Reporter::flow_weird%(name: string, orig: addr, resp: addr%): bool %{ reporter->Weird(orig->AsAddr(), resp->AsAddr(), name->CheckString()); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Generates a "conn" weird. @@ -124,7 +124,7 @@ function Reporter::flow_weird%(name: string, orig: addr, resp: addr%): bool function Reporter::conn_weird%(name: string, c: connection, addl: string &default=""%): bool %{ reporter->Weird(c, name->CheckString(), addl->CheckString()); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Generates a "file" weird. @@ -142,10 +142,10 @@ function Reporter::file_weird%(name: string, f: fa_file, addl: string &default=" auto file = file_mgr->LookupFile(fuid->CheckString()); if ( ! file ) - return val_mgr->GetFalse(); + return val_mgr->False(); reporter->Weird(file, name->CheckString(), addl->CheckString()); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Gets the weird sampling whitelist @@ -185,7 +185,7 @@ function Reporter::set_weird_sampling_whitelist%(weird_sampling_whitelist: strin delete k; } reporter->SetWeirdSamplingWhitelist(whitelist_set); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Gets the current weird sampling threshold @@ -204,7 +204,7 @@ function Reporter::get_weird_sampling_threshold%(%) : count function Reporter::set_weird_sampling_threshold%(weird_sampling_threshold: count%) : bool %{ reporter->SetWeirdSamplingThreshold(weird_sampling_threshold); - return val_mgr->GetTrue(); + return val_mgr->True(); %} @@ -224,7 +224,7 @@ function Reporter::get_weird_sampling_rate%(%) : count function Reporter::set_weird_sampling_rate%(weird_sampling_rate: count%) : bool %{ reporter->SetWeirdSamplingRate(weird_sampling_rate); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Gets the current weird sampling duration. @@ -244,5 +244,5 @@ function Reporter::get_weird_sampling_duration%(%) : interval function Reporter::set_weird_sampling_duration%(weird_sampling_duration: interval%) : bool %{ reporter->SetWeirdSamplingDuration(weird_sampling_duration); - return val_mgr->GetTrue(); + return val_mgr->True(); %} diff --git a/src/scan.l b/src/scan.l index 516fb4edf2..007b737180 100644 --- a/src/scan.l +++ b/src/scan.l @@ -466,8 +466,8 @@ when return TOK_WHEN; [^@\n]+ /* eat */ . /* eat */ -T RET_CONST(val_mgr->GetTrue()) -F RET_CONST(val_mgr->GetFalse()) +T RET_CONST(val_mgr->True()->Ref()) +F RET_CONST(val_mgr->False()->Ref()) {ID} { yylval.str = copy_string(yytext); diff --git a/src/strings.bif b/src/strings.bif index 16f796eb37..c19c89418b 100644 --- a/src/strings.bif +++ b/src/strings.bif @@ -627,9 +627,9 @@ function is_ascii%(str: string%): bool for ( int i = 0; i < n; ++i ) if ( s[i] > 127 ) - return val_mgr->GetFalse(); + return val_mgr->False(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Replaces non-printable characters in a string with escaped sequences. The diff --git a/src/zeek.bif b/src/zeek.bif index 539c87e5d2..44ef202a1a 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -364,8 +364,8 @@ function setenv%(var: string, val: string%): bool val->AsString()->CheckString(), 1); if ( result < 0 ) - return val_mgr->GetFalse(); - return val_mgr->GetTrue(); + return val_mgr->False(); + return val_mgr->True(); %} ## Shuts down the Zeek process immediately. @@ -388,10 +388,10 @@ function exit%(code: int%): any function terminate%(%): bool %{ if ( terminating ) - return val_mgr->GetFalse(); + return val_mgr->False(); terminate_processing(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} %%{ @@ -520,7 +520,7 @@ function piped_exec%(program: string, to_write: string%): bool if ( ! f ) { reporter->Error("Failed to popen %s", prog); - return val_mgr->GetFalse(); + return val_mgr->False(); } const u_char* input_data = to_write->Bytes(); @@ -533,10 +533,10 @@ function piped_exec%(program: string, to_write: string%): bool if ( bytes_written != input_data_len ) { reporter->Error("Failed to write all given data to %s", prog); - return val_mgr->GetFalse(); + return val_mgr->False(); } - return val_mgr->GetTrue(); + return val_mgr->True(); %} %%{ @@ -710,7 +710,7 @@ function sha256_hash_init%(%): opaque of sha256 function md5_hash_update%(handle: opaque of md5, data: string%): bool %{ bool rc = static_cast(handle)->Feed(data->Bytes(), data->Len()); - return val_mgr->GetBool(rc); + return val_mgr->Bool(rc); %} ## Updates the SHA1 value associated with a given index. It is required to @@ -729,7 +729,7 @@ function md5_hash_update%(handle: opaque of md5, data: string%): bool function sha1_hash_update%(handle: opaque of sha1, data: string%): bool %{ bool rc = static_cast(handle)->Feed(data->Bytes(), data->Len()); - return val_mgr->GetBool(rc); + return val_mgr->Bool(rc); %} ## Updates the SHA256 value associated with a given index. It is required to @@ -748,7 +748,7 @@ function sha1_hash_update%(handle: opaque of sha1, data: string%): bool function sha256_hash_update%(handle: opaque of sha256, data: string%): bool %{ bool rc = static_cast(handle)->Feed(data->Bytes(), data->Len()); - return val_mgr->GetBool(rc); + return val_mgr->Bool(rc); %} ## Returns the final MD5 digest of an incremental hash computation. @@ -856,7 +856,7 @@ function paraglob_match%(handle: opaque of paraglob, match: string%): string_vec ## ## .. zeek:see::paraglob_add paraglob_match paraglob_init function paraglob_equals%(p_one: opaque of paraglob, p_two: opaque of paraglob%) : bool %{ - return val_mgr->GetBool( + return val_mgr->Bool( *(static_cast(p_one)) == *(static_cast(p_two)) ); %} @@ -1082,7 +1082,7 @@ function entropy_test_add%(handle: opaque of entropy, data: string%): bool %{ bool status = static_cast(handle)->Feed(data->Bytes(), data->Len()); - return val_mgr->GetBool(status); + return val_mgr->Bool(status); %} ## Finishes an incremental entropy calculation. Before using this function, @@ -1224,7 +1224,7 @@ function check_subnet%(search: subnet, t: any%): bool void* res = pt->Lookup(search, true); - return val_mgr->GetBool(res != nullptr); + return val_mgr->Bool(res != nullptr); %} ## Checks whether two objects reference the same internal object. This function @@ -1238,7 +1238,7 @@ function check_subnet%(search: subnet, t: any%): bool ## Returns: True if *o1* and *o2* are equal. function same_object%(o1: any, o2: any%): bool %{ - return val_mgr->GetBool(o1 == o2); + return val_mgr->Bool(o1 == o2); %} ## Returns the number of bytes that a value occupies in memory. @@ -1283,15 +1283,15 @@ function any_set%(v: any%) : bool v->Type()->YieldType()->Tag() != TYPE_BOOL ) { builtin_error("any_set() requires vector of bool"); - return val_mgr->GetFalse(); + return val_mgr->False(); } VectorVal* vv = v->AsVectorVal(); for ( unsigned int i = 0; i < vv->Size(); ++i ) if ( vv->Lookup(i) && vv->Lookup(i)->AsBool() ) - return val_mgr->GetTrue(); + return val_mgr->True(); - return val_mgr->GetFalse(); + return val_mgr->False(); %} ## Tests whether *all* elements of a boolean vector (``vector of bool``) are @@ -1312,15 +1312,15 @@ function all_set%(v: any%) : bool v->Type()->YieldType()->Tag() != TYPE_BOOL ) { builtin_error("all_set() requires vector of bool"); - return val_mgr->GetFalse(); + return val_mgr->False(); } VectorVal* vv = v->AsVectorVal(); for ( unsigned int i = 0; i < vv->Size(); ++i ) if ( ! vv->Lookup(i) || ! vv->Lookup(i)->AsBool() ) - return val_mgr->GetFalse(); + return val_mgr->False(); - return val_mgr->GetTrue(); + return val_mgr->True(); %} %%{ @@ -1702,7 +1702,7 @@ function print_raw%(...%): bool d.SetStyle(RAW_STYLE); describe_vals(@ARG@, &d, 0); printf("%.*s", d.Len(), d.Description()); - return val_mgr->GetBool(true); + return val_mgr->Bool(true); %} # =========================================================================== @@ -1874,7 +1874,7 @@ function zeek_args%(%): string_vec ## .. zeek:see:: reading_traces packet_source function reading_live_traffic%(%): bool %{ - return val_mgr->GetBool(reading_live); + return val_mgr->Bool(reading_live); %} ## Checks whether Zeek reads traffic from a trace file (as opposed to from a @@ -1885,7 +1885,7 @@ function reading_live_traffic%(%): bool ## .. zeek:see:: reading_live_traffic packet_source function reading_traces%(%): bool %{ - return val_mgr->GetBool(reading_traces); + return val_mgr->Bool(reading_traces); %} ## Returns: the packet source being read by Zeek. @@ -1899,7 +1899,7 @@ function packet_source%(%): PacketSource if ( ps ) { - r->Assign(0, val_mgr->GetBool(ps->IsLive())); + r->Assign(0, val_mgr->Bool(ps->IsLive())); r->Assign(1, make_intrusive(ps->Path())); r->Assign(2, val_mgr->GetInt(ps->LinkType())); r->Assign(3, val_mgr->GetCount(ps->Netmask())); @@ -1952,11 +1952,11 @@ function global_ids%(%): id_table ID* id = global.second.get(); auto rec = make_intrusive(script_id); rec->Assign(0, make_intrusive(type_name(id->Type()->Tag()))); - rec->Assign(1, val_mgr->GetBool(id->IsExport())); - rec->Assign(2, val_mgr->GetBool(id->IsConst())); - rec->Assign(3, val_mgr->GetBool(id->IsEnumConst())); - rec->Assign(4, val_mgr->GetBool(id->IsOption())); - rec->Assign(5, val_mgr->GetBool(id->IsRedefinable())); + rec->Assign(1, val_mgr->Bool(id->IsExport())); + rec->Assign(2, val_mgr->Bool(id->IsConst())); + rec->Assign(3, val_mgr->Bool(id->IsEnumConst())); + rec->Assign(4, val_mgr->Bool(id->IsOption())); + rec->Assign(5, val_mgr->Bool(id->IsRedefinable())); if ( id->HasVal() ) { @@ -2047,7 +2047,7 @@ function do_profiling%(%) : any function is_local_interface%(ip: addr%) : bool %{ if ( ip->AsAddr().IsLoopback() ) - return val_mgr->GetTrue(); + return val_mgr->True(); list addrs; @@ -2079,10 +2079,10 @@ function is_local_interface%(ip: addr%) : bool for ( it = addrs.begin(); it != addrs.end(); ++it ) { if ( *it == ip->AsAddr() ) - return val_mgr->GetTrue(); + return val_mgr->True(); } - return val_mgr->GetFalse(); + return val_mgr->False(); %} ## Write rule matcher statistics (DFA states, transitions, memory usage, cache @@ -2098,7 +2098,7 @@ function dump_rule_stats%(f: file%): bool if ( rule_matcher ) rule_matcher->DumpStats(f); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Checks if Zeek is terminating. @@ -2108,7 +2108,7 @@ function dump_rule_stats%(f: file%): bool ## .. zeek:see:: terminate function zeek_is_terminating%(%): bool %{ - return val_mgr->GetBool(terminating); + return val_mgr->Bool(terminating); %} ## Returns the hostname of the machine Zeek runs on. @@ -2132,9 +2132,9 @@ function gethostname%(%) : string function is_v4_addr%(a: addr%): bool %{ if ( a->AsAddr().GetFamily() == IPv4 ) - return val_mgr->GetTrue(); + return val_mgr->True(); else - return val_mgr->GetFalse(); + return val_mgr->False(); %} ## Returns whether an address is IPv6 or not. @@ -2145,9 +2145,9 @@ function is_v4_addr%(a: addr%): bool function is_v6_addr%(a: addr%): bool %{ if ( a->AsAddr().GetFamily() == IPv6 ) - return val_mgr->GetTrue(); + return val_mgr->True(); else - return val_mgr->GetFalse(); + return val_mgr->False(); %} ## Returns whether a subnet specification is IPv4 or not. @@ -2158,9 +2158,9 @@ function is_v6_addr%(a: addr%): bool function is_v4_subnet%(s: subnet%): bool %{ if ( s->AsSubNet().Prefix().GetFamily() == IPv4 ) - return val_mgr->GetTrue(); + return val_mgr->True(); else - return val_mgr->GetFalse(); + return val_mgr->False(); %} ## Returns whether a subnet specification is IPv6 or not. @@ -2171,9 +2171,9 @@ function is_v4_subnet%(s: subnet%): bool function is_v6_subnet%(s: subnet%): bool %{ if ( s->AsSubNet().Prefix().GetFamily() == IPv6 ) - return val_mgr->GetTrue(); + return val_mgr->True(); else - return val_mgr->GetFalse(); + return val_mgr->False(); %} @@ -2469,7 +2469,7 @@ function is_valid_ip%(ip: string%): bool char* s = ip->AsString()->Render(); auto rval = IPAddr::IsValid(s); delete [] s; - return val_mgr->GetBool(rval); + return val_mgr->Bool(rval); %} ## Converts a :zeek:type:`string` to a :zeek:type:`subnet`. @@ -3185,7 +3185,7 @@ function remask_addr%(a1: addr, a2: addr, top_bits_from_a1: count%): addr ## .. zeek:see:: is_udp_port is_icmp_port function is_tcp_port%(p: port%): bool %{ - return val_mgr->GetBool(p->IsTCP()); + return val_mgr->Bool(p->IsTCP()); %} ## Checks whether a given :zeek:type:`port` has UDP as transport protocol. @@ -3197,7 +3197,7 @@ function is_tcp_port%(p: port%): bool ## .. zeek:see:: is_icmp_port is_tcp_port function is_udp_port%(p: port%): bool %{ - return val_mgr->GetBool(p->IsUDP()); + return val_mgr->Bool(p->IsUDP()); %} ## Checks whether a given :zeek:type:`port` has ICMP as transport protocol. @@ -3209,7 +3209,7 @@ function is_udp_port%(p: port%): bool ## .. zeek:see:: is_tcp_port is_udp_port function is_icmp_port%(p: port%): bool %{ - return val_mgr->GetBool(p->IsICMP()); + return val_mgr->Bool(p->IsICMP()); %} %%{ @@ -3281,9 +3281,9 @@ function get_port_transport_proto%(p: port%): transport_proto function connection_exists%(c: conn_id%): bool %{ if ( sessions->FindConnection(c) ) - return val_mgr->GetTrue(); + return val_mgr->True(); else - return val_mgr->GetFalse(); + return val_mgr->False(); %} ## Returns the :zeek:type:`connection` record for a given connection identifier. @@ -3361,7 +3361,7 @@ function dump_current_packet%(file_name: string%) : bool if ( ! current_pktsrc || ! current_pktsrc->GetCurrentPacket(&pkt) ) - return val_mgr->GetFalse(); + return val_mgr->False(); if ( addl_pkt_dumper && addl_pkt_dumper->Path() != file_name->CheckString()) { @@ -3377,7 +3377,7 @@ function dump_current_packet%(file_name: string%) : bool addl_pkt_dumper->Dump(pkt); } - return val_mgr->GetBool( addl_pkt_dumper && ! addl_pkt_dumper->IsError()); + return val_mgr->Bool( addl_pkt_dumper && ! addl_pkt_dumper->IsError()); %} ## Returns the currently processed PCAP packet. @@ -3472,7 +3472,7 @@ function dump_packet%(pkt: pcap_packet, file_name: string%) : bool addl_pkt_dumper->Dump(&p); } - return val_mgr->GetBool(addl_pkt_dumper && ! addl_pkt_dumper->IsError()); + return val_mgr->Bool(addl_pkt_dumper && ! addl_pkt_dumper->IsError()); %} %%{ @@ -3944,7 +3944,7 @@ function mmdb_open_location_db%(f: string%) : bool #ifdef USE_GEOIP return val_mgr->GetBool(mmdb_open_loc(f->CheckString())); #else - return val_mgr->GetFalse(); + return val_mgr->False(); #endif %} @@ -3961,7 +3961,7 @@ function mmdb_open_asn_db%(f: string%) : bool #ifdef USE_GEOIP return val_mgr->GetBool(mmdb_open_asn(f->CheckString())); #else - return val_mgr->GetFalse(); + return val_mgr->False(); #endif %} @@ -4261,7 +4261,7 @@ function disable_analyzer%(cid: conn_id, aid: count, err_if_no_conn: bool &defau if ( ! c ) { reporter->Error("cannot find connection"); - return val_mgr->GetFalse(); + return val_mgr->False(); } analyzer::Analyzer* a = c->FindAnalyzer(aid); @@ -4269,7 +4269,7 @@ function disable_analyzer%(cid: conn_id, aid: count, err_if_no_conn: bool &defau { if ( err_if_no_conn ) reporter->Error("connection does not have analyzer specified to disable"); - return val_mgr->GetFalse(); + return val_mgr->False(); } if ( prevent ) @@ -4297,10 +4297,10 @@ function skip_further_processing%(cid: conn_id%): bool %{ Connection* c = sessions->FindConnection(cid); if ( ! c ) - return val_mgr->GetFalse(); + return val_mgr->False(); c->SetSkip(1); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Controls whether packet contents belonging to a connection should be @@ -4327,10 +4327,10 @@ function set_record_packets%(cid: conn_id, do_record: bool%): bool %{ Connection* c = sessions->FindConnection(cid); if ( ! c ) - return val_mgr->GetFalse(); + return val_mgr->False(); c->SetRecordPackets(do_record); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Sets an individual inactivity timeout for a connection and thus @@ -4422,7 +4422,7 @@ function close%(f: file%): bool function write_file%(f: file, data: string%): bool %{ if ( ! f ) - return val_mgr->GetFalse(); + return val_mgr->False(); return val_mgr->GetBool(f->Write((const char*) data->Bytes(), data->Len())); %} @@ -4442,7 +4442,7 @@ function write_file%(f: file, data: string%): bool function set_buf%(f: file, buffered: bool%): any %{ f->SetBuf(buffered); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Flushes all open files to disk. @@ -4478,14 +4478,14 @@ function mkdir%(f: string%): bool // check if already exists and is directory. if ( errno == EEXIST && stat(filename, &filestat) == 0 && S_ISDIR(filestat.st_mode) ) - return val_mgr->GetTrue(); + return val_mgr->True(); builtin_error(fmt("cannot create directory '%s': %s", filename, strerror(error))); - return val_mgr->GetFalse(); + return val_mgr->False(); } else - return val_mgr->GetTrue(); + return val_mgr->True(); %} @@ -4507,10 +4507,10 @@ function rmdir%(d: string%): bool { builtin_error(fmt("cannot remove directory '%s': %s", dirname, strerror(errno))); - return val_mgr->GetFalse(); + return val_mgr->False(); } else - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Removes a file from a directory. @@ -4531,10 +4531,10 @@ function unlink%(f: string%): bool { builtin_error(fmt("cannot unlink file '%s': %s", filename, strerror(errno))); - return val_mgr->GetFalse(); + return val_mgr->False(); } else - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Renames a file from src_f to dst_f. @@ -4557,10 +4557,10 @@ function rename%(src_f: string, dst_f: string%): bool { builtin_error(fmt("cannot rename file '%s' to '%s': %s", src_filename, dst_filename, strerror(errno))); - return val_mgr->GetFalse(); + return val_mgr->False(); } else - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Checks whether a given file is open. @@ -4745,7 +4745,7 @@ function enable_raw_output%(f: file%): any function install_src_addr_filter%(ip: addr, tcp_flags: count, prob: double%) : bool %{ sessions->GetPacketFilter()->AddSrc(ip->AsAddr(), tcp_flags, prob); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Installs a filter to drop packets originating from a given subnet with @@ -4775,7 +4775,7 @@ function install_src_addr_filter%(ip: addr, tcp_flags: count, prob: double%) : b function install_src_net_filter%(snet: subnet, tcp_flags: count, prob: double%) : bool %{ sessions->GetPacketFilter()->AddSrc(snet, tcp_flags, prob); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Removes a source address filter. @@ -4850,7 +4850,7 @@ function uninstall_src_net_filter%(snet: subnet%) : bool function install_dst_addr_filter%(ip: addr, tcp_flags: count, prob: double%) : bool %{ sessions->GetPacketFilter()->AddDst(ip->AsAddr(), tcp_flags, prob); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Installs a filter to drop packets destined to a given subnet with @@ -4880,7 +4880,7 @@ function install_dst_addr_filter%(ip: addr, tcp_flags: count, prob: double%) : b function install_dst_net_filter%(snet: subnet, tcp_flags: count, prob: double%) : bool %{ sessions->GetPacketFilter()->AddDst(snet, tcp_flags, prob); - return val_mgr->GetTrue(); + return val_mgr->True(); %} ## Removes a destination address filter. @@ -4966,12 +4966,12 @@ function match_signatures%(c: connection, pattern_type: int, s: string, from_orig: bool, clear: bool%) : bool %{ if ( ! rule_matcher ) - return val_mgr->GetFalse(); + return val_mgr->False(); c->Match((Rule::PatternType) pattern_type, s->Bytes(), s->Len(), from_orig, bol, eol, clear); - return val_mgr->GetTrue(); + return val_mgr->True(); %} # ===========================================================================