]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
moved stats / peg counts to module
authorRuss Combs <rucombs@cisco.com>
Tue, 15 Jul 2014 21:08:44 +0000 (17:08 -0400)
committerRuss Combs <rucombs@cisco.com>
Tue, 15 Jul 2014 21:08:44 +0000 (17:08 -0400)
73 files changed:
ChangeLog
configure.ac
doc/style.txt
src/framework/counts.h
src/framework/inspector.h
src/framework/module.cc
src/framework/module.h
src/main/snort.cc
src/managers/inspector_manager.cc
src/managers/inspector_manager.h
src/managers/module_manager.cc
src/managers/module_manager.h
src/network_inspectors/arp_spoof/arp_module.cc
src/network_inspectors/arp_spoof/arp_module.h
src/network_inspectors/arp_spoof/arp_spoof.cc
src/network_inspectors/binder/bind_module.cc
src/network_inspectors/binder/bind_module.h
src/network_inspectors/binder/binder.cc
src/network_inspectors/normalize/norm.cc
src/network_inspectors/normalize/norm.h
src/network_inspectors/normalize/norm_module.cc
src/network_inspectors/normalize/norm_module.h
src/network_inspectors/normalize/normalize.cc
src/network_inspectors/perf_monitor/perf_module.cc
src/network_inspectors/perf_monitor/perf_module.h
src/network_inspectors/perf_monitor/perf_monitor.cc
src/network_inspectors/port_scan/port_scan.cc
src/network_inspectors/port_scan/ps_module.cc
src/network_inspectors/port_scan/ps_module.h
src/parser/cmd_line.cc
src/service_inspectors/back_orifice/back_orifice.cc
src/service_inspectors/ftp_telnet/ftp.cc
src/service_inspectors/ftp_telnet/ftp_data.cc
src/service_inspectors/ftp_telnet/ftp_module.cc
src/service_inspectors/ftp_telnet/ftp_module.h
src/service_inspectors/ftp_telnet/telnet.cc
src/service_inspectors/ftp_telnet/telnet_module.cc
src/service_inspectors/ftp_telnet/telnet_module.h
src/service_inspectors/http_inspect/hi_include.h
src/service_inspectors/http_inspect/hi_module.cc
src/service_inspectors/http_inspect/hi_module.h
src/service_inspectors/http_inspect/http_inspect.cc
src/service_inspectors/nhttp_inspect/nhttp_api.cc
src/service_inspectors/nhttp_inspect/nhttp_api.h
src/service_inspectors/rpc_decode/rpc_decode.cc
src/service_inspectors/rpc_decode/rpc_module.cc
src/service_inspectors/rpc_decode/rpc_module.h
src/service_inspectors/wizard/wiz_module.cc
src/service_inspectors/wizard/wiz_module.h
src/service_inspectors/wizard/wizard.cc
src/stream/base/stream_base.cc
src/stream/base/stream_module.cc
src/stream/base/stream_module.h
src/stream/icmp/icmp_module.cc
src/stream/icmp/icmp_module.h
src/stream/icmp/icmp_session.cc
src/stream/icmp/icmp_session.h
src/stream/icmp/stream_icmp.cc
src/stream/ip/ip_module.cc
src/stream/ip/ip_module.h
src/stream/ip/ip_session.cc
src/stream/ip/stream_ip.cc
src/stream/ip/stream_ip.h
src/stream/tcp/stream_tcp.cc
src/stream/tcp/tcp_module.cc
src/stream/tcp/tcp_module.h
src/stream/tcp/tcp_session.cc
src/stream/udp/stream_udp.cc
src/stream/udp/udp_module.cc
src/stream/udp/udp_module.h
src/stream/udp/udp_session.cc
src/stream/udp/udp_session.h
src/utils/stats.cc

index 2d7b7ba34a62f4d4d4572b8c9ad310af2e6be17c..b3667a6c17db5e86120648e3e3b8b543847e75bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+102
+-- moved stats (peg counts) to module
+-- removed sum() and stats() from InspectApi
+-- tweaked --help-module
+
 101
 -- tweaked startup output
 -- fixed pattern matcher
index 6c48b28be8b490b089d68b69578797d0c14558bd..6cbb1bc19f7c4b73079d0454e37894b89048f82b 100644 (file)
@@ -25,7 +25,7 @@
 # initialization
 #--------------------------------------------------------------------------
 
-AC_INIT([snort], [2.10.101])
+AC_INIT([snort], [2.10.102])
 AC_PREREQ([2.68])
 
 AC_CONFIG_SRCDIR([src/main.h])
index c1182e113e3df8492ab8216a65864cea10e9cb31..947599273585eb23a3248be501085abf9ed73228 100644 (file)
@@ -49,7 +49,7 @@ yet firm so feedback is welcome to get something we can live with.
   write, easier to read, and overall better code.
 
 * Use consistent spacing and linebreaks.  Always indent 4 spaces from the
-  breaking line.  Try to keep lines less than 80 chars; it greatly helps
+  breaking line.  Keep lines less than 100 chars; it greatly helps
   readability.
 
     No:
index b8d64b107ca28c09bb868fbbbb5934c3d3d23cf2..0626f72b372e7a6954651b5d113911047dd4bbe7 100644 (file)
@@ -31,6 +31,8 @@ struct SimpleStats
     PegCount total_packets;
 };
 
+extern const char* simple_pegs[];
+
 #define array_size(a) (sizeof(a)/sizeof(a[0]))
 
 #endif
index 1973d2451d3c6ac04005c4bf27186f3536d8cbf7..a8043f78e6b31bdf5bf00538559248e7ae8e5713 100644 (file)
@@ -154,8 +154,6 @@ struct InspectApi
     InspectFunc pinit;     // plugin thread local allocation
     InspectFunc pterm;     // plugin thread local cleanup
     InspectSsnFunc ssn;    // purge caches
-    InspectFunc sum;       // accumulate stats
-    InspectFunc stats;     // output stats
     InspectFunc reset;     // clear stats
 };
 
index f08422d76ab7ca8a51b724eafcd9ab32b29f44a6..d3e39dcac0d7904c6cda719ae23ea355807bb9d1 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "module.h"
 #include "parameter.h"
+#include "utils/stats.h"
 
 static const Parameter null_params[] =
 {
@@ -33,6 +34,7 @@ void Module::init(const char* s)
     list = false;
     cmds = nullptr;
     rules = nullptr;
+    num_counts = -1;
 }
 
 Module::Module(const char* s)
@@ -47,3 +49,49 @@ Module::Module(const char* s, const Parameter* p, bool is_list)
     list = is_list;
 }
 
+void Module::sum_stats()
+{
+    if ( num_counts < 0 )
+        reset_stats();
+
+    PegCount* p = get_counts();
+
+    if ( !p )
+        return;
+
+    for ( int i = 0; i < num_counts; i++ )
+    {
+        counts[i] += p[i];
+        p[i] = 0;
+    }
+}
+
+void Module::show_stats()
+{
+    if ( num_counts > 0 )
+        ::show_stats(get_counts(), get_pegs(), num_counts, get_name());
+}
+
+void Module::reset_stats()
+{
+    num_counts = 0;
+    const char** pegs = get_pegs();
+
+    if ( !pegs )
+        return;
+
+    while ( pegs[num_counts] )
+        ++num_counts;
+
+    counts.resize(num_counts);
+
+    for ( int i = 0; i < num_counts; i++ )
+        counts[i] = 0;
+}
+
+const char* simple_pegs[] =
+{
+    "packets",
+    nullptr
+};
+
index 796948937a3173a6ecbcd84ebeaf022f317b08f3..5ada9b2fee9a29332394e2d185079c03c30f953a 100644 (file)
@@ -30,6 +30,7 @@
 #ifndef MODULE_H
 #define MODULE_H
 
+#include <vector>
 #include <lua.hpp>
 
 #include "framework/value.h"
@@ -103,11 +104,11 @@ public:
     virtual const RuleMap* get_rules() const
     { return nullptr; };
 
-    virtual const char* get_pegs() const
+    virtual const char** get_pegs() const
     { return nullptr; };
 
     // counts and profile are thread local
-    virtual const PegCount* get_counts() const
+    virtual PegCount* get_counts() const
     { return nullptr; };
 
     virtual ProfileStats* get_profile() const
@@ -118,6 +119,10 @@ public:
         unsigned /*index*/, const char*& /*name*/, const char*& /*parent*/) const
     { return nullptr; };
 
+    virtual void sum_stats();
+    virtual void show_stats();
+    virtual void reset_stats();
+
 protected:
     Module(const char* s);
     Module(const char* s, const Parameter* p, bool is_list = false);
@@ -131,6 +136,8 @@ private:
     const Parameter* params;
     const Command* cmds;
     const RuleMap* rules;
+    std::vector<PegCount> counts;
+    int num_counts;
 };
 
 #endif
