suricata
|
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 | DatasetFormats { DATASET_FORMAT_CSV = 0, DATASET_FORMAT_JSON, DATASET_FORMAT_NDJSON } |
enum | DatasetTypes { DATASET_TYPE_STRING = 1, DATASET_TYPE_MD5, DATASET_TYPE_SHA256, DATASET_TYPE_IPV4, DATASET_TYPE_IPV6 } |
Functions | |
int | DatasetsInit (void) |
void | DatasetsDestroy (void) |
void | DatasetsSave (void) |
void | DatasetReload (void) |
void | DatasetPostReloadCleanup (void) |
enum DatasetTypes | DatasetGetTypeFromString (const char *s) |
int | DatasetAppendSet (Dataset *set) |
Dataset * | DatasetAlloc (const char *name) |
void | DatasetLock (void) |
void | DatasetUnlock (void) |
Dataset * | DatasetSearchByName (const char *name) |
Dataset * | DatasetFind (const char *name, enum DatasetTypes type) |
look for set by name without creating it More... | |
Dataset * | DatasetGet (const char *name, enum DatasetTypes type, const char *save, const char *load, uint64_t memcap, uint32_t hashsize) |
int | DatasetGetOrCreate (const char *name, enum DatasetTypes type, const char *save, const char *load, uint64_t *memcap, uint32_t *hashsize, Dataset **ret_set) |
int | DatasetAdd (Dataset *set, const uint8_t *data, const uint32_t data_len) |
int | DatasetRemove (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) |
void | DatasetGetDefaultMemcap (uint64_t *memcap, uint32_t *hashsize) |
int | DatasetParseIpv6String (Dataset *set, const char *line, struct in6_addr *in6) |
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... | |
int | DatasetLookupSerialized (Dataset *set, const char *string) |
add serialized data to set More... | |
#define DATASET_NAME_MAX_LEN 63 |
Definition at line 47 of file datasets.h.
#define DATASET_TYPE_NOTSET 0 |
Definition at line 39 of file datasets.h.
enum DatasetFormats |
Enumerator | |
---|---|
DATASET_FORMAT_CSV | |
DATASET_FORMAT_JSON | |
DATASET_FORMAT_NDJSON |
Definition at line 31 of file datasets.h.
enum DatasetTypes |
Enumerator | |
---|---|
DATASET_TYPE_STRING | |
DATASET_TYPE_MD5 | |
DATASET_TYPE_SHA256 | |
DATASET_TYPE_IPV4 | |
DATASET_TYPE_IPV6 |
Definition at line 37 of file datasets.h.
int DatasetAdd | ( | Dataset * | set, |
const uint8_t * | data, | ||
const uint32_t | data_len | ||
) |
Definition at line 1339 of file datasets.c.
References DATASET_TYPE_STRING, and Dataset::type.
int DatasetAddSerialized | ( | Dataset * | set, |
const char * | string | ||
) |
add serialized data to set
int | 1 added |
int | 0 already in hash |
int | -1 API error (not added) |
int | -2 DATA error |
Definition at line 1446 of file datasets.c.
Dataset* DatasetAlloc | ( | const char * | name | ) |
Definition at line 112 of file datasets.c.
References Dataset::id, and SCCalloc.
int DatasetAppendSet | ( | Dataset * | set | ) |
Definition at line 79 of file datasets.c.
References Dataset::hash, Dataset::load, Dataset::name, Dataset::next, Dataset::save, SC_ATOMIC_GET, SCLogDebug, SCLogError, and Dataset::type.
Dataset* DatasetFind | ( | const char * | name, |
enum DatasetTypes | type | ||
) |
look for set by name without creating it
Definition at line 320 of file datasets.c.
References DatasetSearchByName(), name, SCMutexLock, SCMutexUnlock, sets_lock, Dataset::type, and type.
Dataset* DatasetGet | ( | const char * | name, |
enum DatasetTypes | type, | ||
const char * | save, | ||
const char * | load, | ||
uint64_t | memcap, | ||
uint32_t | hashsize | ||
) |
Definition at line 451 of file datasets.c.
References DATASET_TYPE_MD5, DatasetGetOrCreate(), DatasetLock(), DatasetUnlock(), Dataset::hash, hashsize, Md5StrCompare(), Md5StrFree(), Md5StrHash(), Md5StrSet(), name, SCLogDebug, SCLogError, THashInit(), and type.
void DatasetGetDefaultMemcap | ( | uint64_t * | memcap, |
uint32_t * | hashsize | ||
) |
Definition at line 599 of file datasets.c.
References DATASETS_HASHSIZE_DEFAULT, hashsize, ParseSizeStringU32(), ParseSizeStringU64(), SCConfGet(), SCLogWarning, and str.
Referenced by DatasetGetOrCreate(), and DatasetsInit().
int DatasetGetOrCreate | ( | const char * | name, |
enum DatasetTypes | type, | ||
const char * | save, | ||
const char * | load, | ||
uint64_t * | memcap, | ||
uint32_t * | hashsize, | ||
Dataset ** | ret_set | ||
) |
Calling function is responsible for locking via DatasetLock()
Definition at line 369 of file datasets.c.
References DATASET_NAME_MAX_LEN, DATASET_TYPE_NOTSET, DatasetGetDefaultMemcap(), DatasetSearchByName(), DatasetUnlock(), hashsize, Dataset::load, Dataset::name, name, Dataset::save, SCLogError, Dataset::type, and type.
Referenced by DatajsonGet(), and DatasetGet().
enum DatasetTypes DatasetGetTypeFromString | ( | const char * | s | ) |
Definition at line 62 of file datasets.c.
void DatasetLock | ( | void | ) |
Definition at line 102 of file datasets.c.
References SCMutexLock, and sets_lock.
Referenced by DatajsonGet(), and DatasetGet().
int DatasetLookup | ( | Dataset * | set, |
const uint8_t * | data, | ||
const uint32_t | data_len | ||
) |
see if data is part of the set
set | dataset |
data | data to look up |
data_len | length in bytes of data |
-1 | error |
0 | not found |
1 | found |
Definition at line 1104 of file datasets.c.
References DATASET_TYPE_STRING, and Dataset::type.
int DatasetLookupSerialized | ( | Dataset * | set, |
const char * | string | ||
) |
add serialized data to set
int | 1 added |
int | 0 already in hash |
int | -1 API error (not added) |
int | -2 DATA error |
Definition at line 1458 of file datasets.c.
DataRepResultType DatasetLookupwRep | ( | Dataset * | set, |
const uint8_t * | data, | ||
const uint32_t | data_len, | ||
const DataRepType * | rep | ||
) |
Definition at line 1124 of file datasets.c.
References DATASET_TYPE_STRING, DataRepResultType::found, and Dataset::type.
Referenced by DetectDatarepBufferMatch().
int DatasetParseIpv6String | ( | Dataset * | set, |
const char * | line, | ||
struct in6_addr * | in6 | ||
) |
Definition at line 156 of file datasets.c.
References FatalErrorOnInit, Dataset::load, and Dataset::name.
void DatasetPostReloadCleanup | ( | void | ) |
Definition at line 569 of file datasets.c.
References SCLogDebug, SCMutexLock, and sets_lock.
void DatasetReload | ( | void | ) |
Definition at line 543 of file datasets.c.
References SCMutexLock, and sets_lock.
int DatasetRemove | ( | Dataset * | set, |
const uint8_t * | data, | ||
const uint32_t | data_len | ||
) |
Definition at line 1542 of file datasets.c.
References DATASET_TYPE_STRING, and Dataset::type.
int DatasetRemoveSerialized | ( | Dataset * | set, |
const char * | string | ||
) |
remove serialized data from set
int | 1 removed |
int | 0 found but busy (not removed) |
int | -1 API error (not removed) |
int | -2 DATA error |
Definition at line 1536 of file datasets.c.
void DatasetsDestroy | ( | void | ) |
Definition at line 774 of file datasets.c.
References SCLogDebug.
Referenced by GlobalsDestroy().
Dataset* DatasetSearchByName | ( | const char * | name | ) |
Definition at line 121 of file datasets.c.
Referenced by DatasetFind(), and DatasetGetOrCreate().
int DatasetsInit | ( | void | ) |
Definition at line 622 of file datasets.c.
References dataset_max_one_hashsize, dataset_max_total_hashsize, DATASET_NAME_MAX_LEN, DatasetGetDefaultMemcap(), FatalError, FatalErrorOnInit, hashsize, SCConfNode_::name, next, ParseSizeStringU32(), SCConfGet(), SCConfGetNode(), SCConfNodeLookupChild(), SCLogDebug, str, and TAILQ_FOREACH.
Referenced by PreRunPostPrivsDropInit().
void DatasetsSave | ( | void | ) |
Definition at line 852 of file datasets.c.
References SCLogDebug.
Referenced by GlobalsDestroy().
void DatasetUnlock | ( | void | ) |
Definition at line 107 of file datasets.c.
References SCMutexUnlock, and sets_lock.
Referenced by DatajsonGet(), DatasetGet(), and DatasetGetOrCreate().