.tv_usec = 0
};
+const guint64 rspamd_controller_ctx_magic = 0xf72697805e6941faULL;
+
gpointer init_controller_worker (struct rspamd_config *cfg);
void start_controller_worker (struct rspamd_worker *worker);
* Worker's context
*/
struct rspamd_controller_worker_ctx {
+ guint64 magic;
guint32 timeout;
struct timeval io_tv;
/* DNS resolver */
ctx = g_malloc0 (sizeof (struct rspamd_controller_worker_ctx));
+ ctx->magic = rspamd_controller_ctx_magic;
ctx->timeout = DEFAULT_WORKER_IO_TIMEOUT;
rspamd_rcl_register_worker_option (cfg,
rspamd_lru_hash_t *last_ips;
};
+static const guint64 rspamd_fuzzy_storage_magic = 0x291a3253eb1b3ea5ULL;
+
struct rspamd_fuzzy_storage_ctx {
+ guint64 magic;
struct fuzzy_global_stat stat;
char *hashfile;
gdouble expire;
ctx = g_malloc0 (sizeof (struct rspamd_fuzzy_storage_ctx));
+ ctx->magic = rspamd_fuzzy_storage_magic;
ctx->sync_timeout = DEFAULT_SYNC_TIMEOUT;
ctx->expire = DEFAULT_EXPIRE;
ctx->keypair_cache_size = DEFAULT_KEYPAIR_CACHE_SIZE;
static const gdouble default_max_time = 1.0;
static const gdouble default_recompile_time = 60.0;
+static const guint64 rspamd_hs_helper_magic = 0x22d310157a2288a0ULL;
/*
* Worker's context
*/
struct hs_helper_ctx {
+ guint64 magic;
gchar *hs_dir;
gboolean loaded;
gdouble max_time;
type = g_quark_try_string ("hs_helper");
ctx = g_malloc0 (sizeof (*ctx));
+ ctx->magic = rspamd_hs_helper_magic;
ctx->cfg = cfg;
ctx->hs_dir = RSPAMD_DBDIR "/";
ctx->max_time = default_max_time;
struct rspamd_cryptobox_pubkey *key;
};
+static const guint64 rspamd_http_proxy_magic = 0xcdeb4fd1fc351980ULL;
+
struct http_proxy_ctx {
+ guint64 magic;
gdouble timeout;
struct timeval io_tv;
struct rspamd_config *cfg;
type = g_quark_try_string ("http_proxy");
ctx = g_malloc0 (sizeof (struct http_proxy_ctx));
+ ctx->magic = rspamd_http_proxy_magic;
ctx->timeout = 5.0;
ctx->upstreams = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal);
ctx->rotate_tm = DEFAULT_ROTATION_TIME;
#include "message.h"
#include "utlist.h"
#include "http.h"
+#include "worker_private.h"
/* Max line size */
#define OUTBUFSIZ BUFSIZ
RSPAMD_WORKER_VER /* Version info */
};
+static const guint64 rspamd_lua_ctx_magic = 0x8055e2652aacf96eULL;
/*
* Worker's context
*/
struct rspamd_lua_worker_ctx {
+ guint64 magic;
/* DNS resolver */
struct rspamd_dns_resolver *resolver;
/* Events base */
type = g_quark_try_string ("lua");
ctx = g_malloc0 (sizeof (struct rspamd_lua_worker_ctx));
+ ctx->magic = rspamd_lua_ctx_magic;
ctx->params = g_hash_table_new_full (rspamd_str_hash,
rspamd_str_equal,
g_free,
gpointer control_data; /**< used by control protocol to handle commands */
};
+struct rspamd_abstract_worker_ctx {
+ guint64 magic;
+ char data[];
+};
+
struct rspamd_worker_signal_handler;
struct rspamd_worker_signal_cb {
RSPAMD_WORKER_VER /* Version info */
};
+static guint64 rspamd_smtp_proxy_magic = 0xf3d849189c85f12dULL;
+
struct smtp_proxy_ctx {
+ guint64 magic;
struct upstream_list *upstreams;
gchar *upstreams_str;
type = g_quark_try_string ("smtp_proxy");
ctx = g_malloc0 (sizeof (struct smtp_worker_ctx));
+ ctx->magic = rspamd_smtp_proxy_magic;
ctx->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
/* Set default values */
#include "libstat/stat_api.h"
#include "libserver/worker_util.h"
#include "libserver/rspamd_control.h"
+#include "worker_private.h"
#include "utlist.h"
#include "lua/lua_common.h"
G_STRFUNC, \
__VA_ARGS__)
-struct rspamd_worker_log_pipe {
- gint fd;
- enum rspamd_log_pipe_type type;
- struct rspamd_worker_log_pipe *prev, *next;
-};
-
-/*
- * Worker's context
- */
-struct rspamd_worker_ctx {
- guint32 timeout;
- struct timeval io_tv;
- /* Detect whether this worker is mime worker */
- gboolean is_mime;
- /* HTTP worker */
- gboolean is_http;
- /* JSON output */
- gboolean is_json;
- /* Allow learning throught worker */
- gboolean allow_learn;
- /* DNS resolver */
- struct rspamd_dns_resolver *resolver;
- /* Limit of tasks */
- guint32 max_tasks;
- /* Maximum time for task processing */
- gdouble task_timeout;
- /* Events base */
- struct event_base *ev_base;
- /* Encryption key */
- struct rspamd_cryptobox_keypair *key;
- /* Keys cache */
- struct rspamd_keypair_cache *keys_cache;
- /* Configuration */
- struct rspamd_config *cfg;
- /* Log pipe */
- struct rspamd_worker_log_pipe *log_pipes;
-};
-
/*
* Reduce number of tasks proceeded
*/
ctx = g_malloc0 (sizeof (struct rspamd_worker_ctx));
+ ctx->magic = rspamd_worker_magic;
ctx->is_mime = TRUE;
ctx->timeout = DEFAULT_WORKER_IO_TIMEOUT;
ctx->cfg = cfg;