mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Remove deprecated print_hook event
This commit is contained in:
parent
5343924eb9
commit
e9fefa6501
9 changed files with 15 additions and 81 deletions
3
NEWS
3
NEWS
|
@ -381,6 +381,7 @@ Removed Functionality
|
||||||
- ``rescan_state``
|
- ``rescan_state``
|
||||||
- ``log_file_name``
|
- ``log_file_name``
|
||||||
- ``open_log_file``
|
- ``open_log_file``
|
||||||
|
- ``disable_print_hook``
|
||||||
|
|
||||||
- The following events were deprecated in version 2.6 or below and are completely
|
- The following events were deprecated in version 2.6 or below and are completely
|
||||||
removed from this release:
|
removed from this release:
|
||||||
|
@ -409,6 +410,7 @@ Removed Functionality
|
||||||
- ``software_version_found``
|
- ``software_version_found``
|
||||||
- ``software_unparsed_version_found``
|
- ``software_unparsed_version_found``
|
||||||
- ``software_parse_error``
|
- ``software_parse_error``
|
||||||
|
- ``print_hook``
|
||||||
|
|
||||||
- The following types/records were deprecated in version 2.6 or below and are
|
- The following types/records were deprecated in version 2.6 or below and are
|
||||||
removed from this release:
|
removed from this release:
|
||||||
|
@ -437,6 +439,7 @@ Removed Functionality
|
||||||
- ``ssl_ca_certificate``
|
- ``ssl_ca_certificate``
|
||||||
- ``ssl_private_key``
|
- ``ssl_private_key``
|
||||||
- ``ssl_passphrase``
|
- ``ssl_passphrase``
|
||||||
|
- ``suppress_local_output``
|
||||||
|
|
||||||
- The following constants were used as part of deprecated functionality in version 2.6
|
- The following constants were used as part of deprecated functionality in version 2.6
|
||||||
or below and are removed from this release:
|
or below and are removed from this release:
|
||||||
|
|
|
@ -4723,9 +4723,6 @@ const time_machine_profiling = F &redef;
|
||||||
## If true, warns about unused event handlers at startup.
|
## If true, warns about unused event handlers at startup.
|
||||||
const check_for_unused_event_handlers = F &redef;
|
const check_for_unused_event_handlers = F &redef;
|
||||||
|
|
||||||
## Deprecated.
|
|
||||||
const suppress_local_output = F &redef;
|
|
||||||
|
|
||||||
## Holds the filename of the trace file given with ``-w`` (empty if none).
|
## Holds the filename of the trace file given with ``-w`` (empty if none).
|
||||||
##
|
##
|
||||||
## .. zeek:see:: record_all_packets
|
## .. zeek:see:: record_all_packets
|
||||||
|
|
|
@ -168,7 +168,6 @@ void BroFile::Init()
|
||||||
is_open = 0;
|
is_open = 0;
|
||||||
attrs = 0;
|
attrs = 0;
|
||||||
buffered = true;
|
buffered = true;
|
||||||
print_hook = true;
|
|
||||||
raw_output = false;
|
raw_output = false;
|
||||||
t = 0;
|
t = 0;
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,6 @@ public:
|
||||||
// Get the file with the given name, opening it if it doesn't yet exist.
|
// Get the file with the given name, opening it if it doesn't yet exist.
|
||||||
static BroFile* GetFile(const char* name);
|
static BroFile* GetFile(const char* name);
|
||||||
|
|
||||||
void DisablePrintHook() { print_hook = false; }
|
|
||||||
bool IsPrintHookEnabled() const { return print_hook; }
|
|
||||||
|
|
||||||
void EnableRawOutput() { raw_output = true; }
|
void EnableRawOutput() { raw_output = true; }
|
||||||
bool IsRawOutput() const { return raw_output; }
|
bool IsRawOutput() const { return raw_output; }
|
||||||
|
|
||||||
|
@ -98,7 +95,6 @@ protected:
|
||||||
Attributes* attrs;
|
Attributes* attrs;
|
||||||
bool buffered;
|
bool buffered;
|
||||||
double open_time;
|
double open_time;
|
||||||
bool print_hook;
|
|
||||||
bool raw_output;
|
bool raw_output;
|
||||||
|
|
||||||
static const int MIN_BUFFER_SIZE = 1024;
|
static const int MIN_BUFFER_SIZE = 1024;
|
||||||
|
|
48
src/Stmt.cc
48
src/Stmt.cc
|
@ -203,49 +203,25 @@ Val* PrintStmt::DoExec(val_list* vals, stmt_flow_type& /* flow */) const
|
||||||
++offset;
|
++offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ph = print_hook && f->IsPrintHookEnabled();
|
|
||||||
|
|
||||||
desc_style style = f->IsRawOutput() ? RAW_STYLE : STANDARD_STYLE;
|
desc_style style = f->IsRawOutput() ? RAW_STYLE : STANDARD_STYLE;
|
||||||
|
|
||||||
if ( ! (suppress_local_output && ph) )
|
if ( f->IsRawOutput() )
|
||||||
{
|
|
||||||
if ( f->IsRawOutput() )
|
|
||||||
{
|
|
||||||
ODesc d(DESC_READABLE);
|
|
||||||
d.SetFlush(0);
|
|
||||||
d.SetStyle(style);
|
|
||||||
|
|
||||||
PrintVals(&d, vals, offset);
|
|
||||||
f->Write(d.Description(), d.Len());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ODesc d(DESC_READABLE, f);
|
|
||||||
d.SetFlush(0);
|
|
||||||
d.SetStyle(style);
|
|
||||||
|
|
||||||
PrintVals(&d, vals, offset);
|
|
||||||
f->Write("\n", 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ph )
|
|
||||||
{
|
{
|
||||||
ODesc d(DESC_READABLE);
|
ODesc d(DESC_READABLE);
|
||||||
|
d.SetFlush(0);
|
||||||
d.SetStyle(style);
|
d.SetStyle(style);
|
||||||
|
|
||||||
PrintVals(&d, vals, offset);
|
PrintVals(&d, vals, offset);
|
||||||
|
f->Write(d.Description(), d.Len());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ODesc d(DESC_READABLE, f);
|
||||||
|
d.SetFlush(0);
|
||||||
|
d.SetStyle(style);
|
||||||
|
|
||||||
if ( print_hook )
|
PrintVals(&d, vals, offset);
|
||||||
{
|
f->Write("\n", 1);
|
||||||
::Ref(f);
|
|
||||||
|
|
||||||
// Note, this doesn't do remote printing.
|
|
||||||
mgr.Dispatch(
|
|
||||||
new Event(
|
|
||||||
print_hook,
|
|
||||||
{new Val(f), new StringVal(d.Len(), d.Description())}),
|
|
||||||
true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -813,6 +813,3 @@ event gaobot_signature_found%(c: connection%);
|
||||||
|
|
||||||
## Shows an IP address anonymization mapping.
|
## Shows an IP address anonymization mapping.
|
||||||
event anonymization_mapping%(orig: addr, mapped: addr%);
|
event anonymization_mapping%(orig: addr, mapped: addr%);
|
||||||
|
|
||||||
## Deprecated. Will be removed.
|
|
||||||
event print_hook%(f:file, s: string%);
|
|
||||||
|
|
18
src/zeek.bif
18
src/zeek.bif
|
@ -4723,28 +4723,10 @@ function file_size%(f: string%) : double
|
||||||
return new Val(double(s.st_size), TYPE_DOUBLE);
|
return new Val(double(s.st_size), TYPE_DOUBLE);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
## Disables sending :zeek:id:`print_hook` events to remote peers for a given
|
|
||||||
## file. In a
|
|
||||||
## distributed setup, communicating Zeek instances generate the event
|
|
||||||
## :zeek:id:`print_hook` for each print statement and send it to the remote
|
|
||||||
## side. When disabled for a particular file, these events will not be
|
|
||||||
## propagated to other peers.
|
|
||||||
##
|
|
||||||
## f: The file to disable :zeek:id:`print_hook` events for.
|
|
||||||
##
|
|
||||||
## .. zeek:see:: enable_raw_output
|
|
||||||
function disable_print_hook%(f: file%): any
|
|
||||||
%{
|
|
||||||
f->DisablePrintHook();
|
|
||||||
return 0;
|
|
||||||
%}
|
|
||||||
|
|
||||||
## Prevents escaping of non-ASCII characters when writing to a file.
|
## Prevents escaping of non-ASCII characters when writing to a file.
|
||||||
## This function is equivalent to :zeek:attr:`&raw_output`.
|
## This function is equivalent to :zeek:attr:`&raw_output`.
|
||||||
##
|
##
|
||||||
## f: The file to disable raw output for.
|
## f: The file to disable raw output for.
|
||||||
##
|
|
||||||
## .. zeek:see:: disable_print_hook
|
|
||||||
function enable_raw_output%(f: file%): any
|
function enable_raw_output%(f: file%): any
|
||||||
%{
|
%{
|
||||||
f->EnableRawOutput();
|
f->EnableRawOutput();
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
# @TEST-EXEC: zeek -b %INPUT
|
# @TEST-EXEC: zeek -b %INPUT
|
||||||
# @TEST-EXEC: tr '\000' 'X' <myfile >output
|
# @TEST-EXEC: tr '\000' 'X' <myfile >output
|
||||||
# @TEST-EXEC: btest-diff output
|
# @TEST-EXEC: btest-diff output
|
||||||
# @TEST-EXEC: cmp myfile hookfile
|
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
|
@ -14,10 +13,3 @@ event zeek_init()
|
||||||
print myfile, "hello\x00world", "hi";
|
print myfile, "hello\x00world", "hi";
|
||||||
close(myfile);
|
close(myfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
event print_hook(f: file, s: string)
|
|
||||||
{
|
|
||||||
local hookfile = open("hookfile");
|
|
||||||
write_file(hookfile, s);
|
|
||||||
close(hookfile);
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
# @TEST-EXEC: zeek -b %INPUT
|
# @TEST-EXEC: zeek -b %INPUT
|
||||||
# @TEST-EXEC: tr '\000' 'X' <myfile >output
|
# @TEST-EXEC: tr '\000' 'X' <myfile >output
|
||||||
# @TEST-EXEC: btest-diff output
|
# @TEST-EXEC: btest-diff output
|
||||||
# @TEST-EXEC: cmp myfile hookfile
|
|
||||||
|
|
||||||
# first check local variable of file type w/ &raw_output
|
# first check local variable of file type w/ &raw_output
|
||||||
|
|
||||||
|
@ -16,10 +15,3 @@ event zeek_init()
|
||||||
print myfile, "hello\x00world", "hi";
|
print myfile, "hello\x00world", "hi";
|
||||||
close(myfile);
|
close(myfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
event print_hook(f: file, s: string)
|
|
||||||
{
|
|
||||||
local hookfile = open("hookfile");
|
|
||||||
write_file(hookfile, s);
|
|
||||||
close(hookfile);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue