suricata
datasets.c File Reference
#include "suricata-common.h"
#include "conf.h"
#include "datasets.h"
#include "datasets-string.h"
#include "datasets-md5.h"
#include "datasets-sha256.h"
#include "datasets-reputation.h"
#include "util-thash.h"
#include "util-print.h"
#include "util-crypt.h"
#include "util-base64.h"
Include dependency graph for datasets.c:

Go to the source code of this file.

Macros

#define SETNAME_MAX   63
 

Enumerations

enum  DatasetGetPathType { TYPE_STATE, TYPE_LOAD }
 

Functions

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)
 
int DatasetsInit (void)
 
void DatasetsDestroy (void)
 
void DatasetsSave (void)
 
int DatasetLookup (Dataset *set, const uint8_t *data, const uint32_t data_len)
 
DataRepResultType DatasetLookupwRep (Dataset *set, const uint8_t *data, const uint32_t data_len, const DataRepType *rep)
 
int DatasetAdd (Dataset *set, const uint8_t *data, const uint32_t data_len)
 
int DatasetAddSerialized (Dataset *set, const char *string)
 add serialized data to set More...
 

Variables

SCMutex sets_lock = SCMUTEX_INITIALIZER
 
bool g_system
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Definition in file datasets.c.

Macro Definition Documentation

#define SETNAME_MAX   63

Definition at line 510 of file datasets.c.

Referenced by DatasetsInit().

Enumeration Type Documentation

Enumerator
TYPE_STATE 
TYPE_LOAD 

Definition at line 354 of file datasets.c.

Function Documentation

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

Definition at line 952 of file datasets.c.

References THashDataGetResult::data, DATASET_TYPE_MD5, DATASET_TYPE_SHA256, and DATASET_TYPE_STRING.

Referenced by DatasetGetTypeFromString(), and DetectDatasetBufferMatch().

Here is the caller graph for this function:

int DatasetAddSerialized ( Dataset set,
const char *  string 
)

add serialized data to set

Definition at line 986 of file datasets.c.

References DATASET_TYPE_MD5, DATASET_TYPE_SHA256, DATASET_TYPE_STRING, DecodeBase64(), and len.

Referenced by UnixSocketPcapFile().

Here is the call graph for this function:

Here is the caller graph for this function:

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

look for set by name without creating it

Definition at line 393 of file datasets.c.

References SCMutexLock, SCMutexUnlock, and sets_lock.

Referenced by UnixSocketPcapFile().

Here is the caller graph for this function:

Dataset* DatasetGet ( const char *  name,
enum DatasetTypes  type,
const char *  save,
const char *  load 
)
enum DatasetTypes DatasetGetTypeFromString ( const char *  s)

Definition at line 43 of file datasets.c.

References DATASET_TYPE_MD5, DATASET_TYPE_NOTSET, DATASET_TYPE_SHA256, DATASET_TYPE_STRING, DatasetAdd(), DecodeBase64(), FatalError, g_system, len, Dataset::next, SC_ERR_DATASET, SC_ERR_FATAL, SC_ERR_INVALID_HASH, SCCalloc, SCLogDebug, SCLogError, and DataRepType::value.

Referenced by UnixSocketPcapFile().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 803 of file datasets.c.

References DATASET_TYPE_MD5, DATASET_TYPE_SHA256, and DATASET_TYPE_STRING.

Referenced by DetectDatasetBufferMatch().

Here is the caller graph for this function:

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

Definition at line 595 of file datasets.c.

References Md5Type::md5, HtpBodyChunk_::next, next, SCFree, SCLogDebug, SCMutexLock, SCMutexUnlock, sets_lock, Sha256Type::sha256, str, strlcat(), and THashShutdown().

Referenced by GlobalsInitPreConfig().

Here is the call graph for this function:

Here is the caller graph for this function:

int DatasetsInit ( void  )

Definition at line 512 of file datasets.c.

References ConfGetNode(), ConfNodeLookupChild(), DATASET_TYPE_MD5, DATASET_TYPE_SHA256, DATASET_TYPE_STRING, DatasetGet(), FatalError, next, SC_ERR_CONF_NAME_TOO_LONG, SC_ERR_FATAL, SCLogDebug, SETNAME_MAX, strlcpy(), TAILQ_FOREACH, TYPE_LOAD, TYPE_STATE, and ConfNode_::val.

Referenced by PreRunInit().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

bool g_system

Definition at line 228 of file suricata.c.

Referenced by DatasetGetTypeFromString(), and RegisterAllModules().

Definition at line 36 of file datasets.c.

Referenced by DatasetFind(), DatasetGet(), DatasetsDestroy(), and DatasetsSave().