Merge in SNORT/snort3 from ~STECHEW/snort3:oleksii_alias_fix to master
Squashed commit of the following:
commit
e14bdcd2196c9151048a2afb8559a64ab6fb4358
Author: Oleksii Shumeiko <oshumeik@cisco.com>
Date: Wed Apr 2 15:54:45 2025 +0300
framework: make alias name internal to inspector instance
commit
32450f01541938b7e3b80d1b52df3ad172bf56c3
Author: Oleksii Shumeiko <oshumeik@cisco.com>
Date: Wed Apr 2 14:07:16 2025 +0300
managers: update formatting
#include "main/thread_config.h"
#include "protocols/packet.h"
#include "stream/stream_splitter.h"
+#include "utils/util.h"
namespace snort
{
assert(0 == ref_count[i]);
delete[] ref_count;
+ delete[] alias_name;
}
bool Inspector::is_inactive()
void* Inspector::get_thread_specific_data() const
{ return thread_specific_data->data[get_instance_id()]; }
+void Inspector::set_alias_name(const char* name)
+{
+ delete[] alias_name;
+ alias_name = snort_strdup(name);
+}
+
static const char* InspectorTypeNames[IT_MAX] =
{
"passive",
struct Packet;
// this is the current version of the api
-#define INSAPI_VERSION ((BASE_API_VERSION << 16) | 2)
+#define INSAPI_VERSION ((BASE_API_VERSION << 16) | 3)
struct InspectionBuffer
{
const char* get_name() const;
- void set_alias_name(const char* name)
- { alias_name = name; }
-
+ void set_alias_name(const char*);
const char* get_alias_name() const
{ return alias_name; }
std::shared_ptr<ThreadSpecificData> thread_specific_data;
std::atomic_uint* ref_count;
SnortProtocolId snort_protocol_id = 0;
- // FIXIT-E Use std::string to avoid storing a pointer to external std::string buffers
const char* alias_name = nullptr;
uint64_t network_policy_user_id = 0;
bool network_policy_user_id_set = false;
typedef vector<PHObject> PHObjectList;
typedef vector<PHObjectList*> PHTSObjectLists;
+
struct ThreadSpecificHandlers
{
explicit ThreadSpecificHandlers(unsigned max)
bool is_reloaded()
{
- return ((reload_type == RELOAD_TYPE_REENABLED)or
- (reload_type == RELOAD_TYPE_DELETED) or
- (reload_type == RELOAD_TYPE_NEW));
+ return reload_type == RELOAD_TYPE_REENABLED
+ or reload_type == RELOAD_TYPE_DELETED
+ or reload_type == RELOAD_TYPE_NEW;
}
ReloadType get_reload_type()
typedef vector<PHObject*> PHGlobalList;
typedef vector<PHClass*> PHClassList;
typedef vector<PHInstance*> PHInstanceList;
+
struct PHRemovedInstance
{
PHRemovedInstance(PHInstance* i, PHTSObjectLists& handlers)
: instance(i), handlers(handlers)
{ }
+
PHInstance* instance;
PHTSObjectLists& handlers;
};
+
typedef vector<PHRemovedInstance> PHRemovedInstanceList;
typedef list<Inspector*> PHList;
static PHList s_trash;
static PHList s_trash2;
static bool s_sorted = false;
-
static PHTSObjectLists s_tl_handlers;
void InspectorManager::global_init()
Module::Module(const char* name, const char*) : name(name), help(nullptr), params(nullptr), list(false)
{ }
+void Inspector::set_alias_name(const char* n)
+{ alias_name = n; }
+
class TestInspector : public Inspector
{
public: