suricata
datasets-context-json.h
Go to the documentation of this file.
1 /* Copyright (C) 2024 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 /**
19  * \file
20  *
21  * \author Eric Leblond <el@stamus-networks.com>
22  */
23 
24 #ifndef SURICATA_DATASETS_CONTEXT_JSON_H
25 #define SURICATA_DATASETS_CONTEXT_JSON_H
26 
27 #include "suricata-common.h"
28 #include "datasets.h"
29 
30 #define DATAJSON_JSON_LENGTH 1024
31 
32 typedef struct DataJsonType {
33  char *value;
34  uint16_t len;
36 
37 typedef struct DataJsonResultType {
38  bool found;
42 
43 /* Common functions */
44 
45 Dataset *DatajsonGet(const char *name, enum DatasetTypes type, const char *load, uint64_t memcap,
46  uint32_t hashsize, char *json_key_value, char *json_array_key, DatasetFormats format,
47  bool remove_key);
48 
49 DataJsonResultType DatajsonLookup(Dataset *set, const uint8_t *data, const uint32_t data_len);
50 
51 int DatajsonAddSerialized(Dataset *set, const char *value, const char *json);
52 
54 
56 
57 #endif /* SURICATA_DATASETS_CONTEXT_JSON_H */
DataJsonType::len
uint16_t len
Definition: datasets-context-json.h:34
DatajsonLookup
DataJsonResultType DatajsonLookup(Dataset *set, const uint8_t *data, const uint32_t data_len)
Definition: datasets-context-json.c:846
DataJsonResultType
struct DataJsonResultType DataJsonResultType
DatasetFormats
DatasetFormats
Definition: datasets.h:31
DatajsonGet
Dataset * DatajsonGet(const char *name, enum DatasetTypes type, const char *load, uint64_t memcap, uint32_t hashsize, char *json_key_value, char *json_array_key, DatasetFormats format, bool remove_key)
Definition: datasets-context-json.c:631
DataJsonResultType::found
bool found
Definition: datasets-context-json.h:38
DataJsonType
struct DataJsonType DataJsonType
DataJsonResultType::hashdata
THashData * hashdata
Definition: datasets-context-json.h:40
DataJsonResultType
Definition: datasets-context-json.h:37
datasets.h
DatajsonAddSerialized
int DatajsonAddSerialized(Dataset *set, const char *value, const char *json)
add serialized data to json set
Definition: datasets-context-json.c:875
DataJsonResultType::json
DataJsonType json
Definition: datasets-context-json.h:39
type
uint16_t type
Definition: decode-vlan.c:106
name
const char * name
Definition: tm-threads.c:2163
DatajsonCopyJson
int DatajsonCopyJson(DataJsonType *dst, DataJsonType *src)
Definition: datasets-context-json.c:54
DatasetTypes
DatasetTypes
Definition: datasets.h:37
DatajsonUnlockElt
void DatajsonUnlockElt(DataJsonResultType *r)
Definition: datasets-context-json.c:47
THashData_
Definition: util-thash.h:85
suricata-common.h
DataJsonType
Definition: datasets-context-json.h:32
hashsize
#define hashsize(n)
Definition: util-hash-lookup3.h:40
src
uint16_t src
Definition: app-layer-dnp3.h:5
DataJsonType::value
char * value
Definition: datasets-context-json.h:33
Dataset
Definition: datasets.h:47
dst
uint16_t dst
Definition: app-layer-dnp3.h:4