index dbd8afb31e835a02cc62b26a3a4ec8dccfe11f9c..608fc8fc800f11f1c34359e9196ea60522cfdb3d 100644 (file)
@@ -1006,6 +1006,7 @@ void snort_thread_init(const char* intf)
 
 void snort_thread_term()
 {
+    ModuleManager::accumulate(snort_conf);
     InspectorManager::thread_term(snort_conf);
     IpsManager::clear_options();
     EventManager::close_outputs();
index a7ae2d28615c3562a5518f752f40d0b6413b3e86..1477b8255896f45834917b1f7bfba9cee9b01043 100644 (file)
@@ -382,33 +382,6 @@ static PHClass* GetClass(const char* keyword, FrameworkConfig* fc)
     return NULL;
 }
 
-void InspectorManager::dump_stats (SnortConfig* sc)
-{
-    for ( auto* p : sc->framework_config->clist )
-        if ( p->api.stats )
-            p->api.stats();
-}
-
-void InspectorManager::accumulate (SnortConfig* sc)
-{
-    static mutex stats_mutex;
-    stats_mutex.lock();
-
-    for ( auto* p : sc->framework_config->clist )
-        if ( p->api.sum )
-            p->api.sum();
-
-    pc_sum();
-    stats_mutex.unlock();
-}
-
-void InspectorManager::reset_stats (SnortConfig* sc)
-{
-    for ( auto* p : sc->framework_config->clist )
-        if ( p->api.reset )
-            p->api.reset();
-}
-
 // this is per thread
 void InspectorManager::thread_init(SnortConfig* sc)
 {
@@ -441,8 +414,6 @@ void InspectorManager::thread_term(SnortConfig* sc)
     for ( auto* p : sc->framework_config->clist )
         if ( p->api.pterm )
             p->api.pterm();
-
-    accumulate(sc);
 }
 
 //-------------------------------------------------------------------------
index c554ca944a75015dbe15aa7d3834216cfb2f5b1b..a70d03091cbbf3080ff67673e68b840f57d471e2 100644 (file)
@@ -46,10 +46,6 @@ public:
     static void new_config(SnortConfig*);
     static void delete_config(SnortConfig*);
 
-    static void dump_stats(SnortConfig*);
-    static void accumulate(SnortConfig*);
-    static void reset_stats(SnortConfig*);
-
     static void instantiate(const InspectApi*, Module*, SnortConfig*);
     static Inspector* get_inspector(const char* key);
     static void free_inspector(Inspector*);
index 2bae2810c604696482fc84f003f429f9ad7d2491..32181f7647a6bee69763914026ddd5648cece3e3 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <iostream>
 #include <list>
+#include <mutex>
 #include <string>
 #include <sstream>
 #include <lua.hpp>
@@ -492,6 +493,50 @@ void ModuleManager::dump_modules()
             d.dump(p->mod->get_name());
 }
 
+void ModuleManager::show_module(bool markup, const char* name)
+{
+    s_modules.sort(comp_gids);
+    s_markup = markup;
+
+    for ( auto p : s_modules )
+    {
+        const Module* m = p->mod;
+        assert(m);
+
+        if ( strcmp(m->get_name(), name) )
+            continue;
+
+        LogMessage("\nModule: %s\n", name);
+
+        if ( const Parameter* p = m->get_parameters() )
+        {
+            if ( p->type < Parameter::PT_MAX )
+            {
+                LogMessage("\nConfiguration:\n");
+                show_configs(markup, name);
+            }
+        }
+
+        if ( m->get_commands() )
+        {
+            LogMessage("\nCommands:\n");
+            show_commands(markup, name);
+        }
+
+        if ( m->get_rules() )
+        {
+            LogMessage("\nRules:\n");
+            show_rules(markup, name);
+        }
+
+        if ( m->get_pegs() )
+        {
+            LogMessage("\nPeg counts:\n");
+            show_pegs(markup, name);
+        }
+    }
+}
+
 void ModuleManager::show_configs(bool markup, const char* pfx)
 {
     s_modules.sort(comp_mods);
@@ -585,6 +630,37 @@ void ModuleManager::show_gids(bool markup, const char* pfx)
     }    
 }
 
+void ModuleManager::show_pegs(bool markup, const char* pfx)
+{
+    s_modules.sort(comp_gids);
+    s_markup = markup;
+    unsigned len = pfx ? strlen(pfx) : 0;
+
+    for ( auto p : s_modules )
+    {
+        const Module* m = p->mod;
+        assert(m);
+
+        if ( pfx && strncmp(m->get_name(), pfx, len) )
+            continue;
+
+        const char** pegs = m->get_pegs();
+
+        if ( !pegs )
+            continue;
+
+        while ( *pegs )
+        {
+            cout << item();
+            cout << emphasis_on();
+            cout << *pegs;
+            cout << emphasis_off();
+            cout << endl;
+            ++pegs;
+        }
+    }    
+}
+
 void ModuleManager::show_rules(bool markup, const char* pfx)
 {
     s_modules.sort(comp_gids);
@@ -652,3 +728,27 @@ void ModuleManager::load_rules(SnortConfig* sc)
     pop_parse_location();
 }
 
+void ModuleManager::dump_stats (SnortConfig*)
+{
+    for ( auto p : s_modules )
+        p->mod->show_stats();
+}
+
+void ModuleManager::accumulate (SnortConfig*)
+{
+    static mutex stats_mutex;
+    stats_mutex.lock();
+
+    for ( auto p : s_modules )
+        p->mod->sum_stats();
+
+    pc_sum();
+    stats_mutex.unlock();
+}
+
+void ModuleManager::reset_stats (SnortConfig*)
+{
+    for ( auto p : s_modules )
+        p->mod->reset_stats();
+}
+
index 2661b06a40d11b7c70cddb092461dfc3bd80dfe0..7dce1a4ff6d099bc06838459939bdd520505bde0 100644 (file)
@@ -36,14 +36,20 @@ public:
     static Module* get_module(const char*);
 
     static void dump_modules();
+    static void show_module(bool markup, const char*);
     static void show_configs(bool markup, const char* = nullptr);
     static void show_commands(bool markup, const char* = nullptr);
     static void show_gids(bool markup, const char* = nullptr);
+    static void show_pegs(bool markup, const char* = nullptr);
     static void show_rules(bool markup, const char* = nullptr);
     static void load_rules(SnortConfig*);
 
     static void set_config(SnortConfig*);
     static unsigned get_errors();
+
+    static void dump_stats(SnortConfig*);
+    static void accumulate(SnortConfig*);
+    static void reset_stats(SnortConfig*);
 };
 
 #endif
index 8a7fbc0a5cd55164a69c42c6ea8c47854cd967ee..f7ece3f9538564ba29162fd07dda9284e92d5fb2 100644 (file)
@@ -32,6 +32,8 @@ static const char* mod_name = "arp_spoof";
 #define ARPSPOOF_ARP_CACHE_OVERWRITE_ATTACK_STR \
     "(arp_spoof) Attempted ARP cache overwrite attack"
 
+THREAD_LOCAL SimpleStats asstats;
+
 //-------------------------------------------------------------------------
 // arp_spoof stuff
 //-------------------------------------------------------------------------
@@ -133,3 +135,10 @@ bool ArpSpoofModule::end(const char*, int idx, SnortConfig*)
     return true;
 }
 
+const char** ArpSpoofModule::get_pegs() const
+{ return simple_pegs; }
+
+PegCount* ArpSpoofModule::get_counts() const
+{ return (PegCount*)&asstats; }
+
+
index 6f55451753231dc98826ea4e5bbb1d4eca3494cf..7390bcef74fb3ef92d702c1c010e770a84a6b77c 100644 (file)
@@ -36,6 +36,7 @@
 #define ARPSPOOF_ETHERFRAME_ARP_MISMATCH_DST  3
 #define ARPSPOOF_ARP_CACHE_OVERWRITE_ATTACK   4
 
+extern THREAD_LOCAL SimpleStats asstats;
 extern THREAD_LOCAL ProfileStats arpPerfStats;
 
 struct IPMacEntry
@@ -71,6 +72,9 @@ public:
         return temp;
     };
 
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
+
     unsigned get_gid() const
     { return GID_ARP_SPOOF; };
 
index 947bb619f6f4de50a73c4fd07b347209c1bca2ee..9dce8fa8455edf047f1e5e90496a7d762939f05d 100644 (file)
@@ -98,9 +98,6 @@ static const uint8_t bcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
 THREAD_LOCAL ProfileStats arpPerfStats;
 
-static THREAD_LOCAL SimpleStats asstats;
-static SimpleStats gasstats;
-
 //-------------------------------------------------------------------------
 // implementation stuff
 //-------------------------------------------------------------------------
@@ -299,15 +296,6 @@ static Inspector* as_ctor(Module* m)
 static void as_dtor(Inspector* p)
 { delete p; }
 
