diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-12 13:34:17 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-12 13:34:17 +0000 |
commit | d54124d738a0e30d2b3b9adb1966374935ff3f46 (patch) | |
tree | 26fdb2a5582c81b865d94a12064a45a086fd35bc | |
parent | d8e99a0ecd83177911d10e395ee7490af91008d1 (diff) | |
download | rspamd-d54124d738a0e30d2b3b9adb1966374935ff3f46.tar.gz rspamd-d54124d738a0e30d2b3b9adb1966374935ff3f46.zip |
Add versions to rspamd modules and workers
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | config.h.in | 4 | ||||
-rw-r--r-- | src/controller.c | 3 | ||||
-rw-r--r-- | src/fuzzy_storage.c | 3 | ||||
-rw-r--r-- | src/hs_helper.c | 3 | ||||
-rw-r--r-- | src/http_proxy.c | 3 | ||||
-rw-r--r-- | src/lmtp.c | 3 | ||||
-rw-r--r-- | src/lua_worker.c | 3 | ||||
-rw-r--r-- | src/plugins/chartable.c | 3 | ||||
-rw-r--r-- | src/plugins/dkim_check.c | 3 | ||||
-rw-r--r-- | src/plugins/fuzzy_check.c | 3 | ||||
-rw-r--r-- | src/plugins/surbl.c | 3 | ||||
-rw-r--r-- | src/rspamd.h | 40 | ||||
-rw-r--r-- | src/smtp.c | 3 | ||||
-rw-r--r-- | src/smtp_proxy.c | 3 | ||||
-rw-r--r-- | src/worker.c | 3 |
16 files changed, 74 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 33dcf5cbf..55611a75a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,11 @@ SET(RSPAMD_VERSION_MAJOR 1) SET(RSPAMD_VERSION_MINOR 2) 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) SET(GIT_VERSION 1) SET(RSPAMD_ID "${GIT_ID}") diff --git a/config.h.in b/config.h.in index bae4efdb9..4505c87bc 100644 --- a/config.h.in +++ b/config.h.in @@ -184,11 +184,13 @@ #define RSPAMD_PREFIX "${CMAKE_INSTALL_PREFIX}" -#ifdef GIT_VERSION +#if defined(GIT_VERSION) && GIT_VERSION == 1 # define RVERSION "${RSPAMD_VERSION}" # 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 # 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" #endif diff --git a/src/controller.c b/src/controller.c index c88e51ef2..59388ba1b 100644 --- a/src/controller.c +++ b/src/controller.c @@ -109,7 +109,8 @@ worker_t controller_worker = { TRUE, /* Non unique */ FALSE, /* Non threaded */ TRUE, /* Killable */ - SOCK_STREAM /* TCP socket */ + SOCK_STREAM, /* TCP socket */ + RSPAMD_WORKER_VER /* Version info */ }; /* * Worker's context diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index c4814c6d4..b852dbb85 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -56,7 +56,8 @@ worker_t fuzzy_worker = { FALSE, /* Unique */ FALSE, /* Threaded */ FALSE, /* Non killable */ - SOCK_DGRAM /* UDP socket */ + SOCK_DGRAM, /* UDP socket */ + RSPAMD_WORKER_VER /* Version info */ }; /* For evtimer */ diff --git a/src/hs_helper.c b/src/hs_helper.c index 6e496f28c..a34d1d885 100644 --- a/src/hs_helper.c +++ b/src/hs_helper.c @@ -36,7 +36,8 @@ worker_t hs_helper_worker = { TRUE, /* Unique */ FALSE, /* Non threaded */ TRUE, /* Killable */ - SOCK_STREAM /* TCP socket */ + SOCK_STREAM, /* TCP socket */ + RSPAMD_WORKER_VER /* Version info */ }; static const gdouble default_max_time = 1.0; diff --git a/src/http_proxy.c b/src/http_proxy.c index 1af159f48..02f676945 100644 --- a/src/http_proxy.c +++ b/src/http_proxy.c @@ -42,7 +42,8 @@ worker_t http_proxy_worker = { FALSE, /* Non unique */ FALSE, /* Non threaded */ TRUE, /* Killable */ - SOCK_STREAM /* TCP socket */ + SOCK_STREAM, /* TCP socket */ + RSPAMD_WORKER_VER }; struct rspamd_http_upstream { diff --git a/src/lmtp.c b/src/lmtp.c index cb8a6718d..09c1f467c 100644 --- a/src/lmtp.c +++ b/src/lmtp.c @@ -37,7 +37,8 @@ worker_t lmtp_worker = { TRUE, /* Has socket */ FALSE, /* Non unique */ FALSE, /* Non threaded */ - TRUE /* Killable */ + TRUE, /* Killable */ + RSPAMD_WORKER_VER /* Version info */ }; #ifndef HAVE_SA_SIGINFO diff --git a/src/lua_worker.c b/src/lua_worker.c index 6aba9e64f..5f8c96fa9 100644 --- a/src/lua_worker.c +++ b/src/lua_worker.c @@ -46,7 +46,8 @@ worker_t lua_worker = { FALSE, /* Non unique */ FALSE, /* Non threaded */ TRUE, /* Killable */ - SOCK_STREAM /* TCP socket */ + SOCK_STREAM, /* TCP socket */ + RSPAMD_WORKER_VER /* Version info */ }; /* diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c index 50d4adb90..0ef9efff6 100644 --- a/src/plugins/chartable.c +++ b/src/plugins/chartable.c @@ -39,7 +39,8 @@ module_t chartable_module = { chartable_module_init, chartable_module_config, chartable_module_reconfig, - NULL + NULL, + RSPAMD_MODULE_VER }; struct chartable_ctx { diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c index 5813d1acd..24f08e9b1 100644 --- a/src/plugins/dkim_check.c +++ b/src/plugins/dkim_check.c @@ -83,7 +83,8 @@ module_t dkim_module = { dkim_module_init, dkim_module_config, dkim_module_reconfig, - NULL + NULL, + RSPAMD_MODULE_VER }; static void diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 9edf7fc9d..85c147a52 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -151,7 +151,8 @@ module_t fuzzy_check_module = { fuzzy_check_module_init, fuzzy_check_module_config, fuzzy_check_module_reconfig, - fuzzy_attach_controller + fuzzy_attach_controller, + RSPAMD_MODULE_VER }; static void diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index ca565f343..cbd5f0f2b 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -73,7 +73,8 @@ module_t surbl_module = { surbl_module_init, surbl_module_config, surbl_module_reconfig, - NULL + NULL, + RSPAMD_MODULE_VER }; static void diff --git a/src/rspamd.h b/src/rspamd.h index df5239357..e5c7bb4db 100644 --- a/src/rspamd.h +++ b/src/rspamd.h @@ -96,6 +96,40 @@ struct module_ctx { 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 */ @@ -106,6 +140,9 @@ typedef struct module_s { int (*module_reconfig_func)(struct rspamd_config *cfg); int (*module_attach_controller_func)(struct module_ctx *ctx, GHashTable *custom_commands); + guint module_version; + guint64 rspamd_version; + const gchar *rspamd_features; } module_t; typedef struct worker_s { @@ -117,6 +154,9 @@ typedef struct worker_s { gboolean threaded; gboolean killable; gint listen_type; + guint module_version; + guint64 rspamd_version; + const gchar *rspamd_features; } worker_t; struct pidfh; diff --git a/src/smtp.c b/src/smtp.c index 71e0da061..07e28a4de 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -51,7 +51,8 @@ worker_t smtp_worker = { FALSE, /* Non unique */ FALSE, /* Non threaded */ TRUE, /* Killable */ - SOCK_STREAM /* TCP socket */ + SOCK_STREAM, /* TCP socket */ + RSPAMD_WORKER_VER /* Version info */ }; static gboolean diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c index 0698802a2..1a1e628b8 100644 --- a/src/smtp_proxy.c +++ b/src/smtp_proxy.c @@ -47,7 +47,8 @@ worker_t smtp_proxy_worker = { FALSE, /* Non unique */ FALSE, /* Non threaded */ TRUE, /* Killable */ - SOCK_STREAM /* TCP socket */ + SOCK_STREAM, /* TCP socket */ + RSPAMD_WORKER_VER /* Version info */ }; struct smtp_proxy_ctx { diff --git a/src/worker.c b/src/worker.c index ab038f63f..91f570b62 100644 --- a/src/worker.c +++ b/src/worker.c @@ -50,7 +50,8 @@ worker_t normal_worker = { FALSE, /* Non unique */ FALSE, /* Non threaded */ 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, \ |