mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
give EventDescripion field back to events
This commit is contained in:
parent
367c4b4a7e
commit
842f635695
2 changed files with 21 additions and 7 deletions
|
@ -41,11 +41,14 @@ public:
|
||||||
EnumVal* type;
|
EnumVal* type;
|
||||||
ReaderFrontend* reader;
|
ReaderFrontend* reader;
|
||||||
|
|
||||||
|
RecordVal* description;
|
||||||
|
|
||||||
virtual ~Filter();
|
virtual ~Filter();
|
||||||
};
|
};
|
||||||
|
|
||||||
Manager::Filter::~Filter() {
|
Manager::Filter::~Filter() {
|
||||||
Unref(type);
|
Unref(type);
|
||||||
|
Unref(description);
|
||||||
|
|
||||||
delete(reader);
|
delete(reader);
|
||||||
}
|
}
|
||||||
|
@ -219,6 +222,8 @@ bool Manager::CreateStream(Filter* info, RecordVal* description)
|
||||||
info->type = reader->AsEnumVal(); // ref'd by lookupwithdefault
|
info->type = reader->AsEnumVal(); // ref'd by lookupwithdefault
|
||||||
info->name = name;
|
info->name = name;
|
||||||
info->source = source;
|
info->source = source;
|
||||||
|
Ref(description);
|
||||||
|
info->description = description;
|
||||||
|
|
||||||
DBG_LOG(DBG_INPUT, "Successfully created new input stream %s",
|
DBG_LOG(DBG_INPUT, "Successfully created new input stream %s",
|
||||||
name.c_str());
|
name.c_str());
|
||||||
|
@ -275,26 +280,32 @@ bool Manager::CreateEventStream(RecordVal* fval) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! same_type((*args)[1], BifType::Record::Input::EventDescription, 0) )
|
||||||
|
{
|
||||||
|
reporter->Error("events second attribute must be of type Input::EventDescription");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ( want_record->InternalInt() == 0 ) {
|
if ( want_record->InternalInt() == 0 ) {
|
||||||
if ( args->length() != fields->NumFields() + 1 ) {
|
if ( args->length() != fields->NumFields() + 2 ) {
|
||||||
reporter->Error("events has wrong number of arguments");
|
reporter->Error("event has wrong number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( int i = 0; i < fields->NumFields(); i++ ) {
|
for ( int i = 0; i < fields->NumFields(); i++ ) {
|
||||||
if ( !same_type((*args)[i+1], fields->FieldType(i) ) ) {
|
if ( !same_type((*args)[i+2], fields->FieldType(i) ) ) {
|
||||||
reporter->Error("Incompatible type for event");
|
reporter->Error("Incompatible type for event");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ( want_record->InternalInt() == 1 ) {
|
} else if ( want_record->InternalInt() == 1 ) {
|
||||||
if ( args->length() != 2 ) {
|
if ( args->length() != 3 ) {
|
||||||
reporter->Error("events has wrong number of arguments");
|
reporter->Error("event has wrong number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !same_type((*args)[1], fields ) ) {
|
if ( !same_type((*args)[2], fields ) ) {
|
||||||
reporter->Error("Incompatible type for event");
|
reporter->Error("Incompatible type for event");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -965,6 +976,8 @@ int Manager::SendEventFilterEvent(Filter* i, EnumVal* type, const Value* const *
|
||||||
// no tracking, send everything with a new event...
|
// no tracking, send everything with a new event...
|
||||||
//out_vals.push_back(new EnumVal(BifEnum::Input::EVENT_NEW, BifType::Enum::Input::Event));
|
//out_vals.push_back(new EnumVal(BifEnum::Input::EVENT_NEW, BifType::Enum::Input::Event));
|
||||||
out_vals.push_back(type);
|
out_vals.push_back(type);
|
||||||
|
Ref(filter->description);
|
||||||
|
out_vals.push_back(filter->description);
|
||||||
|
|
||||||
int position = 0;
|
int position = 0;
|
||||||
if ( filter->want_record ) {
|
if ( filter->want_record ) {
|
||||||
|
|
|
@ -20,7 +20,8 @@ type Val: record {
|
||||||
s: string;
|
s: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
event line(tpe: Input::Event, s: string) {
|
event line(tpe: Input::Event, description: Input::EventDescription, s: string) {
|
||||||
|
print description;
|
||||||
print s;
|
print s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue