mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/johanna/1095-just-get-rid-of-it'
* origin/topic/johanna/1095-just-get-rid-of-it: Re-add TYPE_COUNTER without function and deprecation marker. Completely remove all traces of the COUNTER type.
This commit is contained in:
commit
22b401f52f
26 changed files with 24 additions and 69 deletions
6
CHANGES
6
CHANGES
|
@ -1,3 +1,9 @@
|
||||||
|
|
||||||
|
3.3.0-dev.42 | 2020-08-03 10:37:38 -0700
|
||||||
|
|
||||||
|
* Remove counter type, only leaving compatibility enum. The type was unused/non-functional.
|
||||||
|
See GH-1095 (Johanna Amann, Corelight).
|
||||||
|
|
||||||
3.3.0-dev.38 | 2020-08-01 09:21:17 -0700
|
3.3.0-dev.38 | 2020-08-01 09:21:17 -0700
|
||||||
|
|
||||||
* Properly forward-declare zeek::plugin::plugin in DebugLogger (Tim Wojtulewicz, Corelight)
|
* Properly forward-declare zeek::plugin::plugin in DebugLogger (Tim Wojtulewicz, Corelight)
|
||||||
|
|
6
NEWS
6
NEWS
|
@ -8,6 +8,12 @@ Zeek 4.0.0
|
||||||
|
|
||||||
TODO: nothing notable yet
|
TODO: nothing notable yet
|
||||||
|
|
||||||
|
Removed Functionality
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
- The counter type was removed. This type was never fully functional/used
|
||||||
|
anywhere.
|
||||||
|
|
||||||
Zeek 3.2.0
|
Zeek 3.2.0
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
3.3.0-dev.38
|
3.3.0-dev.42
|
||||||
|
|
|
@ -784,7 +784,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));
|
||||||
|
|
|
@ -203,7 +203,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 +1542,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 +1743,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 +1794,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
|
||||||
|
|
|
@ -39,7 +39,7 @@ enum TypeTag {
|
||||||
TYPE_BOOL, // 1
|
TYPE_BOOL, // 1
|
||||||
TYPE_INT, // 2
|
TYPE_INT, // 2
|
||||||
TYPE_COUNT, // 3
|
TYPE_COUNT, // 3
|
||||||
TYPE_COUNTER, // 4
|
TYPE_COUNTER [[deprecated("Remove in v4.1. TYPE_COUNTER was removed; use TYPE_COUNT instead.")]], // 4
|
||||||
TYPE_DOUBLE, // 5
|
TYPE_DOUBLE, // 5
|
||||||
TYPE_TIME, // 6
|
TYPE_TIME, // 6
|
||||||
TYPE_INTERVAL, // 7
|
TYPE_INTERVAL, // 7
|
||||||
|
@ -97,7 +97,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 +817,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,7 +936,7 @@ 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.")]]
|
[[deprecated("Remove in v4.1. TYPE_COUNTER was removed. Use zeek::TYPE_COUNT instead.")]]
|
||||||
constexpr auto TYPE_COUNTER = zeek::TYPE_COUNTER;
|
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;
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -237,7 +237,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:
|
||||||
zeek::reporter->Error("bad asn1_integer_to_val tag: %s", zeek::type_name(t));
|
zeek::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();
|
||||||
|
|
|
@ -809,7 +809,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:
|
||||||
|
@ -1929,7 +1928,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;
|
||||||
|
|
||||||
|
@ -2025,7 +2023,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);
|
||||||
|
|
||||||
|
@ -2214,7 +2211,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;
|
||||||
|
|
||||||
|
|
|
@ -957,7 +957,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(zeek::detail::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(zeek::detail::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(zeek::ODesc* desc, threading::Value* val, const string& nam
|
||||||
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)
|
||||||
|
|
|
@ -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