suricata
detect-threshold.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2013 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Breno Silva <breno.silva@gmail.com>
22  */
23 
24 #ifndef __DETECT_THRESHOLD_H__
25 #define __DETECT_THRESHOLD_H__
26 
27 
28 #define TYPE_LIMIT 1
29 #define TYPE_BOTH 2
30 #define TYPE_THRESHOLD 3
31 #define TYPE_DETECTION 4
32 #define TYPE_RATE 5
33 #define TYPE_SUPPRESS 6
34 
35 #define TRACK_DST 1
36 #define TRACK_SRC 2
37 #define TRACK_RULE 3
38 #define TRACK_EITHER 4 /**< either src or dst: only used by suppress */
39 #define TRACK_BOTH 5 /* used by rate_filter to match detections by both src and dst addresses */
40 
41 /* Get the new action to take */
42 #define TH_ACTION_ALERT 0x01
43 #define TH_ACTION_DROP 0x02
44 #define TH_ACTION_PASS 0x04
45 #define TH_ACTION_LOG 0x08
46 #define TH_ACTION_SDROP 0x10
47 #define TH_ACTION_REJECT 0x20
48 
49 /**
50  * \typedef DetectThresholdData
51  * A typedef for DetectThresholdData_
52  */
53 
54 typedef struct DetectThresholdData_ {
55  uint32_t count; /**< Event count */
56  uint32_t seconds; /**< Event seconds */
57  uint8_t type; /**< Threshold type : limit , threshold, both, detection_filter */
58  uint8_t track; /**< Track type: by_src, by_dst */
59  uint8_t new_action; /**< new_action alert|drop|pass|log|sdrop|reject */
60  uint32_t timeout; /**< timeout */
61  uint32_t flags; /**< flags used to set option */
64 
65 typedef struct DetectThresholdEntry_ {
66  uint32_t sid; /**< Signature id */
67  uint32_t gid; /**< Signature group id */
68 
69  uint32_t tv_timeout; /**< Timeout for new_action (for rate_filter)
70  its not "seconds", that define the time interval */
71  uint32_t seconds; /**< Event seconds */
72  uint32_t current_count; /**< Var for count control */
73  int track; /**< Track type: by_src, by_src */
74 
75  SCTime_t tv1; /**< Var for time control */
78 
79 
80 /**
81  * Registration function for threshold: keyword
82  */
83 
84 void DetectThresholdRegister(void);
86 
87 #endif /*__DETECT_THRESHOLD_H__ */
DetectThresholdData_::timeout
uint32_t timeout
Definition: detect-threshold.h:60
DetectAddressHead_
Definition: detect.h:174
DetectThresholdData_::count
uint32_t count
Definition: detect-threshold.h:55
DetectThresholdRegister
void DetectThresholdRegister(void)
Registration function for threshold: keyword.
Definition: detect-threshold.c:79
DetectThresholdData_::new_action
uint8_t new_action
Definition: detect-threshold.h:59
DetectThresholdEntry_
Definition: detect-threshold.h:65
DetectThresholdEntry_::sid
uint32_t sid
Definition: detect-threshold.h:66
DetectThresholdEntry_::seconds
uint32_t seconds
Definition: detect-threshold.h:71
DetectThresholdData_::type
uint8_t type
Definition: detect-threshold.h:57
DetectThresholdEntry_::track
int track
Definition: detect-threshold.h:73
DetectThresholdEntry_::tv_timeout
uint32_t tv_timeout
Definition: detect-threshold.h:69
DetectThresholdEntry
struct DetectThresholdEntry_ DetectThresholdEntry
DetectThresholdDataCopy
DetectThresholdData * DetectThresholdDataCopy(DetectThresholdData *)
Make a deep-copy of an extant DetectTHresholdData object.
Definition: detect-threshold.c:299
DetectThresholdEntry_::tv1
SCTime_t tv1
Definition: detect-threshold.h:75
SCTime_t
Definition: util-time.h:40
DetectThresholdData_::track
uint8_t track
Definition: detect-threshold.h:58
DetectThresholdEntry_::current_count
uint32_t current_count
Definition: detect-threshold.h:72
DetectThresholdData_
Definition: detect-threshold.h:54
DetectThresholdData_::flags
uint32_t flags
Definition: detect-threshold.h:61
DetectThresholdEntry_::next
struct DetectThresholdEntry_ * next
Definition: detect-threshold.h:76
DetectThresholdEntry_::gid
uint32_t gid
Definition: detect-threshold.h:67
DetectThresholdData
struct DetectThresholdData_ DetectThresholdData
DetectThresholdData_::seconds
uint32_t seconds
Definition: detect-threshold.h:56
DetectThresholdData_::addrs
DetectAddressHead addrs
Definition: detect-threshold.h:62