return Snort::get_switcher()->get_context()->buf;
}
+void DetectionEngine::set_data(unsigned id, IpsContextData* p)
+{ Snort::get_switcher()->get_context()->set_context_data(id, p); }
+
+IpsContextData* DetectionEngine::get_data(unsigned id)
+{ return Snort::get_switcher()->get_context()->get_context_data(id); }
+
DetectionEngine::ActiveRules DetectionEngine::get_detects()
{ return active_rules; }
#include "actions/actions.h"
#include "main/snort_types.h"
+class IpsContextData;
struct Packet;
class SO_PUBLIC DetectionEngine
static uint8_t* get_buffer(unsigned& max);
+ static void set_data(unsigned id, IpsContextData*);
+ static IpsContextData* get_data(unsigned id);
+
static bool detect(Packet*);
static void inspect(Packet*);
// context methods
//--------------------------------------------------------------------------
-IpsContext::IpsContext(unsigned size) : data(size, nullptr)
+IpsContext::IpsContext(unsigned size) :
+ data(size ? size : IpsContextData::get_max_id() + 1, nullptr)
{
packet = new Packet(false);
pkth = new DAQ_PktHdr_t;
class SO_PUBLIC IpsContext
{
public:
- IpsContext(unsigned size);
+ IpsContext(unsigned size = 0); // defaults to max id
~IpsContext();
void set_context_data(unsigned id, IpsContextData*);
{
// using dummy values until further integration
const unsigned max_contexts = 20;
- const unsigned max_data = 1;
s_switcher = new ContextSwitcher(max_contexts);
for ( unsigned i = 0; i < max_contexts; ++i )
- s_switcher->push(new IpsContext(max_data));
+ s_switcher->push(new IpsContext);
CodecManager::thread_init(snort_conf);