bool dump_stats_initialized = false;
-private:
- friend ModuleManager;
- void init(const char*, const char* = nullptr);
-
std::vector<PegCount> counts;
std::vector<PegCount> dump_stats_counts;
int num_counts = -1;
- const char* name;
- const char* help;
-
- const Parameter* params;
- bool list;
- int table_level = 0;
-
void set_peg_count(int index, PegCount value, bool dump_stats = false)
{
assert(index < num_counts);
counts[index] = value;
}
+ void add_peg_count(int index, PegCount value, bool dump_stats = false)
+ {
+ assert(index < num_counts);
+ if(dump_stats)
+ dump_stats_counts[index] += value;
+ else
+ counts[index] += value;
+ }
+
+private:
+ friend ModuleManager;
+ void init(const char*, const char* = nullptr);
+
+ const char* name;
+ const char* help;
+
+ const Parameter* params;
+ bool list;
+ int table_level = 0;
+
void set_max_peg_count(int index, PegCount value, bool dump_stats = false)
{
assert(index < num_counts);
counts[index] = value;
}
}
-
- void add_peg_count(int index, PegCount value, bool dump_stats = false)
- {
- assert(index < num_counts);
- if(dump_stats)
- dump_stats_counts[index] += value;
- else
- counts[index] += value;
-
- }
};
}
#endif
public:
MockModule() : Module("mockery", "mockery")
{
- counts = (PegCount*)snort_alloc(5 * sizeof(PegCount));
+ mock_counts = (PegCount*)snort_alloc(5 * sizeof(PegCount));
for( unsigned i = 0; i < 5; i++ )
- counts[i] = i;
+ mock_counts[i] = i;
}
- ~MockModule() override { snort_free(counts); }
+ ~MockModule() override { snort_free(mock_counts); }
const PegInfo* get_pegs() const override { return pegs; }
- PegCount* get_counts() const override { return counts; }
+ PegCount* get_counts() const override { return mock_counts; }
void sum_stats(bool) override {}
{ return INSPECT; }
private:
- PegCount* counts;
+ PegCount* mock_counts;
PegInfo pegs[6] =
{