Base: Clean up explicit uses of namespaces in places where they're not necessary.

This commit covers all of the common and base classes.
This commit is contained in:
Tim Wojtulewicz 2020-08-21 09:29:37 -07:00
parent 9f802b2a4d
commit fe0c22c789
240 changed files with 6823 additions and 6787 deletions

View file

@ -9,7 +9,7 @@
namespace zeek::input {
Component::Component(const std::string& name, factory_callback arg_factory)
: zeek::plugin::Component(zeek::plugin::component::READER, name)
: plugin::Component(plugin::component::READER, name)
{
factory = arg_factory;
}
@ -24,7 +24,7 @@ Component::~Component()
{
}
void Component::DoDescribe(zeek::ODesc* d) const
void Component::DoDescribe(ODesc* d) const
{
d->Add("Input::READER_");
d->Add(CanonicalName());

View file

@ -14,8 +14,8 @@ namespace zeek::input {
/**
* Component description for plugins providing log readers.
*/
class Component : public zeek::plugin::Component,
public plugin::TaggedComponent<zeek::input::Tag> {
class Component : public plugin::Component,
public plugin::TaggedComponent<Tag> {
public:
typedef ReaderBackend* (*factory_callback)(ReaderFrontend* frontend);
@ -54,7 +54,7 @@ protected:
/**
* Overriden from plugin::Component.
*/
void DoDescribe(zeek::ODesc* d) const override;
void DoDescribe(ODesc* d) const override;
private:
factory_callback factory;

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,7 @@ public:
* This method corresponds directly to the internal BiF defined in
* input.bif, which just forwards here.
*/
bool CreateTableStream(zeek::RecordVal* description);
bool CreateTableStream(RecordVal* description);
/**
* Creates a new input stream which sends events for read input data.
@ -55,7 +55,7 @@ public:
* This method corresponds directly to the internal BiF defined in
* input.bif, which just forwards here.
*/
bool CreateEventStream(zeek::RecordVal* description);
bool CreateEventStream(RecordVal* description);
/**
* Creates a new input stream which will forward the data from the data
@ -67,7 +67,7 @@ public:
* @param description A record of the script type \c
* Input::AnalysisDescription
*/
bool CreateAnalysisStream(zeek::RecordVal* description);
bool CreateAnalysisStream(RecordVal* description);
/**
* Force update on a input stream. Forces a re-read of the whole
@ -111,7 +111,7 @@ public:
*
* @return True if the type is compatible with the input framework.
*/
static bool IsCompatibleType(zeek::Type* t, bool atomic_only=false);
static bool IsCompatibleType(Type* t, bool atomic_only=false);
protected:
friend class ReaderFrontend;
@ -143,7 +143,7 @@ protected:
// Instantiates a new ReaderBackend of the given type (note that
// doing so creates a new thread!).
ReaderBackend* CreateBackend(ReaderFrontend* frontend, zeek::EnumVal* tag);
ReaderBackend* CreateBackend(ReaderFrontend* frontend, EnumVal* tag);
// Function called from the ReaderBackend to notify the manager that
// a stream has been removed or a stream has been closed. Used to
@ -180,12 +180,12 @@ private:
// protected definitions are wrappers around this function.
bool RemoveStream(Stream* i);
bool CreateStream(Stream*, zeek::RecordVal* description);
bool CreateStream(Stream*, RecordVal* description);
// Check if the types of the error_ev event are correct. If table is
// true, check for tablestream type, otherwhise check for eventstream
// type.
bool CheckErrorEventTypes(const std::string& stream_name, const zeek::Func* error_event, bool table) const;
bool CheckErrorEventTypes(const std::string& stream_name, const Func* error_event, bool table) const;
// SendEntry implementation for Table stream.
int SendEntryTable(Stream* i, const threading::Value* const *vals);
@ -194,22 +194,22 @@ private:
int PutTable(Stream* i, const threading::Value* const *vals);
// SendEntry and Put implementation for Event stream.
int SendEventStreamEvent(Stream* i, zeek::EnumVal* type, const threading::Value* const *vals);
int SendEventStreamEvent(Stream* i, EnumVal* type, const threading::Value* const *vals);
// Check if a record is made up of compatible types and return a list
// of all fields that are in the record in order. Recursively unrolls
// records
bool UnrollRecordType(std::vector<threading::Field*> *fields, const zeek::RecordType *rec, const std::string& nameprepend, bool allow_file_func) const;
bool UnrollRecordType(std::vector<threading::Field*> *fields, const RecordType *rec, const std::string& nameprepend, bool allow_file_func) const;
// Send events
void SendEvent(zeek::EventHandlerPtr ev, const int numvals, ...) const;
void SendEvent(zeek::EventHandlerPtr ev, std::list<zeek::Val*> events) const;
void SendEvent(EventHandlerPtr ev, const int numvals, ...) const;
void SendEvent(EventHandlerPtr ev, std::list<Val*> events) const;
// Implementation of SendEndOfData (send end_of_data event).
void SendEndOfData(const Stream *i);
// Call predicate function and return result.
bool CallPred(zeek::Func* pred_func, const int numvals, ...) const;
bool CallPred(Func* pred_func, const int numvals, ...) const;
// Get a hashkey for a set of threading::Values.
zeek::detail::HashKey* HashValues(const int num_elements, const threading::Value* const *vals) const;
@ -222,19 +222,19 @@ private:
int CopyValue(char *data, const int startpos, const threading::Value* val) const;
// Convert Threading::Value to an internal Bro Type (works with Records).
zeek::Val* ValueToVal(const Stream* i, const threading::Value* val, zeek::Type* request_type, bool& have_error) const;
Val* ValueToVal(const Stream* i, const threading::Value* val, Type* request_type, bool& have_error) const;
// Convert Threading::Value to an internal Bro list type.
zeek::Val* ValueToIndexVal(const Stream* i, int num_fields, const zeek::RecordType* type, const threading::Value* const *vals, bool& have_error) const;
Val* ValueToIndexVal(const Stream* i, int num_fields, const RecordType* type, const threading::Value* const *vals, bool& have_error) const;
// Converts a threading::value to a record type. Mostly used by
// ValueToVal.
zeek::RecordVal* ValueToRecordVal(const Stream* i, const threading::Value* const *vals, zeek::RecordType *request_type, int* position, bool& have_error) const;
RecordVal* ValueToRecordVal(const Stream* i, const threading::Value* const *vals, RecordType *request_type, int* position, bool& have_error) const;
zeek::Val* RecordValToIndexVal(zeek::RecordVal *r) const;
Val* RecordValToIndexVal(RecordVal *r) const;
// Converts a Bro ListVal to a RecordVal given the record type.
zeek::RecordVal* ListValToRecordVal(zeek::ListVal* list, zeek::RecordType *request_type, int* position) const;
RecordVal* ListValToRecordVal(ListVal* list, RecordType *request_type, int* position) const;
// Internally signal errors, warnings, etc.
// These are sent on to input scriptland and reporter.log
@ -253,7 +253,7 @@ private:
std::map<ReaderFrontend*, Stream*> readers;
zeek::EventHandlerPtr end_of_data;
EventHandlerPtr end_of_data;
};
} // namespace input

View file

@ -63,7 +63,7 @@ public:
ReaderErrorMessage(ReaderFrontend* reader, Type arg_type, const char* arg_msg)
: threading::OutputMessage<ReaderFrontend>("ReaderErrorMessage", reader)
{ type = arg_type; msg = zeek::util::copy_string(arg_msg); }
{ type = arg_type; msg = util::copy_string(arg_msg); }
~ReaderErrorMessage() override { delete [] msg; }

View file

@ -75,7 +75,7 @@ public:
struct ReaderInfo
{
// Structure takes ownership of the strings.
typedef std::map<const char*, const char*, zeek::util::CompareString> config_map;
typedef std::map<const char*, const char*, util::CompareString> config_map;
/**
* A string left to the interpretation of the reader
@ -111,12 +111,12 @@ public:
ReaderInfo(const ReaderInfo& other)
{
source = other.source ? zeek::util::copy_string(other.source) : nullptr;
name = other.name ? zeek::util::copy_string(other.name) : nullptr;
source = other.source ? util::copy_string(other.source) : nullptr;
name = other.name ? util::copy_string(other.name) : nullptr;
mode = other.mode;
for ( config_map::const_iterator i = other.config.begin(); i != other.config.end(); i++ )
config.insert(std::make_pair(zeek::util::copy_string(i->first), zeek::util::copy_string(i->second)));
config.insert(std::make_pair(util::copy_string(i->first), util::copy_string(i->second)));
}
~ReaderInfo()

View file

@ -34,13 +34,13 @@ public:
bool Process() override { return Object()->Update(); }
};
ReaderFrontend::ReaderFrontend(const ReaderBackend::ReaderInfo& arg_info, zeek::EnumVal* type)
ReaderFrontend::ReaderFrontend(const ReaderBackend::ReaderInfo& arg_info, EnumVal* type)
{
disabled = initialized = false;
info = new ReaderBackend::ReaderInfo(arg_info);
const char* t = type->GetType()->AsEnumType()->Lookup(type->InternalInt());
name = zeek::util::copy_string(zeek::util::fmt("%s/%s", arg_info.source, t));
name = util::copy_string(util::fmt("%s/%s", arg_info.source, t));
backend = input_mgr->CreateBackend(this, type);
assert(backend);
@ -69,7 +69,7 @@ void ReaderFrontend::Init(const int arg_num_fields,
return;
if ( initialized )
zeek::reporter->InternalError("reader initialize twice");
reporter->InternalError("reader initialize twice");
num_fields = arg_num_fields;
fields = arg_fields;
@ -85,7 +85,7 @@ void ReaderFrontend::Update()
if ( ! initialized )
{
zeek::reporter->Error("Tried to call update on uninitialized reader");
reporter->Error("Tried to call update on uninitialized reader");
return;
}

View file

@ -32,7 +32,7 @@ public:
*
* Frontends must only be instantiated by the main thread.
*/
ReaderFrontend(const ReaderBackend::ReaderInfo& info, zeek::EnumVal* type);
ReaderFrontend(const ReaderBackend::ReaderInfo& info, EnumVal* type);
/**
* Destructor.
@ -118,7 +118,7 @@ public:
const threading::Field* const * Fields() const { return fields; }
protected:
friend class zeek::input::Manager;
friend class Manager;
private:
ReaderBackend* backend; // The backend we have instanatiated.

View file

@ -18,22 +18,22 @@ Tag& Tag::operator=(const Tag& other)
return *this;
}
const zeek::EnumValPtr& Tag::AsVal() const
const EnumValPtr& Tag::AsVal() const
{
return zeek::Tag::AsVal(input_mgr->GetTagType());
}
zeek::EnumVal* Tag::AsEnumVal() const
EnumVal* Tag::AsEnumVal() const
{
return AsVal().get();
}
Tag::Tag(zeek::EnumValPtr val)
Tag::Tag(EnumValPtr val)
: zeek::Tag(std::move(val))
{ }
Tag::Tag(zeek::EnumVal* val)
: zeek::Tag({zeek::NewRef{}, val})
Tag::Tag(EnumVal* val)
: zeek::Tag({NewRef{}, val})
{ }
} // namespace zeek::input

View file

@ -89,16 +89,16 @@ public:
*
* @param etype the script-layer enum type associated with the tag.
*/
const zeek::EnumValPtr& AsVal() const;
const EnumValPtr& AsVal() const;
[[deprecated("Remove in v4.1. Use AsVal() instead.")]]
zeek::EnumVal* AsEnumVal() const;
EnumVal* AsEnumVal() const;
static const Tag Error;
protected:
friend class zeek::plugin::ComponentManager<Tag, Component>;
friend class zeek::plugin::TaggedComponent<Tag>;
friend class plugin::ComponentManager<Tag, Component>;
friend class plugin::TaggedComponent<Tag>;
/**
* Constructor.
@ -117,10 +117,10 @@ protected:
*
* @param val An enum value of script type \c Input::Reader.
*/
explicit Tag(zeek::EnumValPtr val);
explicit Tag(EnumValPtr val);
[[deprecated("Remove in v4.1. Construct from IntrusivePtr isntead.")]]
explicit Tag(zeek::EnumVal* val);
explicit Tag(EnumVal* val);
};
} // namespace zeek::input