suricata
datasets.h
Go to the documentation of this file.
1 /* Copyright (C) 2017 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 #ifndef __DATASETS_H__
19 #define __DATASETS_H__
20 
21 #include "util-thash.h"
22 #include "datasets-reputation.h"
23 
24 int DatasetsInit(void);
25 void DatasetsDestroy(void);
26 void DatasetsSave(void);
27 
29 #define DATASET_TYPE_NOTSET 0
33 };
34 
35 typedef struct Dataset {
36  char name[64];
38  uint32_t id;
39 
41 
42  char load[PATH_MAX];
43  char save[PATH_MAX];
44 
45  struct Dataset *next;
46 } Dataset;
47 
48 enum DatasetTypes DatasetGetTypeFromString(const char *s);
49 Dataset *DatasetFind(const char *name, enum DatasetTypes type);
50 Dataset *DatasetGet(const char *name, enum DatasetTypes type,
51  const char *save, const char *load);
52 int DatasetAdd(Dataset *set, const uint8_t *data, const uint32_t data_len);
53 int DatasetLookup(Dataset *set, const uint8_t *data, const uint32_t data_len);
54 DataRepResultType DatasetLookupwRep(Dataset *set, const uint8_t *data, const uint32_t data_len,
55  const DataRepType *rep);
56 int DatasetAddSerialized(Dataset *set, const char *string);
57 
58 #endif /* __DATASETS_H__ */
void DatasetsSave(void)
Definition: datasets.c:650
int DatasetLookup(Dataset *set, const uint8_t *data, const uint32_t data_len)
Definition: datasets.c:803
DatasetTypes
Definition: datasets.h:28
int DatasetAdd(Dataset *set, const uint8_t *data, const uint32_t data_len)
Definition: datasets.c:952
enum DatasetTypes type
Definition: datasets.h:37
uint32_t id
Definition: datasets.h:38
struct Dataset * next
Definition: datasets.h:45
Dataset * DatasetGet(const char *name, enum DatasetTypes type, const char *save, const char *load)
Definition: datasets.c:407
void DatasetsDestroy(void)
Definition: datasets.c:595
char load[PATH_MAX]
Definition: datasets.h:42
DataRepResultType DatasetLookupwRep(Dataset *set, const uint8_t *data, const uint32_t data_len, const DataRepType *rep)
Definition: datasets.c:819
enum DatasetTypes DatasetGetTypeFromString(const char *s)
Definition: datasets.c:43
Dataset * DatasetFind(const char *name, enum DatasetTypes type)
look for set by name without creating it
Definition: datasets.c:393
struct Dataset Dataset
THashTableContext * hash
Definition: datasets.h:40
char save[PATH_MAX]
Definition: datasets.h:43
int DatasetAddSerialized(Dataset *set, const char *string)
add serialized data to set
Definition: datasets.c:986
char name[64]
Definition: datasets.h:36
int DatasetsInit(void)
Definition: datasets.c:512