-static void as_sum()
-{ sum_stats(&gasstats, &asstats); }
-
-static void as_stats()
-{ show_stats(&gasstats, MOD_NAME); }
-
-static void as_reset()
-{ memset(&gasstats, 0, sizeof(gasstats)); }
-
 static const InspectApi as_api =
 {
     {
@@ -329,9 +317,7 @@ static const InspectApi as_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    as_sum,
-    as_stats,
-    as_reset
+    nullptr, // reset
 };
 
 #ifdef BUILDING_SO
index decd24445054afa2886147ad87a3e0c959211a32..f581db39febac3c74ae53dd8b3db62ebc0caddd1 100644 (file)
@@ -29,6 +29,8 @@ using namespace std;
 
 #include "binder.h"
 
+THREAD_LOCAL SimpleStats bstats;
+
 //-------------------------------------------------------------------------
 // binder module
 //-------------------------------------------------------------------------
@@ -178,3 +180,9 @@ vector<Binding*> BinderModule::get_data()
     return bindings;  // move semantics
 }
 
+const char** BinderModule::get_pegs() const
+{ return simple_pegs; }
+
+PegCount* BinderModule::get_counts() const
+{ return (PegCount*)&bstats; }
+
index bed393af9d547c18cda9d3958afe67a1aadb2b14..5425fff4e702a13b9961e2ad61b79d2dbca99f8f 100644 (file)
@@ -27,6 +27,7 @@
 #include "framework/module.h"
 #include "main/thread.h"
 
+extern THREAD_LOCAL SimpleStats bstats;
 extern THREAD_LOCAL ProfileStats bindPerfStats;
 struct Binding;
 
@@ -40,6 +41,8 @@ public:
     bool begin(const char*, int, SnortConfig*);
     bool end(const char*, int, SnortConfig*);
 
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
 
     std::vector<Binding*> get_data();
index 6d9e3a78296a1031997c7bf04b117cf6b90aaad7..358ad8a835e2308e087318c1d4db8bbe638e36ee 100644 (file)
@@ -37,8 +37,6 @@ using namespace std;
 static const char* mod_name = "binder";
 
 THREAD_LOCAL ProfileStats bindPerfStats;
-static THREAD_LOCAL SimpleStats tstats;
-static SimpleStats gstats;
 
 //-------------------------------------------------------------------------
 // helpers
@@ -118,7 +116,7 @@ void Binder::eval(Packet* p)
 {
     Flow* flow = p->flow;
     flow->flow_state = check_rules(flow, p);
-    ++tstats.total_packets;
+    ++bstats.total_packets;
 }
 
 // FIXIT implement inspector lookup from policy / bindings
@@ -257,21 +255,6 @@ static void bind_dtor(Inspector* p)
     delete p;
 }
 
-static void bind_sum()
-{
-    sum_stats(&gstats, &tstats);
-}
-
-static void bind_stats()
-{
-    show_stats(&gstats, mod_name);
-}
-
-static void bind_reset()
-{
-    memset(&gstats, 0, sizeof(gstats));
-}
-
 static const InspectApi bind_api =
 {
     {
@@ -293,9 +276,7 @@ static const InspectApi bind_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    bind_sum,
-    bind_stats,
-    bind_reset
+    nullptr  // reset
 };
 
 const BaseApi* nin_binder = &bind_api.base;
index 83970c3a82f210a785f284da8fb38ecb553d119c..52fd8713f8c1e0e91744624659a4df25ab8eaa4c 100644 (file)
@@ -32,6 +32,7 @@
 #include "packet_io/sfdaq.h"
 #include "protocols/ipv4.h"
 #include "protocols/tcp.h"
+#include "stream/stream.h"
 
 typedef enum {
     PC_IP4_TRIM,
@@ -57,25 +58,25 @@ typedef enum {
 } PegCounts;
 
 static const char* pegName[PC_MAX] = {
-    "ip4::trim",
-    "ip4::tos",
-    "ip4::df",
-    "ip4::rf",
-    "ip4::ttl",
-    "ip4::opts",
-    "icmp4::echo",
-    "ip6::ttl",
-    "ip6::opts",
-    "icmp6::echo",
-    "tcp::syn_opt",
-    "tcp::ts_ecr",
-    "tcp::opt",
-    "tcp::pad",
-    "tcp::rsv",
-    "tcp::ecn_pkt",
-    "tcp::ns",
-    "tcp::urg",
-    "tcp::urp"
+    "ip4.trim",
+    "ip4.tos",
+    "ip4.df",
+    "ip4.rf",
+    "ip4.ttl",
+    "ip4.opts",
+    "icmp4.echo",
+    "ip6.ttl",
+    "ip6.opts",
+    "icmp6.echo",
+    "tcp.syn_opt",
+    "tcp.ts_ecr",
+    "tcp.opt",
+    "tcp.pad",
+    "tcp.rsv",
+    "tcp.ecn_pkt",
+    "tcp.ns",
+    "tcp.urg",
+    "tcp.urp"
 };
 
 static THREAD_LOCAL PegCount normStats[PC_MAX];
@@ -516,16 +517,19 @@ static int Norm_TCP (
 void Norm_SumStats (void)
 {
     sum_stats((PegCount*)&gnormStats, (PegCount*)&normStats, array_size(pegName));
+    Stream_SumNormalizationStats();
 }
 
 void Norm_PrintStats (const char* name)
 {
     show_stats((PegCount*)&gnormStats, pegName, array_size(pegName), name);
+    Stream_PrintNormalizationStats();
 }
 
 void Norm_ResetStats (void)
 {
     memset(gnormStats, 0, sizeof(gnormStats));
+    Stream_ResetNormalizationStats();
 }
 
 //-----------------------------------------------------------------------
index 663a174b4b28378776ea138fa26ed961c10d41c0..c17ebb07d6bdda7cd4f01905ec306d712f736d62 100644 (file)
@@ -1,6 +1,6 @@
 /****************************************************************************
  *
-** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved.
+ * Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved.
  * Copyright (C) 2005-2013 Sourcefire, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
index 26f4a3fa995653def106eaab0ed350708d16bc9f..f0ff409fc05f89c54ab3d1973e6d46007a27f062 100644 (file)
@@ -277,3 +277,12 @@ bool NormalizeModule::end(const char*, int, SnortConfig*)
     return true;
 }
 
+void NormalizeModule::sum_stats()
+{ Norm_SumStats(); }
+
+void NormalizeModule::show_stats()
+{ Norm_PrintStats(get_name()); }
+
+void NormalizeModule::reset_stats()
+{ Norm_ResetStats(); }
+
index 4927504b64f12157148ed7bffe97a7d930d4cb19..2d3d766eb03a055162775851c661ac2ef55aa1f0 100644 (file)
@@ -45,6 +45,10 @@ public:
     const NormalizerConfig* get_config()
     { return &config; };
 
+    void sum_stats();
+    void show_stats();
+    void reset_stats();
+
 private:
     bool set_ip4(const char*, Value&, SnortConfig*);
     bool set_tcp(const char*, Value&, SnortConfig*);
index c19271fb1e3b242a3982b8d1288d1953f023a249..2f7cba4edd174b2c1fb5a2dc1bcf81161da92fa0 100644 (file)
 #include "profiler.h"
 #include "snort_types.h"
 #include "snort.h"
-#include "stream/stream.h"
 #include "framework/inspector.h"
 
-THREAD_LOCAL ProfileStats norm_perf_stats;
-
 #define PROTO_BITS (PROTO_BIT__IP|PROTO_BIT__ICMP|PROTO_BIT__TCP)
 
+static const char* name = "normalize";
+
+THREAD_LOCAL ProfileStats norm_perf_stats;
+
 //-------------------------------------------------------------------------
 // printing stuff
 //-------------------------------------------------------------------------
@@ -231,26 +232,6 @@ static Module* mod_ctor()
 static void mod_dtor(Module* m)
 { delete m; }
 
-static const char* name = "normalize";
-
-static void no_sum()
-{
-    Norm_SumStats();
-    Stream_SumNormalizationStats();
-}
-
-static void no_stats()
-{
-    Norm_PrintStats(name);
-    Stream_PrintNormalizationStats();
-}
-
-static void no_reset()
-{
-    Norm_ResetStats();
-    Stream_ResetNormalizationStats();
-}
-
 static Inspector* no_ctor(Module* m)
 {
     return new Normalizer((NormalizeModule*)m);
@@ -282,9 +263,7 @@ static const InspectApi no_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    no_sum,
-    no_stats,
-    no_reset
+    nullptr  // reset
 };
 
 const BaseApi* nin_normalize = &no_api.base;
index 99af51201a51b4888d0943a91248588c4c6233b8..8c74601d3941d63bc4821896f014f82bc3229509 100644 (file)
@@ -174,3 +174,9 @@ void PerfMonModule::get_config(SFPERF& cfg)
     memset(&config, 0, sizeof(config));
 }
 
+const char** PerfMonModule::get_pegs() const
+{ return simple_pegs; }
+
+PegCount* PerfMonModule::get_counts() const
+{ return (PegCount*)&pmstats; }
+
index b61a9a1b906e2dcc6e26e5cd0b1a05a12490f9e4..4fd2e96442c6516fea2f4e853fbd4e4568611bf4 100644 (file)
@@ -25,6 +25,7 @@
 #include "perf.h"
 #include "framework/module.h"
 
+extern THREAD_LOCAL SimpleStats pmstats;
 extern THREAD_LOCAL ProfileStats perfmonStats;
 
 class PerfMonModule : public Module
@@ -35,6 +36,8 @@ public:
     bool set(const char*, Value&, SnortConfig*);
     bool begin(const char*, int, SnortConfig*);
 
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
 
     void get_config(SFPERF&);
index f5a2372be65b8eca60904985cc82bb2fef54ed71..26b0bd95ba935ef228b06ea09b3a1db678e5c1c5 100644 (file)
@@ -57,11 +57,9 @@ THREAD_LOCAL SFPERF *perfmon_config = NULL;
 
 static const char* mod_name = "perf_monitor";
 
+THREAD_LOCAL SimpleStats pmstats;
 THREAD_LOCAL ProfileStats perfmonStats;
 
-static THREAD_LOCAL SimpleStats pmstats;
-static SimpleStats gpmstats;
-
 /* This function changes the perfmon log files permission if exists.
    It is done in the  PerfMonitorInit() before Snort changed its user & group.
  */
@@ -356,21 +354,6 @@ static Inspector* pm_ctor(Module* m)
     return new PerfMonitor((PerfMonModule*)m);
 }
 
-static void pm_sum()
-{
-    sum_stats(&gpmstats, &pmstats);
-}
-
-static void pm_stats()
-{
-    show_stats(&gpmstats, mod_name);
-}
-
-static void pm_reset()
-{
-    memset(&gpmstats, 0, sizeof(gpmstats));
-}
-
 static void pm_dtor(Inspector* p)
 {
     delete p;
@@ -397,9 +380,7 @@ static const InspectApi pm_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    pm_sum,
-    pm_stats,
-    pm_reset
+    nullptr  // reset
 };
 
 const BaseApi* nin_perf_monitor = &pm_api.base;
index 4709f10d81e6113a6c7b22d19fd7d39645355f71..438cac2e2ed6faf872f67f0f2e67a71bbd9d6b70 100644 (file)
 static THREAD_LOCAL Packet* g_tmp_pkt = NULL;
 static THREAD_LOCAL FILE* g_logfile = NULL;
 
+THREAD_LOCAL SimpleStats spstats;
 THREAD_LOCAL ProfileStats psPerfStats;
 
-static THREAD_LOCAL SimpleStats spstats;
-static SimpleStats gspstats;
-
 /*
 **  NAME
 **    MakeProtoInfo::
@@ -985,20 +983,9 @@ static void sp_dtor(Inspector* p)
     delete p;
 }
 
-static void sp_sum()
-{
-    sum_stats(&gspstats, &spstats);
-}
-
-static void sp_stats()
-{
-    show_stats(&gspstats, PS_MODULE);
-}
-
 static void sp_reset()
 {
     ps_reset();
-    memset(&gspstats, 0, sizeof(gspstats));
 }
 
 static const InspectApi sp_api =
@@ -1022,8 +1009,6 @@ static const InspectApi sp_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    sp_sum,
-    sp_stats,
     sp_reset
 };
 
index 9598139a470ac76aed61ad7be32a7bc9a5376ad9..951e9aaeded587172467149f66b2731258c10763 100644 (file)
@@ -245,3 +245,9 @@ PsCommon* PortScanGlobalModule::get_data()
     return tmp;
 }
 
+const char** PortScanGlobalModule::get_pegs() const
+{ return simple_pegs; }
+
+PegCount* PortScanGlobalModule::get_counts() const
+{ return (PegCount*)&spstats; }
+
index 5397bb119b4024c535ce3878a71c502cd0542751..91cc00c7b59609fb94eca0fff9c4eb6e1c3effb4 100644 (file)
@@ -31,6 +31,7 @@
 #define PS_MODULE "port_scan"
 #define PS_GLOBAL "port_scan_global"
 
+extern THREAD_LOCAL SimpleStats spstats;
 extern THREAD_LOCAL ProfileStats psPerfStats;
 
 //-------------------------------------------------------------------------
@@ -44,6 +45,8 @@ public:
     bool set(const char*, Value&, SnortConfig*);
     bool begin(const char*, int, SnortConfig*);
 
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
     PsCommon* get_data();
 
index ea6de8a2e39ba10d358d711cd37bb57ac91ef839..460c17ff1362b6153b8824634db4783629a1550c 100644 (file)
@@ -280,9 +280,7 @@ static void show_help(SnortConfig* sc, const char* val, HelpType ht)
         ModuleManager::show_rules(s_markup, val);
         break;
     case HT_MOD:
-        ModuleManager::show_configs(s_markup, val);
-        ModuleManager::show_commands(s_markup, val);
-        ModuleManager::show_rules(s_markup, val);
+        ModuleManager::show_module(s_markup, val);
         break;
     case HT_BUF:
         InspectorManager::dump_buffers();
@@ -797,7 +795,7 @@ static ConfigFunc basic_opts[] =
       "<module prefix> output matching generators" },
 
     { "help-module", config_help_module,
-      "output config, commands, and builtin rules for given module" },
+      "output description of given module" },
 
     { "help-options", config_help_options,
       "<option prefix> (same as --help)" },
index ec8509faa6d8b92d9bdb4a6c20e9c9eefe055113..8a2828083e1354d845168dd2202f6888d67fe547 100644 (file)
@@ -153,9 +153,7 @@ static uint16_t lookup1[65536][3];
 static uint16_t lookup2[65536];
 
 static THREAD_LOCAL ProfileStats boPerfStats;
-
 static THREAD_LOCAL SimpleStats bostats;
-static SimpleStats gbostats;
 
 //-------------------------------------------------------------------------
 // bo module
@@ -199,9 +197,17 @@ public:
     unsigned get_gid() const
     { return GID_BO; };
 
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
 };
 
+const char** BoModule::get_pegs() const
+{ return simple_pegs; }
+
+PegCount* BoModule::get_counts() const
+{ return (PegCount*)&bostats; }
+
 ProfileStats* BoModule::get_profile() const
 { return &boPerfStats; }
 
@@ -585,21 +591,6 @@ static void bo_dtor(Inspector* p)
     delete p;
 }
 
-static void bo_sum()
-{
-    sum_stats(&gbostats, &bostats);
-}
-
-static void bo_stats()
-{
-    show_stats(&gbostats, mod_name);
-}
-
-static void bo_reset()
-{
-    memset(&gbostats, 0, sizeof(gbostats));
-}
-
 static const InspectApi bo_api =
 {
     {
@@ -621,9 +612,7 @@ static const InspectApi bo_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    bo_sum,
-    bo_stats,
-    bo_reset
+    nullptr  // reset
 };
 
 #ifdef BUILDING_SO
index 0fe33b1605f3eba63d9dc1ad5363d10ac812cd13..555ee535c04133f3dd85a129e708a5d401e5d14e 100644 (file)
@@ -58,9 +58,7 @@ static const char* client_key = "ftp_client";
 static const char* server_key = "ftp_server";
 
 THREAD_LOCAL ProfileStats ftpPerfStats;
-
-static THREAD_LOCAL SimpleStats ftstats;
-static SimpleStats gftstats;
+THREAD_LOCAL SimpleStats ftstats;
 
 static FTP_CLIENT_PROTO_CONF* bind_client = nullptr;
 static FTP_SERVER_PROTO_CONF* bind_server = nullptr;
@@ -502,21 +500,6 @@ static void fs_dtor(Inspector* p)
     delete p;
 }
 
-static void fs_sum()
-{
-    sum_stats(&gftstats, &ftstats);
-}
-
-static void fs_stats()
-{
-    show_stats(&gftstats, server_key);
-}
-
-static void fs_reset()
-{
-    memset(&gftstats, 0, sizeof(gftstats));
-}
-
 static const InspectApi fs_api =
 {
     {
@@ -539,9 +522,7 @@ static const InspectApi fs_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    fs_sum,
-    fs_stats,
-    fs_reset
+    nullptr  // reset
 };
 
 #ifdef BUILDING_SO
index d7e6c3d7ec7f527ed0129384b03653ae1affead8..7cbc3a58222694150d7c05bf2351cb316ec7765a 100644 (file)
@@ -55,9 +55,7 @@
 static const char* data_key = "ftp_data";
 
 static THREAD_LOCAL ProfileStats ftpdataPerfStats;
-
 static THREAD_LOCAL SimpleStats fdstats;
-static SimpleStats gfdstats;
 
 //-------------------------------------------------------------------------
 // implementation stuff
@@ -222,12 +220,20 @@ class FtpDataModule : public Module
 public:
     FtpDataModule() : Module(data_key, fd_params) { };
 
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
 
     bool set(const char*, Value&, SnortConfig*)
     { return false; };
 };
 
+const char** FtpDataModule::get_pegs() const
+{ return simple_pegs; }
+
+PegCount* FtpDataModule::get_counts() const
+{ return (PegCount*)&fdstats; }
+
 ProfileStats* FtpDataModule::get_profile() const
 { return &ftpdataPerfStats; }
 
@@ -252,12 +258,12 @@ void FtpData::eval(Packet* p)
 // api stuff
 //-------------------------------------------------------------------------
 
-static void mod_dtor(Module* m)
-{ delete m; }
-
 static Module* mod_ctor()
 { return new FtpDataModule; }
 
+static void mod_dtor(Module* m)
+{ delete m; }
+
 static void fd_init()
 {
     FtpDataFlowData::init();
@@ -273,21 +279,6 @@ static void fd_dtor(Inspector* p)
     delete p;
 }
 
-static void fd_sum()
-{
-    sum_stats(&gfdstats, &fdstats);
-}
-
-static void fd_stats()
-{
-    show_stats(&gfdstats, data_key);
-}
-
-static void fd_reset()
-{
-    memset(&gfdstats, 0, sizeof(gfdstats));
-}
-
 // exported in ftp.cc
 const InspectApi fd_api =
 {
@@ -310,8 +301,6 @@ const InspectApi fd_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    fd_sum,
-    fd_stats,
-    fd_reset
+    nullptr  // reset
 };
 
index 13c91fb5896129a27769851359f7a08528f05032..e8757a218ab90e5fb37bef4e4f2a34b63b0fd2c0 100644 (file)
@@ -490,3 +490,9 @@ bool FtpServerModule::end(const char* fqn, int idx, SnortConfig*)
     return true;
 }
 
+const char** FtpServerModule::get_pegs() const
+{ return simple_pegs; }
+
+PegCount* FtpServerModule::get_counts() const
+{ return (PegCount*)&ftstats; }
+
index ad5887151f412e1de72c477ea83db799f1b1bf68..4804956c285a9d6c4ee84db6522e01d6c4348e31 100644 (file)
@@ -43,6 +43,7 @@
 
 struct SnortConfig;
 
+extern THREAD_LOCAL SimpleStats ftstats;
 extern THREAD_LOCAL ProfileStats ftpPerfStats;
 
 //-------------------------------------------------------------------------
@@ -117,6 +118,8 @@ public:
     { return GID_FTP; };
 
     const RuleMap* get_rules() const;
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
 
     FTP_SERVER_PROTO_CONF* get_data();
index 3bf5d7e091dd902bc9114f79c8b3982cd98bbef0..c6e3497bfdc3fa2908b0866a170a09d7d5c51622 100644 (file)
@@ -49,9 +49,7 @@
 static const char* tn_name = "telnet";
 
 THREAD_LOCAL ProfileStats telnetPerfStats;
-
-static THREAD_LOCAL SimpleStats tnstats;
-static SimpleStats gtnstats;
+THREAD_LOCAL SimpleStats tnstats;
 
 //-------------------------------------------------------------------------
 // implementation
@@ -300,21 +298,6 @@ static void tn_dtor(Inspector* p)
     delete p;
 }
 
-static void tn_sum()
-{
-    sum_stats(&gtnstats, &tnstats);
-}
-
-static void tn_stats()
-{
-    show_stats(&gtnstats, tn_name);
-}
-
-static void tn_reset()
-{
-    memset(&gtnstats, 0, sizeof(gtnstats));
-}
-
 // exported in ftp.cc
 const InspectApi tn_api =
 {
@@ -337,8 +320,6 @@ const InspectApi tn_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    tn_sum,
-    tn_stats,
-    tn_reset,
+    nullptr  // reset
 };
 
index 5e570bce99b5b0de94804aeea9b4892b3b58000b..61a53933cfabad9f6ed73a0ff5bd78302a4fabf9 100644 (file)
@@ -124,3 +124,9 @@ bool TelnetModule::end(const char*, int, SnortConfig*)
     return true;
 }
 
+const char** TelnetModule::get_pegs() const
+{ return simple_pegs; }
+
+PegCount* TelnetModule::get_counts() const
+{ return (PegCount*)&tnstats; }
+
index 0f74e21e39e5c50c939e0d59b811a9306dbdb971..239788d03d4f3a4d3abaf7f8c52a7f6f8819b9ad 100644 (file)
@@ -34,6 +34,7 @@
 
 struct SnortConfig;
 
+extern THREAD_LOCAL SimpleStats tnstats;
 extern THREAD_LOCAL ProfileStats telnetPerfStats;
 
 class TelnetModule : public Module
@@ -50,6 +51,8 @@ public:
     { return GID_TELNET; };
 
     const RuleMap* get_rules() const;
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
 
     TELNET_PROTO_CONF* get_data();
index 2bcd46101822d4536a15aab155fea2ecc7675632..c0ebe5b64af650747027763635606b267e666407 100644 (file)
@@ -57,6 +57,7 @@ typedef struct _hi_stats {
 } HIStats;
 
 extern THREAD_LOCAL HIStats hi_stats;
+extern const char* peg_names[];
 
 #endif
 
index 0bb946eac0e67794848b8c8d4697f2b445e61c9c..a5d58fb5ad53f6495f76d19f06c0aeb3fba164dc 100644 (file)
@@ -155,6 +155,12 @@ const RuleMap* HttpInspectModule::get_rules() const
 ProfileStats* HttpInspectModule::get_profile() const
 { return &hiPerfStats; }
 
+const char** HttpInspectModule::get_pegs() const
+{ return peg_names; }
+
+PegCount* HttpInspectModule::get_counts() const
+{ return (PegCount*)&hi_stats; }
+
 HTTPINSPECT_GLOBAL_CONF* HttpInspectModule::get_data()
 {
     HTTPINSPECT_GLOBAL_CONF* tmp = config;
index 951c5b256b273d9a01e290b274f65f0892b3762e..82216e0f4572f35658f11c700494a68ca97595d3 100644 (file)
@@ -45,6 +45,8 @@ public:
     { return GID_HTTP_CLIENT; };
 
     const RuleMap* get_rules() const;
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
 
     HTTPINSPECT_GLOBAL_CONF* get_data();
index 5f916881995a4c57be68c4fe29eccffabe3d6475..0c7a987a50c98a1cdd00d8cb9e64d081e2b9f38c 100644 (file)
@@ -83,9 +83,7 @@ int valid_lookup[256];
 THREAD_LOCAL ProfileStats hiPerfStats;
 THREAD_LOCAL ProfileStats hiDetectPerfStats;
 
-static HIStats ghi_stats;
-
-static const char* peg_names[] =
+const char* peg_names[] =
 {
     "packets",
     "gets",
@@ -424,22 +422,6 @@ static void hs_dtor(Inspector* p)
     delete p;
 }
 
-static void hs_sum()
-{
-    sum_stats((PegCount*)&ghi_stats, (PegCount*)&hi_stats, array_size(peg_names));
-}
-
-static void hs_stats()
-{
-    show_stats((PegCount*)&ghi_stats, peg_names, array_size(peg_names),
-        SERVER_KEYWORD);
-}
-
-static void hs_reset()
-{
-    memset(&ghi_stats, 0, sizeof(ghi_stats));
-}
-
 //-------------------------------------------------------------------------
 
 static const char* buffers[] =
@@ -478,9 +460,7 @@ static const InspectApi hs_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    hs_sum,
-    hs_stats,
-    hs_reset
+    nullptr  // reset
 };
 
 #ifdef BUILDING_SO
index a62a987dfb4cb98be6a385e9e6934704cda675cc..ee63a7e237022e70eed9cc5370403c44cc12edc9 100644 (file)
@@ -85,10 +85,8 @@ const InspectApi NHttpApi::nhttp_api =
     NHttpApi::nhttp_dtor,
     NHttpApi::nhttp_pinit,
     NHttpApi::nhttp_pterm,
-    nullptr,
-    NHttpApi::nhttp_sum,
-    NHttpApi::nhttp_stats,
-    NHttpApi::nhttp_reset
+    nullptr, // ssn
+    nullptr  // reset
 };
 
 #ifdef BUILDING_SO
index 7a4e82211df7546809054fd0ff773c897bf646d3..3d4df3cd5856e9d43ba96eeb02c9eaf418ee6a19 100644 (file)
@@ -49,9 +49,6 @@ private:
     static void nhttp_dtor(Inspector* p) { delete p; };
     static void nhttp_pinit() {};
     static void nhttp_pterm() {};
-    static void nhttp_sum() {};
-    static void nhttp_stats() {};
-    static void nhttp_reset() {};
 };
 
 #endif
index 37add49c232c6d5ed435ae719699a938bc0faffb..bbc129e95bee03be3b4466bc4bc6a607b0765237 100644 (file)
@@ -125,9 +125,7 @@ static THREAD_LOCAL uint32_t rpc_memory = 0;
 static const char* mod_name = "rpc_decode";
 
 THREAD_LOCAL ProfileStats rpcdecodePerfStats;
-
-static THREAD_LOCAL SimpleStats rdstats;
-static SimpleStats grdstats;
+THREAD_LOCAL SimpleStats rdstats;
 
 static int ConvertRPC(RpcDecodeConfig *, RpcSsnData *, Packet *);
 
@@ -1100,21 +1098,6 @@ static void rd_dtor(Inspector* p)
     delete p;
 }
 
-static void rd_sum()
-{
-    sum_stats(&grdstats, &rdstats);
-}
-
-static void rd_stats()
-{
-    show_stats(&grdstats, mod_name);
-}
-
-static void rd_reset()
-{
-    memset(&grdstats, 0, sizeof(grdstats));
-}
-
 static const InspectApi rd_api =
 {
     {
@@ -1136,9 +1119,7 @@ static const InspectApi rd_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    rd_sum,
-    rd_stats,
-    rd_reset
+    nullptr  // reset
 };
 
 #ifdef BUILDING_SO
index 9431a96f2d6ab49bede6055cab47e3b2d7bd099f..eb76cb440f6d566e28ca56f2380eca813d78d873 100644 (file)
@@ -59,6 +59,12 @@ RpcModule::RpcModule() : Module("rpc_decode", rpc_params)
 const RuleMap* RpcModule::get_rules() const
 { return rpc_rules; }
 
+const char** RpcModule::get_pegs() const
+{ return simple_pegs; }
+
+PegCount* RpcModule::get_counts() const
+{ return (PegCount*)&rdstats; }
+
 ProfileStats* RpcModule::get_profile() const
 { return &rpcdecodePerfStats; }
 
index f2ead7748fef1d6a97c3594ffd9fd6d35e911db3..9b602f56210c3c6169f8aea27d5be5b32ea2cf72 100644 (file)
@@ -34,6 +34,7 @@
 #define RPC_INCOMPLETE_SEGMENT     4
 #define RPC_ZERO_LENGTH_FRAGMENT   5
 
+extern THREAD_LOCAL SimpleStats rdstats;
 extern THREAD_LOCAL ProfileStats rpcdecodePerfStats;
 
 class RpcModule : public Module
@@ -48,6 +49,8 @@ public:
     { return GID_RPC_DECODE; };
 
     const RuleMap* get_rules() const;
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
 };
 
index d427e881e9e59673986ad1236990696e46b776a7..8db0d5380f5c3788fbfb576774b22db9b3c8d964 100644 (file)
@@ -216,3 +216,9 @@ MagicBook* WizardModule::get_book(bool c2s, bool hex)
     return hex ? s2c_hexes : s2c_spells;
 }
 
+const char** WizardModule::get_pegs() const
+{ return wiz_pegs; }
+
+PegCount* WizardModule::get_counts() const
+{ return (PegCount*)&tstats; }
+
index efe2e077fc01869ab9bca8bf3a631043c75f153a..ffbe9ffa94720f691716463374b569da0fb40438 100644 (file)
@@ -27,6 +27,8 @@
 #include "framework/module.h"
 #include "main/thread.h"
 
+extern const char* wiz_pegs[];
+extern THREAD_LOCAL struct WizStats tstats;
 extern THREAD_LOCAL ProfileStats wizPerfStats;
 
 class MagicBook;
@@ -41,6 +43,8 @@ public:
     bool begin(const char*, int, SnortConfig*);
     bool end(const char*, int, SnortConfig*);
 
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     ProfileStats* get_profile() const;
 
     MagicBook* get_book(bool c2s, bool hex);
index f25f4d35137dc8ced3b57c450316463c88e7d973..d625f6fd47ef02bd64ee9f8f2041d7a13ac86d9b 100644 (file)
@@ -48,16 +48,16 @@ struct WizStats
     PegCount udp_hits;
 };
 
-static const char* wiz_pegs[] =
+const char* wiz_pegs[] =
 {
     "tcp scans",
     "tcp hits",
     "udp scans",
-    "udp hits"
+    "udp hits",
+    nullptr
 };
 
-static THREAD_LOCAL WizStats tstats;
-static WizStats gstats;
+THREAD_LOCAL WizStats tstats;
 
 //-------------------------------------------------------------------------
 // configuration
@@ -237,21 +237,6 @@ static void wiz_dtor(Inspector* p)
     delete p;
 }
 
-static void wiz_sum()
-{
-    sum_stats((PegCount*)&gstats, (PegCount*)&tstats, array_size(wiz_pegs));
-}
-
-static void wiz_stats()
-{
-    show_stats((PegCount*)&gstats, wiz_pegs, array_size(wiz_pegs), mod_name);
-}
-
-static void wiz_reset()
-{
-    memset(&gstats, 0, sizeof(gstats));
-}
-
 static const InspectApi wiz_api =
 {
     {
@@ -273,9 +258,7 @@ static const InspectApi wiz_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    wiz_sum,
-    wiz_stats,
-    wiz_reset
+    nullptr  // reset
 };
 
 #ifdef BUILDING_SO
index 756c059830971605fae6d4166dd99f666fe60328..869ca6d6d0f79927de596ba1c598eef92ba89f77 100644 (file)
@@ -40,7 +40,7 @@
 #include "profiler.h"
 
 //-------------------------------------------------------------------------
-// globals
+// stats
 //-------------------------------------------------------------------------
 
 THREAD_LOCAL ProfileStats s5PerfStats;
@@ -54,7 +54,8 @@ const char* session_pegs[] =
     "created",
     "released",
     "discards",
-    "events"
+    "events",
+    nullptr
 };
 
 const unsigned session_peg_count = array_size(session_pegs);
@@ -78,6 +79,29 @@ static const char* base_pegs[] =
     "ip flows"
 };
 
+void base_sum()
+{   
+    t_stats.tcp = flow_con->get_flow_count(IPPROTO_TCP);
+    t_stats.udp = flow_con->get_flow_count(IPPROTO_UDP);
+    t_stats.icmp = flow_con->get_flow_count(IPPROTO_ICMP);
+    t_stats.ip = flow_con->get_flow_count(IPPROTO_IP);
+
+    sum_stats((PegCount*)&g_stats, (PegCount*)&t_stats,
+        array_size(base_pegs));
+}   
+    
+void base_stats()
+{   
+    show_stats((PegCount*)&g_stats, base_pegs, array_size(base_pegs),
+        MOD_NAME);
+}
+
+void base_reset()
+{
+    flow_con->clear_flow_counts();
+    memset(&t_stats, 0, sizeof(t_stats));
+}
+
 //-------------------------------------------------------------------------
 // runtime support
 //-------------------------------------------------------------------------
@@ -245,29 +269,6 @@ static void base_dtor(Inspector* p)
     delete p;
 }
 
-void base_sum()
-{   
-    t_stats.tcp = flow_con->get_flow_count(IPPROTO_TCP);
-    t_stats.udp = flow_con->get_flow_count(IPPROTO_UDP);
-    t_stats.icmp = flow_con->get_flow_count(IPPROTO_ICMP);
-    t_stats.ip = flow_con->get_flow_count(IPPROTO_IP);
-
-    sum_stats((PegCount*)&g_stats, (PegCount*)&t_stats,
-        array_size(base_pegs));
-}   
-    
-void base_stats()
-{   
-    show_stats((PegCount*)&g_stats, base_pegs, array_size(base_pegs),
-        MOD_NAME);
-}
-
-void base_reset()
-{
-    flow_con->clear_flow_counts();
-    memset(&t_stats, 0, sizeof(t_stats));
-}
-
 static const InspectApi base_api =
 {
     {
@@ -289,9 +290,7 @@ static const InspectApi base_api =
     nullptr, // pinit
     nullptr, // pterm
     nullptr, // ssn
-    base_sum,
-    base_stats,
-    base_reset
+    nullptr  // reset
 };
 
 const BaseApi* nin_stream_base = &base_api.base;
index f0c8012c501996bf8dc761f78f72523b44f14c4d..df89bddc6de764e704e429802dd45a9ca1b8b306 100644 (file)
@@ -130,3 +130,12 @@ bool StreamModule::begin(const char* fqn, int, SnortConfig*)
     return true;
 }
 
+void StreamModule::sum_stats()
+{ base_sum(); }
+
+void StreamModule::show_stats()
+{ base_stats(); }
+
+void StreamModule::reset_stats()
+{ base_reset(); }
+
index da2e34efe2f490ee07b964a24c5af965f208883c..bb60be43170efa27ad4fd7c2c3869fa4c7142168 100644 (file)
@@ -54,9 +54,17 @@ public:
     ProfileStats* get_profile() const;
     const StreamConfig* get_data();
 
+    void sum_stats();
+    void show_stats();
+    void reset_stats();
+
 private:
     FlowConfig* proto;
 };
 
+extern void base_sum();
+extern void base_stats();
+extern void base_reset();
+
 #endif
 
index d8569fe2ace879626f924fded0b7e9e8b24f71cb..864970143993c793609296f4e303d9260770b85a 100644 (file)
@@ -79,3 +79,9 @@ bool StreamIcmpModule::end(const char*, int, SnortConfig*)
     return true;
 }
 
+const char** StreamIcmpModule::get_pegs() const
+{ return session_pegs; }
+
+PegCount* StreamIcmpModule::get_counts() const
+{ return (PegCount*)&icmpStats; }
+
index d0b03145c26a5981e0300f165752c320aa53b18e..afc894e02ccef1ad870cef201d860f93615821b1 100644 (file)
 #include "snort_types.h"
 #include "framework/module.h"
 #include "main/thread.h"
+#include "stream/stream.h"
 
+extern THREAD_LOCAL SessionStats icmpStats;
 extern THREAD_LOCAL ProfileStats icmp_perf_stats;
+
 struct SnortConfig;
 
 //-------------------------------------------------------------------------
@@ -46,6 +49,8 @@ public:
     bool end(const char*, int, SnortConfig*);
 
     ProfileStats* get_profile() const;
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     StreamIcmpConfig* get_data();
 
 private:
index 33199f680a882a6732a151992f4387415b4574fa..c36177ee340e37f71367e53b9e4bd7b5807e6b39 100644 (file)
@@ -43,9 +43,7 @@
 #include "protocols/layer.h"
 #include "protocols/vlan.h"
 
-static SessionStats gicmpStats;
-static THREAD_LOCAL SessionStats icmpStats;
-
+THREAD_LOCAL SessionStats icmpStats;
 THREAD_LOCAL ProfileStats icmp_perf_stats;
 
 //------------------------------------------------------------------------
@@ -234,20 +232,14 @@ void IcmpSession::update_direction(char dir, snort_ip* ip, uint16_t)
 // api related methods
 //-------------------------------------------------------------------------
 
-void icmp_sum()
-{
-    sum_stats((PegCount*)&gicmpStats, (PegCount*)&icmpStats,
-        session_peg_count);
-}
-
+#if 0
 void icmp_stats()
 {
+    // FIXIT move these to the actual owner
     // FIXIT need to get these before delete flow_con
     //flow_con->get_prunes(IPPROTO_UDP, icmpStats.prunes);
-
-    show_stats((PegCount*)&gicmpStats, session_pegs, session_peg_count,
-        MOD_NAME);
 }
+#endif
 
 void icmp_reset()
 {
index 753f527aea2fe663d0ddeb1d7fb291ac94110db1..f607ebe2ce9f6762ebd73f646087639c83354dea 100644 (file)
@@ -40,7 +40,6 @@ public:
     struct timeval ssn_time;
 };
 
-void icmp_sum();
 void icmp_stats();
 void icmp_reset();
 
index 40a040f68b9c298d5dde7dcfc62a6252f5a188fd..b66a681b77032f1f5c9c77f859c858da3d65d086 100644 (file)
@@ -131,8 +131,6 @@ static const InspectApi icmp_api =
     nullptr, // pinit
     nullptr, // pterm
     icmp_ssn,
-    icmp_sum,
-    icmp_stats,
     icmp_reset
 };
 
index b132eb7a04d2e07cac5e8f7b6b296ae000765c48..a9778ab9b1c52a6d940d552e4411b8c43c22da3f 100644 (file)
@@ -25,6 +25,7 @@
 using namespace std;
 
 #include "stream_ip.h"
+#include "ip_defrag.h"
 #include "main/snort_config.h"
 #include "stream/stream.h"
 
@@ -212,3 +213,18 @@ bool StreamIpModule::end(const char*, int, SnortConfig*)
     return true;
 }
 
+const char** StreamIpModule::get_pegs() const
+{ return session_pegs; }
+
+PegCount* StreamIpModule::get_counts() const
+{ return (PegCount*)&ipStats; }
+
+void StreamIpModule::sum_stats()
+{ Defrag::sum(); }
+
+void StreamIpModule::show_stats()
+{ Defrag::stats(); }
+
+void StreamIpModule::reset_stats()
+{ Defrag::reset(); }
+
index b0aec0339c35d0c4e2f04224ce64a99ff67a66cf..4bb4edcfcc996adbc1036d6ff8ddb28111f1d094 100644 (file)
@@ -25,6 +25,7 @@
 #include "snort_types.h"
 #include "framework/module.h"
 #include "main/thread.h"
+#include "stream/stream.h"
 
 struct SnortConfig;
 
@@ -54,6 +55,7 @@ struct SnortConfig;
 #define DEFRAG_EXCESSIVE_OVERLAP  12
 #define DEFRAG_TINY_FRAGMENT      13
 
+extern THREAD_LOCAL SessionStats ipStats;
 extern THREAD_LOCAL ProfileStats ip_perf_stats;
 extern THREAD_LOCAL ProfileStats fragPerfStats;
 extern THREAD_LOCAL ProfileStats fragInsertPerfStats;
@@ -79,8 +81,17 @@ public:
 
     const RuleMap* get_rules() const;
     ProfileStats* get_profile(unsigned, const char*&, const char*&) const;
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     StreamIpConfig* get_data();
 
+    unsigned get_gid() const
+    { return GID_DEFRAG; };
+
+    void sum_stats();
+    void show_stats();
+    void reset_stats();
+
 private:
     StreamIpConfig* config;
 };
index 41bcefd4ff33374190e7084e4e94b65e3d67ad87..83ecf961208fd2ad4c0d3f73e071c48c59e923c8 100644 (file)
@@ -33,9 +33,7 @@
 #include "perf_monitor/perf.h"
 #include "flow/flow_control.h"
 
-static SessionStats gipStats;
-static THREAD_LOCAL SessionStats ipStats;
-
+THREAD_LOCAL SessionStats ipStats;
 THREAD_LOCAL ProfileStats ip_perf_stats;
 
 //-------------------------------------------------------------------------
@@ -184,29 +182,3 @@ int IpSession::process(Packet* p)
     return 0;
 }
 
-//-------------------------------------------------------------------------
-// api related methods
-//-------------------------------------------------------------------------
-
-void ip_sum()
-{
-    sum_stats((PegCount*)&gipStats, (PegCount*)&ipStats, session_peg_count);
-    Defrag::sum();
-}
-
-void ip_stats()
-{
-    // FIXIT need to get these before delete flow_con
-    //flow_con->get_prunes(IPPROTO_UDP, ipStats.prunes);
-
-    show_stats((PegCount*)&gipStats, session_pegs, session_peg_count, MOD_NAME);
-    Defrag::stats();
-}
-
-void ip_reset()
-{
-    memset(&ipStats, 0, sizeof(ipStats));
-    flow_con->reset_prunes(IPPROTO_IP);
-    Defrag::reset();
-}
-
index 279a3e83b9ca81c93a9622798b6235d541b2be49..09a667d9b05aa757d0fafa3a4b0ff58594f55a77 100644 (file)
@@ -178,9 +178,7 @@ static const InspectApi ip_api =
     nullptr, // pinit
     nullptr, // pterm
     ip_ssn,
-    ip_sum,
-    ip_stats,
-    ip_reset
+    nullptr  // reset
 };
 
 const BaseApi* nin_stream_ip = &ip_api.base;
index 51bc415c615e6afe4d4ed7ceb1ee9a20c3d4e85a..3b9d624e363d67ea0f27352d1d6ec910c2583ee2 100644 (file)
@@ -53,10 +53,6 @@ struct StreamIpConfig
     StreamIpConfig();
 };
 
-void ip_sum();
-void ip_stats();
-void ip_reset();
-
 StreamIpConfig* get_ip_cfg(Inspector*);
 class Defrag* get_defrag(Inspector*);
 
index 8320f1f82201794cbd72e8d060bd9ce651ab954f..79e23fe3f53513232de43eccc4e4fd1496a6dcf3 100644 (file)
@@ -138,8 +138,6 @@ static const InspectApi tcp_api =
     tcp_pinit,
     tcp_pterm,
     tcp_ssn,
-    tcp_sum,
-    tcp_stats,
     tcp_reset
 };
 
index e7cb1a3b765c03ae68a4b016705310bf6f91b100..b1d518c871fcc5b954ee415c6e683b26a20ca47f 100644 (file)
@@ -434,3 +434,9 @@ bool StreamTcpModule::end(const char*, int, SnortConfig*)
     return true;
 }
 
+const char** StreamTcpModule::get_pegs() const
+{ return tcp_pegs; }
+
+PegCount* StreamTcpModule::get_counts() const
+{ return (PegCount*)&tcpStats; }
+
index 04792883242c17ed4eb2c95e69fa16f01a736060..c25e23dcf0e17cf9adf1026ce62b2a19fc0b7f40 100644 (file)
@@ -28,6 +28,7 @@
 #include "snort_types.h"
 #include "framework/module.h"
 #include "main/thread.h"
+#include "stream/stream.h"
 
 #define GID_STREAM_TCP  129
 
@@ -52,6 +53,8 @@
 #define STREAM_TCP_WINDOW_SLAM                    19
 #define STREAM_TCP_NO_3WHS                        20
 
+extern const char* tcp_pegs[];
+extern THREAD_LOCAL struct TcpStats tcpStats;
 extern THREAD_LOCAL ProfileStats s5TcpPerfStats;
 extern THREAD_LOCAL ProfileStats s5TcpNewSessPerfStats;
 extern THREAD_LOCAL ProfileStats s5TcpStatePerfStats;
@@ -102,6 +105,8 @@ public:
     const ServiceReassembly* get_proto(unsigned);
 
     ProfileStats* get_profile(unsigned, const char*&, const char*&) const;
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
 
 private:
     void add_protos(Value&, bool, bool);
index 42cf219d785c9aea8d599c97269fc6de3f7f900f..3ffafa8e8b47885c2ae008cbedd90de69f147206 100644 (file)
@@ -99,6 +99,13 @@ THREAD_LOCAL ProfileStats streamReassembleRuleOptionPerfStats;
 
 struct TcpStats
 {
+    PegCount sessions;
+    PegCount prunes;
+    PegCount timeouts;
+    PegCount created;
+    PegCount released;
+    PegCount discards;
+    PegCount events;
     PegCount trackers_created;
     PegCount trackers_released;
     PegCount segs_created;
@@ -112,8 +119,15 @@ struct TcpStats
     PegCount s5tcp2;
 };
 
-static const char* tcp_pegs[] =
+const char* tcp_pegs[] =
 {
+    "sessions",
+    "prunes",
+    "timeouts",
+    "created",
+    "released",
+    "discards",
+    "events",
     "trackers created",
     "trackers released",
     "segs created",
@@ -127,12 +141,7 @@ static const char* tcp_pegs[] =
     "server cleanup flushes"
 };
 
-static SessionStats gssnStats;
-static TcpStats gtcpStats;
-
-static THREAD_LOCAL SessionStats ssnStats;
-static THREAD_LOCAL TcpStats tcpStats;
-
+THREAD_LOCAL TcpStats tcpStats;
 THREAD_LOCAL Memcap* tcp_memcap = nullptr;
 
 /*  M A C R O S  **************************************************/
@@ -912,114 +921,114 @@ static void PrintFlushMgr(FlushMgr *fm)
 
 static inline void Discard ()
 {
-    ssnStats.discards++;
+    tcpStats.discards++;
 }
 
 static inline void EventSynOnEst()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_SYN_ON_EST);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventExcessiveOverlap()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_EXCESSIVE_TCP_OVERLAPS);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventBadTimestamp()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_BAD_TIMESTAMP);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventWindowTooLarge()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_WINDOW_TOO_LARGE);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventDataOnSyn()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_DATA_ON_SYN);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventDataOnClosed()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_DATA_ON_CLOSED);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventDataAfterReset()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_DATA_AFTER_RESET);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventBadSegment()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_BAD_SEGMENT);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventSessionHijackedClient()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_SESSION_HIJACKED_CLIENT);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 static inline void EventSessionHijackedServer()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_SESSION_HIJACKED_SERVER);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventDataWithoutFlags()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_DATA_WITHOUT_FLAGS);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventMaxSmallSegsExceeded()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_SMALL_SEGMENT);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void Event4whs()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_4WAY_HANDSHAKE);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventNoTimestamp()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_NO_TIMESTAMP);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventBadReset()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_BAD_RST);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventBadFin()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_BAD_FIN);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventBadAck()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_BAD_ACK);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventDataAfterRstRcvd()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_DATA_AFTER_RST_RCVD);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventInternal (uint32_t eventSid)
