mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Deprecate VectorVal(VectorType*) ctora
Adds a new one taking an IntrusivePtr.
This commit is contained in:
parent
c5236ecaee
commit
d4dba40727
51 changed files with 171 additions and 160 deletions
|
@ -340,10 +340,8 @@ BroString::Vec* BroString::Split(const BroString::IdxVec& indices) const
|
|||
|
||||
VectorVal* BroString:: VecToPolicy(Vec* vec)
|
||||
{
|
||||
VectorVal* result =
|
||||
new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
if ( ! result )
|
||||
return nullptr;
|
||||
auto result =
|
||||
make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
for ( unsigned int i = 0; i < vec->size(); ++i )
|
||||
{
|
||||
|
@ -353,7 +351,7 @@ VectorVal* BroString:: VecToPolicy(Vec* vec)
|
|||
result->Assign(i+1, val);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result.release();
|
||||
}
|
||||
|
||||
BroString::Vec* BroString::VecFromPolicy(VectorVal* vec)
|
||||
|
|
|
@ -973,7 +973,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
n = *kp;
|
||||
kp1 = reinterpret_cast<const char*>(kp+1);
|
||||
VectorType* vt = t->AsVectorType();
|
||||
auto vv = make_intrusive<VectorVal>(vt);
|
||||
auto vv = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, vt});
|
||||
|
||||
for ( unsigned int i = 0; i < n; ++i )
|
||||
{
|
||||
|
|
|
@ -127,7 +127,7 @@ void EventHandler::NewEvent(const zeek::Args& vl)
|
|||
return;
|
||||
|
||||
RecordType* args = FType()->Args();
|
||||
auto vargs = make_intrusive<VectorVal>(call_argument_vector);
|
||||
auto vargs = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, call_argument_vector});
|
||||
|
||||
for ( int i = 0; i < args->NumFields(); i++ )
|
||||
{
|
||||
|
|
24
src/Expr.cc
24
src/Expr.cc
|
@ -361,7 +361,7 @@ IntrusivePtr<Val> UnaryExpr::Eval(Frame* f) const
|
|||
else
|
||||
out_t = Type()->AsVectorType();
|
||||
|
||||
auto result = make_intrusive<VectorVal>(out_t);
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, out_t});
|
||||
|
||||
for ( unsigned int i = 0; i < v_op->Size(); ++i )
|
||||
{
|
||||
|
@ -454,7 +454,7 @@ IntrusivePtr<Val> BinaryExpr::Eval(Frame* f) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto v_result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto v_result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
|
||||
for ( unsigned int i = 0; i < v_op1->Size(); ++i )
|
||||
{
|
||||
|
@ -471,7 +471,7 @@ IntrusivePtr<Val> BinaryExpr::Eval(Frame* f) const
|
|||
if ( IsVector(Type()->Tag()) && (is_vec1 || is_vec2) )
|
||||
{ // fold vector against scalar
|
||||
VectorVal* vv = (is_vec1 ? v1 : v2)->AsVectorVal();
|
||||
auto v_result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto v_result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
|
||||
for ( unsigned int i = 0; i < vv->Size(); ++i )
|
||||
{
|
||||
|
@ -1583,7 +1583,7 @@ IntrusivePtr<Val> BoolExpr::Eval(Frame* f) const
|
|||
|
||||
if ( scalar_v->IsZero() == is_and )
|
||||
{
|
||||
result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
result->Resize(vector_v->Size());
|
||||
result->AssignRepeat(0, result->Size(), scalar_v.get());
|
||||
}
|
||||
|
@ -1608,7 +1608,7 @@ IntrusivePtr<Val> BoolExpr::Eval(Frame* f) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
result->Resize(vec_v1->Size());
|
||||
|
||||
for ( unsigned int i = 0; i < vec_v1->Size(); ++i )
|
||||
|
@ -1940,7 +1940,7 @@ IntrusivePtr<Val> CondExpr::Eval(Frame* f) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
result->Resize(cond->Size());
|
||||
|
||||
for ( unsigned int i = 0; i < cond->Size(); ++i )
|
||||
|
@ -2592,7 +2592,7 @@ IntrusivePtr<Val> IndexExpr::Eval(Frame* f) const
|
|||
{
|
||||
VectorVal* v_v1 = v1->AsVectorVal();
|
||||
VectorVal* v_v2 = indv->AsVectorVal();
|
||||
auto v_result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto v_result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
|
||||
// Booleans select each element (or not).
|
||||
if ( IsBool(v_v2->Type()->Yield()->Tag()) )
|
||||
|
@ -2659,7 +2659,7 @@ IntrusivePtr<Val> IndexExpr::Fold(Val* v1, Val* v2) const
|
|||
else
|
||||
{
|
||||
size_t len = vect->Size();
|
||||
auto result = make_intrusive<VectorVal>(vect->Type()->AsVectorType());
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, vect->Type()->AsVectorType()});
|
||||
|
||||
bro_int_t first = get_slice_index(lv->Idx(0)->CoerceToInt(), len);
|
||||
bro_int_t last = get_slice_index(lv->Idx(1)->CoerceToInt(), len);
|
||||
|
@ -3352,7 +3352,7 @@ IntrusivePtr<Val> VectorConstructorExpr::Eval(Frame* f) const
|
|||
if ( IsError() )
|
||||
return nullptr;
|
||||
|
||||
auto vec = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto vec = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||
|
||||
loop_over_list(exprs, i)
|
||||
|
@ -3377,7 +3377,7 @@ IntrusivePtr<Val> VectorConstructorExpr::InitVal(const BroType* t, IntrusivePtr<
|
|||
VectorType* vt = Type()->AsVectorType();
|
||||
auto vec = aggr ?
|
||||
IntrusivePtr<VectorVal>{AdoptRef{}, aggr.release()->AsVectorVal()} :
|
||||
make_intrusive<VectorVal>(vt);
|
||||
make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, vt});
|
||||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||
|
||||
loop_over_list(exprs, i)
|
||||
|
@ -3514,7 +3514,7 @@ IntrusivePtr<Val> ArithCoerceExpr::Fold(Val* v) const
|
|||
t = Type()->AsVectorType()->Yield()->InternalType();
|
||||
|
||||
VectorVal* vv = v->AsVectorVal();
|
||||
auto result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
|
||||
for ( unsigned int i = 0; i < vv->Size(); ++i )
|
||||
{
|
||||
|
@ -3794,7 +3794,7 @@ IntrusivePtr<Val> VectorCoerceExpr::Fold(Val* v) const
|
|||
if ( vv->Size() > 0 )
|
||||
RuntimeErrorWithCallStack("coercion of non-empty vector");
|
||||
|
||||
return make_intrusive<VectorVal>(Type()->Ref()->AsVectorType());
|
||||
return make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
}
|
||||
|
||||
FlattenExpr::FlattenExpr(IntrusivePtr<Expr> arg_op)
|
||||
|
|
|
@ -46,7 +46,7 @@ static inline RecordType* hdrType(RecordType*& type, const char* name)
|
|||
|
||||
static IntrusivePtr<VectorVal> BuildOptionsVal(const u_char* data, int len)
|
||||
{
|
||||
auto vv = make_intrusive<VectorVal>(lookup_type("ip6_options")->AsVectorType());
|
||||
auto vv = make_intrusive<VectorVal>(lookup_type<VectorType>("ip6_options"));
|
||||
|
||||
while ( len > 0 )
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ IntrusivePtr<RecordVal> IPv6_Hdr::ToVal(IntrusivePtr<VectorVal> chain) const
|
|||
rv->Assign(6, make_intrusive<AddrVal>(IPAddr(ip6->ip6_dst)));
|
||||
if ( ! chain )
|
||||
chain = make_intrusive<VectorVal>(
|
||||
lookup_type("ip6_ext_hdr_chain")->AsVectorType());
|
||||
lookup_type<VectorType>("ip6_ext_hdr_chain"));
|
||||
rv->Assign(7, std::move(chain));
|
||||
}
|
||||
break;
|
||||
|
@ -710,7 +710,7 @@ IntrusivePtr<VectorVal> IPv6_Hdr_Chain::ToVal() const
|
|||
}
|
||||
|
||||
auto rval = make_intrusive<VectorVal>(
|
||||
lookup_type("ip6_ext_hdr_chain")->AsVectorType());
|
||||
lookup_type<VectorType>("ip6_ext_hdr_chain"));
|
||||
|
||||
for ( size_t i = 1; i < chain.size(); ++i )
|
||||
{
|
||||
|
|
|
@ -981,7 +981,7 @@ ParaglobVal::ParaglobVal(std::unique_ptr<paraglob::Paraglob> p)
|
|||
|
||||
IntrusivePtr<VectorVal> ParaglobVal::Get(StringVal* &pattern)
|
||||
{
|
||||
auto rval = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
auto rval = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("string_vec"));
|
||||
std::string string_pattern (reinterpret_cast<const char*>(pattern->Bytes()), pattern->Len());
|
||||
|
||||
std::vector<std::string> matches = this->internal_paraglob->get(string_pattern);
|
||||
|
|
|
@ -68,15 +68,10 @@ VectorVal* BroSubstring::VecToPolicy(Vec* vec)
|
|||
if ( ! sw_align_type )
|
||||
return nullptr;
|
||||
|
||||
VectorType* sw_align_vec_type =
|
||||
zeek::lookup_type("sw_align_vec")->AsVectorType();
|
||||
if ( ! sw_align_vec_type )
|
||||
return nullptr;
|
||||
auto sw_align_vec_type = zeek::lookup_type<VectorType>("sw_align_vec");
|
||||
|
||||
VectorVal* result =
|
||||
new VectorVal(zeek::lookup_type("sw_substring_vec")->AsVectorType());
|
||||
if ( ! result )
|
||||
return nullptr;
|
||||
auto result =
|
||||
make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("sw_substring_vec"));
|
||||
|
||||
if ( vec )
|
||||
{
|
||||
|
@ -106,7 +101,7 @@ VectorVal* BroSubstring::VecToPolicy(Vec* vec)
|
|||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return result.release();
|
||||
}
|
||||
|
||||
BroSubstring::Vec* BroSubstring::VecFromPolicy(VectorVal* vec)
|
||||
|
|
|
@ -202,7 +202,7 @@ static void print_log(const std::vector<IntrusivePtr<Val>>& vals)
|
|||
{
|
||||
auto plval = lookup_enum_val("Log", "PRINTLOG");
|
||||
auto record = make_intrusive<RecordVal>(zeek::lookup_type("Log::PrintLogInfo")->AsRecordType());
|
||||
auto vec = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
auto vec = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
for ( const auto& val : vals )
|
||||
{
|
||||
|
@ -1665,7 +1665,7 @@ IntrusivePtr<Val> InitStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
|||
v = new RecordVal(t->AsRecordType());
|
||||
break;
|
||||
case TYPE_VECTOR:
|
||||
v = new VectorVal(t->AsVectorType());
|
||||
v = new VectorVal(cast_intrusive<VectorType>(t));
|
||||
break;
|
||||
case TYPE_TABLE:
|
||||
v = new TableVal(cast_intrusive<TableType>(t), {NewRef{}, aggr->Attrs()});
|
||||
|
|
|
@ -198,7 +198,7 @@ public:
|
|||
IntrusivePtr<VectorVal> ToVal() const
|
||||
{
|
||||
auto vv = make_intrusive<VectorVal>(
|
||||
zeek::lookup_type("EncapsulatingConnVector")->AsVectorType());
|
||||
zeek::lookup_type<VectorType>("EncapsulatingConnVector"));
|
||||
|
||||
if ( conns )
|
||||
{
|
||||
|
|
16
src/Type.h
16
src/Type.h
|
@ -580,6 +580,14 @@ public:
|
|||
const IntrusivePtr<BroType>& GetFieldType(const char* field_name) const
|
||||
{ return GetFieldType(FieldOffset(field_name)); }
|
||||
|
||||
/**
|
||||
* Looks up a field by name and returns its type as cast to @c T.
|
||||
* No check for invalid field name is performed.
|
||||
*/
|
||||
template <class T>
|
||||
IntrusivePtr<T> GetFieldType(const char* field_name) const
|
||||
{ return cast_intrusive<T>(GetFieldType(field_name)); }
|
||||
|
||||
/**
|
||||
* Looks up a field by its index and returns its type. No check for
|
||||
* invalid field offset is performed.
|
||||
|
@ -587,6 +595,14 @@ public:
|
|||
const IntrusivePtr<BroType>& GetFieldType(int field_index) const
|
||||
{ return (*types)[field_index]->type; }
|
||||
|
||||
/**
|
||||
* Looks up a field by its index and returns its type as cast to @c T.
|
||||
* No check for invalid field offset is performed.
|
||||
*/
|
||||
template <class T>
|
||||
IntrusivePtr<T> GetFieldType(int field_index) const
|
||||
{ return cast_intrusive<T>((*types)[field_index]->type); }
|
||||
|
||||
IntrusivePtr<Val> FieldDefault(int field) const;
|
||||
|
||||
// A field's offset is its position in the type_decl_list,
|
||||
|
|
17
src/Val.cc
17
src/Val.cc
|
@ -1933,7 +1933,7 @@ IntrusivePtr<VectorVal> TableVal::LookupSubnets(const SubNetVal* search)
|
|||
if ( ! subnets )
|
||||
reporter->InternalError("LookupSubnets called on wrong table type");
|
||||
|
||||
auto result = make_intrusive<VectorVal>(zeek::lookup_type("subnet_vec")->AsVectorType());
|
||||
auto result = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("subnet_vec"));
|
||||
|
||||
auto matches = subnets->FindAll(search);
|
||||
for ( auto element : matches )
|
||||
|
@ -2671,11 +2671,11 @@ RecordVal::RecordVal(RecordType* t, bool init_fields) : Val(t)
|
|||
Attributes* a = t->FieldDecl(i)->attrs.get();
|
||||
Attr* def_attr = a ? a->FindAttr(ATTR_DEFAULT) : nullptr;
|
||||
auto def = def_attr ? def_attr->AttrExpr()->Eval(nullptr) : nullptr;
|
||||
BroType* type = t->FieldDecl(i)->type.get();
|
||||
const auto& type = t->FieldDecl(i)->type;
|
||||
|
||||
if ( def && type->Tag() == TYPE_RECORD &&
|
||||
def->Type()->Tag() == TYPE_RECORD &&
|
||||
! same_type(def->Type(), type) )
|
||||
! same_type(def->Type(), type.get()) )
|
||||
{
|
||||
auto tmp = def->AsRecordVal()->CoerceTo(type->AsRecordType());
|
||||
|
||||
|
@ -2695,7 +2695,7 @@ RecordVal::RecordVal(RecordType* t, bool init_fields) : Val(t)
|
|||
IntrusivePtr{NewRef{}, a});
|
||||
|
||||
else if ( tag == TYPE_VECTOR )
|
||||
def = make_intrusive<VectorVal>(type->AsVectorType());
|
||||
def = make_intrusive<VectorVal>(cast_intrusive<VectorType>(type));
|
||||
}
|
||||
|
||||
vl->push_back(def.release());
|
||||
|
@ -2977,9 +2977,12 @@ IntrusivePtr<Val> EnumVal::DoClone(CloneState* state)
|
|||
return {NewRef{}, this};
|
||||
}
|
||||
|
||||
VectorVal::VectorVal(VectorType* t) : Val(t)
|
||||
VectorVal::VectorVal(VectorType* t) : VectorVal({NewRef{}, t})
|
||||
{ }
|
||||
|
||||
VectorVal::VectorVal(IntrusivePtr<VectorType> t) : Val(t.get())
|
||||
{
|
||||
vector_type = t->Ref()->AsVectorType();
|
||||
vector_type = std::move(t);
|
||||
val.vector_val = new vector<Val*>();
|
||||
}
|
||||
|
||||
|
@ -2988,8 +2991,6 @@ VectorVal::~VectorVal()
|
|||
for ( unsigned int i = 0; i < val.vector_val->size(); ++i )
|
||||
Unref((*val.vector_val)[i]);
|
||||
|
||||
Unref(vector_type);
|
||||
|
||||
delete val.vector_val;
|
||||
}
|
||||
|
||||
|
|
|
@ -1016,7 +1016,9 @@ protected:
|
|||
|
||||
class VectorVal final : public Val, public notifier::Modifiable {
|
||||
public:
|
||||
[[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]]
|
||||
explicit VectorVal(VectorType* t);
|
||||
explicit VectorVal(IntrusivePtr<VectorType> t);
|
||||
~VectorVal() override;
|
||||
|
||||
IntrusivePtr<Val> SizeVal() const override;
|
||||
|
@ -1076,7 +1078,7 @@ protected:
|
|||
void ValDescribe(ODesc* d) const override;
|
||||
IntrusivePtr<Val> DoClone(CloneState* state) override;
|
||||
|
||||
VectorType* vector_type;
|
||||
IntrusivePtr<VectorType> vector_type;
|
||||
};
|
||||
|
||||
// Checks the given value for consistency with the given type. If an
|
||||
|
|
|
@ -253,7 +253,7 @@ static void make_var(ID* id, IntrusivePtr<BroType> t, init_class c,
|
|||
IntrusivePtr{NewRef{}, id->Attrs()});
|
||||
|
||||
else if ( t->Tag() == TYPE_VECTOR )
|
||||
aggr = make_intrusive<VectorVal>(t->AsVectorType());
|
||||
aggr = make_intrusive<VectorVal>(cast_intrusive<VectorType>(t));
|
||||
|
||||
IntrusivePtr<Val> v;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ refine flow DHCP_Flow += {
|
|||
if ( ! options )
|
||||
{
|
||||
options = make_intrusive<RecordVal>(BifType::Record::DHCP::Options);
|
||||
all_options = make_intrusive<VectorVal>(index_vec);
|
||||
all_options = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, index_vec});
|
||||
options->Assign(0, all_options);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ refine casetype OptionValue += {
|
|||
refine flow DHCP_Flow += {
|
||||
function process_router_option(v: OptionValue): bool
|
||||
%{
|
||||
VectorVal* router_list = new VectorVal(BifType::Vector::DHCP::Addrs);
|
||||
auto router_list = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::DHCP::Addrs});
|
||||
int num_routers = ${v.router_list}->size();
|
||||
vector<uint32>* rlist = ${v.router_list};
|
||||
|
||||
|
@ -67,7 +67,7 @@ refine flow DHCP_Flow += {
|
|||
router_list->Assign(i, make_intrusive<AddrVal>(htonl(raddr)));
|
||||
}
|
||||
|
||||
${context.flow}->options->Assign(2, router_list);
|
||||
${context.flow}->options->Assign(2, std::move(router_list));
|
||||
|
||||
return true;
|
||||
%}
|
||||
|
@ -91,7 +91,7 @@ refine casetype OptionValue += {
|
|||
refine flow DHCP_Flow += {
|
||||
function process_timeserver_option(v: OptionValue): bool
|
||||
%{
|
||||
VectorVal* timeserver_list = new VectorVal(BifType::Vector::DHCP::Addrs);
|
||||
auto timeserver_list = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::DHCP::Addrs});
|
||||
int num_servers = ${v.timeserver_list}->size();
|
||||
vector<uint32>* rlist = ${v.timeserver_list};
|
||||
|
||||
|
@ -101,7 +101,7 @@ refine flow DHCP_Flow += {
|
|||
timeserver_list->Assign(i, make_intrusive<AddrVal>(htonl(raddr)));
|
||||
}
|
||||
|
||||
${context.flow}->options->Assign(26, timeserver_list);
|
||||
${context.flow}->options->Assign(26, std::move(timeserver_list));
|
||||
|
||||
return true;
|
||||
%}
|
||||
|
@ -125,7 +125,7 @@ refine casetype OptionValue += {
|
|||
refine flow DHCP_Flow += {
|
||||
function process_nameserver_option(v: OptionValue): bool
|
||||
%{
|
||||
VectorVal* nameserver_list = new VectorVal(BifType::Vector::DHCP::Addrs);
|
||||
auto nameserver_list = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::DHCP::Addrs});
|
||||
int num_servers = ${v.nameserver_list}->size();
|
||||
vector<uint32>* rlist = ${v.nameserver_list};
|
||||
|
||||
|
@ -135,7 +135,7 @@ refine flow DHCP_Flow += {
|
|||
nameserver_list->Assign(i, make_intrusive<AddrVal>(htonl(raddr)));
|
||||
}
|
||||
|
||||
${context.flow}->options->Assign(27, nameserver_list);
|
||||
${context.flow}->options->Assign(27, std::move(nameserver_list));
|
||||
|
||||
return true;
|
||||
%}
|
||||
|
@ -159,7 +159,7 @@ refine casetype OptionValue += {
|
|||
refine flow DHCP_Flow += {
|
||||
function process_dns_server_option(v: OptionValue): bool
|
||||
%{
|
||||
VectorVal* server_list = new VectorVal(BifType::Vector::DHCP::Addrs);
|
||||
auto server_list = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::DHCP::Addrs});
|
||||
int num_servers = ${v.dns_server_list}->size();
|
||||
vector<uint32>* rlist = ${v.dns_server_list};
|
||||
|
||||
|
@ -169,7 +169,7 @@ refine flow DHCP_Flow += {
|
|||
server_list->Assign(i, make_intrusive<AddrVal>(htonl(raddr)));
|
||||
}
|
||||
|
||||
${context.flow}->options->Assign(3, server_list);
|
||||
${context.flow}->options->Assign(3, std::move(server_list));
|
||||
return true;
|
||||
%}
|
||||
};
|
||||
|
@ -298,7 +298,7 @@ refine casetype OptionValue += {
|
|||
refine flow DHCP_Flow += {
|
||||
function process_ntpserver_option(v: OptionValue): bool
|
||||
%{
|
||||
VectorVal* ntpserver_list = new VectorVal(BifType::Vector::DHCP::Addrs);
|
||||
auto ntpserver_list = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::DHCP::Addrs});
|
||||
int num_servers = ${v.ntpserver_list}->size();
|
||||
vector<uint32>* rlist = ${v.ntpserver_list};
|
||||
|
||||
|
@ -308,7 +308,7 @@ refine flow DHCP_Flow += {
|
|||
ntpserver_list->Assign(i, make_intrusive<AddrVal>(htonl(raddr)));
|
||||
}
|
||||
|
||||
${context.flow}->options->Assign(28, ntpserver_list);
|
||||
${context.flow}->options->Assign(28, std::move(ntpserver_list));
|
||||
|
||||
return true;
|
||||
%}
|
||||
|
@ -356,7 +356,7 @@ refine casetype OptionValue += {
|
|||
refine flow DHCP_Flow += {
|
||||
function process_nbns_option(v: OptionValue): bool
|
||||
%{
|
||||
VectorVal* server_list = new VectorVal(BifType::Vector::DHCP::Addrs);
|
||||
auto server_list = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::DHCP::Addrs});
|
||||
int num_servers = ${v.nbns}->size();
|
||||
vector<uint32>* rlist = ${v.nbns};
|
||||
|
||||
|
@ -366,7 +366,7 @@ refine flow DHCP_Flow += {
|
|||
server_list->Assign(i, make_intrusive<AddrVal>(htonl(raddr)));
|
||||
}
|
||||
|
||||
${context.flow}->options->Assign(9, server_list);
|
||||
${context.flow}->options->Assign(9, std::move(server_list));
|
||||
return true;
|
||||
%}
|
||||
};
|
||||
|
@ -462,7 +462,7 @@ refine casetype OptionValue += {
|
|||
refine flow DHCP_Flow += {
|
||||
function process_par_req_list_option(v: OptionValue): bool
|
||||
%{
|
||||
VectorVal* params = new VectorVal(index_vec);
|
||||
auto params = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, index_vec});
|
||||
int num_parms = ${v.par_req_list}->size();
|
||||
vector<uint8>* plist = ${v.par_req_list};
|
||||
|
||||
|
@ -472,7 +472,7 @@ refine flow DHCP_Flow += {
|
|||
params->Assign(i, val_mgr->Count(param));
|
||||
}
|
||||
|
||||
${context.flow}->options->Assign(13, params);
|
||||
${context.flow}->options->Assign(13, std::move(params));
|
||||
|
||||
return true;
|
||||
%}
|
||||
|
@ -743,7 +743,7 @@ refine flow DHCP_Flow += {
|
|||
|
||||
function process_relay_agent_inf_option(v: OptionValue): bool
|
||||
%{
|
||||
VectorVal* relay_agent_sub_opt = new VectorVal(BifType::Vector::DHCP::SubOpts);
|
||||
auto relay_agent_sub_opt = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::DHCP::SubOpts});
|
||||
|
||||
uint16 i = 0;
|
||||
|
||||
|
@ -758,7 +758,7 @@ refine flow DHCP_Flow += {
|
|||
++i;
|
||||
}
|
||||
|
||||
${context.flow}->options->Assign(22, relay_agent_sub_opt);
|
||||
${context.flow}->options->Assign(22, std::move(relay_agent_sub_opt));
|
||||
return true;
|
||||
%}
|
||||
};
|
||||
|
|
|
@ -998,7 +998,7 @@ bool DNS_Interpreter::ParseRR_NSEC(DNS_MsgInfo* msg,
|
|||
|
||||
int typebitmaps_len = rdlength - (data - data_start);
|
||||
|
||||
auto char_strings = make_intrusive<VectorVal>(string_vec);
|
||||
auto char_strings = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, string_vec});
|
||||
|
||||
while ( typebitmaps_len > 0 && len > 0 )
|
||||
{
|
||||
|
@ -1073,7 +1073,7 @@ bool DNS_Interpreter::ParseRR_NSEC3(DNS_MsgInfo* msg,
|
|||
|
||||
int typebitmaps_len = rdlength - (data - data_start);
|
||||
|
||||
auto char_strings = make_intrusive<VectorVal>(string_vec);
|
||||
auto char_strings = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, string_vec});
|
||||
|
||||
while ( typebitmaps_len > 0 && len > 0 )
|
||||
{
|
||||
|
@ -1288,7 +1288,7 @@ bool DNS_Interpreter::ParseRR_TXT(DNS_MsgInfo* msg,
|
|||
return true;
|
||||
}
|
||||
|
||||
auto char_strings = make_intrusive<VectorVal>(string_vec);
|
||||
auto char_strings = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, string_vec});
|
||||
IntrusivePtr<StringVal> char_string;
|
||||
|
||||
while ( (char_string = extract_char_string(analyzer, data, len, rdlength)) )
|
||||
|
@ -1316,7 +1316,7 @@ bool DNS_Interpreter::ParseRR_SPF(DNS_MsgInfo* msg,
|
|||
return true;
|
||||
}
|
||||
|
||||
auto char_strings = make_intrusive<VectorVal>(string_vec);
|
||||
auto char_strings = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, string_vec});
|
||||
IntrusivePtr<StringVal> char_string;
|
||||
|
||||
while ( (char_string = extract_char_string(analyzer, data, len, rdlength)) )
|
||||
|
|
|
@ -732,7 +732,7 @@ IntrusivePtr<VectorVal> ICMP_Analyzer::BuildNDOptionsVal(int caplen, const u_cha
|
|||
}
|
||||
|
||||
auto vv = make_intrusive<VectorVal>(
|
||||
zeek::lookup_type("icmp6_nd_options")->AsVectorType());
|
||||
zeek::lookup_type<VectorType>("icmp6_nd_options"));
|
||||
|
||||
while ( caplen > 0 )
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ refine connection IMAP_Conn += {
|
|||
if ( ! imap_capabilities )
|
||||
return true;
|
||||
|
||||
auto capv = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
auto capv = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
for ( unsigned int i = 0; i< capabilities->size(); i++ )
|
||||
{
|
||||
|
|
|
@ -13,10 +13,10 @@ VectorVal* proc_padata(const KRB_PA_Data_Sequence* data, const BroAnalyzer bro_a
|
|||
%code{
|
||||
VectorVal* proc_padata(const KRB_PA_Data_Sequence* data, const BroAnalyzer bro_analyzer, bool is_error)
|
||||
{
|
||||
VectorVal* vv = new VectorVal(zeek::lookup_type("KRB::Type_Value_Vector")->AsVectorType());
|
||||
auto vv = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("KRB::Type_Value_Vector"));
|
||||
|
||||
if ( ! data->data()->has_padata() )
|
||||
return vv;
|
||||
return vv.release();
|
||||
|
||||
for ( uint i = 0; i < data->data()->padata_elems()->size(); ++i)
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ VectorVal* proc_padata(const KRB_PA_Data_Sequence* data, const BroAnalyzer bro_a
|
|||
}
|
||||
}
|
||||
}
|
||||
return vv;
|
||||
return vv.release();
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
@ -27,22 +27,22 @@ IntrusivePtr<Val> GetStringFromPrincipalName(const KRB_Principal_Name* pname)
|
|||
|
||||
VectorVal* proc_cipher_list(const Array* list)
|
||||
{
|
||||
VectorVal* ciphers = new VectorVal(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto ciphers = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
for ( uint i = 0; i < list->data()->size(); ++i )
|
||||
ciphers->Assign(ciphers->Size(), asn1_integer_to_val((*list->data())[i], TYPE_COUNT));
|
||||
return ciphers;
|
||||
return ciphers.release();
|
||||
}
|
||||
|
||||
VectorVal* proc_host_address_list(const BroAnalyzer a, const KRB_Host_Addresses* list)
|
||||
{
|
||||
VectorVal* addrs = new VectorVal(zeek::lookup_type("KRB::Host_Address_Vector")->AsVectorType());
|
||||
auto addrs = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("KRB::Host_Address_Vector"));
|
||||
|
||||
for ( uint i = 0; i < list->addresses()->size(); ++i )
|
||||
{
|
||||
addrs->Assign(addrs->Size(), proc_host_address(a, (*list->addresses())[i]));
|
||||
}
|
||||
|
||||
return addrs;
|
||||
return addrs.release();
|
||||
}
|
||||
|
||||
RecordVal* proc_host_address(const BroAnalyzer a, const KRB_Host_Address* addr)
|
||||
|
@ -94,7 +94,7 @@ RecordVal* proc_host_address(const BroAnalyzer a, const KRB_Host_Address* addr)
|
|||
|
||||
IntrusivePtr<VectorVal> proc_tickets(const KRB_Ticket_Sequence* list)
|
||||
{
|
||||
auto tickets = make_intrusive<VectorVal>(zeek::lookup_type("KRB::Ticket_Vector")->AsVectorType());
|
||||
auto tickets = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("KRB::Ticket_Vector"));
|
||||
|
||||
for ( uint i = 0; i < list->tickets()->size(); ++i )
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
%code{
|
||||
IntrusivePtr<VectorVal> bytestring_to_coils(const bytestring& coils, uint quantity)
|
||||
{
|
||||
auto modbus_coils = make_intrusive<VectorVal>(BifType::Vector::ModbusCoils);
|
||||
auto modbus_coils = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::ModbusCoils});
|
||||
|
||||
for ( uint i = 0; i < quantity; i++ )
|
||||
{
|
||||
|
@ -40,7 +40,7 @@
|
|||
IntrusivePtr<VectorVal> create_vector_of_count()
|
||||
{
|
||||
auto vt = make_intrusive<VectorType>(base_type(TYPE_COUNT));
|
||||
auto vv = make_intrusive<VectorVal>(vt.get());
|
||||
auto vv = make_intrusive<VectorVal>(std::move(vt));
|
||||
return vv;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ refine flow ModbusTCP_Flow += {
|
|||
|
||||
if ( ::modbus_read_holding_registers_response )
|
||||
{
|
||||
auto t = make_intrusive<VectorVal>(BifType::Vector::ModbusRegisters);
|
||||
auto t = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::ModbusRegisters});
|
||||
|
||||
for ( unsigned int i=0; i < ${message.registers}->size(); ++i )
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ refine flow ModbusTCP_Flow += {
|
|||
|
||||
if ( ::modbus_read_input_registers_response )
|
||||
{
|
||||
auto t = make_intrusive<VectorVal>(BifType::Vector::ModbusRegisters);
|
||||
auto t = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::ModbusRegisters});
|
||||
|
||||
for ( unsigned int i=0; i < (${message.registers})->size(); ++i )
|
||||
{
|
||||
|
@ -397,7 +397,7 @@ refine flow ModbusTCP_Flow += {
|
|||
|
||||
if ( ::modbus_write_multiple_registers_request )
|
||||
{
|
||||
auto t = make_intrusive<VectorVal>(BifType::Vector::ModbusRegisters);
|
||||
auto t = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::ModbusRegisters});
|
||||
|
||||
for ( unsigned int i = 0; i < (${message.registers}->size()); ++i )
|
||||
{
|
||||
|
@ -582,7 +582,7 @@ refine flow ModbusTCP_Flow += {
|
|||
|
||||
if ( ::modbus_read_write_multiple_registers_request )
|
||||
{
|
||||
auto t = make_intrusive<VectorVal>(BifType::Vector::ModbusRegisters);
|
||||
auto t = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::ModbusRegisters});
|
||||
|
||||
for ( unsigned int i = 0; i < ${message.write_register_values}->size(); ++i )
|
||||
{
|
||||
|
@ -614,7 +614,7 @@ refine flow ModbusTCP_Flow += {
|
|||
|
||||
if ( ::modbus_read_write_multiple_registers_response )
|
||||
{
|
||||
auto t = make_intrusive<VectorVal>(BifType::Vector::ModbusRegisters);
|
||||
auto t = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::ModbusRegisters});
|
||||
|
||||
for ( unsigned int i = 0; i < ${message.registers}->size(); ++i )
|
||||
{
|
||||
|
|
|
@ -19,8 +19,8 @@ refine flow MQTT_Flow += {
|
|||
%{
|
||||
if ( mqtt_subscribe )
|
||||
{
|
||||
auto topics = make_intrusive<VectorVal>(string_vec);
|
||||
auto qos_levels = make_intrusive<VectorVal>(index_vec);
|
||||
auto topics = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, string_vec});
|
||||
auto qos_levels = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, index_vec});
|
||||
|
||||
for ( auto topic: *${msg.topics} )
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ refine flow MQTT_Flow += {
|
|||
%{
|
||||
if ( mqtt_unsubscribe )
|
||||
{
|
||||
auto topics = make_intrusive<VectorVal>(string_vec);
|
||||
auto topics = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, string_vec});
|
||||
|
||||
for ( auto topic: *${msg.topics} )
|
||||
{
|
||||
|
|
|
@ -82,8 +82,8 @@ refine flow MySQL_Flow += {
|
|||
if ( ! mysql_result_row )
|
||||
return true;
|
||||
|
||||
auto vt = zeek::lookup_type("string_vec")->AsVectorType();
|
||||
auto vv = make_intrusive<VectorVal>(vt);
|
||||
auto vt = zeek::lookup_type<VectorType>("string_vec");
|
||||
auto vv = make_intrusive<VectorVal>(std::move(vt));
|
||||
|
||||
auto& bstring = ${msg.row.first_field.val};
|
||||
auto ptr = reinterpret_cast<const char*>(bstring.data());
|
||||
|
|
|
@ -32,9 +32,9 @@ refine flow RADIUS_Flow += {
|
|||
|
||||
else
|
||||
{
|
||||
VectorVal* attribute_list = new VectorVal(BifType::Vector::RADIUS::AttributeList);
|
||||
auto attribute_list = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::RADIUS::AttributeList});
|
||||
attribute_list->Assign((unsigned int)0, std::move(val));
|
||||
attributes->Assign(index.get(), attribute_list);
|
||||
attributes->Assign(index.get(), std::move(attribute_list));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ refine flow RDP_Flow += {
|
|||
|
||||
if ( ${cnetwork.channel_def_array}->size() )
|
||||
{
|
||||
auto channels = make_intrusive<VectorVal>(BifType::Vector::RDP::ClientChannelList);
|
||||
auto channels = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::RDP::ClientChannelList});
|
||||
|
||||
for ( uint i = 0; i < ${cnetwork.channel_def_array}->size(); ++i )
|
||||
{
|
||||
|
|
|
@ -192,7 +192,7 @@ zeek::Args MOUNT_Interp::event_common_vl(RPC_CallInfo *c,
|
|||
zeek::Args vl;
|
||||
vl.reserve(2 + extra_elements);
|
||||
vl.emplace_back(analyzer->ConnVal());
|
||||
auto auxgids = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto auxgids = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
for (size_t i = 0; i < c->AuxGIDs().size(); ++i)
|
||||
{
|
||||
|
@ -272,9 +272,8 @@ RecordVal* MOUNT_Interp::mount3_mnt_reply(const u_char*& buf, int& n,
|
|||
auth_flavors_count = max_auth_flavors;
|
||||
}
|
||||
|
||||
VectorType* enum_vector = new VectorType(base_type(TYPE_ENUM));
|
||||
VectorVal* auth_flavors = new VectorVal(enum_vector);
|
||||
Unref(enum_vector);
|
||||
auto enum_vector = make_intrusive<VectorType>(base_type(TYPE_ENUM));
|
||||
auto auth_flavors = make_intrusive<VectorVal>(std::move(enum_vector));
|
||||
|
||||
for ( auto i = 0u; i < auth_flavors_count; ++i )
|
||||
auth_flavors->Assign(auth_flavors->Size(),
|
||||
|
@ -284,7 +283,7 @@ RecordVal* MOUNT_Interp::mount3_mnt_reply(const u_char*& buf, int& n,
|
|||
// Prevent further "excess RPC" weirds
|
||||
n = 0;
|
||||
|
||||
rep->Assign(1, auth_flavors);
|
||||
rep->Assign(1, std::move(auth_flavors));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -328,7 +328,7 @@ zeek::Args NFS_Interp::event_common_vl(RPC_CallInfo *c, BifEnum::rpc_status rpc_
|
|||
zeek::Args vl;
|
||||
vl.reserve(2 + extra_elements);
|
||||
vl.emplace_back(analyzer->ConnVal());
|
||||
auto auxgids = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto auxgids = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
for ( size_t i = 0; i < c->AuxGIDs().size(); ++i )
|
||||
auxgids->Assign(i, val_mgr->Count(c->AuxGIDs()[i]));
|
||||
|
@ -769,7 +769,7 @@ RecordVal* NFS_Interp::nfs3_readdir_reply(bool isplus, const u_char*& buf,
|
|||
if ( status == BifEnum::NFS3::NFS3ERR_OK )
|
||||
{
|
||||
unsigned pos;
|
||||
VectorVal *entries = new VectorVal(BifType::Vector::NFS3::direntry_vec_t);
|
||||
auto entries = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::NFS3::direntry_vec_t});
|
||||
|
||||
rep->Assign(1, nfs3_post_op_attr(buf,n)); // dir_attr
|
||||
rep->Assign(2, ExtractUint64(buf,n)); // cookieverf
|
||||
|
|
|
@ -15,7 +15,7 @@ refine connection SMB_Conn += {
|
|||
%{
|
||||
if ( smb1_negotiate_request )
|
||||
{
|
||||
auto dialects = make_intrusive<VectorVal>(string_vec);
|
||||
auto dialects = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, string_vec});
|
||||
|
||||
for ( unsigned int i = 0; i < ${val.dialects}->size(); ++i )
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ refine connection SMB_Conn += {
|
|||
%{
|
||||
if ( smb2_negotiate_request )
|
||||
{
|
||||
auto dialects = make_intrusive<VectorVal>(index_vec);
|
||||
auto dialects = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, index_vec});
|
||||
|
||||
for ( unsigned int i = 0; i < ${val.dialects}->size(); ++i )
|
||||
dialects->Assign(i, val_mgr->Count((*${val.dialects})[i]));
|
||||
|
@ -48,7 +48,7 @@ refine connection SMB_Conn += {
|
|||
nr->Assign(4, filetime2brotime(${val.server_start_time}));
|
||||
nr->Assign(5, val_mgr->Count(${val.negotiate_context_count}));
|
||||
|
||||
auto cv = make_intrusive<VectorVal>(BifType::Vector::SMB2::NegotiateContextValues);
|
||||
auto cv = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::SMB2::NegotiateContextValues});
|
||||
|
||||
if ( ${val.dialect_revision} == 0x0311 && ${val.negotiate_context_count} > 0 )
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ refine connection SMB_Conn += {
|
|||
%{
|
||||
if ( smb2_file_fullea )
|
||||
{
|
||||
auto eas = make_intrusive<VectorVal>(BifType::Vector::SMB2::FileEAs);
|
||||
auto eas = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::SMB2::FileEAs});
|
||||
|
||||
for ( auto i = 0u; i < ${val.ea_vector}->size(); ++i )
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ IntrusivePtr<RecordVal> BuildSMB2ContextVal(SMB3_negotiate_context_value* ncv)
|
|||
rpreauth->Assign(0, val_mgr->Count(${ncv.preauth_integrity_capabilities.hash_alg_count}));
|
||||
rpreauth->Assign(1, val_mgr->Count(${ncv.preauth_integrity_capabilities.salt_length}));
|
||||
|
||||
auto ha = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto ha = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
for ( int i = 0; i < ${ncv.preauth_integrity_capabilities.hash_alg_count}; ++i )
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ IntrusivePtr<RecordVal> BuildSMB2ContextVal(SMB3_negotiate_context_value* ncv)
|
|||
auto rencr = make_intrusive<RecordVal>(BifType::Record::SMB2::EncryptionCapabilities);
|
||||
rencr->Assign(0, val_mgr->Count(${ncv.encryption_capabilities.cipher_count}));
|
||||
|
||||
auto c = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto c = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
for ( int i = 0; i < ${ncv.encryption_capabilities.cipher_count}; ++i )
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ IntrusivePtr<RecordVal> BuildSMB2ContextVal(SMB3_negotiate_context_value* ncv)
|
|||
auto rcomp = make_intrusive<RecordVal>(BifType::Record::SMB2::CompressionCapabilities);
|
||||
rcomp->Assign(0, val_mgr->Count(${ncv.compression_capabilities.alg_count}));
|
||||
|
||||
auto c = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto c = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
for ( int i = 0; i < ${ncv.compression_capabilities.alg_count}; ++i )
|
||||
{
|
||||
|
|
|
@ -155,7 +155,7 @@ RecordVal* build_hdrV3(const Header* header)
|
|||
|
||||
VectorVal* build_bindings(const VarBindList* vbl)
|
||||
{
|
||||
VectorVal* vv = new VectorVal(BifType::Vector::SNMP::Bindings);
|
||||
auto vv = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::SNMP::Bindings});
|
||||
|
||||
for ( size_t i = 0; i < vbl->bindings()->size(); ++i )
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ VectorVal* build_bindings(const VarBindList* vbl)
|
|||
vv->Assign(i, binding);
|
||||
}
|
||||
|
||||
return vv;
|
||||
return vv.release();
|
||||
}
|
||||
|
||||
IntrusivePtr<RecordVal> build_pdu(const CommonPDU* pdu)
|
||||
|
|
|
@ -12,7 +12,7 @@ VectorVal* name_list_to_vector(const bytestring& nl);
|
|||
// Copied from IRC_Analyzer::SplitWords
|
||||
VectorVal* name_list_to_vector(const bytestring& nl)
|
||||
{
|
||||
VectorVal* vv = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
VectorVal* vv = new VectorVal(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
string name_list = std_str(nl);
|
||||
if ( name_list.size() < 1 )
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
else
|
||||
std::transform(cipher_suites24->begin(), cipher_suites24->end(), std::back_inserter(cipher_suites), to_int());
|
||||
|
||||
auto cipher_vec = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto cipher_vec = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
for ( unsigned int i = 0; i < cipher_suites.size(); ++i )
|
||||
{
|
||||
|
@ -31,7 +31,7 @@
|
|||
cipher_vec->Assign(i, ciph);
|
||||
}
|
||||
|
||||
auto comp_vec = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto comp_vec = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
if ( compression_methods )
|
||||
{
|
||||
|
|
|
@ -75,7 +75,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_ec_point_formats )
|
||||
return true;
|
||||
|
||||
auto points = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto points = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
if ( point_format_list )
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_elliptic_curves )
|
||||
return true;
|
||||
|
||||
auto curves = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto curves = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
if ( list )
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_key_share )
|
||||
return true;
|
||||
|
||||
auto nglist = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto nglist = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
if ( keyshare )
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_key_share )
|
||||
return true;
|
||||
|
||||
auto nglist = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto nglist = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
nglist->Assign(0u, val_mgr->Count(keyshare->namedgroup()));
|
||||
BifEvent::enqueue_ssl_extension_key_share(bro_analyzer(), bro_analyzer()->Conn(), ${rec.is_orig}, std::move(nglist));
|
||||
|
@ -143,7 +143,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_key_share )
|
||||
return true;
|
||||
|
||||
auto nglist = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto nglist = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
nglist->Assign(0u, val_mgr->Count(namedgroup));
|
||||
BifEvent::enqueue_ssl_extension_key_share(bro_analyzer(), bro_analyzer()->Conn(), ${rec.is_orig}, std::move(nglist));
|
||||
|
@ -155,7 +155,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_signature_algorithm )
|
||||
return true;
|
||||
|
||||
auto slist = make_intrusive<VectorVal>(zeek::lookup_type("signature_and_hashalgorithm_vec")->AsVectorType());
|
||||
auto slist = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("signature_and_hashalgorithm_vec"));
|
||||
|
||||
if ( supported_signature_algorithms )
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_application_layer_protocol_negotiation )
|
||||
return true;
|
||||
|
||||
auto plist = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
auto plist = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
if ( protocols )
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ refine connection Handshake_Conn += {
|
|||
|
||||
function proc_server_name(rec: HandshakeRecord, list: ServerName[]) : bool
|
||||
%{
|
||||
auto servers = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
auto servers = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
if ( list )
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_supported_versions )
|
||||
return true;
|
||||
|
||||
auto versions = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto versions = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
if ( versions_list )
|
||||
{
|
||||
|
@ -245,7 +245,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_supported_versions )
|
||||
return true;
|
||||
|
||||
auto versions = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto versions = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
versions->Assign(0u, val_mgr->Count(version));
|
||||
|
||||
BifEvent::enqueue_ssl_extension_supported_versions(bro_analyzer(), bro_analyzer()->Conn(),
|
||||
|
@ -259,7 +259,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_psk_key_exchange_modes )
|
||||
return true;
|
||||
|
||||
auto modes = make_intrusive<VectorVal>(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto modes = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
if ( mode_list )
|
||||
{
|
||||
|
@ -492,7 +492,7 @@ refine connection Handshake_Conn += {
|
|||
if ( ! ssl_extension_pre_shared_key_server_hello )
|
||||
return true;
|
||||
|
||||
auto slist = make_intrusive<VectorVal>(zeek::lookup_type("psk_identity_vec")->AsVectorType());
|
||||
auto slist = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("psk_identity_vec"));
|
||||
|
||||
if ( identities && identities->identities() )
|
||||
{
|
||||
|
@ -505,7 +505,7 @@ refine connection Handshake_Conn += {
|
|||
}
|
||||
}
|
||||
|
||||
auto blist = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
auto blist = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
if ( binders && binders->binders() )
|
||||
{
|
||||
|
|
|
@ -1355,7 +1355,7 @@ int TCP_Analyzer::ParseTCPOptions(const struct tcphdr* tcp, bool is_orig)
|
|||
|
||||
if ( tcp_options )
|
||||
{
|
||||
auto option_list = make_intrusive<VectorVal>(BifType::Vector::TCP::OptionList);
|
||||
auto option_list = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, BifType::Vector::TCP::OptionList});
|
||||
|
||||
auto add_option_data = [](RecordVal* rv, const u_char* odata, int olen)
|
||||
{
|
||||
|
@ -1421,8 +1421,8 @@ int TCP_Analyzer::ParseTCPOptions(const struct tcphdr* tcp, bool is_orig)
|
|||
{
|
||||
auto p = reinterpret_cast<const uint32_t*>(o + 2);
|
||||
auto num_pointers = (length - 2) / 4;
|
||||
auto vt = zeek::lookup_type("index_vec")->AsVectorType();
|
||||
auto sack = new VectorVal(vt);
|
||||
auto vt = zeek::lookup_type<VectorType>("index_vec");
|
||||
auto sack = make_intrusive<VectorVal>(std::move(vt));
|
||||
|
||||
for ( auto i = 0; i < num_pointers; ++i )
|
||||
sack->Assign(sack->Size(), val_mgr->Count(ntohl(p[i])));
|
||||
|
|
|
@ -330,7 +330,7 @@ struct val_converter {
|
|||
if ( type->Tag() == TYPE_VECTOR )
|
||||
{
|
||||
auto vt = type->AsVectorType();
|
||||
auto rval = make_intrusive<VectorVal>(vt);
|
||||
auto rval = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, vt});
|
||||
|
||||
for ( auto& item : a )
|
||||
{
|
||||
|
|
|
@ -132,7 +132,6 @@ Manager::Manager(bool arg_use_real_time)
|
|||
peer_count = 0;
|
||||
log_batch_size = 0;
|
||||
log_topic_func = nullptr;
|
||||
vector_of_data_type = nullptr;
|
||||
log_id_type = nullptr;
|
||||
writer_id_type = nullptr;
|
||||
}
|
||||
|
@ -158,7 +157,7 @@ void Manager::InitPostScript()
|
|||
opaque_of_vector_iterator = new OpaqueType("Broker::VectorIterator");
|
||||
opaque_of_record_iterator = new OpaqueType("Broker::RecordIterator");
|
||||
opaque_of_store_handle = new OpaqueType("Broker::Store");
|
||||
vector_of_data_type = new VectorType(zeek::lookup_type("Broker::Data"));
|
||||
vector_of_data_type = make_intrusive<VectorType>(zeek::lookup_type("Broker::Data"));
|
||||
|
||||
// Register as a "dont-count" source first, we may change that later.
|
||||
iosource_mgr->Register(this, true);
|
||||
|
@ -701,7 +700,7 @@ bool Manager::AutoUnpublishEvent(const string& topic, Val* event)
|
|||
RecordVal* Manager::MakeEvent(val_list* args, Frame* frame)
|
||||
{
|
||||
auto rval = new RecordVal(BifType::Record::Broker::Event);
|
||||
auto arg_vec = new VectorVal(vector_of_data_type);
|
||||
auto arg_vec = make_intrusive<VectorVal>(vector_of_data_type);
|
||||
rval->Assign(1, arg_vec);
|
||||
Func* func = nullptr;
|
||||
scoped_reporter_location srl{frame};
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "IntrusivePtr.h"
|
||||
#include "iosource/IOSource.h"
|
||||
#include "logging/WriterBackend.h"
|
||||
|
||||
|
@ -394,7 +395,7 @@ private:
|
|||
|
||||
size_t log_batch_size;
|
||||
Func* log_topic_func;
|
||||
VectorType* vector_of_data_type;
|
||||
IntrusivePtr<VectorType> vector_of_data_type;
|
||||
EnumType* log_id_type;
|
||||
EnumType* writer_id_type;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ function Broker::__unpeer%(a: string, p: port%): bool
|
|||
function Broker::__peers%(%): PeerInfos
|
||||
%{
|
||||
bro_broker::Manager::ScriptScopeGuard ssg;
|
||||
auto rval = make_intrusive<VectorVal>(zeek::lookup_type("Broker::PeerInfos")->AsVectorType());
|
||||
auto rval = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("Broker::PeerInfos"));
|
||||
auto i = 0;
|
||||
|
||||
for ( auto& p : broker_mgr->Peers() )
|
||||
|
|
|
@ -499,7 +499,7 @@ string Manager::DetectMIME(const u_char* data, uint64_t len) const
|
|||
|
||||
IntrusivePtr<VectorVal> file_analysis::GenMIMEMatchesVal(const RuleMatcher::MIME_Matches& m)
|
||||
{
|
||||
auto rval = make_intrusive<VectorVal>(mime_matches);
|
||||
auto rval = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, mime_matches});
|
||||
|
||||
for ( RuleMatcher::MIME_Matches::const_iterator it = m.begin();
|
||||
it != m.end(); ++it )
|
||||
|
|
|
@ -11,11 +11,12 @@ VectorVal* process_rvas(const RVAS* rvas);
|
|||
%code{
|
||||
VectorVal* process_rvas(const RVAS* rva_table)
|
||||
{
|
||||
VectorVal* rvas = new VectorVal(zeek::lookup_type("index_vec")->AsVectorType());
|
||||
auto rvas = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
|
||||
|
||||
for ( uint16 i=0; i < rva_table->rvas()->size(); ++i )
|
||||
rvas->Assign(i, val_mgr->Count((*rva_table->rvas())[i]->size()));
|
||||
|
||||
return rvas;
|
||||
return rvas.release();
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
@ -634,7 +634,7 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
|||
//ocsp_resp_record->Assign(7, make_intrusive<StringVal>(len, buf));
|
||||
//BIO_reset(bio);
|
||||
|
||||
certs_vector = new VectorVal(zeek::lookup_type("x509_opaque_vector")->AsVectorType());
|
||||
certs_vector = new VectorVal(zeek::lookup_type<VectorType>("x509_opaque_vector"));
|
||||
vl.emplace_back(AdoptRef{}, certs_vector);
|
||||
|
||||
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
||||
|
|
|
@ -367,21 +367,21 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
|
|||
{
|
||||
case GEN_DNS:
|
||||
if ( names == nullptr )
|
||||
names = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
names = new VectorVal(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
names->Assign(names->Size(), bs);
|
||||
break;
|
||||
|
||||
case GEN_URI:
|
||||
if ( uris == nullptr )
|
||||
uris = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
uris = new VectorVal(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
uris->Assign(uris->Size(), bs);
|
||||
break;
|
||||
|
||||
case GEN_EMAIL:
|
||||
if ( emails == nullptr )
|
||||
emails = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
emails = new VectorVal(zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
emails->Assign(emails->Size(), bs);
|
||||
break;
|
||||
|
@ -391,7 +391,7 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
|
|||
else if ( gen->type == GEN_IPADD )
|
||||
{
|
||||
if ( ips == nullptr )
|
||||
ips = new VectorVal(zeek::lookup_type("addr_vec")->AsVectorType());
|
||||
ips = new VectorVal(zeek::lookup_type<VectorType>("addr_vec"));
|
||||
|
||||
uint32_t* addr = (uint32_t*) gen->d.ip->data;
|
||||
|
||||
|
|
|
@ -556,7 +556,7 @@ function x509_verify%(certs: x509_opaque_vector, root_certs: table_string_of_str
|
|||
}
|
||||
|
||||
int num_certs = sk_X509_num(chain);
|
||||
chainVector = new VectorVal(zeek::lookup_type("x509_opaque_vector")->AsVectorType());
|
||||
chainVector = new VectorVal(zeek::lookup_type<VectorType>("x509_opaque_vector"));
|
||||
|
||||
for ( int i = 0; i < num_certs; i++ )
|
||||
{
|
||||
|
|
|
@ -2356,7 +2356,7 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, BroType* request_typ
|
|||
// all entries have to have the same type...
|
||||
const auto& type = request_type->AsVectorType()->Yield();
|
||||
auto vt = make_intrusive<VectorType>(type);
|
||||
auto v = make_intrusive<VectorVal>(vt.get());
|
||||
auto v = make_intrusive<VectorVal>(std::move(vt));
|
||||
|
||||
for ( int j = 0; j < val->val.vector_val.size; j++ )
|
||||
v->Assign(j, ValueToVal(i, val->val.vector_val.vals[j], type.get(), have_error));
|
||||
|
@ -2548,12 +2548,12 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, bool& have_error) co
|
|||
}
|
||||
|
||||
auto vt = make_intrusive<VectorType>(std::move(type));
|
||||
VectorVal* v = new VectorVal(vt.get());
|
||||
auto v = make_intrusive<VectorVal>(std::move(vt));
|
||||
|
||||
for ( int j = 0; j < val->val.vector_val.size; j++ )
|
||||
v->Assign(j, ValueToVal(i, val->val.vector_val.vals[j], have_error));
|
||||
|
||||
return v;
|
||||
return v.release();
|
||||
}
|
||||
|
||||
case TYPE_ENUM: {
|
||||
|
|
|
@ -201,8 +201,8 @@ VectorVal* TopkVal::GetTopK(int k) const // returns vector
|
|||
|
||||
auto vector_index = make_intrusive<TypeList>(IntrusivePtr{NewRef{}, type});
|
||||
vector_index->Append({NewRef{}, type});
|
||||
VectorType* v = new VectorType(std::move(vector_index));
|
||||
VectorVal* t = new VectorVal(v);
|
||||
auto v = make_intrusive<VectorType>(std::move(vector_index));
|
||||
auto t = make_intrusive<VectorVal>(std::move(v));
|
||||
|
||||
// this does no estimation if the results is correct!
|
||||
// in any case - just to make this future-proof (and I am lazy) - this can return more than k.
|
||||
|
@ -228,8 +228,7 @@ VectorVal* TopkVal::GetTopK(int k) const // returns vector
|
|||
it--;
|
||||
}
|
||||
|
||||
Unref(v);
|
||||
return t;
|
||||
return t.release();
|
||||
}
|
||||
|
||||
uint64_t TopkVal::GetCount(Val* value) const
|
||||
|
|
|
@ -204,7 +204,7 @@ static IntrusivePtr<VectorVal> do_split_string(StringVal* str_val,
|
|||
int max_num_sep)
|
||||
{
|
||||
// string_vec is used early in the version script - do not use the NetVar.
|
||||
auto rval = make_intrusive<VectorVal>(zeek::lookup_type("string_vec")->AsVectorType());
|
||||
auto rval = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("string_vec"));
|
||||
const u_char* s = str_val->Bytes();
|
||||
int n = str_val->Len();
|
||||
const u_char* end_of_s = s + n;
|
||||
|
@ -714,7 +714,7 @@ function str_split%(s: string, idx: index_vec%): string_vec
|
|||
|
||||
BroString::Vec* result = s->AsString()->Split(indices);
|
||||
auto result_v = make_intrusive<VectorVal>(
|
||||
zeek::lookup_type("string_vec")->AsVectorType());
|
||||
zeek::lookup_type<VectorType>("string_vec"));
|
||||
|
||||
if ( result )
|
||||
{
|
||||
|
|
|
@ -1123,13 +1123,14 @@ IntrusivePtr<RecordVal> Supervisor::NodeConfig::ToRecord() const
|
|||
if ( cpu_affinity )
|
||||
rval->Assign(rt->FieldOffset("cpu_affinity"), val_mgr->Int(*cpu_affinity));
|
||||
|
||||
const auto& st = rt->GetFieldType("scripts");
|
||||
auto scripts_val = new VectorVal(st->AsVectorType());
|
||||
rval->Assign(rt->FieldOffset("scripts"), scripts_val);
|
||||
auto st = rt->GetFieldType<VectorType>("scripts");
|
||||
auto scripts_val = make_intrusive<VectorVal>(std::move(st));
|
||||
|
||||
for ( const auto& s : scripts )
|
||||
scripts_val->Assign(scripts_val->Size(), make_intrusive<StringVal>(s));
|
||||
|
||||
rval->Assign(rt->FieldOffset("scripts"), std::move(scripts_val));
|
||||
|
||||
const auto& tt = rt->GetFieldType("cluster");
|
||||
auto cluster_val = new TableVal({NewRef{}, tt->AsTableType()});
|
||||
rval->Assign(rt->FieldOffset("cluster"), cluster_val);
|
||||
|
|
13
src/zeek.bif
13
src/zeek.bif
|
@ -1470,8 +1470,7 @@ function sort%(v: any, ...%) : any
|
|||
## .. zeek:see:: sort
|
||||
function order%(v: any, ...%) : index_vec
|
||||
%{
|
||||
auto result_v = make_intrusive<VectorVal>(
|
||||
lookup_type("index_vec")->AsVectorType());
|
||||
auto result_v = make_intrusive<VectorVal>(lookup_type<VectorType>("index_vec"));
|
||||
|
||||
if ( v->Type()->Tag() != TYPE_VECTOR )
|
||||
{
|
||||
|
@ -1825,7 +1824,7 @@ function zeek_version%(%): string
|
|||
function record_type_to_vector%(rt: string%): string_vec
|
||||
%{
|
||||
auto result =
|
||||
make_intrusive<VectorVal>(lookup_type("string_vec")->AsVectorType());
|
||||
make_intrusive<VectorVal>(lookup_type<VectorType>("string_vec"));
|
||||
|
||||
RecordType* type = lookup_type(rt->CheckString())->AsRecordType();
|
||||
|
||||
|
@ -1854,8 +1853,8 @@ function type_name%(t: any%): string
|
|||
## Returns: list of command-line arguments (``argv``) used to run Zeek.
|
||||
function zeek_args%(%): string_vec
|
||||
%{
|
||||
auto sv = lookup_type("string_vec")->AsVectorType();
|
||||
auto rval = make_intrusive<VectorVal>(sv);
|
||||
auto sv = lookup_type<VectorType>("string_vec");
|
||||
auto rval = make_intrusive<VectorVal>(std::move(sv));
|
||||
|
||||
for ( auto i = 0; i < bro_argc; ++i )
|
||||
rval->Assign(rval->Size(), make_intrusive<StringVal>(bro_argv[i]));
|
||||
|
@ -2187,7 +2186,7 @@ function is_v6_subnet%(s: subnet%): bool
|
|||
## Returns: The vector of addresses contained in the routing header data.
|
||||
function routing0_data_to_addrs%(s: string%): addr_vec
|
||||
%{
|
||||
auto rval = make_intrusive<VectorVal>(lookup_type("addr_vec")->AsVectorType());
|
||||
auto rval = make_intrusive<VectorVal>(lookup_type<VectorType>("addr_vec"));
|
||||
|
||||
int len = s->Len();
|
||||
const u_char* bytes = s->Bytes();
|
||||
|
@ -2218,7 +2217,7 @@ function routing0_data_to_addrs%(s: string%): addr_vec
|
|||
## .. zeek:see:: counts_to_addr
|
||||
function addr_to_counts%(a: addr%): index_vec
|
||||
%{
|
||||
auto rval = make_intrusive<VectorVal>(lookup_type("index_vec")->AsVectorType());
|
||||
auto rval = make_intrusive<VectorVal>(lookup_type<VectorType>("index_vec"));
|
||||
const uint32_t* bytes;
|
||||
int len = a->AsAddr().GetBytes(&bytes);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue