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 #define DATASET_NAME_MAX_LEN 63
36 typedef struct Dataset {
39  uint32_t id;
40 
42 
43  char load[PATH_MAX];
44  char save[PATH_MAX];
45 
46  struct Dataset *next;
47 } Dataset;
48 
49 enum DatasetTypes DatasetGetTypeFromString(const char *s);
50 Dataset *DatasetFind(const char *name, enum DatasetTypes type);
51 Dataset *DatasetGet(const char *name, enum DatasetTypes type,
52  const char *save, const char *load);
53 int DatasetAdd(Dataset *set, const uint8_t *data, const uint32_t data_len);
54 int DatasetLookup(Dataset *set, const uint8_t *data, const uint32_t data_len);
55 DataRepResultType DatasetLookupwRep(Dataset *set, const uint8_t *data, const uint32_t data_len,
56  const DataRepType *rep);
57 int DatasetAddSerialized(Dataset *set, const char *string);
58 
59 #endif /* __DATASETS_H__ */
void DatasetsSave(void)
Definition: datasets.c:657
int DatasetLookup(Dataset *set, const uint8_t *data, const uint32_t data_len)
see if data is part of the set
Definition: datasets.c:819
DatasetTypes
Definition: datasets.h:28
char name[DATASET_NAME_MAX_LEN+1]
Definition: datasets.h:37
int DatasetAdd(Dataset *set, const uint8_t *data, const uint32_t data_len)
Definition: datasets.c:968
enum DatasetTypes type
Definition: datasets.h:38
uint32_t id
Definition: datasets.h:39
struct Dataset * next
Definition: datasets.h:46
Dataset * DatasetGet(const char *name, enum DatasetTypes type, const char *save, const char *load)
Definition: datasets.c:408
void DatasetsDestroy(void)
Definition: datasets.c:602
char load[PATH_MAX]
Definition: datasets.h:43
DataRepResultType DatasetLookupwRep(Dataset *set, const uint8_t *data, const uint32_t data_len, const DataRepType *rep)
Definition: datasets.c:835
enum DatasetTypes DatasetGetTypeFromString(const char *s)
Definition: datasets.c:44
Dataset * DatasetFind(const char *name, enum DatasetTypes type)
look for set by name without creating it
Definition: datasets.c:394
struct Dataset Dataset
THashTableContext * hash
Definition: datasets.h:41
char save[PATH_MAX]
Definition: datasets.h:44
int DatasetAddSerialized(Dataset *set, const char *string)
add serialized data to set
Definition: datasets.c:1002
#define DATASET_NAME_MAX_LEN
Definition: datasets.h:35
int DatasetsInit(void)
Definition: datasets.c:525