mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Miscellaneous deprecations and renaming
This commit is contained in:
parent
d875ad1a96
commit
4d4c6280e9
14 changed files with 57 additions and 57 deletions
16
src/Expr.cc
16
src/Expr.cc
|
@ -29,7 +29,7 @@
|
|||
namespace zeek::detail
|
||||
{
|
||||
|
||||
const char* expr_name(BroExprTag t)
|
||||
const char* expr_name(ExprTag t)
|
||||
{
|
||||
static const char* expr_names[int(NUM_EXPRS)] = {
|
||||
"name",
|
||||
|
@ -112,7 +112,7 @@ const char* expr_name(BroExprTag t)
|
|||
|
||||
int Expr::num_exprs = 0;
|
||||
|
||||
Expr::Expr(BroExprTag arg_tag) : tag(arg_tag), paren(false), type(nullptr)
|
||||
Expr::Expr(ExprTag arg_tag) : tag(arg_tag), paren(false), type(nullptr)
|
||||
{
|
||||
SetLocationInfo(&start_location, &end_location);
|
||||
opt_info = new ExprOptInfo();
|
||||
|
@ -606,7 +606,7 @@ TraversalCode ConstExpr::Traverse(TraversalCallback* cb) const
|
|||
HANDLE_TC_EXPR_POST(tc);
|
||||
}
|
||||
|
||||
UnaryExpr::UnaryExpr(BroExprTag arg_tag, ExprPtr arg_op) : Expr(arg_tag), op(std::move(arg_op))
|
||||
UnaryExpr::UnaryExpr(ExprTag arg_tag, ExprPtr arg_op) : Expr(arg_tag), op(std::move(arg_op))
|
||||
{
|
||||
if ( op->IsError() )
|
||||
SetError();
|
||||
|
@ -1386,7 +1386,7 @@ ValPtr CloneExpr::Fold(Val* v) const
|
|||
return v->Clone();
|
||||
}
|
||||
|
||||
IncrExpr::IncrExpr(BroExprTag arg_tag, ExprPtr arg_op) : UnaryExpr(arg_tag, arg_op->MakeLvalue())
|
||||
IncrExpr::IncrExpr(ExprTag arg_tag, ExprPtr arg_op) : UnaryExpr(arg_tag, arg_op->MakeLvalue())
|
||||
{
|
||||
if ( IsError() )
|
||||
return;
|
||||
|
@ -1997,7 +1997,7 @@ ModExpr::ModExpr(ExprPtr arg_op1, ExprPtr arg_op2)
|
|||
CheckScalarAggOp();
|
||||
}
|
||||
|
||||
BoolExpr::BoolExpr(BroExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
BoolExpr::BoolExpr(ExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
: BinaryExpr(arg_tag, std::move(arg_op1), std::move(arg_op2))
|
||||
{
|
||||
if ( IsError() )
|
||||
|
@ -2137,7 +2137,7 @@ ValPtr BoolExpr::Eval(Frame* f) const
|
|||
return result;
|
||||
}
|
||||
|
||||
BitExpr::BitExpr(BroExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
BitExpr::BitExpr(ExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
: BinaryExpr(arg_tag, std::move(arg_op1), std::move(arg_op2))
|
||||
{
|
||||
if ( IsError() )
|
||||
|
@ -2186,7 +2186,7 @@ BitExpr::BitExpr(BroExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
|||
ExprError("requires \"count\" or compatible \"set\" operands");
|
||||
}
|
||||
|
||||
EqExpr::EqExpr(BroExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
EqExpr::EqExpr(ExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
: BinaryExpr(arg_tag, std::move(arg_op1), std::move(arg_op2))
|
||||
{
|
||||
if ( IsError() )
|
||||
|
@ -2301,7 +2301,7 @@ bool EqExpr::InvertSense()
|
|||
return true;
|
||||
}
|
||||
|
||||
RelExpr::RelExpr(BroExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
RelExpr::RelExpr(ExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
: BinaryExpr(arg_tag, std::move(arg_op1), std::move(arg_op2))
|
||||
{
|
||||
if ( IsError() )
|
||||
|
|
26
src/Expr.h
26
src/Expr.h
|
@ -31,7 +31,7 @@ struct function_ingredients;
|
|||
using IDPtr = IntrusivePtr<ID>;
|
||||
using ScopePtr = IntrusivePtr<Scope>;
|
||||
|
||||
enum BroExprTag : int
|
||||
enum ExprTag : int
|
||||
{
|
||||
EXPR_ANY = -1,
|
||||
EXPR_NAME,
|
||||
|
@ -104,7 +104,9 @@ enum BroExprTag : int
|
|||
#define NUM_EXPRS (int(EXPR_NOP) + 1)
|
||||
};
|
||||
|
||||
extern const char* expr_name(BroExprTag t);
|
||||
using BroExprTag [[deprecated("Remove in v6.1. Use ExprTag.")]] = ExprTag;
|
||||
|
||||
extern const char* expr_name(ExprTag t);
|
||||
|
||||
class AddToExpr;
|
||||
class AnyIndexExpr;
|
||||
|
@ -151,7 +153,7 @@ public:
|
|||
|
||||
template <class T> IntrusivePtr<T> GetType() const { return cast_intrusive<T>(type); }
|
||||
|
||||
BroExprTag Tag() const { return tag; }
|
||||
ExprTag Tag() const { return tag; }
|
||||
|
||||
Expr* Ref()
|
||||
{
|
||||
|
@ -416,7 +418,7 @@ public:
|
|||
|
||||
protected:
|
||||
Expr() = default;
|
||||
explicit Expr(BroExprTag arg_tag);
|
||||
explicit Expr(ExprTag arg_tag);
|
||||
|
||||
virtual void ExprDescribe(ODesc* d) const = 0;
|
||||
void AddTag(ODesc* d) const;
|
||||
|
@ -435,7 +437,7 @@ protected:
|
|||
[[noreturn]] void RuntimeError(const std::string& msg) const;
|
||||
[[noreturn]] void RuntimeErrorWithCallStack(const std::string& msg) const;
|
||||
|
||||
BroExprTag tag;
|
||||
ExprTag tag;
|
||||
bool paren;
|
||||
TypePtr type;
|
||||
|
||||
|
@ -533,7 +535,7 @@ public:
|
|||
void SetOp1(ExprPtr _op) override final { op = std::move(_op); }
|
||||
|
||||
protected:
|
||||
UnaryExpr(BroExprTag arg_tag, ExprPtr arg_op);
|
||||
UnaryExpr(ExprTag arg_tag, ExprPtr arg_op);
|
||||
|
||||
void ExprDescribe(ODesc* d) const override;
|
||||
|
||||
|
@ -573,7 +575,7 @@ public:
|
|||
void SetOp2(ExprPtr _op) override final { op2 = std::move(_op); }
|
||||
|
||||
protected:
|
||||
BinaryExpr(BroExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
BinaryExpr(ExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
||||
: Expr(arg_tag), op1(std::move(arg_op1)), op2(std::move(arg_op2))
|
||||
{
|
||||
if ( ! (op1 && op2) )
|
||||
|
@ -654,7 +656,7 @@ protected:
|
|||
class IncrExpr final : public UnaryExpr
|
||||
{
|
||||
public:
|
||||
IncrExpr(BroExprTag tag, ExprPtr op);
|
||||
IncrExpr(ExprTag tag, ExprPtr op);
|
||||
|
||||
ValPtr Eval(Frame* f) const override;
|
||||
ValPtr DoSingleEval(Frame* f, Val* v) const;
|
||||
|
@ -839,7 +841,7 @@ public:
|
|||
class BoolExpr final : public BinaryExpr
|
||||
{
|
||||
public:
|
||||
BoolExpr(BroExprTag tag, ExprPtr op1, ExprPtr op2);
|
||||
BoolExpr(ExprTag tag, ExprPtr op1, ExprPtr op2);
|
||||
|
||||
ValPtr Eval(Frame* f) const override;
|
||||
ValPtr DoSingleEval(Frame* f, ValPtr v1, Expr* op2) const;
|
||||
|
@ -858,7 +860,7 @@ protected:
|
|||
class BitExpr final : public BinaryExpr
|
||||
{
|
||||
public:
|
||||
BitExpr(BroExprTag tag, ExprPtr op1, ExprPtr op2);
|
||||
BitExpr(ExprTag tag, ExprPtr op1, ExprPtr op2);
|
||||
|
||||
// Optimization-related:
|
||||
ExprPtr Duplicate() override;
|
||||
|
@ -869,7 +871,7 @@ public:
|
|||
class EqExpr final : public BinaryExpr
|
||||
{
|
||||
public:
|
||||
EqExpr(BroExprTag tag, ExprPtr op1, ExprPtr op2);
|
||||
EqExpr(ExprTag tag, ExprPtr op1, ExprPtr op2);
|
||||
void Canonicize() override;
|
||||
|
||||
// Optimization-related:
|
||||
|
@ -885,7 +887,7 @@ protected:
|
|||
class RelExpr final : public BinaryExpr
|
||||
{
|
||||
public:
|
||||
RelExpr(BroExprTag tag, ExprPtr op1, ExprPtr op2);
|
||||
RelExpr(ExprTag tag, ExprPtr op1, ExprPtr op2);
|
||||
void Canonicize() override;
|
||||
|
||||
// Optimization-related:
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "zeek/util.h" // for zeek_int_t
|
||||
|
||||
// to allow bro_md5_hmac access to the hmac seed
|
||||
// to allow md5_hmac_bif access to the hmac seed
|
||||
#include "zeek/ZeekArgs.h"
|
||||
|
||||
namespace zeek
|
||||
|
|
|
@ -1327,7 +1327,7 @@ void RuleMatcher::DumpStateStats(File* f, RuleHdrTest* hdr_test)
|
|||
DumpStateStats(f, h);
|
||||
}
|
||||
|
||||
static Val* get_bro_val(const char* label)
|
||||
static Val* get_zeek_val(const char* label)
|
||||
{
|
||||
auto id = lookup_ID(label, GLOBAL_MODULE_NAME, false);
|
||||
if ( ! id )
|
||||
|
@ -1410,7 +1410,7 @@ static bool val_to_maskedval(Val* v, maskedvalue_list* append_to, vector<IPPrefi
|
|||
void id_to_maskedvallist(const char* id, maskedvalue_list* append_to,
|
||||
vector<IPPrefix>* prefix_vector)
|
||||
{
|
||||
Val* v = get_bro_val(id);
|
||||
Val* v = get_zeek_val(id);
|
||||
if ( ! v )
|
||||
return;
|
||||
|
||||
|
@ -1432,7 +1432,7 @@ char* id_to_str(const char* id)
|
|||
const String* src;
|
||||
char* dst;
|
||||
|
||||
Val* v = get_bro_val(id);
|
||||
Val* v = get_zeek_val(id);
|
||||
if ( ! v )
|
||||
goto error;
|
||||
|
||||
|
@ -1455,7 +1455,7 @@ error:
|
|||
|
||||
uint32_t id_to_uint(const char* id)
|
||||
{
|
||||
Val* v = get_bro_val(id);
|
||||
Val* v = get_zeek_val(id);
|
||||
if ( ! v )
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -2448,7 +2448,7 @@ void TableVal::DoExpire(double t)
|
|||
{
|
||||
// This happens when we insert val while network_time
|
||||
// hasn't been initialized yet (e.g. in zeek_init()), and
|
||||
// also when bro_start_network_time hasn't been initialized
|
||||
// also when zeek_start_network_time hasn't been initialized
|
||||
// (e.g. before first packet). The expire_access_time is
|
||||
// correct, so we just need to wait.
|
||||
}
|
||||
|
|
|
@ -26,9 +26,6 @@ using namespace std::string_literals;
|
|||
namespace zeek
|
||||
{
|
||||
|
||||
constexpr int String::EXPANDED_STRING;
|
||||
constexpr int String::BRO_STRING_LITERAL;
|
||||
|
||||
// This constructor forces the user to specify arg_final_NUL. When str
|
||||
// is a *normal* NUL-terminated string, make arg_n == strlen(str) and
|
||||
// arg_final_NUL == 1; when str is a sequence of n bytes, make
|
||||
|
@ -678,7 +675,7 @@ TEST_CASE("rendering")
|
|||
CHECK_EQ(test_length, 7);
|
||||
delete[] r;
|
||||
|
||||
r = s2.Render(zeek::String::BRO_STRING_LITERAL);
|
||||
r = s2.Render(zeek::String::ZEEK_STRING_LITERAL);
|
||||
CHECK_EQ(std::string(r), "\\x03\\x04\\x05\\x06\\\\\\\'");
|
||||
delete[] r;
|
||||
|
||||
|
|
|
@ -101,9 +101,12 @@ public:
|
|||
static constexpr int EXPANDED_STRING = // the original style
|
||||
ESC_HEX;
|
||||
|
||||
static constexpr int BRO_STRING_LITERAL = // as in a Bro/Zeek string literal
|
||||
static constexpr int ZEEK_STRING_LITERAL = // as in a Zeek string literal
|
||||
ESC_ESC | ESC_QUOT | ESC_HEX;
|
||||
|
||||
static constexpr int BRO_STRING_LITERAL
|
||||
[[deprecated("Remove in v6.1. Use ZEEK_STRING_LITERAL.")]] = ZEEK_STRING_LITERAL;
|
||||
|
||||
// Renders a string into a newly allocated character array that
|
||||
// you have to delete[]. You can combine the render styles given
|
||||
// above to achieve the representation you desire. If you pass a
|
||||
|
|
|
@ -339,7 +339,7 @@ static bool component_cmp(const Component* a, const Component* b)
|
|||
return a->Name() < b->Name();
|
||||
}
|
||||
|
||||
bool Plugin::LoadBroFile(const std::string& file)
|
||||
bool Plugin::LoadZeekFile(const std::string& file)
|
||||
{
|
||||
::add_input_file(file.c_str());
|
||||
return true;
|
||||
|
|
|
@ -726,7 +726,12 @@ public:
|
|||
* @return True if successful (which however may only mean
|
||||
* "successfully queued").
|
||||
*/
|
||||
bool LoadBroFile(const std::string& file);
|
||||
bool LoadZeekFile(const std::string& file);
|
||||
|
||||
[[deprecated("Remove in v6.1. Use LoadZeekFile.")]] bool LoadBroFile(const std::string& file)
|
||||
{
|
||||
return LoadZeekFile(file);
|
||||
}
|
||||
|
||||
protected:
|
||||
friend class Manager;
|
||||
|
|
|
@ -609,7 +609,7 @@ function clean%(str: string%): string
|
|||
## .. zeek:see:: clean escape_string
|
||||
function to_string_literal%(str: string%): string
|
||||
%{
|
||||
char* s = str->AsString()->Render(zeek::String::BRO_STRING_LITERAL);
|
||||
char* s = str->AsString()->Render(zeek::String::ZEEK_STRING_LITERAL);
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(1, byte_vec(s), strlen(s)));
|
||||
%}
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ static void atexit_handler()
|
|||
util::detail::set_processing_status("TERMINATED", "atexit");
|
||||
}
|
||||
|
||||
static void bro_new_handler()
|
||||
static void zeek_new_handler()
|
||||
{
|
||||
out_of_memory("new");
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ static void set_signal_mask(bool do_block)
|
|||
SetupResult setup(int argc, char** argv, Options* zopts)
|
||||
{
|
||||
ZEEK_LSAN_DISABLE();
|
||||
std::set_new_handler(bro_new_handler);
|
||||
std::set_new_handler(zeek_new_handler);
|
||||
|
||||
auto zeek_exe_path = util::detail::get_exe_path(argv[0]);
|
||||
|
||||
|
|
11
src/zeek.bif
11
src/zeek.bif
|
@ -437,19 +437,12 @@ static bool prepare_environment(zeek::TableVal* tbl, bool set)
|
|||
char* tmp = zeek::util::copy_string(key->AsString()->CheckString());
|
||||
zeek::util::to_upper(tmp);
|
||||
std::string var1 = zeek::util::fmt("ZEEK_ARG_%s", tmp);
|
||||
std::string var2 = zeek::util::fmt("BRO_ARG_%s", tmp); // legacy support
|
||||
delete [] tmp;
|
||||
|
||||
if ( set )
|
||||
{
|
||||
setenv(var1.data(), val->AsString()->CheckString(), 1);
|
||||
setenv(var2.data(), val->AsString()->CheckString(), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsetenv(var1.data());
|
||||
unsetenv(var2.data());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3174,7 +3167,7 @@ function decode_base64_conn%(cid: conn_id, s: string, a: string &default=""%): s
|
|||
%}
|
||||
|
||||
%%{
|
||||
struct bro_uuid_t {
|
||||
struct zeek_uuid_t {
|
||||
uint32_t time_low;
|
||||
uint16_t time_mid;
|
||||
uint16_t time_hi_and_version;
|
||||
|
@ -3197,7 +3190,7 @@ function uuid_to_string%(uuid: string%): string
|
|||
if ( uuid->Len() != 16 )
|
||||
return zeek::make_intrusive<zeek::StringVal>("<Invalid UUID>");
|
||||
|
||||
bro_uuid_t* id = (bro_uuid_t*) uuid->Bytes();
|
||||
zeek_uuid_t* id = (zeek_uuid_t*) uuid->Bytes();
|
||||
|
||||
static char s[1024];
|
||||
char* sp = s;
|
||||
|
|
|
@ -53,37 +53,37 @@ static string RemoveLeadingSpace(const string& s)
|
|||
return rval;
|
||||
}
|
||||
|
||||
Manager::Manager(const string& arg_config, const string& bro_command)
|
||||
Manager::Manager(const string& arg_config, const string& command)
|
||||
: disabled(), comment_buffer(), comment_buffer_map(), packages(), scripts(), identifiers(),
|
||||
all_info(), last_identifier_seen(), incomplete_type(), enum_mappings(), config(arg_config),
|
||||
bro_mtime()
|
||||
mtime()
|
||||
{
|
||||
if ( getenv("ZEEK_DISABLE_ZEEKYGEN") )
|
||||
disabled = true;
|
||||
|
||||
// If running Zeek without the "-X" option, then we don't need bro_mtime.
|
||||
// If running Zeek without the "-X" option, then we don't need mtime.
|
||||
if ( disabled || arg_config.empty() )
|
||||
return;
|
||||
|
||||
// Find the absolute or relative path to Zeek by checking each PATH
|
||||
// component and also the current directory (so that this works if
|
||||
// bro_command is a relative path).
|
||||
// command is a relative path).
|
||||
const char* env_path = getenv("PATH");
|
||||
string path = env_path ? string(env_path) + ":." : ".";
|
||||
string path_to_bro = util::find_file(bro_command, path);
|
||||
string path_to_zeek = util::find_file(command, path);
|
||||
struct stat s;
|
||||
|
||||
// One way that find_file() could fail is when Zeek is located in
|
||||
// a PATH component that starts with a tilde (such as "~/bin"). A simple
|
||||
// workaround is to just run Zeek with a relative or absolute path.
|
||||
if ( path_to_bro.empty() || stat(path_to_bro.c_str(), &s) < 0 )
|
||||
if ( path_to_zeek.empty() || stat(path_to_zeek.c_str(), &s) < 0 )
|
||||
reporter->InternalError("Zeekygen can't get mtime of zeek binary %s (try again by "
|
||||
"specifying the absolute or relative path to Zeek): %s",
|
||||
path_to_bro.c_str(), strerror(errno));
|
||||
path_to_zeek.c_str(), strerror(errno));
|
||||
|
||||
// Internal error will abort above in the case that stat isn't initialized
|
||||
// NOLINTNEXTLINE(clang-analyzer-core.uninitialized.Assign)
|
||||
bro_mtime = s.st_mtime;
|
||||
mtime = s.st_mtime;
|
||||
}
|
||||
|
||||
Manager::~Manager()
|
||||
|
|
|
@ -58,11 +58,11 @@ public:
|
|||
* Ctor.
|
||||
* @param config Path to a Zeekygen config file if documentation is to be
|
||||
* written to disk.
|
||||
* @param bro_command The command used to invoke the Zeek process.
|
||||
* @param command The command used to invoke the Zeek process.
|
||||
* It's used when checking for out-of-date targets. If the Zeek binary is
|
||||
* newer then a target, it needs to be rebuilt.
|
||||
*/
|
||||
Manager(const std::string& config, const std::string& bro_command);
|
||||
Manager(const std::string& config, const std::string& command);
|
||||
|
||||
/**
|
||||
* Dtor.
|
||||
|
@ -233,7 +233,7 @@ private:
|
|||
IdentifierInfo* incomplete_type;
|
||||
std::map<std::string, std::string> enum_mappings; // enum id -> enum type id
|
||||
Config config;
|
||||
time_t bro_mtime;
|
||||
time_t mtime;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
@ -251,7 +251,7 @@ bool Manager::IsUpToDate(const std::string& target_file, const std::vector<T*>&
|
|||
strerror(errno));
|
||||
}
|
||||
|
||||
if ( difftime(bro_mtime, s.st_mtime) > 0 )
|
||||
if ( difftime(mtime, s.st_mtime) > 0 )
|
||||
return false;
|
||||
|
||||
if ( difftime(config.GetModificationTime(), s.st_mtime) > 0 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue