]> git.ipfire.org Git - people/ms/suricata.git/blame - src/datasets.h
core: Remove unneeded consts
[people/ms/suricata.git] / src / datasets.h
CommitLineData
317376f5
VJ
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
24int DatasetsInit(void);
25void DatasetsDestroy(void);
26void DatasetsSave(void);
e9fe5ada
SB
27void DatasetReload(void);
28void DatasetPostReloadCleanup(void);
317376f5
VJ
29
30enum DatasetTypes {
31#define DATASET_TYPE_NOTSET 0
32 DATASET_TYPE_STRING = 1,
33 DATASET_TYPE_MD5,
34 DATASET_TYPE_SHA256,
35};
36
e264a0ce 37#define DATASET_NAME_MAX_LEN 63
317376f5 38typedef struct Dataset {
e264a0ce 39 char name[DATASET_NAME_MAX_LEN + 1];
317376f5
VJ
40 enum DatasetTypes type;
41 uint32_t id;
e9fe5ada
SB
42 bool from_yaml; /* Mark whether the set was retrieved from YAML */
43 bool hidden; /* Mark the old sets hidden in case of reload */
317376f5
VJ
44 THashTableContext *hash;
45
46 char load[PATH_MAX];
47 char save[PATH_MAX];
48
49 struct Dataset *next;
50} Dataset;
51
1d6a358d
VJ
52enum DatasetTypes DatasetGetTypeFromString(const char *s);
53Dataset *DatasetFind(const char *name, enum DatasetTypes type);
5ac94fc4
SB
54Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save, const char *load,
55 uint64_t memcap, uint32_t hashsize);
317376f5
VJ
56int DatasetAdd(Dataset *set, const uint8_t *data, const uint32_t data_len);
57int DatasetLookup(Dataset *set, const uint8_t *data, const uint32_t data_len);
58DataRepResultType DatasetLookupwRep(Dataset *set, const uint8_t *data, const uint32_t data_len,
59 const DataRepType *rep);
af06883f 60
1d6a358d 61int DatasetAddSerialized(Dataset *set, const char *string);
af06883f 62int DatasetRemoveSerialized(Dataset *set, const char *string);
317376f5
VJ
63
64#endif /* __DATASETS_H__ */