SET(RSPAMD_VERSION_MINOR 2) | SET(RSPAMD_VERSION_MINOR 2) | ||||
SET(RSPAMD_VERSION_PATCH 0) | SET(RSPAMD_VERSION_PATCH 0) | ||||
# Keep two digits all the time | |||||
SET(RSPAMD_VERSION_MAJOR_NUM ${RSPAMD_VERSION_MAJOR}0) | |||||
SET(RSPAMD_VERSION_MINOR_NUM ${RSPAMD_VERSION_MINOR}0) | |||||
SET(RSPAMD_VERSION_PATCH_NUM ${RSPAMD_VERSION_PATCH}0) | |||||
IF(GIT_ID) | IF(GIT_ID) | ||||
SET(GIT_VERSION 1) | SET(GIT_VERSION 1) | ||||
SET(RSPAMD_ID "${GIT_ID}") | SET(RSPAMD_ID "${GIT_ID}") |
#define RSPAMD_PREFIX "${CMAKE_INSTALL_PREFIX}" | #define RSPAMD_PREFIX "${CMAKE_INSTALL_PREFIX}" | ||||
#ifdef GIT_VERSION | |||||
#if defined(GIT_VERSION) && GIT_VERSION == 1 | |||||
# define RVERSION "${RSPAMD_VERSION}" | # define RVERSION "${RSPAMD_VERSION}" | ||||
# define RID "${RSPAMD_ID}" | # define RID "${RSPAMD_ID}" | ||||
# define RSPAMD_VERSION_NUM 0x${RSPAMD_VERSION_MAJOR_NUM}${RSPAMD_VERSION_MINOR_NUM}${RSPAMD_VERSION_PATCH_NUM}${RSPAMD_ID}ULL | |||||
#else | #else | ||||
# define RVERSION "${RSPAMD_VERSION}" | # define RVERSION "${RSPAMD_VERSION}" | ||||
# define RSPAMD_VERSION_NUM 0x${RSPAMD_VERSION_MAJOR_NUM}${RSPAMD_VERSION_MINOR_NUM}${RSPAMD_VERSION_PATCH_NUM}0000000ULL | |||||
# define RID "release" | # define RID "release" | ||||
#endif | #endif | ||||
TRUE, /* Non unique */ | TRUE, /* Non unique */ | ||||
FALSE, /* Non threaded */ | FALSE, /* Non threaded */ | ||||
TRUE, /* Killable */ | TRUE, /* Killable */ | ||||
SOCK_STREAM /* TCP socket */ | |||||
SOCK_STREAM, /* TCP socket */ | |||||
RSPAMD_WORKER_VER /* Version info */ | |||||
}; | }; | ||||
/* | /* | ||||
* Worker's context | * Worker's context |
FALSE, /* Unique */ | FALSE, /* Unique */ | ||||
FALSE, /* Threaded */ | FALSE, /* Threaded */ | ||||
FALSE, /* Non killable */ | FALSE, /* Non killable */ | ||||
SOCK_DGRAM /* UDP socket */ | |||||
SOCK_DGRAM, /* UDP socket */ | |||||
RSPAMD_WORKER_VER /* Version info */ | |||||
}; | }; | ||||
/* For evtimer */ | /* For evtimer */ |
TRUE, /* Unique */ | TRUE, /* Unique */ | ||||
FALSE, /* Non threaded */ | FALSE, /* Non threaded */ | ||||
TRUE, /* Killable */ | TRUE, /* Killable */ | ||||
SOCK_STREAM /* TCP socket */ | |||||
SOCK_STREAM, /* TCP socket */ | |||||
RSPAMD_WORKER_VER /* Version info */ | |||||
}; | }; | ||||
static const gdouble default_max_time = 1.0; | static const gdouble default_max_time = 1.0; |
FALSE, /* Non unique */ | FALSE, /* Non unique */ | ||||
FALSE, /* Non threaded */ | FALSE, /* Non threaded */ | ||||
TRUE, /* Killable */ | TRUE, /* Killable */ | ||||
SOCK_STREAM /* TCP socket */ | |||||
SOCK_STREAM, /* TCP socket */ | |||||
RSPAMD_WORKER_VER | |||||
}; | }; | ||||
struct rspamd_http_upstream { | struct rspamd_http_upstream { |
TRUE, /* Has socket */ | TRUE, /* Has socket */ | ||||
FALSE, /* Non unique */ | FALSE, /* Non unique */ | ||||
FALSE, /* Non threaded */ | FALSE, /* Non threaded */ | ||||
TRUE /* Killable */ | |||||
TRUE, /* Killable */ | |||||
RSPAMD_WORKER_VER /* Version info */ | |||||
}; | }; | ||||
#ifndef HAVE_SA_SIGINFO | #ifndef HAVE_SA_SIGINFO |
FALSE, /* Non unique */ | FALSE, /* Non unique */ | ||||
FALSE, /* Non threaded */ | FALSE, /* Non threaded */ | ||||
TRUE, /* Killable */ | TRUE, /* Killable */ | ||||
SOCK_STREAM /* TCP socket */ | |||||
SOCK_STREAM, /* TCP socket */ | |||||
RSPAMD_WORKER_VER /* Version info */ | |||||
}; | }; | ||||
/* | /* |
chartable_module_init, | chartable_module_init, | ||||
chartable_module_config, | chartable_module_config, | ||||
chartable_module_reconfig, | chartable_module_reconfig, | ||||
NULL | |||||
NULL, | |||||
RSPAMD_MODULE_VER | |||||
}; | }; | ||||
struct chartable_ctx { | struct chartable_ctx { |
dkim_module_init, | dkim_module_init, | ||||
dkim_module_config, | dkim_module_config, | ||||
dkim_module_reconfig, | dkim_module_reconfig, | ||||
NULL | |||||
NULL, | |||||
RSPAMD_MODULE_VER | |||||
}; | }; | ||||
static void | static void |
fuzzy_check_module_init, | fuzzy_check_module_init, | ||||
fuzzy_check_module_config, | fuzzy_check_module_config, | ||||
fuzzy_check_module_reconfig, | fuzzy_check_module_reconfig, | ||||
fuzzy_attach_controller | |||||
fuzzy_attach_controller, | |||||
RSPAMD_MODULE_VER | |||||
}; | }; | ||||
static void | static void |
surbl_module_init, | surbl_module_init, | ||||
surbl_module_config, | surbl_module_config, | ||||
surbl_module_reconfig, | surbl_module_reconfig, | ||||
NULL | |||||
NULL, | |||||
RSPAMD_MODULE_VER | |||||
}; | }; | ||||
static void | static void |
gboolean enabled; /**< true if module is enabled in configuration */ | gboolean enabled; /**< true if module is enabled in configuration */ | ||||
}; | }; | ||||
#ifndef WITH_HYPERSCAN | |||||
#define RSPAMD_FEATURE_HYPERSCAN "0" | |||||
#else | |||||
#define RSPAMD_FEATURE_HYPERSCAN "1" | |||||
#endif | |||||
#ifndef WITH_PCRE2 | |||||
#define RSPAMD_FEATURE_PCRE2 "0" | |||||
#else | |||||
#define RSPAMD_FEATURE_PCRE2 "1" | |||||
#endif | |||||
#ifndef WITH_FANN | |||||
#define RSPAMD_FEATURE_FANN "0" | |||||
#else | |||||
#define RSPAMD_FEATURE_FANN "1" | |||||
#endif | |||||
#ifndef WITH_SNOWBALL | |||||
#define RSPAMD_FEATURE_SNOWBALL "0" | |||||
#else | |||||
#define RSPAMD_FEATURE_SNOWBALL "1" | |||||
#endif | |||||
#define RSPAMD_FEATURES \ | |||||
RSPAMD_FEATURE_HYPERSCAN RSPAMD_FEATURE_PCRE2 \ | |||||
RSPAMD_FEATURE_FANN RSPAMD_FEATURE_SNOWBALL | |||||
#define RSPAMD_MODULE_VER \ | |||||
0x1, /* Module version */ \ | |||||
RSPAMD_VERSION_NUM, /* Rspamd version */ \ | |||||
RSPAMD_FEATURES /* Compilation features */ \ | |||||
#define RSPAMD_WORKER_VER \ | |||||
0x1, /* Worker version */ \ | |||||
RSPAMD_VERSION_NUM, /* Rspamd version */ \ | |||||
RSPAMD_FEATURES /* Compilation features */ \ | |||||
/** | /** | ||||
* Module | * Module | ||||
*/ | */ | ||||
int (*module_reconfig_func)(struct rspamd_config *cfg); | int (*module_reconfig_func)(struct rspamd_config *cfg); | ||||
int (*module_attach_controller_func)(struct module_ctx *ctx, | int (*module_attach_controller_func)(struct module_ctx *ctx, | ||||
GHashTable *custom_commands); | GHashTable *custom_commands); | ||||
guint module_version; | |||||
guint64 rspamd_version; | |||||
const gchar *rspamd_features; | |||||
} module_t; | } module_t; | ||||
typedef struct worker_s { | typedef struct worker_s { | ||||
gboolean threaded; | gboolean threaded; | ||||
gboolean killable; | gboolean killable; | ||||
gint listen_type; | gint listen_type; | ||||
guint module_version; | |||||
guint64 rspamd_version; | |||||
const gchar *rspamd_features; | |||||
} worker_t; | } worker_t; | ||||
struct pidfh; | struct pidfh; |
FALSE, /* Non unique */ | FALSE, /* Non unique */ | ||||
FALSE, /* Non threaded */ | FALSE, /* Non threaded */ | ||||
TRUE, /* Killable */ | TRUE, /* Killable */ | ||||
SOCK_STREAM /* TCP socket */ | |||||
SOCK_STREAM, /* TCP socket */ | |||||
RSPAMD_WORKER_VER /* Version info */ | |||||
}; | }; | ||||
static gboolean | static gboolean |
FALSE, /* Non unique */ | FALSE, /* Non unique */ | ||||
FALSE, /* Non threaded */ | FALSE, /* Non threaded */ | ||||
TRUE, /* Killable */ | TRUE, /* Killable */ | ||||
SOCK_STREAM /* TCP socket */ | |||||
SOCK_STREAM, /* TCP socket */ | |||||
RSPAMD_WORKER_VER /* Version info */ | |||||
}; | }; | ||||
struct smtp_proxy_ctx { | struct smtp_proxy_ctx { |
FALSE, /* Non unique */ | FALSE, /* Non unique */ | ||||
FALSE, /* Non threaded */ | FALSE, /* Non threaded */ | ||||
TRUE, /* Killable */ | TRUE, /* Killable */ | ||||
SOCK_STREAM /* TCP socket */ | |||||
SOCK_STREAM, /* TCP socket */ | |||||
RSPAMD_WORKER_VER /* Version info */ | |||||
}; | }; | ||||
#define msg_err_ctx(...) rspamd_default_log_function(G_LOG_LEVEL_CRITICAL, \ | #define msg_err_ctx(...) rspamd_default_log_function(G_LOG_LEVEL_CRITICAL, \ |