zeek/src/input.bif
2011-11-22 16:09:13 -08:00

64 lines
1.7 KiB
Text

# functions and types for the input framework
module Input;
%%{
#include "InputMgr.h"
#include "NetVar.h"
%%}
type StreamDescription: record;
type TableFilter: record;
type EventFilter: record;
function Input::__create_stream%(id: Log::ID, description: Input::StreamDescription%) : bool
%{
InputReader *the_reader = input_mgr->CreateStream(id->AsEnumVal(), description->AsRecordVal());
return new Val( the_reader != 0, TYPE_BOOL );
%}
function Input::__remove_stream%(id: Log::ID%) : bool
%{
bool res = input_mgr->RemoveStream(id->AsEnumVal());
return new Val( res, TYPE_BOOL );
%}
function Input::__force_update%(id: Log::ID%) : bool
%{
bool res = input_mgr->ForceUpdate(id->AsEnumVal());
return new Val( res, TYPE_BOOL );
%}
function Input::__add_tablefilter%(id: Log::ID, filter: Input::TableFilter%) : bool
%{
bool res = input_mgr->AddTableFilter(id->AsEnumVal(), filter->AsRecordVal());
return new Val( res, TYPE_BOOL );
%}
function Input::__remove_tablefilter%(id: Log::ID, name: string%) : bool
%{
bool res = input_mgr->RemoveTableFilter(id->AsEnumVal(), name->AsString()->CheckString());
return new Val( res, TYPE_BOOL);
%}
function Input::__add_eventfilter%(id: Log::ID, filter: Input::EventFilter%) : bool
%{
bool res = input_mgr->AddEventFilter(id->AsEnumVal(), filter->AsRecordVal());
return new Val( res, TYPE_BOOL );
%}
function Input::__remove_eventfilter%(id: Log::ID, name: string%) : bool
%{
bool res = input_mgr->RemoveEventFilter(id->AsEnumVal(), name->AsString()->CheckString());
return new Val( res, TYPE_BOOL);
%}
# Options for Ascii Reader
module InputAscii;
const separator: string;
const set_separator: string;
const empty_field: string;
const unset_field: string;