aboutsummaryrefslogtreecommitdiffstats
path: root/src/fuzzy_storage.h
blob: 037f21a7952cd65c64d56c79dbd15f2482c2265b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef RSPAMD_FUZZY_STORAGE_H
#define RSPAMD_FUZZY_STORAGE_H

#include "config.h"
#include "main.h"
#include "fuzzy.h"
#include "shingles.h"

#define RSPAMD_FUZZY_VERSION 2

/* Commands for fuzzy storage */
#define FUZZY_CHECK 0
#define FUZZY_WRITE 1
#define FUZZY_DEL 2

struct legacy_fuzzy_cmd {
	u_char cmd;
	guint32 blocksize;
	gint32 value;
	gint32 flag;
	u_char hash[FUZZY_HASHLEN];
};

struct rspamd_fuzzy_cmd {
	guint8 version;
	guint8 cmd;
	guint16 shingles_count;
	gchar digest[64];
};

struct rspamd_fuzzy_shingle_cmd {
	struct rspamd_fuzzy_cmd basic;
	struct rspamd_shingle sgl;
};

struct rspamd_fuzzy_reply {
	guint32 code;
	gdouble prob;
};

#endif