mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Completely remove all traces of the COUNTER type.
Relates to GH-1095
This commit is contained in:
parent
01fa5611ef
commit
417a6eb1e9
28 changed files with 79 additions and 140 deletions
|
@ -782,7 +782,6 @@ const char* CompositeHash::RecoverOneVal(
|
||||||
|
|
||||||
switch ( tag ) {
|
switch ( tag ) {
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
*pval = zeek::val_mgr->Count(*kp);
|
*pval = zeek::val_mgr->Count(*kp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1685,12 +1685,9 @@ BitExpr::BitExpr(BroExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||||
if ( IsVector(bt2) )
|
if ( IsVector(bt2) )
|
||||||
bt2 = t2->AsVectorType()->Yield()->Tag();
|
bt2 = t2->AsVectorType()->Yield()->Tag();
|
||||||
|
|
||||||
if ( (bt1 == zeek::TYPE_COUNT || bt1 == zeek::TYPE_COUNTER) &&
|
if ( (bt1 == zeek::TYPE_COUNT) && (bt2 == zeek::TYPE_COUNT) )
|
||||||
(bt2 == zeek::TYPE_COUNT || bt2 == zeek::TYPE_COUNTER) )
|
|
||||||
{
|
{
|
||||||
if ( bt1 == zeek::TYPE_COUNTER && bt2 == zeek::TYPE_COUNTER )
|
if ( is_vector(op1) || is_vector(op2) )
|
||||||
ExprError("cannot apply a bitwise operator to two \"counter\" operands");
|
|
||||||
else if ( is_vector(op1) || is_vector(op2) )
|
|
||||||
SetType(zeek::make_intrusive<zeek::VectorType>(base_type(zeek::TYPE_COUNT)));
|
SetType(zeek::make_intrusive<zeek::VectorType>(base_type(zeek::TYPE_COUNT)));
|
||||||
else
|
else
|
||||||
SetType(base_type(zeek::TYPE_COUNT));
|
SetType(base_type(zeek::TYPE_COUNT));
|
||||||
|
|
48
src/Type.cc
48
src/Type.cc
|
@ -34,28 +34,27 @@ const char* type_name(zeek::TypeTag t)
|
||||||
"bool", // 1
|
"bool", // 1
|
||||||
"int", // 2
|
"int", // 2
|
||||||
"count", // 3
|
"count", // 3
|
||||||
"counter", // 4
|
"double", // 4
|
||||||
"double", // 5
|
"time", // 5
|
||||||
"time", // 6
|
"interval", // 6
|
||||||
"interval", // 7
|
"string", // 7
|
||||||
"string", // 8
|
"pattern", // 8
|
||||||
"pattern", // 9
|
"enum", // 9
|
||||||
"enum", // 10
|
"timer", // 10
|
||||||
"timer", // 11
|
"port", // 11
|
||||||
"port", // 12
|
"addr", // 12
|
||||||
"addr", // 13
|
"subnet", // 13
|
||||||
"subnet", // 14
|
"any", // 14
|
||||||
"any", // 15
|
"table", // 15
|
||||||
"table", // 16
|
"union", // 16
|
||||||
"union", // 17
|
"record", // 17
|
||||||
"record", // 18
|
"types", // 18
|
||||||
"types", // 19
|
"func", // 19
|
||||||
"func", // 20
|
"file", // 20
|
||||||
"file", // 21
|
"vector", // 21
|
||||||
"vector", // 22
|
"opaque", // 22
|
||||||
"opaque", // 23
|
"type", // 23
|
||||||
"type", // 24
|
"error", // 24
|
||||||
"error", // 25
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( int(t) >= NUM_TYPES )
|
if ( int(t) >= NUM_TYPES )
|
||||||
|
@ -203,7 +202,6 @@ TypePtr Type::ShallowClone()
|
||||||
case TYPE_BOOL:
|
case TYPE_BOOL:
|
||||||
case TYPE_INT:
|
case TYPE_INT:
|
||||||
case TYPE_COUNT:
|
case TYPE_COUNT:
|
||||||
case TYPE_COUNTER:
|
|
||||||
case TYPE_DOUBLE:
|
case TYPE_DOUBLE:
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
case TYPE_INTERVAL:
|
case TYPE_INTERVAL:
|
||||||
|
@ -1543,7 +1541,6 @@ bool same_type(const Type& arg_t1, const Type& arg_t2,
|
||||||
case TYPE_BOOL:
|
case TYPE_BOOL:
|
||||||
case TYPE_INT:
|
case TYPE_INT:
|
||||||
case TYPE_COUNT:
|
case TYPE_COUNT:
|
||||||
case TYPE_COUNTER:
|
|
||||||
case TYPE_DOUBLE:
|
case TYPE_DOUBLE:
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
case TYPE_INTERVAL:
|
case TYPE_INTERVAL:
|
||||||
|
@ -1745,7 +1742,6 @@ bool is_assignable(TypeTag t)
|
||||||
case TYPE_BOOL:
|
case TYPE_BOOL:
|
||||||
case TYPE_INT:
|
case TYPE_INT:
|
||||||
case TYPE_COUNT:
|
case TYPE_COUNT:
|
||||||
case TYPE_COUNTER:
|
|
||||||
case TYPE_DOUBLE:
|
case TYPE_DOUBLE:
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
case TYPE_INTERVAL:
|
case TYPE_INTERVAL:
|
||||||
|
@ -1797,8 +1793,6 @@ TypeTag max_type(TypeTag t1, TypeTag t2)
|
||||||
CHECK_TYPE(TYPE_INT);
|
CHECK_TYPE(TYPE_INT);
|
||||||
CHECK_TYPE(TYPE_COUNT);
|
CHECK_TYPE(TYPE_COUNT);
|
||||||
|
|
||||||
// Note - mixing two TYPE_COUNTER's still promotes to
|
|
||||||
// a TYPE_COUNT.
|
|
||||||
return TYPE_COUNT;
|
return TYPE_COUNT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
48
src/Type.h
48
src/Type.h
|
@ -39,28 +39,27 @@ enum TypeTag {
|
||||||
TYPE_BOOL, // 1
|
TYPE_BOOL, // 1
|
||||||
TYPE_INT, // 2
|
TYPE_INT, // 2
|
||||||
TYPE_COUNT, // 3
|
TYPE_COUNT, // 3
|
||||||
TYPE_COUNTER, // 4
|
TYPE_DOUBLE, // 4
|
||||||
TYPE_DOUBLE, // 5
|
TYPE_TIME, // 5
|
||||||
TYPE_TIME, // 6
|
TYPE_INTERVAL, // 6
|
||||||
TYPE_INTERVAL, // 7
|
TYPE_STRING, // 7
|
||||||
TYPE_STRING, // 8
|
TYPE_PATTERN, // 8
|
||||||
TYPE_PATTERN, // 9
|
TYPE_ENUM, // 9
|
||||||
TYPE_ENUM, // 10
|
TYPE_TIMER, // 10
|
||||||
TYPE_TIMER, // 11
|
TYPE_PORT, // 11
|
||||||
TYPE_PORT, // 12
|
TYPE_ADDR, // 12
|
||||||
TYPE_ADDR, // 13
|
TYPE_SUBNET, // 13
|
||||||
TYPE_SUBNET, // 14
|
TYPE_ANY, // 14
|
||||||
TYPE_ANY, // 15
|
TYPE_TABLE, // 15
|
||||||
TYPE_TABLE, // 16
|
TYPE_UNION, // 16
|
||||||
TYPE_UNION, // 17
|
TYPE_RECORD, // 17
|
||||||
TYPE_RECORD, // 18
|
TYPE_LIST, // 18
|
||||||
TYPE_LIST, // 19
|
TYPE_FUNC, // 19
|
||||||
TYPE_FUNC, // 20
|
TYPE_FILE, // 20
|
||||||
TYPE_FILE, // 21
|
TYPE_VECTOR, // 21
|
||||||
TYPE_VECTOR, // 22
|
TYPE_OPAQUE, // 22
|
||||||
TYPE_OPAQUE, // 23
|
TYPE_TYPE, // 23
|
||||||
TYPE_TYPE, // 24
|
TYPE_ERROR // 24
|
||||||
TYPE_ERROR // 25
|
|
||||||
#define NUM_TYPES (int(TYPE_ERROR) + 1)
|
#define NUM_TYPES (int(TYPE_ERROR) + 1)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,7 +96,6 @@ constexpr InternalTypeTag to_internal_type_tag(TypeTag tag) noexcept
|
||||||
return TYPE_INTERNAL_INT;
|
return TYPE_INTERNAL_INT;
|
||||||
|
|
||||||
case TYPE_COUNT:
|
case TYPE_COUNT:
|
||||||
case TYPE_COUNTER:
|
|
||||||
case TYPE_PORT:
|
case TYPE_PORT:
|
||||||
return TYPE_INTERNAL_UNSIGNED;
|
return TYPE_INTERNAL_UNSIGNED;
|
||||||
|
|
||||||
|
@ -818,7 +816,7 @@ inline bool is_assignable(Type* t)
|
||||||
{ return zeek::is_assignable(t->Tag()); }
|
{ return zeek::is_assignable(t->Tag()); }
|
||||||
|
|
||||||
// True if the given type tag corresponds to an integral type.
|
// True if the given type tag corresponds to an integral type.
|
||||||
inline bool IsIntegral(TypeTag t) { return (t == TYPE_INT || t == TYPE_COUNT || t == TYPE_COUNTER); }
|
inline bool IsIntegral(TypeTag t) { return (t == TYPE_INT || t == TYPE_COUNT ); }
|
||||||
|
|
||||||
// True if the given type tag corresponds to an arithmetic type.
|
// True if the given type tag corresponds to an arithmetic type.
|
||||||
inline bool IsArithmetic(TypeTag t) { return (IsIntegral(t) || t == TYPE_DOUBLE); }
|
inline bool IsArithmetic(TypeTag t) { return (IsIntegral(t) || t == TYPE_DOUBLE); }
|
||||||
|
@ -937,8 +935,6 @@ constexpr auto TYPE_BOOL = zeek::TYPE_BOOL;
|
||||||
constexpr auto TYPE_INT = zeek::TYPE_INT;
|
constexpr auto TYPE_INT = zeek::TYPE_INT;
|
||||||
[[deprecated("Remove in v4.1. Use zeek::TYPE_COUNT instead.")]]
|
[[deprecated("Remove in v4.1. Use zeek::TYPE_COUNT instead.")]]
|
||||||
constexpr auto TYPE_COUNT = zeek::TYPE_COUNT;
|
constexpr auto TYPE_COUNT = zeek::TYPE_COUNT;
|
||||||
[[deprecated("Remove in v4.1. Use zeek::TYPE_COUNTER instead.")]]
|
|
||||||
constexpr auto TYPE_COUNTER = zeek::TYPE_COUNTER;
|
|
||||||
[[deprecated("Remove in v4.1. Use zeek::TYPE_DOUBLE instead.")]]
|
[[deprecated("Remove in v4.1. Use zeek::TYPE_DOUBLE instead.")]]
|
||||||
constexpr auto TYPE_DOUBLE = zeek::TYPE_DOUBLE;
|
constexpr auto TYPE_DOUBLE = zeek::TYPE_DOUBLE;
|
||||||
[[deprecated("Remove in v4.1. Use zeek::TYPE_TIME instead.")]]
|
[[deprecated("Remove in v4.1. Use zeek::TYPE_TIME instead.")]]
|
||||||
|
|
|
@ -517,10 +517,6 @@ static void BuildJSON(threading::formatter::JSON::NullDoubleWriter& writer, Val*
|
||||||
writer.Uint64(val->AsCount());
|
writer.Uint64(val->AsCount());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_COUNTER:
|
|
||||||
writer.Uint64(val->AsCounter());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
writer.Double(val->AsTime());
|
writer.Double(val->AsTime());
|
||||||
break;
|
break;
|
||||||
|
@ -3449,7 +3445,7 @@ ValPtr check_and_promote(ValPtr v,
|
||||||
t->Error("overflow promoting from signed/double to unsigned arithmetic value", v.get(), false, expr_location);
|
t->Error("overflow promoting from signed/double to unsigned arithmetic value", v.get(), false, expr_location);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if ( t_tag == TYPE_COUNT || t_tag == TYPE_COUNTER )
|
else if ( t_tag == TYPE_COUNT )
|
||||||
promoted_v = zeek::val_mgr->Count(v->CoerceToUnsigned());
|
promoted_v = zeek::val_mgr->Count(v->CoerceToUnsigned());
|
||||||
else // port
|
else // port
|
||||||
{
|
{
|
||||||
|
|
|
@ -232,7 +232,6 @@ public:
|
||||||
CONST_ACCESSOR2(zeek::TYPE_BOOL, bool, int_val, AsBool)
|
CONST_ACCESSOR2(zeek::TYPE_BOOL, bool, int_val, AsBool)
|
||||||
CONST_ACCESSOR2(zeek::TYPE_INT, bro_int_t, int_val, AsInt)
|
CONST_ACCESSOR2(zeek::TYPE_INT, bro_int_t, int_val, AsInt)
|
||||||
CONST_ACCESSOR2(zeek::TYPE_COUNT, bro_uint_t, uint_val, AsCount)
|
CONST_ACCESSOR2(zeek::TYPE_COUNT, bro_uint_t, uint_val, AsCount)
|
||||||
CONST_ACCESSOR2(zeek::TYPE_COUNTER, bro_uint_t, uint_val, AsCounter)
|
|
||||||
CONST_ACCESSOR2(zeek::TYPE_DOUBLE, double, double_val, AsDouble)
|
CONST_ACCESSOR2(zeek::TYPE_DOUBLE, double, double_val, AsDouble)
|
||||||
CONST_ACCESSOR2(zeek::TYPE_TIME, double, double_val, AsTime)
|
CONST_ACCESSOR2(zeek::TYPE_TIME, double, double_val, AsTime)
|
||||||
CONST_ACCESSOR2(zeek::TYPE_INTERVAL, double, double_val, AsInterval)
|
CONST_ACCESSOR2(zeek::TYPE_INTERVAL, double, double_val, AsInterval)
|
||||||
|
|
|
@ -117,7 +117,6 @@ zeek::ValPtr asn1_integer_to_val(const ASN1Encoding* i, zeek::TypeTag t)
|
||||||
case zeek::TYPE_INT:
|
case zeek::TYPE_INT:
|
||||||
return zeek::val_mgr->Int(v);
|
return zeek::val_mgr->Int(v);
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
return zeek::val_mgr->Count(v);
|
return zeek::val_mgr->Count(v);
|
||||||
default:
|
default:
|
||||||
reporter->Error("bad asn1_integer_to_val tag: %s", zeek::type_name(t));
|
reporter->Error("bad asn1_integer_to_val tag: %s", zeek::type_name(t));
|
||||||
|
|
|
@ -93,8 +93,6 @@ struct val_converter {
|
||||||
{
|
{
|
||||||
if ( type->Tag() == zeek::TYPE_COUNT )
|
if ( type->Tag() == zeek::TYPE_COUNT )
|
||||||
return zeek::val_mgr->Count(a);
|
return zeek::val_mgr->Count(a);
|
||||||
if ( type->Tag() == zeek::TYPE_COUNTER )
|
|
||||||
return zeek::val_mgr->Count(a);
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,8 +461,6 @@ struct type_checker {
|
||||||
{
|
{
|
||||||
if ( type->Tag() == zeek::TYPE_COUNT )
|
if ( type->Tag() == zeek::TYPE_COUNT )
|
||||||
return true;
|
return true;
|
||||||
if ( type->Tag() == zeek::TYPE_COUNTER )
|
|
||||||
return true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,8 +792,6 @@ broker::expected<broker::data> bro_broker::val_to_data(const zeek::Val* v)
|
||||||
return {v->AsInt()};
|
return {v->AsInt()};
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
return {v->AsCount()};
|
return {v->AsCount()};
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
return {v->AsCounter()};
|
|
||||||
case zeek::TYPE_PORT:
|
case zeek::TYPE_PORT:
|
||||||
{
|
{
|
||||||
auto p = v->AsPortVal();
|
auto p = v->AsPortVal();
|
||||||
|
|
|
@ -800,7 +800,6 @@ bool Manager::IsCompatibleType(zeek::Type* t, bool atomic_only)
|
||||||
case zeek::TYPE_BOOL:
|
case zeek::TYPE_BOOL:
|
||||||
case zeek::TYPE_INT:
|
case zeek::TYPE_INT:
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
case zeek::TYPE_PORT:
|
case zeek::TYPE_PORT:
|
||||||
case zeek::TYPE_SUBNET:
|
case zeek::TYPE_SUBNET:
|
||||||
case zeek::TYPE_ADDR:
|
case zeek::TYPE_ADDR:
|
||||||
|
@ -1919,7 +1918,6 @@ int Manager::GetValueLength(const Value* val) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
length += sizeof(val->val.uint_val);
|
length += sizeof(val->val.uint_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2015,7 +2013,6 @@ int Manager::CopyValue(char *data, const int startpos, const Value* val) const
|
||||||
return sizeof(val->val.int_val);
|
return sizeof(val->val.int_val);
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
memcpy(data+startpos, (const void*) &(val->val.uint_val), sizeof(val->val.uint_val));
|
memcpy(data+startpos, (const void*) &(val->val.uint_val), sizeof(val->val.uint_val));
|
||||||
return sizeof(val->val.uint_val);
|
return sizeof(val->val.uint_val);
|
||||||
|
|
||||||
|
@ -2204,7 +2201,6 @@ zeek::Val* Manager::ValueToVal(const Stream* i, const Value* val, zeek::Type* re
|
||||||
return zeek::val_mgr->Int(val->val.int_val).release();
|
return zeek::val_mgr->Int(val->val.int_val).release();
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
return zeek::val_mgr->Count(val->val.int_val).release();
|
return zeek::val_mgr->Count(val->val.int_val).release();
|
||||||
|
|
||||||
case zeek::TYPE_DOUBLE:
|
case zeek::TYPE_DOUBLE:
|
||||||
|
|
|
@ -159,7 +159,6 @@ threading::Value* Benchmark::EntryToVal(zeek::TypeTag type, zeek::TypeTag subtyp
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
val->val.uint_val = random();
|
val->val.uint_val = random();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,6 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
val->val.uint_val = sqlite3_column_int64(st, pos);
|
val->val.uint_val = sqlite3_column_int64(st, pos);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -956,7 +956,6 @@ threading::Value* Manager::ValToLogVal(zeek::Val* val, zeek::Type* ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
lval->val.uint_val = val->InternalUnsigned();
|
lval->val.uint_val = val->InternalUnsigned();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@ string SQLite::GetTableType(int arg_type, int arg_subtype) {
|
||||||
|
|
||||||
case zeek::TYPE_INT:
|
case zeek::TYPE_INT:
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
case zeek::TYPE_PORT: // note that we do not save the protocol at the moment. Just like in the case of the ascii-writer
|
case zeek::TYPE_PORT: // note that we do not save the protocol at the moment. Just like in the case of the ascii-writer
|
||||||
type = "integer";
|
type = "integer";
|
||||||
break;
|
break;
|
||||||
|
@ -250,7 +249,6 @@ int SQLite::AddParams(Value* val, int pos)
|
||||||
return sqlite3_bind_int(st, pos, val->val.int_val);
|
return sqlite3_bind_int(st, pos, val->val.int_val);
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
return sqlite3_bind_int(st, pos, val->val.uint_val);
|
return sqlite3_bind_int(st, pos, val->val.uint_val);
|
||||||
|
|
||||||
case zeek::TYPE_PORT:
|
case zeek::TYPE_PORT:
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
%token TOK_ADD TOK_ADD_TO TOK_ADDR TOK_ANY
|
%token TOK_ADD TOK_ADD_TO TOK_ADDR TOK_ANY
|
||||||
%token TOK_ATENDIF TOK_ATELSE TOK_ATIF TOK_ATIFDEF TOK_ATIFNDEF
|
%token TOK_ATENDIF TOK_ATELSE TOK_ATIF TOK_ATIFDEF TOK_ATIFNDEF
|
||||||
%token TOK_BOOL TOK_BREAK TOK_CASE TOK_OPTION TOK_CONST
|
%token TOK_BOOL TOK_BREAK TOK_CASE TOK_OPTION TOK_CONST
|
||||||
%token TOK_CONSTANT TOK_COPY TOK_COUNT TOK_COUNTER TOK_DEFAULT TOK_DELETE
|
%token TOK_CONSTANT TOK_COPY TOK_COUNT TOK_DEFAULT TOK_DELETE
|
||||||
%token TOK_DOUBLE TOK_ELSE TOK_ENUM TOK_EVENT TOK_EXPORT TOK_FALLTHROUGH
|
%token TOK_DOUBLE TOK_ELSE TOK_ENUM TOK_EVENT TOK_EXPORT TOK_FALLTHROUGH
|
||||||
%token TOK_FILE TOK_FOR TOK_FUNCTION TOK_GLOBAL TOK_HOOK TOK_ID TOK_IF TOK_INT
|
%token TOK_FILE TOK_FOR TOK_FUNCTION TOK_GLOBAL TOK_HOOK TOK_ID TOK_IF TOK_INT
|
||||||
%token TOK_INTERVAL TOK_LIST TOK_LOCAL TOK_MODULE
|
%token TOK_INTERVAL TOK_LIST TOK_LOCAL TOK_MODULE
|
||||||
|
@ -840,11 +840,6 @@ type:
|
||||||
$$ = zeek::base_type(zeek::TYPE_COUNT)->Ref();
|
$$ = zeek::base_type(zeek::TYPE_COUNT)->Ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_COUNTER {
|
|
||||||
zeek::detail::set_location(@1);
|
|
||||||
$$ = zeek::base_type(zeek::TYPE_COUNTER)->Ref();
|
|
||||||
}
|
|
||||||
|
|
||||||
| TOK_DOUBLE {
|
| TOK_DOUBLE {
|
||||||
zeek::detail::set_location(@1);
|
zeek::detail::set_location(@1);
|
||||||
$$ = zeek::base_type(zeek::TYPE_DOUBLE)->Ref();
|
$$ = zeek::base_type(zeek::TYPE_DOUBLE)->Ref();
|
||||||
|
|
|
@ -220,7 +220,6 @@ option return TOK_OPTION;
|
||||||
const return TOK_CONST;
|
const return TOK_CONST;
|
||||||
copy return TOK_COPY;
|
copy return TOK_COPY;
|
||||||
count return TOK_COUNT;
|
count return TOK_COUNT;
|
||||||
counter return TOK_COUNTER;
|
|
||||||
default return TOK_DEFAULT;
|
default return TOK_DEFAULT;
|
||||||
delete return TOK_DELETE;
|
delete return TOK_DELETE;
|
||||||
double return TOK_DOUBLE;
|
double return TOK_DOUBLE;
|
||||||
|
|
|
@ -131,7 +131,6 @@ bool Value::IsCompatibleType(zeek::Type* t, bool atomic_only)
|
||||||
case zeek::TYPE_BOOL:
|
case zeek::TYPE_BOOL:
|
||||||
case zeek::TYPE_INT:
|
case zeek::TYPE_INT:
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
case zeek::TYPE_PORT:
|
case zeek::TYPE_PORT:
|
||||||
case zeek::TYPE_SUBNET:
|
case zeek::TYPE_SUBNET:
|
||||||
case zeek::TYPE_ADDR:
|
case zeek::TYPE_ADDR:
|
||||||
|
@ -192,7 +191,6 @@ bool Value::Read(SerializationFormat* fmt)
|
||||||
return fmt->Read(&val.int_val, "int");
|
return fmt->Read(&val.int_val, "int");
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
return fmt->Read(&val.uint_val, "uint");
|
return fmt->Read(&val.uint_val, "uint");
|
||||||
|
|
||||||
case zeek::TYPE_PORT: {
|
case zeek::TYPE_PORT: {
|
||||||
|
@ -339,7 +337,6 @@ bool Value::Write(SerializationFormat* fmt) const
|
||||||
return fmt->Write(val.int_val, "int");
|
return fmt->Write(val.int_val, "int");
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
return fmt->Write(val.uint_val, "uint");
|
return fmt->Write(val.uint_val, "uint");
|
||||||
|
|
||||||
case zeek::TYPE_PORT:
|
case zeek::TYPE_PORT:
|
||||||
|
@ -452,7 +449,6 @@ zeek::Val* Value::ValueToVal(const std::string& source, const Value* val, bool&
|
||||||
return zeek::val_mgr->Int(val->val.int_val).release();
|
return zeek::val_mgr->Int(val->val.int_val).release();
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
return zeek::val_mgr->Count(val->val.int_val).release();
|
return zeek::val_mgr->Count(val->val.int_val).release();
|
||||||
|
|
||||||
case zeek::TYPE_DOUBLE:
|
case zeek::TYPE_DOUBLE:
|
||||||
|
|
|
@ -90,7 +90,6 @@ bool Ascii::Describe(ODesc* desc, threading::Value* val, const string& name) con
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
desc->Add(val->val.uint_val);
|
desc->Add(val->val.uint_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -260,7 +259,6 @@ threading::Value* Ascii::ParseValue(const string& s, const string& name, zeek::T
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
val->val.uint_val = strtoull(start, &end, 10);
|
val->val.uint_val = strtoull(start, &end, 10);
|
||||||
if ( CheckNumberError(start, end) )
|
if ( CheckNumberError(start, end) )
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
|
|
|
@ -106,7 +106,6 @@ void JSON::BuildJSON(NullDoubleWriter& writer, Value* val, const std::string& na
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
writer.Uint64(val->val.uint_val);
|
writer.Uint64(val->val.uint_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ bro_int_t parse_int(const char*& fmt)
|
||||||
}
|
}
|
||||||
|
|
||||||
static zeek::TypeTag ok_d_fmt[] = {
|
static zeek::TypeTag ok_d_fmt[] = {
|
||||||
zeek::TYPE_BOOL, zeek::TYPE_ENUM, zeek::TYPE_INT, zeek::TYPE_COUNT, zeek::TYPE_COUNTER, zeek::TYPE_PORT,
|
zeek::TYPE_BOOL, zeek::TYPE_ENUM, zeek::TYPE_INT, zeek::TYPE_COUNT, zeek::TYPE_PORT,
|
||||||
zeek::TYPE_SUBNET,
|
zeek::TYPE_SUBNET,
|
||||||
zeek::TYPE_ERROR
|
zeek::TYPE_ERROR
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
type inference (PASS)
|
type inference (PASS)
|
||||||
counter alias (PASS)
|
|
||||||
hexadecimal (PASS)
|
hexadecimal (PASS)
|
||||||
inequality operator (PASS)
|
inequality operator (PASS)
|
||||||
relational operator (PASS)
|
relational operator (PASS)
|
||||||
|
@ -19,9 +18,6 @@ bitwise and (PASS)
|
||||||
bitwise and (PASS)
|
bitwise and (PASS)
|
||||||
bitwise or (PASS)
|
bitwise or (PASS)
|
||||||
bitwise or (PASS)
|
bitwise or (PASS)
|
||||||
bitwise or (PASS)
|
|
||||||
bitwise xor (PASS)
|
|
||||||
bitwise xor (PASS)
|
|
||||||
bitwise xor (PASS)
|
bitwise xor (PASS)
|
||||||
bitwise complement (PASS)
|
bitwise complement (PASS)
|
||||||
bitwise complement (PASS)
|
bitwise complement (PASS)
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
1st stuff
|
1st stuff
|
||||||
hrw, 0, zeek/cluster/node/proxy-1/
|
hrw, 0, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 0, zeek/cluster/node/proxy-1/
|
hrw (custom pool), 0, zeek/cluster/node/proxy-2/
|
||||||
hrw, 1, zeek/cluster/node/proxy-1/
|
hrw, 1, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 1, zeek/cluster/node/proxy-1/
|
hrw (custom pool), 1, zeek/cluster/node/proxy-2/
|
||||||
hrw, 2, zeek/cluster/node/proxy-1/
|
hrw, 2, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 2, zeek/cluster/node/proxy-1/
|
hrw (custom pool), 2, zeek/cluster/node/proxy-1/
|
||||||
hrw, 3, zeek/cluster/node/proxy-1/
|
hrw, 3, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 3, zeek/cluster/node/proxy-1/
|
hrw (custom pool), 3, zeek/cluster/node/proxy-2/
|
||||||
hrw, 13, zeek/cluster/node/proxy-1/
|
hrw, 13, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 13, zeek/cluster/node/proxy-2/
|
hrw (custom pool), 13, zeek/cluster/node/proxy-2/
|
||||||
hrw, 37, zeek/cluster/node/proxy-1/
|
hrw, 37, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 37, zeek/cluster/node/proxy-2/
|
hrw (custom pool), 37, zeek/cluster/node/proxy-2/
|
||||||
hrw, 42, zeek/cluster/node/proxy-1/
|
hrw, 42, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 42, zeek/cluster/node/proxy-2/
|
hrw (custom pool), 42, zeek/cluster/node/proxy-1/
|
||||||
hrw, 101, zeek/cluster/node/proxy-1/
|
hrw, 101, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 101, zeek/cluster/node/proxy-2/
|
hrw (custom pool), 101, zeek/cluster/node/proxy-2/
|
||||||
rr, zeek/cluster/node/proxy-1/
|
rr, zeek/cluster/node/proxy-1/
|
||||||
|
@ -32,19 +32,19 @@ rr (custom pool), zeek/cluster/node/proxy-1/
|
||||||
rr, zeek/cluster/node/proxy-1/
|
rr, zeek/cluster/node/proxy-1/
|
||||||
rr (custom pool), zeek/cluster/node/proxy-2/
|
rr (custom pool), zeek/cluster/node/proxy-2/
|
||||||
hrw, 0, zeek/cluster/node/proxy-1/
|
hrw, 0, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 0, zeek/cluster/node/proxy-1/
|
hrw (custom pool), 0, zeek/cluster/node/proxy-2/
|
||||||
hrw, 1, zeek/cluster/node/proxy-1/
|
hrw, 1, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 1, zeek/cluster/node/proxy-1/
|
hrw (custom pool), 1, zeek/cluster/node/proxy-2/
|
||||||
hrw, 2, zeek/cluster/node/proxy-1/
|
hrw, 2, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 2, zeek/cluster/node/proxy-1/
|
hrw (custom pool), 2, zeek/cluster/node/proxy-1/
|
||||||
hrw, 3, zeek/cluster/node/proxy-1/
|
hrw, 3, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 3, zeek/cluster/node/proxy-1/
|
hrw (custom pool), 3, zeek/cluster/node/proxy-2/
|
||||||
hrw, 13, zeek/cluster/node/proxy-1/
|
hrw, 13, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 13, zeek/cluster/node/proxy-2/
|
hrw (custom pool), 13, zeek/cluster/node/proxy-2/
|
||||||
hrw, 37, zeek/cluster/node/proxy-1/
|
hrw, 37, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 37, zeek/cluster/node/proxy-2/
|
hrw (custom pool), 37, zeek/cluster/node/proxy-2/
|
||||||
hrw, 42, zeek/cluster/node/proxy-1/
|
hrw, 42, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 42, zeek/cluster/node/proxy-2/
|
hrw (custom pool), 42, zeek/cluster/node/proxy-1/
|
||||||
hrw, 101, zeek/cluster/node/proxy-1/
|
hrw, 101, zeek/cluster/node/proxy-1/
|
||||||
hrw (custom pool), 101, zeek/cluster/node/proxy-2/
|
hrw (custom pool), 101, zeek/cluster/node/proxy-2/
|
||||||
2nd stuff
|
2nd stuff
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
1st stuff
|
1st stuff
|
||||||
hrw, 0, zeek/cluster/node/proxy-1/
|
hrw, 0, zeek/cluster/node/proxy-2/
|
||||||
hrw, 1, zeek/cluster/node/proxy-1/
|
hrw, 1, zeek/cluster/node/proxy-2/
|
||||||
hrw, 2, zeek/cluster/node/proxy-1/
|
hrw, 2, zeek/cluster/node/proxy-1/
|
||||||
hrw, 3, zeek/cluster/node/proxy-1/
|
hrw, 3, zeek/cluster/node/proxy-2/
|
||||||
hrw, 13, zeek/cluster/node/proxy-2/
|
hrw, 13, zeek/cluster/node/proxy-2/
|
||||||
hrw, 37, zeek/cluster/node/proxy-2/
|
hrw, 37, zeek/cluster/node/proxy-2/
|
||||||
hrw, 42, zeek/cluster/node/proxy-2/
|
hrw, 42, zeek/cluster/node/proxy-1/
|
||||||
hrw, 101, zeek/cluster/node/proxy-2/
|
hrw, 101, zeek/cluster/node/proxy-2/
|
||||||
rr, zeek/cluster/node/proxy-1/
|
rr, zeek/cluster/node/proxy-1/
|
||||||
rr, zeek/cluster/node/proxy-2/
|
rr, zeek/cluster/node/proxy-2/
|
||||||
|
@ -15,13 +15,13 @@ rr, zeek/cluster/node/proxy-1/
|
||||||
rr, zeek/cluster/node/proxy-2/
|
rr, zeek/cluster/node/proxy-2/
|
||||||
rr, zeek/cluster/node/proxy-1/
|
rr, zeek/cluster/node/proxy-1/
|
||||||
rr, zeek/cluster/node/proxy-2/
|
rr, zeek/cluster/node/proxy-2/
|
||||||
hrw, 0, zeek/cluster/node/proxy-1/
|
hrw, 0, zeek/cluster/node/proxy-2/
|
||||||
hrw, 1, zeek/cluster/node/proxy-1/
|
hrw, 1, zeek/cluster/node/proxy-2/
|
||||||
hrw, 2, zeek/cluster/node/proxy-1/
|
hrw, 2, zeek/cluster/node/proxy-1/
|
||||||
hrw, 3, zeek/cluster/node/proxy-1/
|
hrw, 3, zeek/cluster/node/proxy-2/
|
||||||
hrw, 13, zeek/cluster/node/proxy-2/
|
hrw, 13, zeek/cluster/node/proxy-2/
|
||||||
hrw, 37, zeek/cluster/node/proxy-2/
|
hrw, 37, zeek/cluster/node/proxy-2/
|
||||||
hrw, 42, zeek/cluster/node/proxy-2/
|
hrw, 42, zeek/cluster/node/proxy-1/
|
||||||
hrw, 101, zeek/cluster/node/proxy-2/
|
hrw, 101, zeek/cluster/node/proxy-2/
|
||||||
2nd stuff
|
2nd stuff
|
||||||
hrw, 0, zeek/cluster/node/proxy-2/
|
hrw, 0, zeek/cluster/node/proxy-2/
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
got distributed event hrw, 0
|
|
||||||
got distributed event hrw, 1
|
|
||||||
got distributed event hrw, 2
|
got distributed event hrw, 2
|
||||||
got distributed event hrw, 3
|
got distributed event hrw, 42
|
||||||
got distributed event rr, 0
|
got distributed event rr, 0
|
||||||
got distributed event rr, 2
|
got distributed event rr, 2
|
||||||
got distributed event rr, 13
|
got distributed event rr, 13
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
got distributed event hrw, 0
|
||||||
|
got distributed event hrw, 1
|
||||||
|
got distributed event hrw, 3
|
||||||
got distributed event hrw, 13
|
got distributed event hrw, 13
|
||||||
got distributed event hrw, 37
|
got distributed event hrw, 37
|
||||||
got distributed event hrw, 42
|
|
||||||
got distributed event hrw, 101
|
got distributed event hrw, 101
|
||||||
got distributed event rr, 1
|
got distributed event rr, 1
|
||||||
got distributed event rr, 3
|
got distributed event rr, 3
|
||||||
|
|
|
@ -8,18 +8,18 @@ T
|
||||||
F
|
F
|
||||||
[id=0, user_data=alice]
|
[id=0, user_data=alice]
|
||||||
[id=3, user_data=dave]
|
[id=3, user_data=dave]
|
||||||
[id=3, user_data=dave]
|
[id=4, user_data=eve]
|
||||||
[id=0, user_data=alice]
|
[id=4, user_data=eve]
|
||||||
[id=0, user_data=alice]
|
|
||||||
[id=4, user_data=eve]
|
[id=4, user_data=eve]
|
||||||
[id=0, user_data=alice]
|
[id=0, user_data=alice]
|
||||||
|
[id=3, user_data=dave]
|
||||||
[id=1, user_data=bob]
|
[id=1, user_data=bob]
|
||||||
[id=0, user_data=alice]
|
[id=0, user_data=alice]
|
||||||
[id=1, user_data=bob]
|
[id=1, user_data=bob]
|
||||||
T
|
T
|
||||||
|
[id=4, user_data=eve]
|
||||||
[id=3, user_data=dave]
|
[id=3, user_data=dave]
|
||||||
[id=3, user_data=dave]
|
[id=4, user_data=eve]
|
||||||
[id=3, user_data=dave]
|
|
||||||
[id=4, user_data=eve]
|
[id=4, user_data=eve]
|
||||||
[id=4, user_data=eve]
|
[id=4, user_data=eve]
|
||||||
[id=4, user_data=eve]
|
[id=4, user_data=eve]
|
||||||
|
@ -30,11 +30,11 @@ T
|
||||||
T
|
T
|
||||||
[id=0, user_data=alice]
|
[id=0, user_data=alice]
|
||||||
[id=3, user_data=dave]
|
[id=3, user_data=dave]
|
||||||
[id=3, user_data=dave]
|
[id=4, user_data=eve]
|
||||||
[id=0, user_data=alice]
|
[id=4, user_data=eve]
|
||||||
[id=0, user_data=alice]
|
|
||||||
[id=4, user_data=eve]
|
[id=4, user_data=eve]
|
||||||
[id=0, user_data=alice]
|
[id=0, user_data=alice]
|
||||||
|
[id=3, user_data=dave]
|
||||||
[id=1, user_data=bob]
|
[id=1, user_data=bob]
|
||||||
[id=0, user_data=alice]
|
[id=0, user_data=alice]
|
||||||
[id=1, user_data=bob]
|
[id=1, user_data=bob]
|
||||||
|
|
|
@ -15,16 +15,12 @@ event zeek_init()
|
||||||
local c4: count = 255;
|
local c4: count = 255;
|
||||||
local c5: count = 18446744073709551615; # maximum allowed value
|
local c5: count = 18446744073709551615; # maximum allowed value
|
||||||
local c6: count = 0xffffffffffffffff; # maximum allowed value
|
local c6: count = 0xffffffffffffffff; # maximum allowed value
|
||||||
local c7: counter = 5;
|
local c7 = 1;
|
||||||
local c8 = 1;
|
|
||||||
|
|
||||||
# Type inference test
|
# Type inference test
|
||||||
|
|
||||||
test_case( "type inference", type_name(c8) == "count" );
|
test_case( "type inference", type_name(c7) == "count" );
|
||||||
|
|
||||||
# Counter alias test
|
|
||||||
|
|
||||||
test_case( "counter alias", c2 == c7 );
|
|
||||||
|
|
||||||
# Test various constant representations
|
# Test various constant representations
|
||||||
|
|
||||||
|
@ -49,13 +45,10 @@ event zeek_init()
|
||||||
test_case( "assignment operator", c2 == 6 );
|
test_case( "assignment operator", c2 == 6 );
|
||||||
test_case( "bitwise and", c2 & 0x4 == 0x4 );
|
test_case( "bitwise and", c2 & 0x4 == 0x4 );
|
||||||
test_case( "bitwise and", c4 & 0x4 == 0x4 );
|
test_case( "bitwise and", c4 & 0x4 == 0x4 );
|
||||||
test_case( "bitwise and", c8 & 0x4 == 0x0 );
|
test_case( "bitwise and", c7 & 0x4 == 0x0 );
|
||||||
test_case( "bitwise or", c2 | 0x4 == c2 );
|
test_case( "bitwise or", c2 | 0x4 == c2 );
|
||||||
test_case( "bitwise or", c4 | 0x4 == c4 );
|
test_case( "bitwise or", c4 | 0x4 == c4 );
|
||||||
test_case( "bitwise or", c8 | 0x4 == c7 );
|
|
||||||
test_case( "bitwise xor", c7 ^ 0x4 == c8 );
|
|
||||||
test_case( "bitwise xor", c4 ^ 0x4 == 251 );
|
test_case( "bitwise xor", c4 ^ 0x4 == 251 );
|
||||||
test_case( "bitwise xor", c8 ^ 0x4 == c7 );
|
|
||||||
test_case( "bitwise complement", ~c6 == 0 );
|
test_case( "bitwise complement", ~c6 == 0 );
|
||||||
test_case( "bitwise complement", ~~c4 == c4 );
|
test_case( "bitwise complement", ~~c4 == c4 );
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,6 @@ void Plugin::RenderVal(const threading::Value* val, ODesc &d) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_COUNT:
|
case TYPE_COUNT:
|
||||||
case TYPE_COUNTER:
|
|
||||||
d.Add(val->val.uint_val);
|
d.Add(val->val.uint_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,6 @@ threading::Value* Foo::EntryToVal(zeek::TypeTag type, zeek::TypeTag subtype)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zeek::TYPE_COUNT:
|
case zeek::TYPE_COUNT:
|
||||||
case zeek::TYPE_COUNTER:
|
|
||||||
val->val.uint_val = random();
|
val->val.uint_val = random();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue