1 //--------------------------------------------------------------------------
2 // Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved.
3 // Copyright (C) 2013-2013 Sourcefire, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License Version 2 as published
7 // by the Free Software Foundation.  You may not use, modify or distribute
8 // this program under any other version of the GNU General Public License.
9 //
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 //--------------------------------------------------------------------------
19 // counts.h author Russ Combs <rucombs@cisco.com>
20 
21 #ifndef COUNTS_H
22 #define COUNTS_H
23 
24 // basic stats support - note that where these are used, the number of
25 // elements in stats must be the same as the number of elements in the peg
26 // info (and in the same sequence).
27 
28 #include "main/snort_types.h"
29 
30 typedef uint64_t PegCount;
31 
32 enum CountType
33 {
34     END,   // sentinel value
35     SUM,   // tracks cumulative total number of items seen (eg #events)
36     NOW,   // gives snapshot of current number of items (eg current #sessions)
37     MAX,   // tracks maximum value seen (eg max #sessions)
38 };
39 
40 struct SimpleStats
41 {
42     PegCount total_packets;
43 };
44 
45 struct PegInfo
46 {
47     CountType type;
48     const char* name;
49     const char* help;
50 };
51 
52 
53 namespace snort
54 {
55 SO_PUBLIC extern const struct PegInfo simple_pegs[];
56 } // namespace snort
57 
58 #define array_size(a) (sizeof(a)/sizeof((a)[0]))
59 
60 #endif
61 
62