Merge remote branch 'origin/master' into topic/bernhard/input-update

This commit is contained in:
Bernhard Amann 2013-05-27 20:32:50 -07:00
commit 3719524a6a
423 changed files with 240373 additions and 161770 deletions

View file

@ -8,6 +8,8 @@
#include "readers/Ascii.h"
#include "readers/Raw.h"
#include "readers/Benchmark.h"
#include "readers/Binary.h"
#include "readers/SQLite.h"
#include "Event.h"
#include "EventHandler.h"
@ -34,6 +36,8 @@ ReaderDefinition input_readers[] = {
{ BifEnum::Input::READER_ASCII, "Ascii", 0, reader::Ascii::Instantiate },
{ BifEnum::Input::READER_RAW, "Raw", 0, reader::Raw::Instantiate },
{ BifEnum::Input::READER_BENCHMARK, "Benchmark", 0, reader::Benchmark::Instantiate },
{ BifEnum::Input::READER_BINARY, "Binary", 0, reader::Binary::Instantiate },
{ BifEnum::Input::READER_SQLITE, "SQLite", 0, reader::SQLite::Instantiate },
// End marker
{ BifEnum::Input::READER_DEFAULT, "None", 0, (ReaderBackend* (*)(ReaderFrontend* frontend))0 }
@ -744,6 +748,8 @@ bool Manager::RemoveStream(Stream *i)
DBG_LOG(DBG_INPUT, "Successfully queued removal of stream %s",
i->name.c_str());
i->reader->Stop();
return true;
}
@ -2122,19 +2128,25 @@ Val* Manager::ValueToVal(const Value* val, BroType* request_type)
}
case TYPE_ENUM: {
// well, this is kind of stupid, because EnumType just mangles the module name and the var name together again...
// but well
string module = extract_module_name(val->val.string_val.data);
string var = extract_var_name(val->val.string_val.data);
// Convert to string first to not have to deal with missing
// \0's...
string module_string(val->val.string_val.data, val->val.string_val.length);
string var_string(val->val.string_val.data, val->val.string_val.length);
string module = extract_module_name(module_string.c_str());
string var = extract_var_name(var_string.c_str());
// Well, this is kind of stupid, because EnumType just
// mangles the module name and the var name together again...
// but well.
bro_int_t index = request_type->AsEnumType()->Lookup(module, var.c_str());
if ( index == -1 )
reporter->InternalError("Value not found in enum mappimg. Module: %s, var: %s",
module.c_str(), var.c_str());
reporter->InternalError("Value not found in enum mappimg. Module: %s, var: %s, var size: %zu",
module.c_str(), var.c_str(), var.size());
return new EnumVal(index, request_type->Ref()->AsEnumType() );
return new EnumVal(index, request_type->Ref()->AsEnumType());
}
default:
reporter->InternalError("unsupported type for input_read");
}