@@ -1038,13 +1047,13 @@ static inline void EventInternal (uint32_t eventSid)
 static inline void EventWindowSlam ()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_WINDOW_SLAM);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 static inline void EventNo3whs()
 {
     SnortEventqAdd(GID_STREAM_TCP, STREAM_TCP_NO_3WHS);
-    ssnStats.events++;
+    tcpStats.events++;
 }
 
 /*
@@ -7214,7 +7223,7 @@ bool TcpSession::setup (Packet* p)
     stream.set_splitter(flow, true, ins->get_splitter(true));
     stream.set_splitter(flow, false, ins->get_splitter(false));
 
-    ssnStats.sessions++;
+    tcpStats.sessions++;
     return true;
 }
 
@@ -7354,7 +7363,7 @@ int TcpSession::process(Packet *p)
             /* Not reset, simply time'd out.  Clean it up */
             TcpSessionCleanup(flow, 1);
         }
-        ssnStats.timeouts++;
+        tcpStats.timeouts++;
     }
     status = ProcessTcp(flow, p, &tdb, config);
 
@@ -7393,31 +7402,8 @@ void tcp_init()
 #endif
 }
 
-void tcp_sum()
-{
-    sum_stats((PegCount*)&gssnStats, (PegCount*)&ssnStats,
-        session_peg_count);
-
-    sum_stats((PegCount*)&gtcpStats, (PegCount*)&tcpStats,
-        array_size(tcp_pegs));
-}
-
-void tcp_stats()
-{
-    // FIXIT need to get these before delete flow_con
-    //flow_con->get_prunes(IPPROTO_TCP, ssnStats.prunes);
-
-    show_stats((PegCount*)&gssnStats, session_pegs, session_peg_count,
-        MOD_NAME);
-
-    show_stats((PegCount*)&gtcpStats, tcp_pegs, array_size(tcp_pegs));
-}
-
 void tcp_reset()
 {
-    memset(&gssnStats, 0, sizeof(gssnStats));
-    memset(&gtcpStats, 0, sizeof(gtcpStats));
-
     flow_con->reset_prunes(IPPROTO_TCP);
 }
 
