diff --git a/src/CompHash.cc b/src/CompHash.cc index aab4c0c6b6..4f2ca377fd 100644 --- a/src/CompHash.cc +++ b/src/CompHash.cc @@ -770,7 +770,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0, else if ( tag == TYPE_BOOL ) *pval = val_mgr->Bool(*kp); else if ( tag == TYPE_INT ) - *pval = {AdoptRef{}, val_mgr->GetInt(*kp)}; + *pval = val_mgr->Int(*kp); else { reporter->InternalError("bad internal unsigned int in CompositeHash::RecoverOneVal()"); diff --git a/src/Conn.cc b/src/Conn.cc index 8cddcad7cd..415aeb41b1 100644 --- a/src/Conn.cc +++ b/src/Conn.cc @@ -378,10 +378,10 @@ RecordVal* Connection::BuildConnVal() conn_val->Assign(8, encapsulation->GetVectorVal()); if ( vlan != 0 ) - conn_val->Assign(9, val_mgr->GetInt(vlan)); + conn_val->Assign(9, val_mgr->Int(vlan)); if ( inner_vlan != 0 ) - conn_val->Assign(10, val_mgr->GetInt(inner_vlan)); + conn_val->Assign(10, val_mgr->Int(inner_vlan)); } diff --git a/src/Expr.cc b/src/Expr.cc index cda8bc2ece..5222414942 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -686,7 +686,7 @@ IntrusivePtr BinaryExpr::Fold(Val* v1, Val* v2) const else if ( ret_type->Tag() == TYPE_BOOL ) return val_mgr->Bool(i3); else - return {AdoptRef{}, val_mgr->GetInt(i3)}; + return val_mgr->Int(i3); } IntrusivePtr BinaryExpr::StringFold(Val* v1, Val* v2) const @@ -958,7 +958,7 @@ IntrusivePtr IncrExpr::DoSingleEval(Frame* f, Val* v) const ret_type = Type()->YieldType(); if ( ret_type->Tag() == TYPE_INT ) - return {AdoptRef{}, val_mgr->GetInt(k)}; + return val_mgr->Int(k); else return {AdoptRef{}, val_mgr->GetCount(k)}; } @@ -1075,7 +1075,7 @@ IntrusivePtr PosExpr::Fold(Val* v) const if ( t == TYPE_DOUBLE || t == TYPE_INTERVAL || t == TYPE_INT ) return {NewRef{}, v}; else - return {AdoptRef{}, val_mgr->GetInt(v->CoerceToInt())}; + return val_mgr->Int(v->CoerceToInt()); } NegExpr::NegExpr(IntrusivePtr arg_op) @@ -1113,7 +1113,7 @@ IntrusivePtr NegExpr::Fold(Val* v) const else if ( v->Type()->Tag() == TYPE_INTERVAL ) return make_intrusive(- v->InternalDouble(), 1.0); else - return {AdoptRef{}, val_mgr->GetInt(- v->CoerceToInt())}; + return val_mgr->Int(- v->CoerceToInt()); } SizeExpr::SizeExpr(IntrusivePtr arg_op) @@ -3485,7 +3485,7 @@ IntrusivePtr ArithCoerceExpr::FoldSingleVal(Val* v, InternalTypeTag t) cons return make_intrusive(v->CoerceToDouble(), TYPE_DOUBLE); case TYPE_INTERNAL_INT: - return {AdoptRef{}, val_mgr->GetInt(v->CoerceToInt())}; + return val_mgr->Int(v->CoerceToInt()); case TYPE_INTERNAL_UNSIGNED: return {AdoptRef{}, val_mgr->GetCount(v->CoerceToUnsigned())}; diff --git a/src/Stats.cc b/src/Stats.cc index fc18a850e7..3c2508c7f7 100644 --- a/src/Stats.cc +++ b/src/Stats.cc @@ -374,7 +374,7 @@ void SampleLogger::SegmentProfile(const char* /* name */, mgr.Enqueue(load_sample, IntrusivePtr{NewRef{}, load_samples}, make_intrusive(dtime, Seconds), - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(dmem)} + val_mgr->Int(dmem) ); } diff --git a/src/Val.cc b/src/Val.cc index b6502ddc59..638f9dd078 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -732,7 +732,7 @@ void IntervalVal::ValDescribe(ODesc* d) const IntrusivePtr PortVal::SizeVal() const { - return {AdoptRef{}, val_mgr->GetInt(val.uint_val)}; + return val_mgr->Int(val.uint_val); } uint32_t PortVal::Mask(uint32_t port_num, TransportProto port_type) @@ -2931,7 +2931,7 @@ unsigned int RecordVal::MemoryAllocation() const IntrusivePtr EnumVal::SizeVal() const { - return {AdoptRef{}, val_mgr->GetInt(val.int_val)}; + return val_mgr->Int(val.int_val); } void EnumVal::ValDescribe(ODesc* d) const @@ -3205,7 +3205,7 @@ IntrusivePtr check_and_promote(IntrusivePtr v, const BroType* t, return nullptr; } else if ( t_tag == TYPE_INT ) - promoted_v = {AdoptRef{}, val_mgr->GetInt(v->CoerceToInt())}; + promoted_v = val_mgr->Int(v->CoerceToInt()); else // enum { reporter->InternalError("bad internal type in check_and_promote()"); diff --git a/src/analyzer/protocol/asn1/asn1.pac b/src/analyzer/protocol/asn1/asn1.pac index 91a2cf5f1d..7039ff2485 100644 --- a/src/analyzer/protocol/asn1/asn1.pac +++ b/src/analyzer/protocol/asn1/asn1.pac @@ -115,7 +115,7 @@ Val* asn1_integer_to_val(const ASN1Encoding* i, TypeTag t) case TYPE_BOOL: return val_mgr->Bool(v)->Ref(); case TYPE_INT: - return val_mgr->GetInt(v); + return val_mgr->Int(v).release(); case TYPE_COUNT: case TYPE_COUNTER: return val_mgr->GetCount(v); diff --git a/src/analyzer/protocol/bittorrent/BitTorrentTracker.cc b/src/analyzer/protocol/bittorrent/BitTorrentTracker.cc index ed0b6fbe88..f88b780482 100644 --- a/src/analyzer/protocol/bittorrent/BitTorrentTracker.cc +++ b/src/analyzer/protocol/bittorrent/BitTorrentTracker.cc @@ -503,7 +503,7 @@ void BitTorrentTracker_Analyzer::ResponseBenc(int name_len, char* name, RecordVal* benc_value = new RecordVal(bittorrent_benc_value); StringVal* name_ = new StringVal(name_len, name); - benc_value->Assign(type, val_mgr->GetInt(value)); + benc_value->Assign(type, val_mgr->Int(value)); res_val_benc->Assign(name_, benc_value); Unref(name_); diff --git a/src/analyzer/protocol/dhcp/dhcp-options.pac b/src/analyzer/protocol/dhcp/dhcp-options.pac index 3fb593b6fe..bac3408ccc 100644 --- a/src/analyzer/protocol/dhcp/dhcp-options.pac +++ b/src/analyzer/protocol/dhcp/dhcp-options.pac @@ -34,7 +34,7 @@ refine casetype OptionValue += { refine flow DHCP_Flow += { function process_time_offset_option(v: OptionValue): bool %{ - ${context.flow}->options->Assign(25, val_mgr->GetInt(${v.time_offset})); + ${context.flow}->options->Assign(25, val_mgr->Int(${v.time_offset})); return true; %} }; diff --git a/src/analyzer/protocol/irc/IRC.cc b/src/analyzer/protocol/irc/IRC.cc index 374230e5f2..bbfdb6b9c9 100644 --- a/src/analyzer/protocol/irc/IRC.cc +++ b/src/analyzer/protocol/irc/IRC.cc @@ -237,9 +237,9 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig) EnqueueConnEvent(irc_network_info, IntrusivePtr{AdoptRef{}, BuildConnVal()}, val_mgr->Bool(orig), - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(users)}, - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(services)}, - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(servers)} + val_mgr->Int(users), + val_mgr->Int(services), + val_mgr->Int(servers) ); } break; @@ -318,9 +318,9 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig) EnqueueConnEvent(irc_server_info, IntrusivePtr{AdoptRef{}, BuildConnVal()}, val_mgr->Bool(orig), - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(users)}, - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(services)}, - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(servers)} + val_mgr->Int(users), + val_mgr->Int(services), + val_mgr->Int(servers) ); } break; @@ -340,7 +340,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig) EnqueueConnEvent(irc_channel_info, IntrusivePtr{AdoptRef{}, BuildConnVal()}, val_mgr->Bool(orig), - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(channels)} + val_mgr->Int(channels) ); } break; @@ -547,7 +547,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig) make_intrusive(parts[4].c_str()), make_intrusive(parts[5].c_str()), make_intrusive(parts[6].c_str()), - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(atoi(parts[7].c_str()))}, + val_mgr->Int(atoi(parts[7].c_str())), make_intrusive(parts[8].c_str()) ); } diff --git a/src/analyzer/protocol/smb/smb2-com-set-info.pac b/src/analyzer/protocol/smb/smb2-com-set-info.pac index 699fb5f089..5b9a8c0df2 100644 --- a/src/analyzer/protocol/smb/smb2-com-set-info.pac +++ b/src/analyzer/protocol/smb/smb2-com-set-info.pac @@ -193,9 +193,9 @@ refine connection SMB_Conn += { if ( smb2_file_fscontrol ) { RecordVal* r = new RecordVal(BifType::Record::SMB2::Fscontrol); - r->Assign(0, val_mgr->GetInt(${val.free_space_start_filtering})); - r->Assign(1, val_mgr->GetInt(${val.free_space_start_threshold})); - r->Assign(2, val_mgr->GetInt(${val.free_space_stop_filtering})); + r->Assign(0, val_mgr->Int(${val.free_space_start_filtering})); + r->Assign(1, val_mgr->Int(${val.free_space_start_threshold})); + r->Assign(2, val_mgr->Int(${val.free_space_stop_filtering})); r->Assign(3, val_mgr->GetCount(${val.default_quota_threshold})); r->Assign(4, val_mgr->GetCount(${val.default_quota_limit})); r->Assign(5, val_mgr->GetCount(${val.file_system_control_flags})); diff --git a/src/analyzer/protocol/stepping-stone/SteppingStone.cc b/src/analyzer/protocol/stepping-stone/SteppingStone.cc index baf4cba126..3bf71d9c95 100644 --- a/src/analyzer/protocol/stepping-stone/SteppingStone.cc +++ b/src/analyzer/protocol/stepping-stone/SteppingStone.cc @@ -135,10 +135,9 @@ void SteppingStoneEndpoint::Event(EventHandlerPtr f, int id1, int id2) return; if ( id2 >= 0 ) - endp->TCP()->EnqueueConnEvent(f, IntrusivePtr{AdoptRef{}, val_mgr->GetInt(id1)}, - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(id2)}); + endp->TCP()->EnqueueConnEvent(f, val_mgr->Int(id1), val_mgr->Int(id2)); else - endp->TCP()->EnqueueConnEvent(f, IntrusivePtr{AdoptRef{}, val_mgr->GetInt(id1)}); + endp->TCP()->EnqueueConnEvent(f, val_mgr->Int(id1)); } void SteppingStoneEndpoint::CreateEndpEvent(bool is_orig) @@ -148,7 +147,7 @@ void SteppingStoneEndpoint::CreateEndpEvent(bool is_orig) endp->TCP()->EnqueueConnEvent(stp_create_endp, IntrusivePtr{AdoptRef{}, endp->TCP()->BuildConnVal()}, - IntrusivePtr{AdoptRef{}, val_mgr->GetInt(stp_id)}, + val_mgr->Int(stp_id), val_mgr->Bool(is_orig) ); } diff --git a/src/analyzer/protocol/tcp/TCP.cc b/src/analyzer/protocol/tcp/TCP.cc index 6998af68ea..9a83dc8af0 100644 --- a/src/analyzer/protocol/tcp/TCP.cc +++ b/src/analyzer/protocol/tcp/TCP.cc @@ -114,7 +114,7 @@ static RecordVal* build_syn_packet_val(bool is_orig, const IP_Hdr* ip, v->Assign(2, val_mgr->GetCount((ip->TTL()))); v->Assign(3, val_mgr->GetCount((ip->TotalLen()))); v->Assign(4, val_mgr->GetCount(ntohs(tcp->th_win))); - v->Assign(5, val_mgr->GetInt(winscale)); + v->Assign(5, val_mgr->Int(winscale)); v->Assign(6, val_mgr->GetCount(MSS)); v->Assign(7, val_mgr->Bool(SACK)); diff --git a/src/broker/Data.cc b/src/broker/Data.cc index 6616973485..e72cb856ad 100644 --- a/src/broker/Data.cc +++ b/src/broker/Data.cc @@ -106,7 +106,7 @@ struct val_converter { result_type operator()(int64_t a) { if ( type->Tag() == TYPE_INT ) - return val_mgr->GetInt(a); + return val_mgr->Int(a).release(); return nullptr; } diff --git a/src/file_analysis/Manager.cc b/src/file_analysis/Manager.cc index 6aed55df34..9451c1fdd5 100644 --- a/src/file_analysis/Manager.cc +++ b/src/file_analysis/Manager.cc @@ -524,7 +524,7 @@ VectorVal* file_analysis::GenMIMEMatchesVal(const RuleMatcher::MIME_Matches& m) for ( set::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2 ) { - element->Assign(0, val_mgr->GetInt(it->first)); + element->Assign(0, val_mgr->Int(it->first)); element->Assign(1, make_intrusive(*it2)); } diff --git a/src/file_analysis/analyzer/x509/functions.bif b/src/file_analysis/analyzer/x509/functions.bif index 59697e59ee..572ef0bfec 100644 --- a/src/file_analysis/analyzer/x509/functions.bif +++ b/src/file_analysis/analyzer/x509/functions.bif @@ -15,7 +15,7 @@ RecordVal* x509_result_record(uint64_t num, const char* reason, Val* chainVector { RecordVal* rrecord = new RecordVal(BifType::Record::X509::Result); - rrecord->Assign(0, val_mgr->GetInt(num)); + rrecord->Assign(0, val_mgr->Int(num)); rrecord->Assign(1, make_intrusive(reason)); if ( chainVector ) rrecord->Assign(2, chainVector); diff --git a/src/input/Manager.cc b/src/input/Manager.cc index c8a2b72f63..f48052db7c 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -2262,7 +2262,7 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, BroType* request_typ return val_mgr->Bool(val->val.int_val)->Ref(); case TYPE_INT: - return val_mgr->GetInt(val->val.int_val); + return val_mgr->Int(val->val.int_val).release(); case TYPE_COUNT: case TYPE_COUNTER: @@ -2410,7 +2410,7 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, bool& have_error) co return val_mgr->Bool(val->val.int_val)->Ref(); case TYPE_INT: - return val_mgr->GetInt(val->val.int_val); + return val_mgr->Int(val->val.int_val).release(); case TYPE_COUNT: case TYPE_COUNTER: diff --git a/src/strings.bif b/src/strings.bif index c19c89418b..434886d074 100644 --- a/src/strings.bif +++ b/src/strings.bif @@ -444,7 +444,7 @@ function gsub%(str: string, re: pattern, repl: string%): string ## *s1* is greater than, equal to, or less than *s2*. function strcmp%(s1: string, s2: string%): int %{ - return val_mgr->GetInt(Bstr_cmp(s1->AsString(), s2->AsString())); + return val_mgr->Int(Bstr_cmp(s1->AsString(), s2->AsString())); %} ## Locates the first occurrence of one string in another. diff --git a/src/supervisor/Supervisor.cc b/src/supervisor/Supervisor.cc index 8f65611a74..1534d81ad0 100644 --- a/src/supervisor/Supervisor.cc +++ b/src/supervisor/Supervisor.cc @@ -1121,7 +1121,7 @@ IntrusivePtr Supervisor::NodeConfig::ToRecord() const rval->Assign(rt->FieldOffset("stderr_file"), make_intrusive(*stderr_file)); if ( cpu_affinity ) - rval->Assign(rt->FieldOffset("cpu_affinity"), val_mgr->GetInt(*cpu_affinity)); + rval->Assign(rt->FieldOffset("cpu_affinity"), val_mgr->Int(*cpu_affinity)); auto st = BifType::Record::Supervisor::NodeConfig->FieldType("scripts"); auto scripts_val = new VectorVal(st->AsVectorType()); @@ -1163,7 +1163,7 @@ IntrusivePtr Supervisor::Node::ToRecord() const rval->Assign(rt->FieldOffset("node"), config.ToRecord()); if ( pid ) - rval->Assign(rt->FieldOffset("pid"), val_mgr->GetInt(pid)); + rval->Assign(rt->FieldOffset("pid"), val_mgr->Int(pid)); return rval; } diff --git a/src/supervisor/supervisor.bif b/src/supervisor/supervisor.bif index c6b07a42b2..4381412ac8 100644 --- a/src/supervisor/supervisor.bif +++ b/src/supervisor/supervisor.bif @@ -102,11 +102,11 @@ function Supervisor::__is_supervisor%(%): bool function Supervisor::__stem_pid%(%): int %{ if ( zeek::supervisor_mgr ) - return val_mgr->GetInt(zeek::supervisor_mgr->StemPID()); + return val_mgr->Int(zeek::supervisor_mgr->StemPID()); if ( zeek::Supervisor::ThisNode() ) - return val_mgr->GetInt(zeek::Supervisor::ThisNode()->parent_pid); + return val_mgr->Int(zeek::Supervisor::ThisNode()->parent_pid); builtin_error("supervisor mode not enabled and not a supervised node"); - return val_mgr->GetInt(-1); + return val_mgr->Int(-1); %} diff --git a/src/zeek.bif b/src/zeek.bif index bea1145287..f5324e59e7 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -468,7 +468,7 @@ static int do_system(const char* s) function system%(str: string%): int %{ int result = do_system(str->CheckString()); - return val_mgr->GetInt(result); + return val_mgr->Int(result); %} ## Invokes a command via the ``system`` function of the OS with a prepared @@ -489,17 +489,17 @@ function system_env%(str: string, env: table_string_of_string%): int if ( env->Type()->Tag() != TYPE_TABLE ) { builtin_error("system_env() requires a table argument"); - return val_mgr->GetInt(-1); + return val_mgr->Int(-1); } if ( ! prepare_environment(env->AsTableVal(), true) ) - return val_mgr->GetInt(-1); + return val_mgr->Int(-1); int result = do_system(str->CheckString()); prepare_environment(env->AsTableVal(), false); - return val_mgr->GetInt(result); + return val_mgr->Int(result); %} ## Opens a program with ``popen`` and writes a given string to the returned @@ -1901,7 +1901,7 @@ function packet_source%(%): PacketSource { 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(2, val_mgr->Int(ps->LinkType())); r->Assign(3, val_mgr->GetCount(ps->Netmask())); } @@ -2273,10 +2273,10 @@ function enum_to_int%(e: any%): int if ( e->Type()->Tag() != TYPE_ENUM ) { builtin_error("enum_to_int() requires enum value"); - return val_mgr->GetInt(-1); + return val_mgr->Int(-1); } - return val_mgr->GetInt(e->AsEnum()); + return val_mgr->Int(e->AsEnum()); %} ## Converts a :zeek:type:`string` to an :zeek:type:`int`. @@ -2300,7 +2300,7 @@ function to_int%(str: string%): int builtin_error("bad conversion to integer", @ARG@[0]); #endif - return val_mgr->GetInt(i); + return val_mgr->Int(i); %}