suricata
reputation.h
Go to the documentation of this file.
1/* Copyright (C) 2007-2022 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-radix4-tree.h"
31#include "util-radix6-tree.h"
32
33#define SREP_MAX_CATS 60
34#define SREP_MAX_VAL 127
35
40
41typedef struct SReputation_ {
42 uint32_t version;
45
46void SRepFreeHostData(Host *h);
47uint8_t SRepCatGetByShortname(char *shortname);
50void SRepReloadComplete(void);
52
53int8_t SRepCIDRGetIPRepSrc(SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version);
54int8_t SRepCIDRGetIPRepDst(SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version);
55void SRepResetVersion(void);
56int SRepLoadCatFileFromFD(FILE *fp);
57int SRepLoadFileFromFD(SRepCIDRTree *cidr_ctx, FILE *fp);
58
60
61#endif /* SURICATA_REPUTATION_H */
uint8_t version
Definition decode-gre.h:1
DetectEngineCtx * de_ctx
void SRepReloadComplete(void)
Increment effective reputation version after a rule/reputation reload is complete.
Definition reputation.c:161
struct SRepCIDRTree_ SRepCIDRTree
uint8_t SRepCatGetByShortname(char *shortname)
Definition reputation.c:329
struct SReputation_ SReputation
int SRepLoadCatFileFromFD(FILE *fp)
Definition reputation.c:357
int SRepHostTimedOut(Host *)
Check if a Host is timed out wrt ip rep, meaning a new version is in place.
Definition reputation.c:193
int8_t SRepCIDRGetIPRepDst(SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version)
Definition reputation.c:147
int8_t SRepCIDRGetIPRepSrc(SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version)
Definition reputation.c:135
void SRepResetVersion(void)
Definition reputation.c:64
void SCReputationRegisterTests(void)
Definition reputation.c:174
int SRepLoadFileFromFD(SRepCIDRTree *cidr_ctx, FILE *fp)
Definition reputation.c:423
void SRepDestroy(struct DetectEngineCtx_ *de_ctx)
Definition reputation.c:649
void SRepFreeHostData(Host *h)
Definition reputation.c:167
#define SREP_MAX_CATS
Definition reputation.h:33
int SRepInit(struct DetectEngineCtx_ *de_ctx)
init reputation
Definition reputation.c:566
main detection engine ctx
Definition detect.h:932
Definition host.h:58
Structure for the radix tree.
Structure for the radix tree.
SCRadix6Tree srep_ipv6_tree[SREP_MAX_CATS]
Definition reputation.h:38
SCRadix4Tree srep_ipv4_tree[SREP_MAX_CATS]
Definition reputation.h:37
uint32_t version
Definition reputation.h:42
uint8_t rep[SREP_MAX_CATS]
Definition reputation.h:43