index d473b0cca52f1bc72a638dce3520bdbe64254c5e..bbc4b96ddbba5a2a1757b5361ce03a7bbf8ea438 100644 (file)
@@ -146,8 +146,6 @@ static const InspectApi udp_api =
     nullptr, // pinit
     nullptr, // pterm
     udp_ssn,
-    udp_sum,
-    udp_stats,
     udp_reset
 };
 
index 34a85f0fdb8704f4d9f95ce00fbed654e8be2e80..bcef49890b037eeee29ddd9f95a30cebb5f8b8d4 100644 (file)
@@ -87,3 +87,9 @@ bool StreamUdpModule::end(const char*, int, SnortConfig*)
     return true;
 }
 
+const char** StreamUdpModule::get_pegs() const
+{ return session_pegs; }
+
+PegCount* StreamUdpModule::get_counts() const
+{ return (PegCount*)&udpStats; }
+
index ba02489e02ed11b2a8e87082a0a4fde2d29d562e..03a56810c2e78ee7a0c8010b2ab309c42711c31d 100644 (file)
 #include "snort_types.h"
 #include "framework/module.h"
 #include "main/thread.h"
-
+#include "stream/stream.h"
+    
 struct SnortConfig;
 
+extern THREAD_LOCAL SessionStats udpStats;
 extern THREAD_LOCAL ProfileStats udp_perf_stats;
 
 //-------------------------------------------------------------------------
@@ -50,6 +52,8 @@ public:
     bool end(const char*, int, SnortConfig*);
 
     ProfileStats* get_profile() const;
+    const char** get_pegs() const;
+    PegCount* get_counts() const;
     StreamUdpConfig* get_data();
 
 private:
index d51951c06a83740ea38e4f119e92f8de97d9ef03..e87808a2ea402b14f8eaf3283365c95e8d56062e 100644 (file)
@@ -51,9 +51,7 @@
 #define udp_responder_ip flow->server_ip
 #define udp_responder_port flow->server_port
 
-static SessionStats gudpStats;
-static THREAD_LOCAL SessionStats udpStats;
-
+THREAD_LOCAL SessionStats udpStats;
 THREAD_LOCAL ProfileStats udp_perf_stats;
 
 //-------------------------------------------------------------------------
@@ -235,24 +233,16 @@ int UdpSession::process(Packet *p)
 // api related methods
 //-------------------------------------------------------------------------
 
-void udp_sum()
-{
-    sum_stats((PegCount*)&gudpStats, (PegCount*)&udpStats,
-        session_peg_count);
-}
-
+#if 0
 void udp_stats()
 {
     // FIXIT need to get these before delete flow_con
     //flow_con->get_prunes(IPPROTO_UDP, udpStats.prunes);
-
-    show_stats((PegCount*)&gudpStats, session_pegs, session_peg_count,
-        MOD_NAME);
 }
