mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Val: use class IntrusivePtr in class TableVal
This commit is contained in:
parent
93c2064b9a
commit
674e141a15
27 changed files with 88 additions and 109 deletions
|
@ -952,7 +952,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
||||||
n = *kp;
|
n = *kp;
|
||||||
kp1 = reinterpret_cast<const char*>(kp+1);
|
kp1 = reinterpret_cast<const char*>(kp+1);
|
||||||
TableType* tt = t->AsTableType();
|
TableType* tt = t->AsTableType();
|
||||||
auto tv = make_intrusive<TableVal>(tt);
|
auto tv = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, tt});
|
||||||
vector<Val*> keys, values;
|
vector<Val*> keys, values;
|
||||||
for ( int i = 0; i < n; ++i )
|
for ( int i = 0; i < n; ++i )
|
||||||
{
|
{
|
||||||
|
|
|
@ -366,7 +366,7 @@ RecordVal* Connection::BuildConnVal()
|
||||||
conn_val->Assign(1, std::move(orig_endp));
|
conn_val->Assign(1, std::move(orig_endp));
|
||||||
conn_val->Assign(2, std::move(resp_endp));
|
conn_val->Assign(2, std::move(resp_endp));
|
||||||
// 3 and 4 are set below.
|
// 3 and 4 are set below.
|
||||||
conn_val->Assign(5, make_intrusive<TableVal>(string_set)); // service
|
conn_val->Assign(5, make_intrusive<TableVal>(IntrusivePtr{NewRef{}, string_set})); // service
|
||||||
conn_val->Assign(6, val_mgr->GetEmptyString()); // history
|
conn_val->Assign(6, val_mgr->GetEmptyString()); // history
|
||||||
|
|
||||||
if ( ! uid )
|
if ( ! uid )
|
||||||
|
|
|
@ -175,8 +175,8 @@ static TableVal* empty_addr_set()
|
||||||
BroType* addr_t = base_type(TYPE_ADDR);
|
BroType* addr_t = base_type(TYPE_ADDR);
|
||||||
TypeList* set_index = new TypeList(addr_t);
|
TypeList* set_index = new TypeList(addr_t);
|
||||||
set_index->Append(addr_t);
|
set_index->Append(addr_t);
|
||||||
SetType* s = new SetType(set_index, 0);
|
auto s = make_intrusive<SetType>(set_index, nullptr);
|
||||||
return new TableVal(s);
|
return new TableVal(std::move(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
DNS_Mapping::DNS_Mapping(const char* host, struct hostent* h, uint32_t ttl)
|
DNS_Mapping::DNS_Mapping(const char* host, struct hostent* h, uint32_t ttl)
|
||||||
|
|
10
src/Expr.cc
10
src/Expr.cc
|
@ -3165,7 +3165,7 @@ IntrusivePtr<Val> TableConstructorExpr::Eval(Frame* f) const
|
||||||
if ( IsError() )
|
if ( IsError() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto aggr = make_intrusive<TableVal>(Type()->AsTableType(), attrs);
|
auto aggr = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, Type()->AsTableType()}, IntrusivePtr{NewRef{}, attrs});
|
||||||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||||
|
|
||||||
for ( const auto& expr : exprs )
|
for ( const auto& expr : exprs )
|
||||||
|
@ -3184,7 +3184,7 @@ IntrusivePtr<Val> TableConstructorExpr::InitVal(const BroType* t, IntrusivePtr<V
|
||||||
TableType* tt = Type()->AsTableType();
|
TableType* tt = Type()->AsTableType();
|
||||||
auto tval = aggr ?
|
auto tval = aggr ?
|
||||||
IntrusivePtr<TableVal>{AdoptRef{}, aggr.release()->AsTableVal()} :
|
IntrusivePtr<TableVal>{AdoptRef{}, aggr.release()->AsTableVal()} :
|
||||||
make_intrusive<TableVal>(tt, attrs);
|
make_intrusive<TableVal>(IntrusivePtr{NewRef{}, tt}, IntrusivePtr{NewRef{}, attrs});
|
||||||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||||
|
|
||||||
for ( const auto& expr : exprs )
|
for ( const auto& expr : exprs )
|
||||||
|
@ -3273,7 +3273,7 @@ IntrusivePtr<Val> SetConstructorExpr::Eval(Frame* f) const
|
||||||
if ( IsError() )
|
if ( IsError() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto aggr = make_intrusive<TableVal>(type->AsTableType(), attrs);
|
auto aggr = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, type->AsTableType()}, IntrusivePtr{NewRef{}, attrs});
|
||||||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||||
|
|
||||||
for ( const auto& expr : exprs )
|
for ( const auto& expr : exprs )
|
||||||
|
@ -3294,7 +3294,7 @@ IntrusivePtr<Val> SetConstructorExpr::InitVal(const BroType* t, IntrusivePtr<Val
|
||||||
TableType* tt = Type()->AsTableType();
|
TableType* tt = Type()->AsTableType();
|
||||||
auto tval = aggr ?
|
auto tval = aggr ?
|
||||||
IntrusivePtr<TableVal>{AdoptRef{}, aggr.release()->AsTableVal()} :
|
IntrusivePtr<TableVal>{AdoptRef{}, aggr.release()->AsTableVal()} :
|
||||||
make_intrusive<TableVal>(tt, attrs);
|
make_intrusive<TableVal>(IntrusivePtr{NewRef{}, tt}, IntrusivePtr{NewRef{}, attrs});
|
||||||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||||
|
|
||||||
for ( const auto& e : exprs )
|
for ( const auto& e : exprs )
|
||||||
|
@ -3790,7 +3790,7 @@ IntrusivePtr<Val> TableCoerceExpr::Fold(Val* v) const
|
||||||
if ( tv->Size() > 0 )
|
if ( tv->Size() > 0 )
|
||||||
RuntimeErrorWithCallStack("coercion of non-empty table/set");
|
RuntimeErrorWithCallStack("coercion of non-empty table/set");
|
||||||
|
|
||||||
return make_intrusive<TableVal>(Type()->AsTableType(), tv->Attrs());
|
return make_intrusive<TableVal>(IntrusivePtr{NewRef{}, Type()->AsTableType()}, IntrusivePtr{NewRef{}, tv->Attrs()});
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCoerceExpr::VectorCoerceExpr(IntrusivePtr<Expr> arg_op,
|
VectorCoerceExpr::VectorCoerceExpr(IntrusivePtr<Expr> arg_op,
|
||||||
|
|
|
@ -163,7 +163,7 @@ void ID::UpdateValAttrs()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( val && val->Type()->Tag() == TYPE_TABLE )
|
if ( val && val->Type()->Tag() == TYPE_TABLE )
|
||||||
val->AsTableVal()->SetAttrs(attrs.get());
|
val->AsTableVal()->SetAttrs(attrs);
|
||||||
|
|
||||||
if ( val && val->Type()->Tag() == TYPE_FILE )
|
if ( val && val->Type()->Tag() == TYPE_FILE )
|
||||||
val->AsFile()->SetAttrs(attrs.get());
|
val->AsFile()->SetAttrs(attrs.get());
|
||||||
|
|
|
@ -345,7 +345,7 @@ SampleLogger::SampleLogger()
|
||||||
if ( ! load_sample_info )
|
if ( ! load_sample_info )
|
||||||
load_sample_info = internal_type("load_sample_info")->AsTableType();
|
load_sample_info = internal_type("load_sample_info")->AsTableType();
|
||||||
|
|
||||||
load_samples = new TableVal(load_sample_info);
|
load_samples = new TableVal({NewRef{}, load_sample_info});
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleLogger::~SampleLogger()
|
SampleLogger::~SampleLogger()
|
||||||
|
|
|
@ -1666,7 +1666,7 @@ IntrusivePtr<Val> InitStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||||
v = new VectorVal(t->AsVectorType());
|
v = new VectorVal(t->AsVectorType());
|
||||||
break;
|
break;
|
||||||
case TYPE_TABLE:
|
case TYPE_TABLE:
|
||||||
v = new TableVal(t->AsTableType(), aggr->Attrs());
|
v = new TableVal({NewRef{}, t->AsTableType()}, {NewRef{}, aggr->Attrs()});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -808,7 +808,7 @@ static string container_type_name(const BroType* ft)
|
||||||
|
|
||||||
IntrusivePtr<TableVal> RecordType::GetRecordFieldsVal(const RecordVal* rv) const
|
IntrusivePtr<TableVal> RecordType::GetRecordFieldsVal(const RecordVal* rv) const
|
||||||
{
|
{
|
||||||
auto rval = make_intrusive<TableVal>(internal_type("record_field_table")->AsTableType());
|
auto rval = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, internal_type("record_field_table")->AsTableType()});
|
||||||
|
|
||||||
for ( int i = 0; i < NumFields(); ++i )
|
for ( int i = 0; i < NumFields(); ++i )
|
||||||
{
|
{
|
||||||
|
|
69
src/Val.cc
69
src/Val.cc
|
@ -410,7 +410,7 @@ IntrusivePtr<TableVal> Val::GetRecordFields()
|
||||||
if ( t->Tag() != TYPE_RECORD && t->Tag() != TYPE_TYPE )
|
if ( t->Tag() != TYPE_RECORD && t->Tag() != TYPE_TYPE )
|
||||||
{
|
{
|
||||||
reporter->Error("non-record value/type passed to record_fields");
|
reporter->Error("non-record value/type passed to record_fields");
|
||||||
return make_intrusive<TableVal>(internal_type("record_field_table")->AsTableType());
|
return make_intrusive<TableVal>(IntrusivePtr{NewRef{}, internal_type("record_field_table")->AsTableType()});
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordType* rt = nullptr;
|
RecordType* rt = nullptr;
|
||||||
|
@ -428,7 +428,7 @@ IntrusivePtr<TableVal> Val::GetRecordFields()
|
||||||
if ( t->Tag() != TYPE_RECORD )
|
if ( t->Tag() != TYPE_RECORD )
|
||||||
{
|
{
|
||||||
reporter->Error("non-record value/type passed to record_fields");
|
reporter->Error("non-record value/type passed to record_fields");
|
||||||
return make_intrusive<TableVal>(internal_type("record_field_table")->AsTableType());
|
return make_intrusive<TableVal>(IntrusivePtr{NewRef{}, internal_type("record_field_table")->AsTableType()});
|
||||||
}
|
}
|
||||||
|
|
||||||
rt = t->AsRecordType();
|
rt = t->AsRecordType();
|
||||||
|
@ -1236,13 +1236,12 @@ TableVal* ListVal::ConvertToSet() const
|
||||||
|
|
||||||
TypeList* set_index = new TypeList(type->AsTypeList()->PureType());
|
TypeList* set_index = new TypeList(type->AsTypeList()->PureType());
|
||||||
set_index->Append(base_type(tag));
|
set_index->Append(base_type(tag));
|
||||||
SetType* s = new SetType(set_index, 0);
|
auto s = make_intrusive<SetType>(set_index, nullptr);
|
||||||
TableVal* t = new TableVal(s);
|
TableVal* t = new TableVal(std::move(s));
|
||||||
|
|
||||||
for ( const auto& val : vals )
|
for ( const auto& val : vals )
|
||||||
t->Assign(val, 0);
|
t->Assign(val, 0);
|
||||||
|
|
||||||
Unref(s);
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1326,23 +1325,22 @@ static void table_entry_val_delete_func(void* val)
|
||||||
delete tv;
|
delete tv;
|
||||||
}
|
}
|
||||||
|
|
||||||
TableVal::TableVal(TableType* t, Attributes* a) : Val(t)
|
TableVal::TableVal(IntrusivePtr<TableType> t, IntrusivePtr<Attributes> a) : Val(t.get())
|
||||||
{
|
{
|
||||||
Init(t);
|
Init(std::move(t));
|
||||||
SetAttrs(a);
|
SetAttrs(std::move(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableVal::Init(TableType* t)
|
void TableVal::Init(IntrusivePtr<TableType> t)
|
||||||
{
|
{
|
||||||
::Ref(t);
|
table_type = std::move(t);
|
||||||
table_type = t;
|
|
||||||
expire_func = 0;
|
expire_func = 0;
|
||||||
expire_time = 0;
|
expire_time = 0;
|
||||||
expire_cookie = 0;
|
expire_cookie = 0;
|
||||||
timer = 0;
|
timer = 0;
|
||||||
def_val = 0;
|
def_val = 0;
|
||||||
|
|
||||||
if ( t->IsSubNetIndex() )
|
if ( table_type->IsSubNetIndex() )
|
||||||
subnets = new PrefixTable;
|
subnets = new PrefixTable;
|
||||||
else
|
else
|
||||||
subnets = 0;
|
subnets = 0;
|
||||||
|
@ -1358,15 +1356,9 @@ TableVal::~TableVal()
|
||||||
if ( timer )
|
if ( timer )
|
||||||
timer_mgr->Cancel(timer);
|
timer_mgr->Cancel(timer);
|
||||||
|
|
||||||
Unref(table_type);
|
|
||||||
delete table_hash;
|
delete table_hash;
|
||||||
delete AsTable();
|
delete AsTable();
|
||||||
delete subnets;
|
delete subnets;
|
||||||
Unref(attrs);
|
|
||||||
Unref(def_val);
|
|
||||||
Unref(expire_func);
|
|
||||||
Unref(expire_time);
|
|
||||||
Unref(change_func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableVal::RemoveAll()
|
void TableVal::RemoveAll()
|
||||||
|
@ -1404,15 +1396,13 @@ int TableVal::RecursiveSize() const
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableVal::SetAttrs(Attributes* a)
|
void TableVal::SetAttrs(IntrusivePtr<Attributes> a)
|
||||||
{
|
{
|
||||||
attrs = a;
|
attrs = std::move(a);
|
||||||
|
|
||||||
if ( ! a )
|
if ( ! attrs )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
::Ref(attrs);
|
|
||||||
|
|
||||||
CheckExpireAttr(ATTR_EXPIRE_READ);
|
CheckExpireAttr(ATTR_EXPIRE_READ);
|
||||||
CheckExpireAttr(ATTR_EXPIRE_WRITE);
|
CheckExpireAttr(ATTR_EXPIRE_WRITE);
|
||||||
CheckExpireAttr(ATTR_EXPIRE_CREATE);
|
CheckExpireAttr(ATTR_EXPIRE_CREATE);
|
||||||
|
@ -1420,14 +1410,12 @@ void TableVal::SetAttrs(Attributes* a)
|
||||||
Attr* ef = attrs->FindAttr(ATTR_EXPIRE_FUNC);
|
Attr* ef = attrs->FindAttr(ATTR_EXPIRE_FUNC);
|
||||||
if ( ef )
|
if ( ef )
|
||||||
{
|
{
|
||||||
expire_func = ef->AttrExpr();
|
expire_func = {NewRef{}, ef->AttrExpr()};
|
||||||
expire_func->Ref();
|
|
||||||
}
|
}
|
||||||
auto cf = attrs->FindAttr(ATTR_ON_CHANGE);
|
auto cf = attrs->FindAttr(ATTR_ON_CHANGE);
|
||||||
if ( cf )
|
if ( cf )
|
||||||
{
|
{
|
||||||
change_func = cf->AttrExpr();
|
change_func = {NewRef{}, cf->AttrExpr()};
|
||||||
change_func->Ref();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1437,8 +1425,7 @@ void TableVal::CheckExpireAttr(attr_tag at)
|
||||||
|
|
||||||
if ( a )
|
if ( a )
|
||||||
{
|
{
|
||||||
expire_time = a->AttrExpr();
|
expire_time = {NewRef{}, a->AttrExpr()};
|
||||||
expire_time->Ref();
|
|
||||||
|
|
||||||
if ( expire_time->Type()->Tag() != TYPE_INTERVAL )
|
if ( expire_time->Type()->Tag() != TYPE_INTERVAL )
|
||||||
{
|
{
|
||||||
|
@ -1772,11 +1759,11 @@ IntrusivePtr<Val> TableVal::Default(Val* index)
|
||||||
auto coerce = make_intrusive<RecordCoerceExpr>(
|
auto coerce = make_intrusive<RecordCoerceExpr>(
|
||||||
IntrusivePtr{NewRef{}, def_attr->AttrExpr()},
|
IntrusivePtr{NewRef{}, def_attr->AttrExpr()},
|
||||||
IntrusivePtr{NewRef{}, ytype->AsRecordType()});
|
IntrusivePtr{NewRef{}, ytype->AsRecordType()});
|
||||||
def_val = coerce->Eval(0).release();
|
def_val = coerce->Eval(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
def_val = def_attr->AttrExpr()->Eval(0).release();
|
def_val = def_attr->AttrExpr()->Eval(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! def_val )
|
if ( ! def_val )
|
||||||
|
@ -1789,7 +1776,7 @@ IntrusivePtr<Val> TableVal::Default(Val* index)
|
||||||
same_type(def_val->Type(), Type()->YieldType()) )
|
same_type(def_val->Type(), Type()->YieldType()) )
|
||||||
{
|
{
|
||||||
if ( def_attr->AttrExpr()->IsConst() )
|
if ( def_attr->AttrExpr()->IsConst() )
|
||||||
return {NewRef{}, def_val};
|
return def_val;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1900,7 +1887,7 @@ IntrusivePtr<TableVal> TableVal::LookupSubnetValues(const SubNetVal* search)
|
||||||
if ( ! subnets )
|
if ( ! subnets )
|
||||||
reporter->InternalError("LookupSubnetValues called on wrong table type");
|
reporter->InternalError("LookupSubnetValues called on wrong table type");
|
||||||
|
|
||||||
auto nt = make_intrusive<TableVal>(this->Type()->Ref()->AsTableType());
|
auto nt = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, this->Type()->AsTableType()});
|
||||||
|
|
||||||
auto matches = subnets->FindAll(search);
|
auto matches = subnets->FindAll(search);
|
||||||
for ( auto element : matches )
|
for ( auto element : matches )
|
||||||
|
@ -2252,7 +2239,7 @@ void TableVal::InitDefaultFunc(Frame* f)
|
||||||
ytype->AsRecordType()) )
|
ytype->AsRecordType()) )
|
||||||
return; // TableVal::Default will handle this.
|
return; // TableVal::Default will handle this.
|
||||||
|
|
||||||
def_val = def_attr->AttrExpr()->Eval(f).release();
|
def_val = def_attr->AttrExpr()->Eval(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableVal::InitTimer(double delay)
|
void TableVal::InitTimer(double delay)
|
||||||
|
@ -2497,15 +2484,11 @@ IntrusivePtr<Val> TableVal::DoClone(CloneState* state)
|
||||||
delete key;
|
delete key;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attrs )
|
tv->attrs = attrs;
|
||||||
{
|
|
||||||
::Ref(attrs);
|
|
||||||
tv->attrs = attrs;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( expire_time )
|
if ( expire_time )
|
||||||
{
|
{
|
||||||
tv->expire_time = expire_time->Ref();
|
tv->expire_time = expire_time;
|
||||||
|
|
||||||
// As network_time is not necessarily initialized yet, we set
|
// As network_time is not necessarily initialized yet, we set
|
||||||
// a timer which fires immediately.
|
// a timer which fires immediately.
|
||||||
|
@ -2514,10 +2497,10 @@ IntrusivePtr<Val> TableVal::DoClone(CloneState* state)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( expire_func )
|
if ( expire_func )
|
||||||
tv->expire_func = expire_func->Ref();
|
tv->expire_func = expire_func;
|
||||||
|
|
||||||
if ( def_val )
|
if ( def_val )
|
||||||
tv->def_val = def_val->Clone().release();
|
tv->def_val = def_val->Clone();
|
||||||
|
|
||||||
return tv;
|
return tv;
|
||||||
}
|
}
|
||||||
|
@ -2591,7 +2574,7 @@ RecordVal::RecordVal(RecordType* t, bool init_fields) : Val(t)
|
||||||
def = make_intrusive<RecordVal>(type->AsRecordType());
|
def = make_intrusive<RecordVal>(type->AsRecordType());
|
||||||
|
|
||||||
else if ( tag == TYPE_TABLE )
|
else if ( tag == TYPE_TABLE )
|
||||||
def = make_intrusive<TableVal>(type->AsTableType(), a);
|
def = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, type->AsTableType()}, IntrusivePtr{NewRef{}, a});
|
||||||
|
|
||||||
else if ( tag == TYPE_VECTOR )
|
else if ( tag == TYPE_VECTOR )
|
||||||
def = make_intrusive<VectorVal>(type->AsVectorType());
|
def = make_intrusive<VectorVal>(type->AsVectorType());
|
||||||
|
|
20
src/Val.h
20
src/Val.h
|
@ -693,7 +693,7 @@ class Frame;
|
||||||
|
|
||||||
class TableVal : public Val, public notifier::Modifiable {
|
class TableVal : public Val, public notifier::Modifiable {
|
||||||
public:
|
public:
|
||||||
explicit TableVal(TableType* t, Attributes* attrs = 0);
|
explicit TableVal(IntrusivePtr<TableType> t, IntrusivePtr<Attributes> attrs = nullptr);
|
||||||
~TableVal() override;
|
~TableVal() override;
|
||||||
|
|
||||||
// Returns true if the assignment typechecked, false if not. The
|
// Returns true if the assignment typechecked, false if not. The
|
||||||
|
@ -776,9 +776,9 @@ public:
|
||||||
ListVal* ConvertToList(TypeTag t=TYPE_ANY) const;
|
ListVal* ConvertToList(TypeTag t=TYPE_ANY) const;
|
||||||
ListVal* ConvertToPureList() const; // must be single index type
|
ListVal* ConvertToPureList() const; // must be single index type
|
||||||
|
|
||||||
void SetAttrs(Attributes* attrs);
|
void SetAttrs(IntrusivePtr<Attributes> attrs);
|
||||||
Attr* FindAttr(attr_tag t) const;
|
Attr* FindAttr(attr_tag t) const;
|
||||||
Attributes* Attrs() { return attrs; }
|
Attributes* Attrs() { return attrs.get(); }
|
||||||
|
|
||||||
// Returns the size of the table.
|
// Returns the size of the table.
|
||||||
int Size() const;
|
int Size() const;
|
||||||
|
@ -812,7 +812,7 @@ public:
|
||||||
notifier::Modifiable* Modifiable() override { return this; }
|
notifier::Modifiable* Modifiable() override { return this; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init(TableType* t);
|
void Init(IntrusivePtr<TableType> t);
|
||||||
|
|
||||||
void CheckExpireAttr(attr_tag at);
|
void CheckExpireAttr(attr_tag at);
|
||||||
int ExpandCompoundAndInit(val_list* vl, int k, IntrusivePtr<Val> new_val);
|
int ExpandCompoundAndInit(val_list* vl, int k, IntrusivePtr<Val> new_val);
|
||||||
|
@ -841,16 +841,16 @@ protected:
|
||||||
|
|
||||||
IntrusivePtr<Val> DoClone(CloneState* state) override;
|
IntrusivePtr<Val> DoClone(CloneState* state) override;
|
||||||
|
|
||||||
TableType* table_type;
|
IntrusivePtr<TableType> table_type;
|
||||||
CompositeHash* table_hash;
|
CompositeHash* table_hash;
|
||||||
Attributes* attrs;
|
IntrusivePtr<Attributes> attrs;
|
||||||
Expr* expire_time;
|
IntrusivePtr<Expr> expire_time;
|
||||||
Expr* expire_func;
|
IntrusivePtr<Expr> expire_func;
|
||||||
TableValTimer* timer;
|
TableValTimer* timer;
|
||||||
IterCookie* expire_cookie;
|
IterCookie* expire_cookie;
|
||||||
PrefixTable* subnets;
|
PrefixTable* subnets;
|
||||||
Val* def_val;
|
IntrusivePtr<Val> def_val;
|
||||||
Expr* change_func = nullptr;
|
IntrusivePtr<Expr> change_func;
|
||||||
// prevent recursion of change functions
|
// prevent recursion of change functions
|
||||||
bool in_change_func = false;
|
bool in_change_func = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -168,7 +168,7 @@ static void make_var(ID* id, IntrusivePtr<BroType> t, init_class c,
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( t->Tag() == TYPE_TABLE )
|
else if ( t->Tag() == TYPE_TABLE )
|
||||||
aggr = make_intrusive<TableVal>(t->AsTableType(), id->Attrs());
|
aggr = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, t->AsTableType()}, IntrusivePtr{NewRef{}, id->Attrs()});
|
||||||
|
|
||||||
else if ( t->Tag() == TYPE_VECTOR )
|
else if ( t->Tag() == TYPE_VECTOR )
|
||||||
aggr = make_intrusive<VectorVal>(t->AsVectorType());
|
aggr = make_intrusive<VectorVal>(t->AsVectorType());
|
||||||
|
|
|
@ -45,7 +45,7 @@ BitTorrentTracker_Analyzer::BitTorrentTracker_Analyzer(Connection* c)
|
||||||
req_buf_pos = req_buf;
|
req_buf_pos = req_buf;
|
||||||
req_buf_len = 0;
|
req_buf_len = 0;
|
||||||
req_val_uri = 0;
|
req_val_uri = 0;
|
||||||
req_val_headers = new TableVal(bt_tracker_headers);
|
req_val_headers = new TableVal({NewRef{}, bt_tracker_headers});
|
||||||
|
|
||||||
res_state = BTT_RES_STATUS;
|
res_state = BTT_RES_STATUS;
|
||||||
res_allow_blank_line = false;
|
res_allow_blank_line = false;
|
||||||
|
@ -53,9 +53,9 @@ BitTorrentTracker_Analyzer::BitTorrentTracker_Analyzer(Connection* c)
|
||||||
res_buf_pos = res_buf;
|
res_buf_pos = res_buf;
|
||||||
res_buf_len = 0;
|
res_buf_len = 0;
|
||||||
res_status = 0;
|
res_status = 0;
|
||||||
res_val_headers = new TableVal(bt_tracker_headers);
|
res_val_headers = new TableVal({NewRef{}, bt_tracker_headers});
|
||||||
res_val_peers = new TableVal(bittorrent_peer_set);
|
res_val_peers = new TableVal({NewRef{}, bittorrent_peer_set});
|
||||||
res_val_benc = new TableVal(bittorrent_benc_dir);
|
res_val_benc = new TableVal({NewRef{}, bittorrent_benc_dir});
|
||||||
|
|
||||||
InitBencParser();
|
InitBencParser();
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ void BitTorrentTracker_Analyzer::ClientRequest(int len, const u_char* data)
|
||||||
memmove(req_buf, req_buf_pos, req_buf_len);
|
memmove(req_buf, req_buf_pos, req_buf_len);
|
||||||
req_buf_pos = req_buf;
|
req_buf_pos = req_buf;
|
||||||
req_val_headers =
|
req_val_headers =
|
||||||
new TableVal(bt_tracker_headers);
|
new TableVal({NewRef{}, bt_tracker_headers});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,9 +199,9 @@ void BitTorrentTracker_Analyzer::ServerReply(int len, const u_char* data)
|
||||||
res_buf_pos = res_buf;
|
res_buf_pos = res_buf;
|
||||||
res_status = 0;
|
res_status = 0;
|
||||||
|
|
||||||
res_val_headers = new TableVal(bt_tracker_headers);
|
res_val_headers = new TableVal({NewRef{}, bt_tracker_headers});
|
||||||
res_val_peers = new TableVal(bittorrent_peer_set);
|
res_val_peers = new TableVal({NewRef{}, bittorrent_peer_set});
|
||||||
res_val_benc = new TableVal(bittorrent_benc_dir);
|
res_val_benc = new TableVal({NewRef{}, bittorrent_benc_dir});
|
||||||
|
|
||||||
InitBencParser();
|
InitBencParser();
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
if ( parts.size() > 0 && parts[0][0] == ':' )
|
if ( parts.size() > 0 && parts[0][0] == ':' )
|
||||||
parts[0] = parts[0].substr(1);
|
parts[0] = parts[0].substr(1);
|
||||||
|
|
||||||
TableVal* set = new TableVal(string_set);
|
TableVal* set = new TableVal({NewRef{}, string_set});
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < parts.size(); ++i )
|
for ( unsigned int i = 0; i < parts.size(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -463,7 +463,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
if ( parts.size() > 0 && parts[0][0] == ':' )
|
if ( parts.size() > 0 && parts[0][0] == ':' )
|
||||||
parts[0] = parts[0].substr(1);
|
parts[0] = parts[0].substr(1);
|
||||||
|
|
||||||
TableVal* set = new TableVal(string_set);
|
TableVal* set = new TableVal({NewRef{}, string_set});
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < parts.size(); ++i )
|
for ( unsigned int i = 0; i < parts.size(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -841,7 +841,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
nickname = prefix.substr(0, pos);
|
nickname = prefix.substr(0, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
TableVal* list = new TableVal(irc_join_list);
|
TableVal* list = new TableVal({NewRef{}, irc_join_list});
|
||||||
|
|
||||||
vector<string> channels = SplitWords(parts[0], ',');
|
vector<string> channels = SplitWords(parts[0], ',');
|
||||||
vector<string> passwords;
|
vector<string> passwords;
|
||||||
|
@ -886,7 +886,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
parts[1] = parts[1].substr(1);
|
parts[1] = parts[1].substr(1);
|
||||||
|
|
||||||
vector<string> users = SplitWords(parts[1], ',');
|
vector<string> users = SplitWords(parts[1], ',');
|
||||||
TableVal* list = new TableVal(irc_join_list);
|
TableVal* list = new TableVal({NewRef{}, irc_join_list});
|
||||||
|
|
||||||
string empty_string = "";
|
string empty_string = "";
|
||||||
|
|
||||||
|
@ -957,7 +957,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
nick = nick.substr(0, pos);
|
nick = nick.substr(0, pos);
|
||||||
|
|
||||||
vector<string> channelList = SplitWords(channels, ',');
|
vector<string> channelList = SplitWords(channels, ',');
|
||||||
TableVal* set = new TableVal(string_set);
|
TableVal* set = new TableVal({NewRef{}, string_set});
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < channelList.size(); ++i )
|
for ( unsigned int i = 0; i < channelList.size(); ++i )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1299,7 +1299,7 @@ RecordVal* MIME_Message::BuildHeaderVal(MIME_Header* h)
|
||||||
|
|
||||||
TableVal* MIME_Message::BuildHeaderTable(MIME_HeaderList& hlist)
|
TableVal* MIME_Message::BuildHeaderTable(MIME_HeaderList& hlist)
|
||||||
{
|
{
|
||||||
TableVal* t = new TableVal(mime_header_list);
|
TableVal* t = new TableVal({NewRef{}, mime_header_list});
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < hlist.size(); ++i )
|
for ( unsigned int i = 0; i < hlist.size(); ++i )
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ refine flow RADIUS_Flow += {
|
||||||
|
|
||||||
if ( ${msg.attributes}->size() )
|
if ( ${msg.attributes}->size() )
|
||||||
{
|
{
|
||||||
TableVal* attributes = new TableVal(BifType::Table::RADIUS::Attributes);
|
TableVal* attributes = new TableVal({NewRef{}, BifType::Table::RADIUS::Attributes});
|
||||||
|
|
||||||
for ( uint i = 0; i < ${msg.attributes}->size(); ++i ) {
|
for ( uint i = 0; i < ${msg.attributes}->size(); ++i ) {
|
||||||
Val* index = val_mgr->GetCount(${msg.attributes[i].code});
|
Val* index = val_mgr->GetCount(${msg.attributes[i].code});
|
||||||
|
|
|
@ -139,7 +139,7 @@ int PortmapperInterp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status status
|
||||||
event = success ? pm_request_dump : pm_attempt_dump;
|
event = success ? pm_request_dump : pm_attempt_dump;
|
||||||
if ( success )
|
if ( success )
|
||||||
{
|
{
|
||||||
TableVal* mappings = new TableVal(pm_mappings);
|
TableVal* mappings = new TableVal({NewRef{}, pm_mappings});
|
||||||
uint32_t nmap = 0;
|
uint32_t nmap = 0;
|
||||||
|
|
||||||
// Each call in the loop test pulls the next "opted"
|
// Each call in the loop test pulls the next "opted"
|
||||||
|
|
|
@ -65,7 +65,7 @@ refine flow SIP_Flow += {
|
||||||
|
|
||||||
function build_sip_headers_val(): BroVal
|
function build_sip_headers_val(): BroVal
|
||||||
%{
|
%{
|
||||||
TableVal* t = new TableVal(mime_header_list);
|
TableVal* t = new TableVal({NewRef{}, mime_header_list});
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < headers.size(); ++i )
|
for ( unsigned int i = 0; i < headers.size(); ++i )
|
||||||
{ // index starting from 1
|
{ // index starting from 1
|
||||||
|
|
|
@ -208,7 +208,7 @@ struct val_converter {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto tt = type->AsTableType();
|
auto tt = type->AsTableType();
|
||||||
auto rval = make_intrusive<TableVal>(tt);
|
auto rval = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, tt});
|
||||||
|
|
||||||
for ( auto& item : a )
|
for ( auto& item : a )
|
||||||
{
|
{
|
||||||
|
@ -268,7 +268,7 @@ struct val_converter {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto tt = type->AsTableType();
|
auto tt = type->AsTableType();
|
||||||
auto rval = make_intrusive<TableVal>(tt);
|
auto rval = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, tt});
|
||||||
|
|
||||||
for ( auto& item : a )
|
for ( auto& item : a )
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,10 +25,8 @@ static Val* empty_connection_table()
|
||||||
{
|
{
|
||||||
TypeList* tbl_index = new TypeList(conn_id);
|
TypeList* tbl_index = new TypeList(conn_id);
|
||||||
tbl_index->Append(conn_id->Ref());
|
tbl_index->Append(conn_id->Ref());
|
||||||
TableType* tbl_type = new TableType(tbl_index, connection_type->Ref());
|
auto tbl_type = make_intrusive<TableType>(tbl_index, connection_type->Ref());
|
||||||
Val* rval = new TableVal(tbl_type);
|
return new TableVal(std::move(tbl_type));
|
||||||
Unref(tbl_type);
|
|
||||||
return rval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RecordVal* get_conn_id_val(const Connection* conn)
|
static RecordVal* get_conn_id_val(const Connection* conn)
|
||||||
|
|
|
@ -25,7 +25,7 @@ refine flow File += {
|
||||||
function characteristics_to_bro(c: uint32, len: uint8): TableVal
|
function characteristics_to_bro(c: uint32, len: uint8): TableVal
|
||||||
%{
|
%{
|
||||||
uint64 mask = (len==16) ? 0xFFFF : 0xFFFFFFFF;
|
uint64 mask = (len==16) ? 0xFFFF : 0xFFFFFFFF;
|
||||||
TableVal* char_set = new TableVal(internal_type("count_set")->AsTableType());
|
TableVal* char_set = new TableVal({NewRef{}, internal_type("count_set")->AsTableType()});
|
||||||
for ( uint16 i=0; i < len; ++i )
|
for ( uint16 i=0; i < len; ++i )
|
||||||
{
|
{
|
||||||
if ( ((c >> i) & 0x1) == 1 )
|
if ( ((c >> i) & 0x1) == 1 )
|
||||||
|
|
|
@ -2379,8 +2379,8 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, BroType* request_typ
|
||||||
BroType* type = request_type->AsTableType()->Indices()->PureType();
|
BroType* type = request_type->AsTableType()->Indices()->PureType();
|
||||||
TypeList* set_index = new TypeList(type->Ref());
|
TypeList* set_index = new TypeList(type->Ref());
|
||||||
set_index->Append(type->Ref());
|
set_index->Append(type->Ref());
|
||||||
SetType* s = new SetType(set_index, 0);
|
auto s = make_intrusive<SetType>(set_index, nullptr);
|
||||||
TableVal* t = new TableVal(s);
|
TableVal* t = new TableVal(std::move(s));
|
||||||
for ( int j = 0; j < val->val.set_val.size; j++ )
|
for ( int j = 0; j < val->val.set_val.size; j++ )
|
||||||
{
|
{
|
||||||
Val* assignval = ValueToVal(i, val->val.set_val.vals[j], type, have_error);
|
Val* assignval = ValueToVal(i, val->val.set_val.vals[j], type, have_error);
|
||||||
|
@ -2389,7 +2389,6 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, BroType* request_typ
|
||||||
Unref(assignval); // index is not consumed by assign.
|
Unref(assignval); // index is not consumed by assign.
|
||||||
}
|
}
|
||||||
|
|
||||||
Unref(s);
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2562,8 +2561,8 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, bool& have_error) co
|
||||||
set_index->Append(index_type->Ref());
|
set_index->Append(index_type->Ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
SetType* s = new SetType(set_index, 0);
|
auto s = make_intrusive<SetType>(set_index, nullptr);
|
||||||
TableVal* t = new TableVal(s);
|
TableVal* t = new TableVal(std::move(s));
|
||||||
for ( int j = 0; j < val->val.set_val.size; j++ )
|
for ( int j = 0; j < val->val.set_val.size; j++ )
|
||||||
{
|
{
|
||||||
Val* assignval = ValueToVal(i, val->val.set_val.vals[j], have_error);
|
Val* assignval = ValueToVal(i, val->val.set_val.vals[j], have_error);
|
||||||
|
@ -2572,7 +2571,6 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, bool& have_error) co
|
||||||
Unref(assignval); // index is not consumed by assign.
|
Unref(assignval); // index is not consumed by assign.
|
||||||
}
|
}
|
||||||
|
|
||||||
Unref(s);
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,8 @@ function Option::set%(ID: string, val: any, location: string &default=""%): bool
|
||||||
val->Type()->AsTableType()->IsUnspecifiedTable() )
|
val->Type()->AsTableType()->IsUnspecifiedTable() )
|
||||||
{
|
{
|
||||||
// Just coerce an empty/unspecified table to the right type.
|
// Just coerce an empty/unspecified table to the right type.
|
||||||
auto tv = new TableVal(i->Type()->AsTableType(),
|
auto tv = new TableVal({NewRef{}, i->Type()->AsTableType()},
|
||||||
i->ID_Val()->AsTableVal()->Attrs());
|
{NewRef{}, i->ID_Val()->AsTableVal()->Attrs()});
|
||||||
auto rval = call_option_handlers_and_set_value(ID, i, tv, location);
|
auto rval = call_option_handlers_and_set_value(ID, i, tv, location);
|
||||||
Unref(tv);
|
Unref(tv);
|
||||||
return val_mgr->GetBool(rval);
|
return val_mgr->GetBool(rval);
|
||||||
|
|
|
@ -153,7 +153,7 @@ function Reporter::file_weird%(name: string, f: fa_file, addl: string &default="
|
||||||
## Returns: Current weird sampling whitelist
|
## Returns: Current weird sampling whitelist
|
||||||
function Reporter::get_weird_sampling_whitelist%(%): string_set
|
function Reporter::get_weird_sampling_whitelist%(%): string_set
|
||||||
%{
|
%{
|
||||||
TableVal* set = new TableVal(string_set);
|
TableVal* set = new TableVal({NewRef{}, string_set});
|
||||||
for ( auto el : reporter->GetWeirdSamplingWhitelist() )
|
for ( auto el : reporter->GetWeirdSamplingWhitelist() )
|
||||||
{
|
{
|
||||||
auto idx = make_intrusive<StringVal>(el);
|
auto idx = make_intrusive<StringVal>(el);
|
||||||
|
|
|
@ -470,7 +470,7 @@ function get_reporter_stats%(%): ReporterStats
|
||||||
RecordVal* r = new RecordVal(ReporterStats);
|
RecordVal* r = new RecordVal(ReporterStats);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
TableVal* weirds_by_type = new TableVal(internal_type("table_string_of_count")->AsTableType());
|
TableVal* weirds_by_type = new TableVal({NewRef{}, internal_type("table_string_of_count")->AsTableType()});
|
||||||
|
|
||||||
for ( auto& kv : reporter->GetWeirdsByType() )
|
for ( auto& kv : reporter->GetWeirdsByType() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -294,7 +294,7 @@ VectorVal* do_split_string(StringVal* str_val, RE_Matcher* re, int incl_sep,
|
||||||
|
|
||||||
Val* do_split(StringVal* str_val, RE_Matcher* re, int incl_sep, int max_num_sep)
|
Val* do_split(StringVal* str_val, RE_Matcher* re, int incl_sep, int max_num_sep)
|
||||||
{
|
{
|
||||||
TableVal* a = new TableVal(string_array);
|
TableVal* a = new TableVal({NewRef{}, string_array});
|
||||||
const u_char* s = str_val->Bytes();
|
const u_char* s = str_val->Bytes();
|
||||||
int n = str_val->Len();
|
int n = str_val->Len();
|
||||||
const u_char* end_of_s = s + n;
|
const u_char* end_of_s = s + n;
|
||||||
|
@ -946,7 +946,7 @@ function safe_shell_quote%(source: string%): string
|
||||||
## .. zeek:see: find_last strstr
|
## .. zeek:see: find_last strstr
|
||||||
function find_all%(str: string, re: pattern%) : string_set
|
function find_all%(str: string, re: pattern%) : string_set
|
||||||
%{
|
%{
|
||||||
TableVal* a = new TableVal(string_set);
|
TableVal* a = new TableVal({NewRef{}, string_set});
|
||||||
|
|
||||||
const u_char* s = str->Bytes();
|
const u_char* s = str->Bytes();
|
||||||
const u_char* e = s + str->Len();
|
const u_char* e = s + str->Len();
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ IntrusivePtr<RecordVal> Supervisor::NodeConfig::ToRecord() const
|
||||||
scripts_val->Assign(scripts_val->Size(), make_intrusive<StringVal>(s));
|
scripts_val->Assign(scripts_val->Size(), make_intrusive<StringVal>(s));
|
||||||
|
|
||||||
auto tt = BifType::Record::Supervisor::NodeConfig->FieldType("cluster");
|
auto tt = BifType::Record::Supervisor::NodeConfig->FieldType("cluster");
|
||||||
auto cluster_val = new TableVal(tt->AsTableType());
|
auto cluster_val = new TableVal({NewRef{}, tt->AsTableType()});
|
||||||
rval->Assign(rt->FieldOffset("cluster"), cluster_val);
|
rval->Assign(rt->FieldOffset("cluster"), cluster_val);
|
||||||
|
|
||||||
for ( const auto& e : cluster )
|
for ( const auto& e : cluster )
|
||||||
|
@ -1315,7 +1315,7 @@ RecordVal* Supervisor::Status(std::string_view node_name)
|
||||||
{
|
{
|
||||||
auto rval = new RecordVal(BifType::Record::Supervisor::Status);
|
auto rval = new RecordVal(BifType::Record::Supervisor::Status);
|
||||||
auto tt = BifType::Record::Supervisor::Status->FieldType("nodes");
|
auto tt = BifType::Record::Supervisor::Status->FieldType("nodes");
|
||||||
auto node_table_val = new TableVal(tt->AsTableType());
|
auto node_table_val = new TableVal({NewRef{}, tt->AsTableType()});
|
||||||
rval->Assign(0, node_table_val);
|
rval->Assign(0, node_table_val);
|
||||||
|
|
||||||
if ( node_name.empty() )
|
if ( node_name.empty() )
|
||||||
|
|
|
@ -1919,7 +1919,7 @@ function packet_source%(%): PacketSource
|
||||||
## .. zeek:see:: global_ids
|
## .. zeek:see:: global_ids
|
||||||
function global_sizes%(%): var_sizes
|
function global_sizes%(%): var_sizes
|
||||||
%{
|
%{
|
||||||
TableVal* sizes = new TableVal(var_sizes);
|
TableVal* sizes = new TableVal({NewRef{}, var_sizes});
|
||||||
const auto& globals = global_scope()->Vars();
|
const auto& globals = global_scope()->Vars();
|
||||||
|
|
||||||
for ( const auto& global : globals )
|
for ( const auto& global : globals )
|
||||||
|
@ -1947,7 +1947,7 @@ function global_sizes%(%): var_sizes
|
||||||
## .. zeek:see:: global_sizes
|
## .. zeek:see:: global_sizes
|
||||||
function global_ids%(%): id_table
|
function global_ids%(%): id_table
|
||||||
%{
|
%{
|
||||||
TableVal* ids = new TableVal(id_table);
|
TableVal* ids = new TableVal({NewRef{}, id_table});
|
||||||
const auto& globals = global_scope()->Vars();
|
const auto& globals = global_scope()->Vars();
|
||||||
|
|
||||||
for ( const auto& global : globals )
|
for ( const auto& global : globals )
|
||||||
|
@ -2009,7 +2009,7 @@ function record_fields%(rec: any%): record_field_table
|
||||||
if ( ! id || ! id->AsType() || id->AsType()->Tag() != TYPE_RECORD )
|
if ( ! id || ! id->AsType() || id->AsType()->Tag() != TYPE_RECORD )
|
||||||
{
|
{
|
||||||
reporter->Error("record_fields string argument does not name a record type");
|
reporter->Error("record_fields string argument does not name a record type");
|
||||||
return new TableVal(internal_type("record_field_table")->AsTableType());
|
return new TableVal({NewRef{}, internal_type("record_field_table")->AsTableType()});
|
||||||
}
|
}
|
||||||
|
|
||||||
return id->AsType()->AsRecordType()->GetRecordFieldsVal().release();
|
return id->AsType()->AsRecordType()->GetRecordFieldsVal().release();
|
||||||
|
@ -3327,7 +3327,7 @@ function lookup_connection%(cid: conn_id%): connection
|
||||||
|
|
||||||
c->Assign(3, make_intrusive<Val>(network_time, TYPE_TIME));
|
c->Assign(3, make_intrusive<Val>(network_time, TYPE_TIME));
|
||||||
c->Assign(4, make_intrusive<Val>(0.0, TYPE_INTERVAL));
|
c->Assign(4, make_intrusive<Val>(0.0, TYPE_INTERVAL));
|
||||||
c->Assign(5, make_intrusive<TableVal>(string_set)); // service
|
c->Assign(5, make_intrusive<TableVal>(IntrusivePtr{NewRef{}, string_set})); // service
|
||||||
c->Assign(6, val_mgr->GetEmptyString()); // history
|
c->Assign(6, val_mgr->GetEmptyString()); // history
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue