mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 13:08:20 +00:00
Plugins: Clean up explicit uses of namespaces in places where they're not necessary.
This commit covers all of the plugin classes.
This commit is contained in:
parent
fe0c22c789
commit
70c2397f69
169 changed files with 3139 additions and 3141 deletions
|
@ -17,27 +17,27 @@ using zeek::threading::Field;
|
|||
|
||||
namespace zeek::logging::writer::detail {
|
||||
|
||||
SQLite::SQLite(zeek::logging::WriterFrontend* frontend)
|
||||
: zeek::logging::WriterBackend(frontend),
|
||||
SQLite::SQLite(WriterFrontend* frontend)
|
||||
: WriterBackend(frontend),
|
||||
fields(), num_fields(), db(), st()
|
||||
{
|
||||
set_separator.assign(
|
||||
(const char*) zeek::BifConst::LogSQLite::set_separator->Bytes(),
|
||||
zeek::BifConst::LogSQLite::set_separator->Len()
|
||||
(const char*) BifConst::LogSQLite::set_separator->Bytes(),
|
||||
BifConst::LogSQLite::set_separator->Len()
|
||||
);
|
||||
|
||||
unset_field.assign(
|
||||
(const char*) zeek::BifConst::LogSQLite::unset_field->Bytes(),
|
||||
zeek::BifConst::LogSQLite::unset_field->Len()
|
||||
(const char*) BifConst::LogSQLite::unset_field->Bytes(),
|
||||
BifConst::LogSQLite::unset_field->Len()
|
||||
);
|
||||
|
||||
empty_field.assign(
|
||||
(const char*) zeek::BifConst::LogSQLite::empty_field->Bytes(),
|
||||
zeek::BifConst::LogSQLite::empty_field->Len()
|
||||
(const char*) BifConst::LogSQLite::empty_field->Bytes(),
|
||||
BifConst::LogSQLite::empty_field->Len()
|
||||
);
|
||||
|
||||
zeek::threading::formatter::Ascii::SeparatorInfo sep_info(string(), set_separator, unset_field, empty_field);
|
||||
io = new zeek::threading::formatter::Ascii(this, sep_info);
|
||||
threading::formatter::Ascii::SeparatorInfo sep_info(string(), set_separator, unset_field, empty_field);
|
||||
io = new threading::formatter::Ascii(this, sep_info);
|
||||
}
|
||||
|
||||
SQLite::~SQLite()
|
||||
|
@ -58,36 +58,36 @@ string SQLite::GetTableType(int arg_type, int arg_subtype) {
|
|||
string type;
|
||||
|
||||
switch ( arg_type ) {
|
||||
case zeek::TYPE_BOOL:
|
||||
case TYPE_BOOL:
|
||||
type = "boolean";
|
||||
break;
|
||||
|
||||
case zeek::TYPE_INT:
|
||||
case zeek::TYPE_COUNT:
|
||||
case zeek::TYPE_PORT: // note that we do not save the protocol at the moment. Just like in the case of the ascii-writer
|
||||
case TYPE_INT:
|
||||
case TYPE_COUNT:
|
||||
case TYPE_PORT: // note that we do not save the protocol at the moment. Just like in the case of the ascii-writer
|
||||
type = "integer";
|
||||
break;
|
||||
|
||||
case zeek::TYPE_SUBNET:
|
||||
case zeek::TYPE_ADDR:
|
||||
case TYPE_SUBNET:
|
||||
case TYPE_ADDR:
|
||||
type = "text"; // sqlite3 does not have a type for internet addresses
|
||||
break;
|
||||
|
||||
case zeek::TYPE_TIME:
|
||||
case zeek::TYPE_INTERVAL:
|
||||
case zeek::TYPE_DOUBLE:
|
||||
case TYPE_TIME:
|
||||
case TYPE_INTERVAL:
|
||||
case TYPE_DOUBLE:
|
||||
type = "double precision";
|
||||
break;
|
||||
|
||||
case zeek::TYPE_ENUM:
|
||||
case zeek::TYPE_STRING:
|
||||
case zeek::TYPE_FILE:
|
||||
case zeek::TYPE_FUNC:
|
||||
case TYPE_ENUM:
|
||||
case TYPE_STRING:
|
||||
case TYPE_FILE:
|
||||
case TYPE_FUNC:
|
||||
type = "text";
|
||||
break;
|
||||
|
||||
case zeek::TYPE_TABLE:
|
||||
case zeek::TYPE_VECTOR:
|
||||
case TYPE_TABLE:
|
||||
case TYPE_VECTOR:
|
||||
type = "text"; // dirty - but sqlite does not directly support arrays. so - we just roll it into a ","-separated string.
|
||||
break;
|
||||
|
||||
|
@ -242,39 +242,39 @@ int SQLite::AddParams(Value* val, int pos)
|
|||
return sqlite3_bind_null(st, pos);
|
||||
|
||||
switch ( val->type ) {
|
||||
case zeek::TYPE_BOOL:
|
||||
case TYPE_BOOL:
|
||||
return sqlite3_bind_int(st, pos, val->val.int_val != 0 ? 1 : 0 );
|
||||
|
||||
case zeek::TYPE_INT:
|
||||
case TYPE_INT:
|
||||
return sqlite3_bind_int(st, pos, val->val.int_val);
|
||||
|
||||
case zeek::TYPE_COUNT:
|
||||
case TYPE_COUNT:
|
||||
return sqlite3_bind_int(st, pos, val->val.uint_val);
|
||||
|
||||
case zeek::TYPE_PORT:
|
||||
case TYPE_PORT:
|
||||
return sqlite3_bind_int(st, pos, val->val.port_val.port);
|
||||
|
||||
case zeek::TYPE_SUBNET:
|
||||
case TYPE_SUBNET:
|
||||
{
|
||||
string out = io->Render(val->val.subnet_val);
|
||||
return sqlite3_bind_text(st, pos, out.data(), out.size(), SQLITE_TRANSIENT);
|
||||
}
|
||||
|
||||
case zeek::TYPE_ADDR:
|
||||
case TYPE_ADDR:
|
||||
{
|
||||
string out = io->Render(val->val.addr_val);
|
||||
return sqlite3_bind_text(st, pos, out.data(), out.size(), SQLITE_TRANSIENT);
|
||||
}
|
||||
|
||||
case zeek::TYPE_TIME:
|
||||
case zeek::TYPE_INTERVAL:
|
||||
case zeek::TYPE_DOUBLE:
|
||||
case TYPE_TIME:
|
||||
case TYPE_INTERVAL:
|
||||
case TYPE_DOUBLE:
|
||||
return sqlite3_bind_double(st, pos, val->val.double_val);
|
||||
|
||||
case zeek::TYPE_ENUM:
|
||||
case zeek::TYPE_STRING:
|
||||
case zeek::TYPE_FILE:
|
||||
case zeek::TYPE_FUNC:
|
||||
case TYPE_ENUM:
|
||||
case TYPE_STRING:
|
||||
case TYPE_FILE:
|
||||
case TYPE_FUNC:
|
||||
{
|
||||
if ( ! val->val.string_val.length || val->val.string_val.length == 0 )
|
||||
return sqlite3_bind_null(st, pos);
|
||||
|
@ -282,9 +282,9 @@ int SQLite::AddParams(Value* val, int pos)
|
|||
return sqlite3_bind_text(st, pos, val->val.string_val.data, val->val.string_val.length, SQLITE_TRANSIENT);
|
||||
}
|
||||
|
||||
case zeek::TYPE_TABLE:
|
||||
case TYPE_TABLE:
|
||||
{
|
||||
zeek::ODesc desc;
|
||||
ODesc desc;
|
||||
desc.Clear();
|
||||
desc.EnableEscaping();
|
||||
desc.AddEscapeSequence(set_separator);
|
||||
|
@ -304,9 +304,9 @@ int SQLite::AddParams(Value* val, int pos)
|
|||
return sqlite3_bind_text(st, pos, (const char*) desc.Bytes(), desc.Len(), SQLITE_TRANSIENT);
|
||||
}
|
||||
|
||||
case zeek::TYPE_VECTOR:
|
||||
case TYPE_VECTOR:
|
||||
{
|
||||
zeek::ODesc desc;
|
||||
ODesc desc;
|
||||
desc.Clear();
|
||||
desc.EnableEscaping();
|
||||
desc.AddEscapeSequence(set_separator);
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
|
||||
namespace zeek::logging::writer::detail {
|
||||
|
||||
class SQLite : public zeek::logging::WriterBackend {
|
||||
class SQLite : public WriterBackend {
|
||||
public:
|
||||
explicit SQLite(zeek::logging::WriterFrontend* frontend);
|
||||
explicit SQLite(WriterFrontend* frontend);
|
||||
~SQLite() override;
|
||||
|
||||
static zeek::logging::WriterBackend* Instantiate(zeek::logging::WriterFrontend* frontend)
|
||||
static WriterBackend* Instantiate(WriterFrontend* frontend)
|
||||
{ return new SQLite(frontend); }
|
||||
|
||||
protected:
|
||||
|
@ -49,7 +49,7 @@ private:
|
|||
std::string unset_field;
|
||||
std::string empty_field;
|
||||
|
||||
zeek::threading::formatter::Ascii* io;
|
||||
threading::formatter::Ascii* io;
|
||||
};
|
||||
|
||||
} // namespace zeek::logging::writer::detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue