1 //--------------------------------------------------------------------------
2 // Copyright (C) 2016-2021 Cisco and/or its affiliates. All rights reserved.
3 //
4 // This program is free software; you can redistribute it and/or modify it
5 // under the terms of the GNU General Public License Version 2 as published
6 // by the Free Software Foundation.  You may not use, modify or distribute
7 // this program under any other version of the GNU General Public License.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License along
15 // with this program; if not, write to the Free Software Foundation, Inc.,
16 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 //--------------------------------------------------------------------------
18 
19 // sfdaq_module.h author Michael Altizer <mialtize@cisco.com>
20 
21 #ifndef SFDAQ_MODULE_H
22 #define SFDAQ_MODULE_H
23 
24 #include "framework/module.h"
25 
26 namespace snort
27 {
28 struct SnortConfig;
29 }
30 struct SFDAQConfig;
31 struct SFDAQModuleConfig;
32 
33 class SFDAQModule : public snort::Module
34 {
35 public:
36     SFDAQModule();
37 
38     bool set(const char*, snort::Value&, snort::SnortConfig*) override;
39     bool begin(const char*, int, snort::SnortConfig*) override;
40     bool end(const char*, int, snort::SnortConfig*) override;
41 
42     const PegInfo* get_pegs() const override;
43     PegCount* get_counts() const override;
44     void prep_counts() override;
45     void reset_stats() override;
46 
counts_need_prep()47     bool counts_need_prep() const override
48     { return true; }
49 
get_usage()50     Usage get_usage() const override
51     { return GLOBAL; }
52 
53 private:
54     SFDAQConfig* config;
55     SFDAQModuleConfig* module_config;
56 };
57 
58 struct DAQStats
59 {
60     PegCount pcaps;
61     PegCount received;
62     PegCount analyzed;
63     PegCount dropped;
64     PegCount filtered;
65     PegCount outstanding;
66     PegCount injected;
67     PegCount verdicts[MAX_DAQ_VERDICT];
68     PegCount internal_blacklist;
69     PegCount internal_whitelist;
70     PegCount skipped;
71     PegCount idle;
72     PegCount rx_bytes;
73     PegCount expected_flows;
74     PegCount retries_queued;
75     PegCount retries_dropped;
76     PegCount retries_processed;
77     PegCount retries_discarded;
78     PegCount sof_messages;
79     PegCount eof_messages;
80     PegCount other_messages;
81 };
82 
83 extern THREAD_LOCAL DAQStats daq_stats;
84 
85 #endif
86