suricata
reputation.h File Reference
#include "host.h"
#include "util-radix-tree.h"
Include dependency graph for reputation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SRepCIDRTree_
 
struct  SReputation_
 

Macros

#define SREP_MAX_CATS   60
 
#define SREP_MAX_VAL   127
 

Typedefs

typedef struct SRepCIDRTree_ SRepCIDRTree
 
typedef struct SReputation_ SReputation
 

Functions

void SRepFreeHostData (Host *h)
 
uint8_t SRepCatGetByShortname (char *shortname)
 
int SRepInit (struct DetectEngineCtx_ *de_ctx)
 init reputation More...
 
void SRepDestroy (struct DetectEngineCtx_ *de_ctx)
 
void SRepReloadComplete (void)
 Increment effective reputation version after a rule/reputation reload is complete. More...
 
int SRepHostTimedOut (Host *)
 Check if a Host is timed out wrt ip rep, meaning a new version is in place. More...
 
uint8_t SRepCIDRGetIPRepSrc (SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version)
 
uint8_t SRepCIDRGetIPRepDst (SRepCIDRTree *cidr_ctx, Packet *p, uint8_t cat, uint32_t version)
 
void SRepResetVersion (void)
 
int SRepLoadCatFileFromFD (FILE *fp)
 
int SRepLoadFileFromFD (SRepCIDRTree *cidr_ctx, FILE *fp)
 
void SCReputationRegisterTests (void)
 

Detailed Description

Macro Definition Documentation

◆ SREP_MAX_CATS

#define SREP_MAX_CATS   60

Definition at line 33 of file reputation.h.

◆ SREP_MAX_VAL

#define SREP_MAX_VAL   127

Definition at line 34 of file reputation.h.

Typedef Documentation

◆ SRepCIDRTree

typedef struct SRepCIDRTree_ SRepCIDRTree

◆ SReputation

typedef struct SReputation_ SReputation

Function Documentation

◆ SCReputationRegisterTests()

void SCReputationRegisterTests ( void  )

Register the following unittests for the Reputation module

Definition at line 174 of file reputation.c.

References UtRegisterTest().

Here is the call graph for this function:

◆ SRepCatGetByShortname()

uint8_t SRepCatGetByShortname ( char *  shortname)

Definition at line 343 of file reputation.c.

References SREP_MAX_CATS.

◆ SRepCIDRGetIPRepDst()

uint8_t SRepCIDRGetIPRepDst ( SRepCIDRTree cidr_ctx,
Packet p,
uint8_t  cat,
uint32_t  version 
)

Definition at line 160 of file reputation.c.

References PKT_IS_IPV4.

◆ SRepCIDRGetIPRepSrc()

uint8_t SRepCIDRGetIPRepSrc ( SRepCIDRTree cidr_ctx,
Packet p,
uint8_t  cat,
uint32_t  version 
)

Definition at line 148 of file reputation.c.

References PKT_IS_IPV4.

◆ SRepDestroy()

void SRepDestroy ( struct DetectEngineCtx_ de_ctx)

Definition at line 664 of file reputation.c.

References de_ctx, SCFree, SCRadixReleaseRadixTree(), SREP_MAX_CATS, DetectEngineCtx_::srepCIDR_ctx, SRepCIDRTree_::srepIPV4_tree, and SRepCIDRTree_::srepIPV6_tree.

Here is the call graph for this function:

◆ SRepFreeHostData()

void SRepFreeHostData ( Host h)

Definition at line 180 of file reputation.c.

References DEBUG_VALIDATE_BUG_ON, HostDecrUsecnt, Host_::iprep, SC_ATOMIC_GET, and SCFree.

Referenced by HostClearMemory().

Here is the caller graph for this function:

◆ SRepHostTimedOut()

int SRepHostTimedOut ( Host h)

Check if a Host is timed out wrt ip rep, meaning a new version is in place.

We clean up the old version here.

Parameters
hhost
Return values
0not timed out
1timed out

Definition at line 206 of file reputation.c.

References BUG_ON, and Host_::iprep.

◆ SRepInit()

int SRepInit ( DetectEngineCtx de_ctx)

init reputation

Parameters
de_ctxdetection engine ctx for tracking iprep version
Return values
0ok
-1error

If this function is called more than once, the category file is not reloaded.

Definition at line 581 of file reputation.c.

References de_ctx, SCCalloc, SREP_MAX_CATS, DetectEngineCtx_::srepCIDR_ctx, SRepCIDRTree_::srepIPV4_tree, and SRepCIDRTree_::srepIPV6_tree.

◆ SRepLoadCatFileFromFD()

int SRepLoadCatFileFromFD ( FILE *  fp)

Definition at line 371 of file reputation.c.

References Address_::family.

◆ SRepLoadFileFromFD()

int SRepLoadFileFromFD ( SRepCIDRTree cidr_ctx,
FILE *  fp 
)

Definition at line 438 of file reputation.c.

References Address_::family, and len.

◆ SRepReloadComplete()

void SRepReloadComplete ( void  )

Increment effective reputation version after a rule/reputation reload is complete.

Definition at line 174 of file reputation.c.

References SC_ATOMIC_ADD, and SCLogDebug.

◆ SRepResetVersion()

void SRepResetVersion ( void  )

Definition at line 62 of file reputation.c.