Merge remote-tracking branch 'origin/master' into topic/johanna/config

This commit is contained in:
Johanna Amann 2018-01-29 14:25:38 -08:00
commit ac9fd000e0
144 changed files with 2768 additions and 2088 deletions

View file

@ -135,6 +135,20 @@ export {
## The default per-file reassembly buffer size.
const reassembly_buffer_size = 524288 &redef;
## Lookup to see if a particular file id exists and is still valid.
##
## fuid: the file id.
##
## Returns: T if the file uid is known.
global file_exists: function(fuid: string): bool;
## Lookup an :bro:see:`fa_file` record with the file id.
##
## fuid: the file id.
##
## Returns: the associated :bro:see:`fa_file` record.
global lookup_file: function(fuid: string): fa_file;
## Allows the file reassembler to be used if it's necessary because the
## file is transferred out of order.
##
@ -338,6 +352,16 @@ function set_info(f: fa_file)
f$info$is_orig = f$is_orig;
}
function file_exists(fuid: string): bool
{
return __file_exists(fuid);
}
function lookup_file(fuid: string): fa_file
{
return __lookup_file(fuid);
}
function set_timeout_interval(f: fa_file, t: interval): bool
{
return __set_timeout_interval(f$id, t);

View file

@ -300,7 +300,7 @@ export {
## the correct type.
##
## .. bro:see:: Log::remove_filter Log::add_default_filter
## Log::remove_default_filter
## Log::remove_default_filter Log::get_filter Log::get_filter_names
global add_filter: function(id: ID, filter: Filter) : bool;
## Removes a filter from an existing logging stream.
@ -315,9 +315,21 @@ export {
## if no filter associated with *name* was found.
##
## .. bro:see:: Log::remove_filter Log::add_default_filter
## Log::remove_default_filter
## Log::remove_default_filter Log::get_filter Log::get_filter_names
global remove_filter: function(id: ID, name: string) : bool;
## Gets the names of all filters associated with an existing
## logging stream.
##
## id: The ID of a logging stream from which to obtain the list
## of filter names.
##
## Returns: The set of filter names associated with the stream.
##
## ..bro:see:: Log::remove_filter Log::add_default_filter
## Log::remove_default_filter Log::get_filter
global get_filter_names: function(id: ID) : set[string];
## Gets a filter associated with an existing logging stream.
##
## id: The ID associated with a logging stream from which to
@ -331,7 +343,7 @@ export {
## :bro:id:`Log::no_filter` sentinel value.
##
## .. bro:see:: Log::add_filter Log::remove_filter Log::add_default_filter
## Log::remove_default_filter
## Log::remove_default_filter Log::get_filter_names
global get_filter: function(id: ID, name: string) : Filter;
## Writes a new log line/entry to a logging stream.
@ -432,6 +444,8 @@ export {
global all_streams: table[ID] of Stream = table();
global stream_filters: table[ID] of set[string] = table();
# We keep a script-level copy of all filters so that we can manipulate them.
global filters: table[ID, string] of Filter;
@ -525,16 +539,41 @@ function remove_stream(id: ID) : bool
{
delete active_streams[id];
delete all_streams[id];
if ( id in stream_filters )
{
for ( i in stream_filters[id] )
delete filters[id, i];
delete stream_filters[id];
}
return __remove_stream(id);
}
function disable_stream(id: ID) : bool
{
delete active_streams[id];
return __disable_stream(id);
}
function enable_stream(id: ID) : bool
{
if ( ! __enable_stream(id) )
return F;
if ( id in all_streams )
active_streams[id] = all_streams[id];
}
# convenience function to add a filter name to stream_filters
function add_stream_filters(id: ID, name: string)
{
if ( id in stream_filters )
add stream_filters[id][name];
else
stream_filters[id] = set(name);
}
function add_filter(id: ID, filter: Filter) : bool
{
local stream = all_streams[id];
@ -545,13 +584,22 @@ function add_filter(id: ID, filter: Filter) : bool
if ( ! filter?$path && ! filter?$path_func )
filter$path_func = default_path_func;
filters[id, filter$name] = filter;
return __add_filter(id, filter);
local res = __add_filter(id, filter);
if ( res )
{
add_stream_filters(id, filter$name);
filters[id, filter$name] = filter;
}
return res;
}
function remove_filter(id: ID, name: string) : bool
{
if ( id in stream_filters )
delete stream_filters[id][name];
delete filters[id, name];
return __remove_filter(id, name);
}
@ -563,6 +611,14 @@ function get_filter(id: ID, name: string) : Filter
return no_filter;
}
function get_filter_names(id: ID) : set[string]
{
if ( id in stream_filters )
return stream_filters[id];
else
return set();
}
function write(id: ID, columns: any) : bool
{
return __write(id, columns);