mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
rename filter to tablefilter in preparation of event filters...
This commit is contained in:
parent
f0e5303330
commit
18591b53d4
8 changed files with 33 additions and 33 deletions
|
@ -9,7 +9,7 @@ export {
|
||||||
reader: Reader &default=default_reader;
|
reader: Reader &default=default_reader;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Filter: record {
|
type TableFilter: record {
|
||||||
## descriptive name. for later removal
|
## descriptive name. for later removal
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
@ -29,14 +29,14 @@ export {
|
||||||
# ev_description: any &optional;
|
# ev_description: any &optional;
|
||||||
};
|
};
|
||||||
|
|
||||||
const no_filter: Filter = [$name="<not found>", $idx="", $val="", $destination=""]; # Sentinel.
|
#const no_filter: Filter = [$name="<not found>", $idx="", $val="", $destination=""]; # Sentinel.
|
||||||
|
|
||||||
global create_stream: function(id: Log::ID, description: Input::StreamDescription) : bool;
|
global create_stream: function(id: Log::ID, description: Input::StreamDescription) : bool;
|
||||||
global remove_stream: function(id: Log::ID) : bool;
|
global remove_stream: function(id: Log::ID) : bool;
|
||||||
global force_update: function(id: Log::ID) : bool;
|
global force_update: function(id: Log::ID) : bool;
|
||||||
global add_filter: function(id: Log::ID, filter: Input::Filter) : bool;
|
global add_tablefilter: function(id: Log::ID, filter: Input::TableFilter) : bool;
|
||||||
global remove_filter: function(id: Log::ID, name: string) : bool;
|
global remove_tablefilter: function(id: Log::ID, name: string) : bool;
|
||||||
global get_filter: function(id: ID, name: string) : Filter;
|
#global get_filter: function(id: ID, name: string) : Filter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ export {
|
||||||
|
|
||||||
module Input;
|
module Input;
|
||||||
|
|
||||||
global filters: table[ID, string] of Filter;
|
#global filters: table[ID, string] of Filter;
|
||||||
|
|
||||||
function create_stream(id: Log::ID, description: Input::StreamDescription) : bool
|
function create_stream(id: Log::ID, description: Input::StreamDescription) : bool
|
||||||
{
|
{
|
||||||
|
@ -62,22 +62,22 @@ function force_update(id: Log::ID) : bool
|
||||||
return __force_update(id);
|
return __force_update(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_filter(id: Log::ID, filter: Input::Filter) : bool
|
function add_tablefilter(id: Log::ID, filter: Input::TableFilter) : bool
|
||||||
{
|
{
|
||||||
filters[id, filter$name] = filter;
|
# filters[id, filter$name] = filter;
|
||||||
return __add_filter(id, filter);
|
return __add_tablefilter(id, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_filter(id: Log::ID, name: string) : bool
|
function remove_tablefilter(id: Log::ID, name: string) : bool
|
||||||
{
|
{
|
||||||
delete filters[id, name];
|
# delete filters[id, name];
|
||||||
return __remove_filter(id, name);
|
return __remove_tablefilter(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_filter(id: ID, name: string) : Filter
|
#function get_filter(id: ID, name: string) : Filter
|
||||||
{
|
# {
|
||||||
if ( [id, name] in filters )
|
# if ( [id, name] in filters )
|
||||||
return filters[id, name];
|
# return filters[id, name];
|
||||||
|
#
|
||||||
return no_filter;
|
# return no_filter;
|
||||||
}
|
# }
|
||||||
|
|
|
@ -237,7 +237,7 @@ InputReader* InputMgr::CreateStream(EnumVal* id, RecordVal* description)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputMgr::AddFilter(EnumVal *id, RecordVal* fval) {
|
bool InputMgr::AddTableFilter(EnumVal *id, RecordVal* fval) {
|
||||||
ReaderInfo *i = FindReader(id);
|
ReaderInfo *i = FindReader(id);
|
||||||
if ( i == 0 ) {
|
if ( i == 0 ) {
|
||||||
reporter->Error("Stream not found");
|
reporter->Error("Stream not found");
|
||||||
|
@ -245,7 +245,7 @@ bool InputMgr::AddFilter(EnumVal *id, RecordVal* fval) {
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordType* rtype = fval->Type()->AsRecordType();
|
RecordType* rtype = fval->Type()->AsRecordType();
|
||||||
if ( ! same_type(rtype, BifType::Record::Input::Filter, 0) )
|
if ( ! same_type(rtype, BifType::Record::Input::TableFilter, 0) )
|
||||||
{
|
{
|
||||||
reporter->Error("filter argument not of right type");
|
reporter->Error("filter argument not of right type");
|
||||||
return false;
|
return false;
|
||||||
|
@ -426,7 +426,7 @@ bool InputMgr::ForceUpdate(const EnumVal* id)
|
||||||
return i->reader->Update();
|
return i->reader->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputMgr::RemoveFilter(EnumVal* id, const string &name) {
|
bool InputMgr::RemoveTableFilter(EnumVal* id, const string &name) {
|
||||||
ReaderInfo *i = FindReader(id);
|
ReaderInfo *i = FindReader(id);
|
||||||
if ( i == 0 ) {
|
if ( i == 0 ) {
|
||||||
reporter->Error("Reader not found");
|
reporter->Error("Reader not found");
|
||||||
|
|
|
@ -24,8 +24,8 @@ public:
|
||||||
bool ForceUpdate(const EnumVal* id);
|
bool ForceUpdate(const EnumVal* id);
|
||||||
bool RemoveStream(const EnumVal* id);
|
bool RemoveStream(const EnumVal* id);
|
||||||
|
|
||||||
bool AddFilter(EnumVal *id, RecordVal* filter);
|
bool AddTableFilter(EnumVal *id, RecordVal* filter);
|
||||||
bool RemoveFilter(EnumVal* id, const string &name);
|
bool RemoveTableFilter(EnumVal* id, const string &name);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Input;
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
type StreamDescription: record;
|
type StreamDescription: record;
|
||||||
type Filter: record;
|
type TableFilter: record;
|
||||||
|
|
||||||
function Input::__create_stream%(id: Log::ID, description: Input::StreamDescription%) : bool
|
function Input::__create_stream%(id: Log::ID, description: Input::StreamDescription%) : bool
|
||||||
%{
|
%{
|
||||||
|
@ -28,15 +28,15 @@ function Input::__force_update%(id: Log::ID%) : bool
|
||||||
return new Val( res, TYPE_BOOL );
|
return new Val( res, TYPE_BOOL );
|
||||||
%}
|
%}
|
||||||
|
|
||||||
function Input::__add_filter%(id: Log::ID, filter: Input::Filter%) : bool
|
function Input::__add_tablefilter%(id: Log::ID, filter: Input::TableFilter%) : bool
|
||||||
%{
|
%{
|
||||||
bool res = input_mgr->AddFilter(id->AsEnumVal(), filter->AsRecordVal());
|
bool res = input_mgr->AddTableFilter(id->AsEnumVal(), filter->AsRecordVal());
|
||||||
return new Val( res, TYPE_BOOL );
|
return new Val( res, TYPE_BOOL );
|
||||||
%}
|
%}
|
||||||
|
|
||||||
function Input::__remove_filter%(id: Log::ID, name: string%) : bool
|
function Input::__remove_tablefilter%(id: Log::ID, name: string%) : bool
|
||||||
%{
|
%{
|
||||||
bool res = input_mgr->RemoveFilter(id->AsEnumVal(), name->AsString()->CheckString());
|
bool res = input_mgr->RemoveTableFilter(id->AsEnumVal(), name->AsString()->CheckString());
|
||||||
return new Val( res, TYPE_BOOL);
|
return new Val( res, TYPE_BOOL);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ TestDirs = doc bifs language core scripts istate coverage
|
||||||
TmpDir = %(testbase)s/.tmp
|
TmpDir = %(testbase)s/.tmp
|
||||||
BaselineDir = %(testbase)s/Baseline
|
BaselineDir = %(testbase)s/Baseline
|
||||||
IgnoreDirs = .svn CVS .tmp
|
IgnoreDirs = .svn CVS .tmp
|
||||||
IgnoreFiles = *.tmp *.swp #* *.trace
|
IgnoreFiles = *.tmp *.swp #* *.trace .DS_Store
|
||||||
|
|
||||||
[environment]
|
[environment]
|
||||||
BROPATH=`bash -c %(testbase)s/../../build/bro-path-dev`
|
BROPATH=`bash -c %(testbase)s/../../build/bro-path-dev`
|
||||||
|
|
|
@ -46,7 +46,7 @@ event bro_init()
|
||||||
{
|
{
|
||||||
# first read in the old stuff into the table...
|
# first read in the old stuff into the table...
|
||||||
Input::create_stream(A::LOG, [$source="input.log"]);
|
Input::create_stream(A::LOG, [$source="input.log"]);
|
||||||
Input::add_filter(A::LOG, [$name="ssh", $idx=idx, $val=val, $destination=servers]);
|
Input::add_tablefilter(A::LOG, [$name="ssh", $idx=idx, $val=val, $destination=servers]);
|
||||||
Input::force_update(A::LOG);
|
Input::force_update(A::LOG);
|
||||||
print servers;
|
print servers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ event bro_init()
|
||||||
{
|
{
|
||||||
# first read in the old stuff into the table...
|
# first read in the old stuff into the table...
|
||||||
Input::create_stream(A::LOG, [$source="input.log"]);
|
Input::create_stream(A::LOG, [$source="input.log"]);
|
||||||
Input::add_filter(A::LOG, [$name="input", $idx=idx, $val=val, $destination=servers, $want_record=F]);
|
Input::add_tablefilter(A::LOG, [$name="input", $idx=idx, $val=val, $destination=servers, $want_record=F]);
|
||||||
Input::force_update(A::LOG);
|
Input::force_update(A::LOG);
|
||||||
print servers;
|
print servers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ event bro_init()
|
||||||
{
|
{
|
||||||
# first read in the old stuff into the table...
|
# first read in the old stuff into the table...
|
||||||
Input::create_stream(A::LOG, [$source="input.log"]);
|
Input::create_stream(A::LOG, [$source="input.log"]);
|
||||||
Input::add_filter(A::LOG, [$name="input", $idx=idx, $val=val, $destination=servers]);
|
Input::add_tablefilter(A::LOG, [$name="input", $idx=idx, $val=val, $destination=servers]);
|
||||||
Input::force_update(A::LOG);
|
Input::force_update(A::LOG);
|
||||||
print servers;
|
print servers;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue