Remove all of the random single-file deprecations

These are the changes that don't require a ton of changes to other files outside
of the original removal.
This commit is contained in:
Tim Wojtulewicz 2021-01-21 11:49:36 -07:00
parent 7e9d89db0a
commit 0618be792f
270 changed files with 36 additions and 4632 deletions

View file

@ -36,14 +36,4 @@ Analyzer::Analyzer(RecordValPtr arg_args, File* arg_file)
: Analyzer({}, std::move(arg_args), arg_file)
{}
Analyzer::Analyzer(file_analysis::Tag arg_tag,
RecordVal* arg_args,
File* arg_file)
: Analyzer(arg_tag, {NewRef{}, arg_args}, arg_file)
{}
Analyzer::Analyzer(RecordVal* arg_args, File* arg_file)
: Analyzer({}, {NewRef{}, arg_args}, arg_file)
{}
} // namespace zeek::file_analysis

View file

@ -101,10 +101,6 @@ public:
const RecordValPtr& GetArgs() const
{ return args; }
[[deprecated("Remove in v4.1. Use GetArgs().")]]
RecordVal* Args() const
{ return args.get(); }
/**
* @return the file_analysis::File object to which the analyzer is attached.
*/
@ -156,9 +152,6 @@ protected:
*/
Analyzer(file_analysis::Tag arg_tag, RecordValPtr arg_args, File* arg_file);
[[deprecated("Remove in v4.1.. Construct using IntrusivePtr instead.")]]
Analyzer(file_analysis::Tag arg_tag, RecordVal* arg_args, File* arg_file);
/**
* Constructor. Only derived classes are meant to be instantiated.
* As this version of the constructor does not receive a name or tag,
@ -170,9 +163,6 @@ protected:
*/
Analyzer(RecordValPtr arg_args, File* arg_file);
[[deprecated("Remove in v4.1.. Construct using IntrusivePtr instead.")]]
Analyzer(RecordVal* arg_args, File* arg_file);
private:
ID id; /**< Unique instance ID. */
@ -186,10 +176,3 @@ private:
};
} // namespace zeek::file_analysis
namespace file_analysis {
using ID [[deprecated("Remove in v4.1. Use zeek::file_analysis::ID.")]] = zeek::file_analysis::ID;
using Analyzer [[deprecated("Remove in v4.1. Use zeek::file_analysis::Analyzer.")]] = zeek::file_analysis::Analyzer;
} // namespace file_analysis

View file

@ -238,9 +238,3 @@ private:
};
} // namespace zeek::file_analysis::detail
namespace file_analysis {
using AnalyzerSet [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::AnalyzerSet.")]] = zeek::file_analysis::detail::AnalyzerSet;
} // namespace file_analysis

View file

@ -8,19 +8,10 @@
namespace zeek::file_analysis {
Component::Component(const std::string& name, factory_callback arg_factory, Tag::subtype_t subtype)
: plugin::Component(plugin::component::FILE_ANALYZER, name),
plugin::TaggedComponent<file_analysis::Tag>(subtype)
{
factory = arg_factory;
factory_func = nullptr;
}
Component::Component(const std::string& name, factory_function arg_factory, Tag::subtype_t subtype)
: plugin::Component(plugin::component::FILE_ANALYZER, name),
plugin::TaggedComponent<file_analysis::Tag>(subtype)
{
factory = nullptr;
factory_func = arg_factory;
}
@ -36,7 +27,7 @@ Component::~Component()
void Component::DoDescribe(ODesc* d) const
{
if ( factory || factory_func )
if ( factory_func )
{
d->Add("ANALYZER_");
d->Add(CanonicalName());

View file

@ -28,7 +28,6 @@ namespace zeek::file_analysis {
class Component : public plugin::Component,
public plugin::TaggedComponent<file_analysis::Tag> {
public:
typedef Analyzer* (*factory_callback)(RecordVal* args, File* file);
using factory_function = Analyzer* (*)(RecordValPtr args, File* file);
/**
@ -52,9 +51,6 @@ public:
*/
Component(const std::string& name, factory_function factory, Tag::subtype_t subtype = 0);
[[deprecated("Remove in v4.1. Use factory_function w/ IntrusivePtr args")]]
Component(const std::string& name, factory_callback factory, Tag::subtype_t subtype = 0);
/**
* Destructor.
*/
@ -73,9 +69,6 @@ public:
factory_function FactoryFunction() const
{ return factory_func; }
[[deprecated("Remove in v4.1. Use FactoryFunction().")]]
factory_callback Factory() const { return factory; }
protected:
/**
* Overriden from plugin::Component.
@ -85,14 +78,7 @@ protected:
private:
friend class Manager;
factory_callback factory; // The analyzer's factory callback (deprecated).
factory_function factory_func; // The analyzer's factory callback.
};
} // namespace zeek::file_analysis
namespace file_analysis {
using Component [[deprecated("Remove in v4.1. Use zeek::file_analysis::Component.")]] = zeek::file_analysis::Component;
} // namespace file_analysis

View file

@ -203,9 +203,6 @@ void File::SetTimeoutInterval(double interval)
val->Assign(timeout_interval_idx, make_intrusive<IntervalVal>(interval));
}
bool File::SetExtractionLimit(RecordVal* args, uint64_t bytes)
{ return SetExtractionLimit({NewRef{}, args}, bytes); }
bool File::SetExtractionLimit(RecordValPtr args, uint64_t bytes)
{
Analyzer* a = analyzers.Find(file_mgr->GetComponentTag("EXTRACT"),
@ -253,9 +250,6 @@ void File::ScheduleInactivityTimer() const
zeek::detail::timer_mgr->Add(new detail::FileTimer(run_state::network_time, id, GetTimeoutInterval()));
}
bool File::AddAnalyzer(file_analysis::Tag tag, RecordVal* args)
{ return AddAnalyzer(tag, {NewRef{}, args}); }
bool File::AddAnalyzer(file_analysis::Tag tag, RecordValPtr args)
{
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Queuing addition of %s analyzer",
@ -267,9 +261,6 @@ bool File::AddAnalyzer(file_analysis::Tag tag, RecordValPtr args)
return analyzers.QueueAdd(tag, std::move(args)) != nullptr;
}
bool File::RemoveAnalyzer(file_analysis::Tag tag, RecordVal* args)
{ return RemoveAnalyzer(tag, {NewRef{}, args}); }
bool File::RemoveAnalyzer(file_analysis::Tag tag, RecordValPtr args)
{
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Queuing remove of %s analyzer",
@ -621,17 +612,6 @@ void File::FileEvent(EventHandlerPtr h)
FileEvent(h, Args{val});
}
void File::FileEvent(EventHandlerPtr h, ValPList* vl)
{
FileEvent(h, val_list_to_args(*vl));
delete vl;
}
void File::FileEvent(EventHandlerPtr h, ValPList vl)
{
FileEvent(h, val_list_to_args(vl));
}
void File::FileEvent(EventHandlerPtr h, Args args)
{
event_mgr.Enqueue(h, std::move(args));

View file

@ -45,10 +45,6 @@ public:
const RecordValPtr& ToVal() const
{ return val; }
[[deprecated("Remove in v4.1. Use ToVal().")]]
RecordVal* GetVal() const
{ return val.get(); }
/**
* @return the value of the "source" field from #val record or an empty
* string if it's not initialized.
@ -80,9 +76,6 @@ public:
*/
bool SetExtractionLimit(RecordValPtr args, uint64_t bytes);
[[deprecated("Remove in v4.1. Pass an IntrusivePtr instead.")]]
bool SetExtractionLimit(RecordVal* args, uint64_t bytes);
/**
* @return value of the "id" field from #val record.
*/
@ -128,9 +121,6 @@ public:
*/
bool AddAnalyzer(file_analysis::Tag tag, RecordValPtr args);
[[deprecated("Remove in v4.1. Pass an IntrusivePtr instead.")]]
bool AddAnalyzer(file_analysis::Tag tag, RecordVal* args);
/**
* Queues removal of an analyzer.
* @param tag the analyzer tag of the file analyzer to remove.
@ -139,9 +129,6 @@ public:
*/
bool RemoveAnalyzer(file_analysis::Tag tag, RecordValPtr args);
[[deprecated("Remove in v4.1. Pass an IntrusivePtr instead.")]]
bool RemoveAnalyzer(file_analysis::Tag tag, RecordVal* args);
/**
* Signal that this analyzer can be deleted once it's safe to do so.
*/
@ -187,22 +174,6 @@ public:
*/
void FileEvent(EventHandlerPtr h);
/**
* Raises an event related to the file's life-cycle.
* @param h pointer to an event handler.
* @param vl list of argument values to pass to event call.
*/
[[deprecated("Remove in v4.1. Use Args overload instead.")]]
void FileEvent(EventHandlerPtr h, ValPList* vl);
/**
* Raises an event related to the file's life-cycle.
* @param h pointer to an event handler.
* @param vl list of argument values to pass to event call.
*/
[[deprecated("Remove in v4.1. Use Args overload instead.")]]
void FileEvent(EventHandlerPtr h, ValPList vl);
/**
* Raises an event related to the file's life-cycle.
* @param h pointer to an event handler.
@ -396,9 +367,3 @@ protected:
};
} // namespace file_analysis
namespace file_analysis {
using File [[deprecated("Remove in v4.1. Use zeek::file_analysis::File.")]] = zeek::file_analysis::File;
} // namespace zeek::file_analysis

View file

@ -5,7 +5,6 @@
#include "zeek/Reassem.h"
namespace zeek { class File; }
using BroFile [[deprecated("Remove in v4.1. Use zeek::File.")]] = zeek::File;
ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis);
@ -59,9 +58,3 @@ protected:
};
} // namespace zeek::file_analysis
namespace file_analysis {
using FileReassembler [[deprecated("Remove in v4.1. Use zeek::file_analysis::FileReassembler.")]] = zeek::file_analysis::FileReassembler;
} // namespace file_analysis

View file

@ -34,9 +34,3 @@ private:
};
} // namespace zeek::file_analysis::detail
namespace file_analysis {
using FileTimer [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::FileTimer.")]] = zeek::file_analysis::detail::FileTimer;
} // namespace file_analysis

View file

@ -80,7 +80,7 @@ void Manager::SetHandle(const string& handle)
return;
#ifdef DEBUG
if ( debug_logger.IsEnabled(DBG_FILE_ANALYSIS) )
if ( zeek::detail::debug_logger.IsEnabled(DBG_FILE_ANALYSIS) )
{
String tmp{handle};
auto rendered = tmp.Render();
@ -260,10 +260,6 @@ bool Manager::SetReassemblyBuffer(const string& file_id, uint64_t max)
return true;
}
bool Manager::SetExtractionLimit(const string& file_id, RecordVal* args,
uint64_t n) const
{ return SetExtractionLimit(file_id, {NewRef{}, args}, n); }
bool Manager::SetExtractionLimit(const string& file_id,
RecordValPtr args, uint64_t n) const
{
@ -275,10 +271,6 @@ bool Manager::SetExtractionLimit(const string& file_id,
return file->SetExtractionLimit(std::move(args), n);
}
bool Manager::AddAnalyzer(const string& file_id, const file_analysis::Tag& tag,
RecordVal* args) const
{ return AddAnalyzer(file_id, tag, {NewRef{}, args}); }
bool Manager::AddAnalyzer(const string& file_id, const file_analysis::Tag& tag,
RecordValPtr args) const
{
@ -290,10 +282,6 @@ bool Manager::AddAnalyzer(const string& file_id, const file_analysis::Tag& tag,
return file->AddAnalyzer(tag, std::move(args));
}
bool Manager::RemoveAnalyzer(const string& file_id, const file_analysis::Tag& tag,
RecordVal* args) const
{ return RemoveAnalyzer(file_id, tag, {NewRef{}, args}); }
bool Manager::RemoveAnalyzer(const string& file_id, const file_analysis::Tag& tag,
RecordValPtr args) const
{
@ -456,9 +444,6 @@ bool Manager::IsDisabled(const analyzer::Tag& tag)
return yield->AsBool();
}
Analyzer* Manager::InstantiateAnalyzer(const Tag& tag, RecordVal* args, File* f) const
{ return InstantiateAnalyzer(tag, {NewRef{}, args}, f); }
Analyzer* Manager::InstantiateAnalyzer(const Tag& tag,
RecordValPtr args,
File* f) const
@ -480,8 +465,6 @@ Analyzer* Manager::InstantiateAnalyzer(const Tag& tag,
if ( c->factory_func )
a = c->factory_func(std::move(args), f);
else if ( c->factory )
a = c->factory(args.get(), f);
else
{
reporter->InternalWarning("file analyzer %s cannot be instantiated "

View file

@ -253,10 +253,6 @@ public:
bool SetExtractionLimit(const std::string& file_id,
RecordValPtr args, uint64_t n) const;
[[deprecated("Remove in v4.1. Pass IntrusivePtr args param instead.")]]
bool SetExtractionLimit(const std::string& file_id, RecordVal* args,
uint64_t n) const;
/**
* Try to retrieve a file that's being analyzed, using its identifier/hash.
* @param file_id the file identifier/hash.
@ -277,10 +273,6 @@ public:
bool AddAnalyzer(const std::string& file_id, const file_analysis::Tag& tag,
RecordValPtr args) const;
[[deprecated("Remove in v4.1. Pass IntrusivePtr args param instead.")]]
bool AddAnalyzer(const std::string& file_id, const file_analysis::Tag& tag,
RecordVal* args) const;
/**
* Queue removal of an analyzer for a given file identifier.
* @param file_id the file identifier/hash.
@ -291,10 +283,6 @@ public:
bool RemoveAnalyzer(const std::string& file_id, const file_analysis::Tag& tag,
RecordValPtr args) const;
[[deprecated("Remove in v4.1. Pass IntrusivePtr args param instead.")]]
bool RemoveAnalyzer(const std::string& file_id, const file_analysis::Tag& tag,
RecordVal* args) const;
/**
* Tells whether analysis for a file is active or ignored.
* @param file_id the file identifier/hash.
@ -312,9 +300,6 @@ public:
Analyzer* InstantiateAnalyzer(const Tag& tag, RecordValPtr args,
File* f) const;
[[deprecated("Remove in v4.1. Pass in IntrusivePtr args instead.")]]
Analyzer* InstantiateAnalyzer(const Tag& tag, RecordVal* args, File* f) const;
/**
* Returns a set of all matching MIME magic signatures for a given
* chunk of data.
@ -443,11 +428,3 @@ VectorValPtr GenMIMEMatchesVal(const zeek::detail::RuleMatcher::MIME_Matches& m)
extern file_analysis::Manager* file_mgr;
} // namespace zeek
namespace file_analysis {
using Manager [[deprecated("Remove in v4.1. Use zeek::file_analysis::Manager.")]] = zeek::file_analysis::Manager;
} // namespace file_analysis
extern zeek::file_analysis::Manager*& file_mgr [[deprecated("Remove in v4.1. Use zeek::file_mgr.")]];

View file

@ -8,7 +8,7 @@ namespace zeek::file_analysis {
const Tag Tag::Error;
Tag::Tag(type_t type, subtype_t subtype)
: ::Tag(file_mgr->GetTagType(), type, subtype)
: zeek::Tag(file_mgr->GetTagType(), type, subtype)
{
}
@ -23,17 +23,8 @@ const EnumValPtr& Tag::AsVal() const
return zeek::Tag::AsVal(file_mgr->GetTagType());
}
EnumVal* Tag::AsEnumVal() const
{
return AsVal().get();
}
Tag::Tag(EnumValPtr val)
: zeek::Tag(std::move(val))
{ }
Tag::Tag(EnumVal* val)
: zeek::Tag({NewRef{}, val})
{ }
} // namespace zeek::file_analysis

View file

@ -11,14 +11,6 @@ namespace zeek::plugin {
template <class T> class TaggedComponent;
template <class T, class C> class ComponentManager;
}
namespace plugin {
template <class T>
using TaggedComponent [[deprecated("Remove in v4.1. Use zeek::plugin::TaggedComponent instead.")]] =
zeek::plugin::TaggedComponent<T>;
template <class T, class C>
using ComponentManager [[deprecated("Remove in v4.1. Use zeek::plugin::ComponentManager instead.")]] =
zeek::plugin::ComponentManager<T, C>;
}
ZEEK_FORWARD_DECLARE_NAMESPACED(Component, zeek, file_analysis);
@ -90,9 +82,6 @@ public:
*/
const EnumValPtr& AsVal() const;
[[deprecated("Remove in v4.1. Use AsVal() instead.")]]
EnumVal* AsEnumVal() const;
static const Tag Error;
protected:
@ -117,15 +106,6 @@ protected:
* @param val An enum value of script type \c Files::Tag.
*/
explicit Tag(EnumValPtr val);
[[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]]
explicit Tag(EnumVal* val);
};
} // namespace zeek::file_analysis
namespace file_analysis {
using Tag [[deprecated("Remove in v4.1. Use zeek::file_analysis::Tag.")]] = zeek::file_analysis::Tag;
} // namespace file_analysis

View file

@ -66,9 +66,3 @@ private:
};
} // namespace zeek::file_analysis::detail
namespace file_analysis {
using DataEvent [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::DataEvent.")]] = zeek::file_analysis::detail::DataEvent;
} // namespace file_analysis

View file

@ -80,9 +80,3 @@ private:
};
} // namespace zeek::file_analysis::detail
namespace file_analysis {
using Entropy [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::Entropy.")]] = zeek::file_analysis::detail::Entropy;
} // namespace file_analysis

View file

@ -78,9 +78,3 @@ private:
};
} // namespace zeek::file_analysis::detail
namespace file_analysis {
using Extract [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::Extract.")]] = zeek::file_analysis::detail::Extract;
} // namespace file_analysis

View file

@ -158,12 +158,3 @@ protected:
};
} // namespace zeek::file_analysis
namespace file_analysis {
using Hash [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::Hash.")]] = zeek::file_analysis::detail::Hash;
using MD5 [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::MD5.")]] = zeek::file_analysis::detail::MD5;
using SHA1 [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::SHA1.")]] = zeek::file_analysis::detail::SHA1;
using SHA256 [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::SHA256.")]] = zeek::file_analysis::detail::SHA256;
} // namespace file_analysis

View file

@ -31,9 +31,3 @@ protected:
};
} // namespace zeek::file_analysis::detail
namespace file_analysis {
using PE [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::PE.")]] = zeek::file_analysis::detail::PE;
} // namespace file_analysis

View file

@ -33,9 +33,3 @@ private:
};
} // namespace zeek::file_analysis::detail
namespace file_analysis {
using Unified2 [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::Unified2.")]] = zeek::file_analysis::detail::Unified2;
} // namespace file_analysis

View file

@ -35,9 +35,3 @@ private:
};
} // namespace zeek::file_analysis::detail
namespace file_analysis {
using OCSP [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::OCSP.")]] = zeek::file_analysis::detail::OCSP;
} // namespace file_analysis

View file

@ -197,10 +197,3 @@ private:
};
} // namespace zeek::file_analysis::detail
namespace file_analysis {
using X509 [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::X509.")]] = zeek::file_analysis::detail::X509;
using X509Val [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::X509Val.")]] = zeek::file_analysis::detail::X509Val;
} // namespace file_analysis

View file

@ -54,9 +54,3 @@ protected:
};
} // namespace zeek::file_analysis
namespace file_analysis {
using X509Common [[deprecated("Remove in v4.1. Use zeek::file_analysis::detail::X509Common.")]] = zeek::file_analysis::detail::X509Common;
} // namespace file_analysis