mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Add bare_mode
bif.
This commit is contained in:
parent
0f1dd8ef1b
commit
e83c4c834d
6 changed files with 30 additions and 0 deletions
|
@ -63,6 +63,7 @@ double current_wallclock = 0.0;
|
||||||
double current_pseudo = 0.0;
|
double current_pseudo = 0.0;
|
||||||
bool zeek_init_done = false;
|
bool zeek_init_done = false;
|
||||||
bool time_updated = false;
|
bool time_updated = false;
|
||||||
|
bool bare_mode = false;
|
||||||
|
|
||||||
RETSIGTYPE watchdog(int /* signo */)
|
RETSIGTYPE watchdog(int /* signo */)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,8 @@ extern double current_pseudo;
|
||||||
|
|
||||||
extern bool zeek_init_done;
|
extern bool zeek_init_done;
|
||||||
|
|
||||||
|
extern bool bare_mode; // True if Zeek was started in bare mode.
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
// Functions to temporarily suspend processing of live input (network packets
|
// Functions to temporarily suspend processing of live input (network packets
|
||||||
|
|
|
@ -516,6 +516,8 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
||||||
|
|
||||||
auto options = zopts ? *zopts : parse_cmdline(argc, argv);
|
auto options = zopts ? *zopts : parse_cmdline(argc, argv);
|
||||||
|
|
||||||
|
run_state::detail::bare_mode = options.bare_mode;
|
||||||
|
|
||||||
// Set up the global that facilitates access to analysis/optimization
|
// Set up the global that facilitates access to analysis/optimization
|
||||||
// options from deep within some modules.
|
// options from deep within some modules.
|
||||||
analysis_options = options.analysis_options;
|
analysis_options = options.analysis_options;
|
||||||
|
|
14
src/zeek.bif
14
src/zeek.bif
|
@ -1748,6 +1748,20 @@ function zeek_version%(%): string
|
||||||
return zeek::make_intrusive<zeek::StringVal>(zeek::zeek_version());
|
return zeek::make_intrusive<zeek::StringVal>(zeek::zeek_version());
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%%{
|
||||||
|
namespace zeek::run_state::detail {
|
||||||
|
extern bool bare_mode;
|
||||||
|
} // namespace zeek::run_state::detail
|
||||||
|
%%}
|
||||||
|
|
||||||
|
## Returns whether Zeek was started in bare mode.
|
||||||
|
##
|
||||||
|
## Returns: True if Zeek was started in bare mode, false otherwise.
|
||||||
|
function bare_mode%(%): bool
|
||||||
|
%{
|
||||||
|
return zeek::val_mgr->Bool(zeek::run_state::detail::bare_mode);
|
||||||
|
%}
|
||||||
|
|
||||||
## Converts a record type name to a vector of strings, where each element is
|
## Converts a record type name to a vector of strings, where each element is
|
||||||
## the name of a record field. Nested records are flattened.
|
## the name of a record field. Nested records are flattened.
|
||||||
##
|
##
|
||||||
|
|
3
testing/btest/Baseline/bifs.bare_mode/output
Normal file
3
testing/btest/Baseline/bifs.bare_mode/output
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
F
|
||||||
|
T
|
8
testing/btest/bifs/bare_mode.zeek
Normal file
8
testing/btest/bifs/bare_mode.zeek
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# @TEST-EXEC: zeek %INPUT >>output
|
||||||
|
# @TEST-EXEC: zeek -b %INPUT >>output
|
||||||
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
|
event zeek_init()
|
||||||
|
{
|
||||||
|
print bare_mode();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue