aboutsummaryrefslogtreecommitdiffstats
path: root/src/greylist.h
blob: e113d2e94a2376724c7eab61246e147933787142 (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
42
43
44
45
46
47
48
#ifndef RSPAMD_GREYLIST_H
#define RSPAMD_GREYLIST_H

#include "config.h"

#define CHECKSUM_SIZE 16
/* 5 minutes */
#define DEFAULT_GREYLIST_TIME 300
/* 2 days */
#define DEFAULT_EXPIRE_TIME 60 * 60 * 24 * 2

/**
 * Item in storage
 */
struct rspamd_grey_item {
	time_t age;					/**< age of checksum			*/
	guint8 data[CHECKSUM_SIZE];	/**< checksum of triplet		*/
};

/**
 * Protocol command that is used to work with greylist storage
 */
struct rspamd_grey_command {
	enum {
		GREY_CMD_ADD = 0,
		GREY_CMD_CHECK,
		GREY_CMD_DEL
	} cmd;
	gint version;
	guint8 data[CHECKSUM_SIZE];
};

/**
 * Reply packet
 */
struct rspamd_grey_reply {
	enum {
		GREY_OK = 0,
		GREY_GREYLISTED,
		GREY_EXPIRED,
		GREY_NOT_FOUND,
		GREY_ERR
	} reply;
};

typedef void (*greylist_cb_t) (gboolean greylisted, struct worker_task *task, gpointer ud);

#endif