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

Go to the source code of this file.

Data Structures

struct  Dataset
 

Macros

#define DATASET_TYPE_NOTSET   0
 
#define DATASET_NAME_MAX_LEN   63
 

Typedefs

typedef struct Dataset Dataset
 

Enumerations

enum  DatasetTypes { DATASET_TYPE_STRING = 1, DATASET_TYPE_MD5, DATASET_TYPE_SHA256 }
 

Functions

int DatasetsInit (void)
 
void DatasetsDestroy (void)
 
void DatasetsSave (void)
 
void DatasetReload (void)
 
void DatasetPostReloadCleanup (void)
 
enum DatasetTypes DatasetGetTypeFromString (const char *s)
 
DatasetDatasetFind (const char *name, enum DatasetTypes type)
 look for set by name without creating it More...
 
DatasetDatasetGet (const char *name, enum DatasetTypes type, const char *save, const char *load, uint64_t memcap, uint32_t hashsize)
 
int DatasetAdd (Dataset *set, const uint8_t *data, const uint32_t data_len)
 
int DatasetLookup (Dataset *set, const uint8_t *data, const uint32_t data_len)
 see if data is part of the set More...
 
DataRepResultType DatasetLookupwRep (Dataset *set, const uint8_t *data, const uint32_t data_len, const DataRepType *rep)
 
int DatasetAddSerialized (Dataset *set, const char *string)
 add serialized data to set More...
 
int DatasetRemoveSerialized (Dataset *set, const char *string)
 remove serialized data from set More...
 

Macro Definition Documentation

◆ DATASET_NAME_MAX_LEN

#define DATASET_NAME_MAX_LEN   63

Definition at line 38 of file datasets.h.

◆ DATASET_TYPE_NOTSET

#define DATASET_TYPE_NOTSET   0

Definition at line 32 of file datasets.h.

Typedef Documentation

◆ Dataset

typedef struct Dataset Dataset

Enumeration Type Documentation

◆ DatasetTypes

Enumerator
DATASET_TYPE_STRING 
DATASET_TYPE_MD5 
DATASET_TYPE_SHA256 

Definition at line 30 of file datasets.h.

Function Documentation

◆ DatasetAdd()

int DatasetAdd ( Dataset set,
const uint8_t *  data,
const uint32_t  data_len 
)

Definition at line 1103 of file datasets.c.

References DATASET_TYPE_STRING, and Dataset::type.

Referenced by DetectDatasetBufferMatch().

Here is the caller graph for this function:

◆ DatasetAddSerialized()

int DatasetAddSerialized ( Dataset set,
const char *  string 
)

add serialized data to set

Return values
int1 added
int0 already in hash
int-1 API error (not added)
int-2 DATA error

Definition at line 1142 of file datasets.c.

References DATASET_TYPE_STRING, DecodeBase64(), len, and Dataset::type.

Here is the call graph for this function:

◆ DatasetFind()

Dataset* DatasetFind ( const char *  name,
enum DatasetTypes  type 
)

look for set by name without creating it

Definition at line 409 of file datasets.c.

References SCMutexLock, and sets_lock.

◆ DatasetGet()

Dataset* DatasetGet ( const char *  name,
enum DatasetTypes  type,
const char *  save,
const char *  load,
uint64_t  memcap,
uint32_t  hashsize 
)

Definition at line 423 of file datasets.c.

References DATASET_NAME_MAX_LEN, SCMutexLock, and sets_lock.

◆ DatasetGetTypeFromString()

enum DatasetTypes DatasetGetTypeFromString ( const char *  s)

Definition at line 51 of file datasets.c.

◆ DatasetLookup()

int DatasetLookup ( Dataset set,
const uint8_t *  data,
const uint32_t  data_len 
)

see if data is part of the set

Parameters
setdataset
datadata to look up
data_lenlength in bytes of data
Return values
-1error
0not found
1found

Definition at line 954 of file datasets.c.

References DATASET_TYPE_STRING, and Dataset::type.

Referenced by DetectDatasetBufferMatch().

Here is the caller graph for this function:

◆ DatasetLookupwRep()

DataRepResultType DatasetLookupwRep ( Dataset set,
const uint8_t *  data,
const uint32_t  data_len,
const DataRepType rep 
)

Definition at line 970 of file datasets.c.

References DATASET_TYPE_STRING, DataRepResultType::found, and Dataset::type.

Referenced by DetectDatarepBufferMatch().

Here is the caller graph for this function:

◆ DatasetPostReloadCleanup()

void DatasetPostReloadCleanup ( void  )

Definition at line 577 of file datasets.c.

References SCLogDebug, SCMutexLock, and sets_lock.

◆ DatasetReload()

void DatasetReload ( void  )

Definition at line 555 of file datasets.c.

References SCMutexLock, and sets_lock.

◆ DatasetRemoveSerialized()

int DatasetRemoveSerialized ( Dataset set,
const char *  string 
)

remove serialized data from set

Return values
int1 removed
int0 found but busy (not removed)
int-1 API error (not removed)
int-2 DATA error

Definition at line 1224 of file datasets.c.

References DATASET_TYPE_STRING, DecodeBase64(), len, and Dataset::type.

Here is the call graph for this function:

◆ DatasetsDestroy()

void DatasetsDestroy ( void  )

Definition at line 737 of file datasets.c.

References SCLogDebug.

◆ DatasetsInit()

int DatasetsInit ( void  )

Definition at line 626 of file datasets.c.

References ConfGetNode(), and SCLogDebug.

Referenced by PreRunInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DatasetsSave()

void DatasetsSave ( void  )

Definition at line 792 of file datasets.c.

References SCLogDebug.