suricata
reputation.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2019 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 Pablo Rincon Crespo <pablo.rincon.crespo@gmail.com>
22  * \author Victor Julien <victor@inliniac.net>
23  * Original Idea by Matt Jonkman
24  */
25 
26 #ifndef SURICATA_REPUTATION_H
27 #define SURICATA_REPUTATION_H
28 
29 #include "host.h"
30 #include "util-radix-tree.h"
31 
32 #define SREP_MAX_CATS 60
33 #define SREP_MAX_VAL 127
34 
35 typedef struct SRepCIDRTree_ {
39 
40 typedef struct SReputation_ {
41  uint32_t version;
42  uint8_t rep[SREP_MAX_CATS];
44 
45 void SRepFreeHostData(Host *h);
46 uint8_t SRepCatGetByShortname(char *shortname);
47 int SRepInit(struct DetectEngineCtx_ *de_ctx);
48 void SRepDestroy(struct DetectEngineCtx_ *de_ctx);
49 void SRepReloadComplete(void);
50 int SRepHostTimedOut(Host *);
51 
52 int8_t SRepCIDRGetIPRepSrc(SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version);
53 int8_t SRepCIDRGetIPRepDst(SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version);
54 void SRepResetVersion(void);
55 int SRepLoadCatFileFromFD(FILE *fp);
56 int SRepLoadFileFromFD(SRepCIDRTree *cidr_ctx, FILE *fp);
57 
58 void SCReputationRegisterTests(void);
59 
60 #endif /* SURICATA_REPUTATION_H */
host.h
SReputation_
Definition: reputation.h:40
SREP_MAX_CATS
#define SREP_MAX_CATS
Definition: reputation.h:32
SReputation_::rep
uint8_t rep[SREP_MAX_CATS]
Definition: reputation.h:42
SRepLoadCatFileFromFD
int SRepLoadCatFileFromFD(FILE *fp)
Definition: reputation.c:368
SRepCIDRGetIPRepDst
int8_t SRepCIDRGetIPRepDst(SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version)
Definition: reputation.c:158
SCRadixTree_
Structure for the radix tree.
Definition: util-radix-tree.h:86
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:841
SRepCIDRGetIPRepSrc
int8_t SRepCIDRGetIPRepSrc(SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version)
Definition: reputation.c:146
SRepResetVersion
void SRepResetVersion(void)
Definition: reputation.c:62
SRepCIDRTree_
Definition: reputation.h:35
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
SRepFreeHostData
void SRepFreeHostData(Host *h)
Definition: reputation.c:178
SRepCIDRTree
struct SRepCIDRTree_ SRepCIDRTree
Packet_
Definition: decode.h:475
util-radix-tree.h
SRepInit
int SRepInit(struct DetectEngineCtx_ *de_ctx)
init reputation
Definition: reputation.c:577
SRepCatGetByShortname
uint8_t SRepCatGetByShortname(char *shortname)
Definition: reputation.c:340
SRepDestroy
void SRepDestroy(struct DetectEngineCtx_ *de_ctx)
Definition: reputation.c:654
SRepReloadComplete
void SRepReloadComplete(void)
Increment effective reputation version after a rule/reputation reload is complete.
Definition: reputation.c:172
version
uint8_t version
Definition: decode-gre.h:1
SReputation
struct SReputation_ SReputation
SReputation_::version
uint32_t version
Definition: reputation.h:41
SCReputationRegisterTests
void SCReputationRegisterTests(void)
Definition: reputation.c:174
SRepHostTimedOut
int SRepHostTimedOut(Host *)
Check if a Host is timed out wrt ip rep, meaning a new version is in place.
Definition: reputation.c:204
SRepCIDRTree_::srepIPV4_tree
SCRadixTree * srepIPV4_tree[SREP_MAX_CATS]
Definition: reputation.h:36
SRepLoadFileFromFD
int SRepLoadFileFromFD(SRepCIDRTree *cidr_ctx, FILE *fp)
Definition: reputation.c:434
Host_
Definition: host.h:58
SRepCIDRTree_::srepIPV6_tree
SCRadixTree * srepIPV6_tree[SREP_MAX_CATS]
Definition: reputation.h:37