+#endif
 
 void udp_reset()
 {
-    memset(&udpStats, 0, sizeof(udpStats));
     flow_con->reset_prunes(IPPROTO_UDP);
 }
 
index 3e9ad6c912675768402a67549eb14a851f9f457b..f859b8d5de2c8a6764ef7840f51eeef47cb6d9e5 100644 (file)
@@ -40,7 +40,6 @@ public:
     struct timeval ssn_time;
 };
 
-void udp_sum();
 void udp_stats();
 void udp_reset();
 
index 2108cc6dc2e51a8f6ecdd29d0e3515410e82d854..00bb909e906c25b9e22274ada345750bc09c3802 100644 (file)
@@ -32,7 +32,7 @@
 #include "packet_io/active.h"
 #include "packet_io/trough.h"
 #include "target_based/sftarget_reader.h"
-#include "managers/inspector_manager.h"
+#include "managers/module_manager.h"
 #include "managers/packet_manager.h"
 
 #define STATS_SEPARATOR \
@@ -297,7 +297,7 @@ void DropStats()
     PacketManager::dump_stats();
     //mpse_print_qinfo();
 
-    InspectorManager::dump_stats(snort_conf);
+    ModuleManager::dump_stats(snort_conf);
 
     // ensure proper counting of log_limit
     SnortEventqResetCounts();