############################# CONFIG SECTION ############################################# | ############################# CONFIG SECTION ############################################# | ||||
# Initial set | # Initial set | ||||
INCLUDE_DIRECTORIES(src/libutil src/libserver src/libmime) | |||||
INCLUDE_DIRECTORIES(src/libutil src/libserver src/libmime src/libstat) | |||||
IF(CMAKE_INSTALL_PREFIX) | IF(CMAKE_INSTALL_PREFIX) | ||||
SET(PREFIX ${CMAKE_INSTALL_PREFIX}) | SET(PREFIX ${CMAKE_INSTALL_PREFIX}) |
ADD_SUBDIRECTORY(libutil) | ADD_SUBDIRECTORY(libutil) | ||||
ADD_SUBDIRECTORY(libserver) | ADD_SUBDIRECTORY(libserver) | ||||
ADD_SUBDIRECTORY(libmime) | ADD_SUBDIRECTORY(libmime) | ||||
ADD_SUBDIRECTORY(libstat) | |||||
ADD_SUBDIRECTORY(client) | ADD_SUBDIRECTORY(client) | ||||
SET(RSPAMDSRC ${CMAKE_CURRENT_BINARY_DIR}/modules.c | SET(RSPAMDSRC ${CMAKE_CURRENT_BINARY_DIR}/modules.c | ||||
SET_TARGET_PROPERTIES(rspamd PROPERTIES VERSION ${RSPAMD_VERSION}) | SET_TARGET_PROPERTIES(rspamd PROPERTIES VERSION ${RSPAMD_VERSION}) | ||||
ENDIF(NOT DEBIAN_BUILD) | ENDIF(NOT DEBIAN_BUILD) | ||||
TARGET_LINK_LIBRARIES(rspamd rspamd-stat) | |||||
TARGET_LINK_LIBRARIES(rspamd rspamd-mime) | TARGET_LINK_LIBRARIES(rspamd rspamd-mime) | ||||
TARGET_LINK_LIBRARIES(rspamd rspamd-server) | TARGET_LINK_LIBRARIES(rspamd rspamd-server) | ||||
TARGET_LINK_LIBRARIES(rspamd rspamd-util) | TARGET_LINK_LIBRARIES(rspamd rspamd-util) |
#include "config.h" | #include "config.h" | ||||
#include "tokenizers/tokenizers.h" | |||||
#include "classifiers/classifiers.h" | |||||
#include "tokenizers.h" | |||||
#include "classifiers.h" | |||||
#include "libserver/dynamic_cfg.h" | #include "libserver/dynamic_cfg.h" | ||||
#include "libutil/rrd.h" | #include "libutil/rrd.h" | ||||
#include "libutil/map.h" | #include "libutil/map.h" |
#include "expressions.h" | #include "expressions.h" | ||||
#include "binlog.h" | #include "binlog.h" | ||||
#include "diff.h" | #include "diff.h" | ||||
#include "classifiers/classifiers.h" | |||||
#include "tokenizers/tokenizers.h" | |||||
#include "classifiers.h" | |||||
#include "tokenizers.h" | |||||
#ifdef WITH_LUA | #ifdef WITH_LUA | ||||
# include "lua/lua_common.h" | # include "lua/lua_common.h" |
#include "html.h" | #include "html.h" | ||||
#include "images.h" | #include "images.h" | ||||
#include "utlist.h" | #include "utlist.h" | ||||
#include "tokenizers/tokenizers.h" | |||||
#include "tokenizers.h" | |||||
#include <iconv.h> | #include <iconv.h> | ||||
url.c | url.c | ||||
worker_util.c) | worker_util.c) | ||||
SET(TOKENIZERSSRC ../tokenizers/tokenizers.c | |||||
../tokenizers/osb.c) | |||||
SET(CLASSIFIERSSRC ../classifiers/classifiers.c | |||||
../classifiers/bayes.c | |||||
../classifiers/winnow.c) | |||||
# Librspamd-server | # Librspamd-server | ||||
#IF(WITH_DB) | #IF(WITH_DB) | ||||
# LIST(APPEND LIBRSPAMDSERVERSRC kvstorage_sqlite.c) | # LIST(APPEND LIBRSPAMDSERVERSRC kvstorage_sqlite.c) | ||||
#ENDIF(WITH_SQLITE) | #ENDIF(WITH_SQLITE) | ||||
ADD_LIBRARY(rspamd-server ${LINK_TYPE} ${LIBRSPAMDSERVERSRC} ${TOKENIZERSSRC} ${CLASSIFIERSSRC}) | |||||
ADD_LIBRARY(rspamd-server ${LINK_TYPE} ${LIBRSPAMDSERVERSRC}) | |||||
IF(NOT DEBIAN_BUILD) | IF(NOT DEBIAN_BUILD) | ||||
SET_TARGET_PROPERTIES(rspamd-server PROPERTIES VERSION ${RSPAMD_VERSION}) | SET_TARGET_PROPERTIES(rspamd-server PROPERTIES VERSION ${RSPAMD_VERSION}) | ||||
ENDIF(NOT DEBIAN_BUILD) | ENDIF(NOT DEBIAN_BUILD) |
#include "config.h" | #include "config.h" | ||||
#include "binlog.h" | #include "binlog.h" | ||||
#include "cfg_file.h" | #include "cfg_file.h" | ||||
#include "tokenizers/tokenizers.h" | |||||
#include "tokenizers.h" | |||||
#define BINLOG_SUFFIX ".binlog" | #define BINLOG_SUFFIX ".binlog" | ||||
#define BACKUP_SUFFIX ".old" | #define BACKUP_SUFFIX ".old" |
#include "cfg_file.h" | #include "cfg_file.h" | ||||
#include "lua/lua_common.h" | #include "lua/lua_common.h" | ||||
#include "expressions.h" | #include "expressions.h" | ||||
#include "classifiers/classifiers.h" | |||||
#include "tokenizers/tokenizers.h" | |||||
#include "classifiers.h" | |||||
#include "tokenizers.h" | |||||
struct rspamd_rcl_default_handler_data { | struct rspamd_rcl_default_handler_data { |
#include "main.h" | #include "main.h" | ||||
#include "uthash_strcase.h" | #include "uthash_strcase.h" | ||||
#include "filter.h" | #include "filter.h" | ||||
#include "classifiers/classifiers.h" | |||||
#include "classifiers.h" | |||||
#include "lua/lua_common.h" | #include "lua/lua_common.h" | ||||
#include "kvstorage_config.h" | #include "kvstorage_config.h" | ||||
#include "map.h" | #include "map.h" |
#include "config.h" | #include "config.h" | ||||
#include "cfg_file.h" | #include "cfg_file.h" | ||||
#include "tokenizers/tokenizers.h" | |||||
#include "classifiers/classifiers.h" | |||||
#include "tokenizers.h" | |||||
#include "classifiers.h" | |||||
#include "statfile.h" | #include "statfile.h" | ||||
#include "binlog.h" | #include "binlog.h" | ||||
#include "buffer.h" | #include "buffer.h" |
# Librspamdserver | |||||
SET(LIBSTATSRC | |||||
) | |||||
SET(TOKENIZERSSRC tokenizers/tokenizers.c | |||||
tokenizers/osb.c) | |||||
SET(CLASSIFIERSSRC classifiers/classifiers.c | |||||
classifiers/bayes.c | |||||
classifiers/winnow.c) | |||||
ADD_LIBRARY(rspamd-stat ${LINK_TYPE} ${LIBSTATSRC} ${TOKENIZERSSRC} ${CLASSIFIERSSRC}) | |||||
IF(NOT DEBIAN_BUILD) | |||||
SET_TARGET_PROPERTIES(rspamd-stat PROPERTIES VERSION ${RSPAMD_VERSION}) | |||||
ENDIF(NOT DEBIAN_BUILD) | |||||
SET_TARGET_PROPERTIES(rspamd-stat PROPERTIES LINKER_LANGUAGE C COMPILE_FLAGS "-DRSPAMD_LIB") | |||||
TARGET_LINK_LIBRARIES(rspamd-stat rspamd-server) | |||||
IF(CMAKE_COMPILER_IS_GNUCC) | |||||
SET_TARGET_PROPERTIES(rspamd-stat PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing") | |||||
ENDIF(CMAKE_COMPILER_IS_GNUCC) | |||||
IF(NO_SHARED MATCHES "OFF") | |||||
INSTALL(TARGETS rspamd-stat | |||||
LIBRARY DESTINATION ${LIBDIR} | |||||
PUBLIC_HEADER DESTINATION ${INCLUDEDIR}) | |||||
ENDIF(NO_SHARED MATCHES "OFF") |
#include "config.h" | #include "config.h" | ||||
#include "mem_pool.h" | #include "mem_pool.h" | ||||
#include "statfile.h" | #include "statfile.h" | ||||
#include "tokenizers/tokenizers.h" | |||||
#include "tokenizers.h" | |||||
#include <lua.h> | #include <lua.h> | ||||
/* Consider this value as 0 */ | /* Consider this value as 0 */ |
* Bayesian classifier | * Bayesian classifier | ||||
*/ | */ | ||||
#include "classifiers.h" | #include "classifiers.h" | ||||
#include "tokenizers/tokenizers.h" | |||||
#include "tokenizers.h" | |||||
#include "main.h" | #include "main.h" | ||||
#include "filter.h" | #include "filter.h" | ||||
#include "cfg_file.h" | #include "cfg_file.h" |
*/ | */ | ||||
#include "classifiers.h" | #include "classifiers.h" | ||||
#include "tokenizers/tokenizers.h" | |||||
#include "tokenizers.h" | |||||
#include "main.h" | #include "main.h" | ||||
#include "filter.h" | #include "filter.h" | ||||
#include "cfg_file.h" | #include "cfg_file.h" |
/* Copyright (c) 2015, Vsevolod Stakhov | |||||
* All rights reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions are met: | |||||
* * Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* * Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in the | |||||
* documentation and/or other materials provided with the distribution. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY | |||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY | |||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
*/ | |||||
#ifndef STAT_API_H_ | |||||
#define STAT_API_H_ | |||||
#include "config.h" | |||||
#include "task.h" | |||||
/** | |||||
* @file stat_api.h | |||||
* High level statistics API | |||||
*/ | |||||
/** | |||||
* Initialise statistics modules | |||||
* @param cfg | |||||
*/ | |||||
void rspamd_stat_init (struct rspamd_config *cfg); | |||||
/** | |||||
* Classify the task specified and insert symbols if needed | |||||
* @param task | |||||
* @return TRUE if task has been classified | |||||
*/ | |||||
gboolean rspamd_stat_classify (struct rspamd_task *task, GError **err); | |||||
/** | |||||
* Learn task as spam or ham, task must be processed prior to this call | |||||
* @param task task to learn | |||||
* @param spam if TRUE learn spam, otherwise learn ham | |||||
* @return TRUE if task has been learned | |||||
*/ | |||||
gboolean rspamd_stat_learn (struct rspamd_task *task, gboolean spam, GError **err); | |||||
void rspamd_stat_unload (void); | |||||
#endif /* STAT_API_H_ */ |
#include "lua_common.h" | #include "lua_common.h" | ||||
#include "cfg_file.h" | #include "cfg_file.h" | ||||
#include "classifiers/classifiers.h" | |||||
#include "classifiers.h" | |||||
/* Classifier methods */ | /* Classifier methods */ | ||||
LUA_FUNCTION_DEF (classifier, register_pre_callback); | LUA_FUNCTION_DEF (classifier, register_pre_callback); |
#include "message.h" | #include "message.h" | ||||
#include "radix.h" | #include "radix.h" | ||||
#include "trie.h" | #include "trie.h" | ||||
#include "classifiers/classifiers.h" | |||||
#include "classifiers.h" | |||||
/*** | /*** | ||||
* This module is used to configure rspamd and is normally available as global | * This module is used to configure rspamd and is normally available as global |
#include "images.h" | #include "images.h" | ||||
#include "cfg_file.h" | #include "cfg_file.h" | ||||
#include "statfile.h" | #include "statfile.h" | ||||
#include "tokenizers/tokenizers.h" | |||||
#include "classifiers/classifiers.h" | |||||
#include "tokenizers.h" | |||||
#include "classifiers.h" | |||||
#include "binlog.h" | #include "binlog.h" | ||||
#include "statfile_sync.h" | #include "statfile_sync.h" | ||||
#include "diff.h" | #include "diff.h" |