ソースを参照

Reorganize statfiles and classifiers into libstat.

tags/0.9.0
Vsevolod Stakhov 9年前
コミット
b5597411a2

+ 1
- 1
CMakeLists.txt ファイルの表示

@@ -278,7 +278,7 @@ ENDMACRO()
############################# CONFIG SECTION #############################################
# Initial set

INCLUDE_DIRECTORIES(src/libutil src/libserver src/libmime)
INCLUDE_DIRECTORIES(src/libutil src/libserver src/libmime src/libstat)

IF(CMAKE_INSTALL_PREFIX)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})

+ 2
- 0
src/CMakeLists.txt ファイルの表示

@@ -66,6 +66,7 @@ ADD_SUBDIRECTORY(lua)
ADD_SUBDIRECTORY(libutil)
ADD_SUBDIRECTORY(libserver)
ADD_SUBDIRECTORY(libmime)
ADD_SUBDIRECTORY(libstat)
ADD_SUBDIRECTORY(client)
SET(RSPAMDSRC ${CMAKE_CURRENT_BINARY_DIR}/modules.c
@@ -97,6 +98,7 @@ IF(NOT DEBIAN_BUILD)
SET_TARGET_PROPERTIES(rspamd PROPERTIES VERSION ${RSPAMD_VERSION})
ENDIF(NOT DEBIAN_BUILD)

TARGET_LINK_LIBRARIES(rspamd rspamd-stat)
TARGET_LINK_LIBRARIES(rspamd rspamd-mime)
TARGET_LINK_LIBRARIES(rspamd rspamd-server)
TARGET_LINK_LIBRARIES(rspamd rspamd-util)

+ 2
- 2
src/controller.c ファイルの表示

@@ -23,8 +23,8 @@


#include "config.h"
#include "tokenizers/tokenizers.h"
#include "classifiers/classifiers.h"
#include "tokenizers.h"
#include "classifiers.h"
#include "libserver/dynamic_cfg.h"
#include "libutil/rrd.h"
#include "libutil/map.h"

+ 2
- 2
src/libmime/filter.c ファイルの表示

@@ -32,8 +32,8 @@
#include "expressions.h"
#include "binlog.h"
#include "diff.h"
#include "classifiers/classifiers.h"
#include "tokenizers/tokenizers.h"
#include "classifiers.h"
#include "tokenizers.h"

#ifdef WITH_LUA
# include "lua/lua_common.h"

+ 1
- 1
src/libmime/message.c ファイルの表示

@@ -30,7 +30,7 @@
#include "html.h"
#include "images.h"
#include "utlist.h"
#include "tokenizers/tokenizers.h"
#include "tokenizers.h"

#include <iconv.h>


+ 1
- 8
src/libserver/CMakeLists.txt ファイルの表示

@@ -21,13 +21,6 @@ SET(LIBRSPAMDSERVERSRC
url.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

#IF(WITH_DB)
@@ -37,7 +30,7 @@ SET(CLASSIFIERSSRC ../classifiers/classifiers.c
# LIST(APPEND LIBRSPAMDSERVERSRC kvstorage_sqlite.c)
#ENDIF(WITH_SQLITE)
ADD_LIBRARY(rspamd-server ${LINK_TYPE} ${LIBRSPAMDSERVERSRC} ${TOKENIZERSSRC} ${CLASSIFIERSSRC})
ADD_LIBRARY(rspamd-server ${LINK_TYPE} ${LIBRSPAMDSERVERSRC})
IF(NOT DEBIAN_BUILD)
SET_TARGET_PROPERTIES(rspamd-server PROPERTIES VERSION ${RSPAMD_VERSION})
ENDIF(NOT DEBIAN_BUILD)

+ 1
- 1
src/libserver/binlog.c ファイルの表示

@@ -25,7 +25,7 @@
#include "config.h"
#include "binlog.h"
#include "cfg_file.h"
#include "tokenizers/tokenizers.h"
#include "tokenizers.h"

#define BINLOG_SUFFIX ".binlog"
#define BACKUP_SUFFIX ".old"

+ 2
- 2
src/libserver/cfg_rcl.c ファイルの表示

@@ -28,8 +28,8 @@
#include "cfg_file.h"
#include "lua/lua_common.h"
#include "expressions.h"
#include "classifiers/classifiers.h"
#include "tokenizers/tokenizers.h"
#include "classifiers.h"
#include "tokenizers.h"


struct rspamd_rcl_default_handler_data {

+ 1
- 1
src/libserver/cfg_utils.c ファイルの表示

@@ -29,7 +29,7 @@
#include "main.h"
#include "uthash_strcase.h"
#include "filter.h"
#include "classifiers/classifiers.h"
#include "classifiers.h"
#include "lua/lua_common.h"
#include "kvstorage_config.h"
#include "map.h"

+ 2
- 2
src/libserver/statfile_sync.c ファイルの表示

@@ -24,8 +24,8 @@

#include "config.h"
#include "cfg_file.h"
#include "tokenizers/tokenizers.h"
#include "classifiers/classifiers.h"
#include "tokenizers.h"
#include "classifiers.h"
#include "statfile.h"
#include "binlog.h"
#include "buffer.h"

+ 27
- 0
src/libstat/CMakeLists.txt ファイルの表示

@@ -0,0 +1,27 @@
# 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")

src/classifiers/classifiers.h → src/libstat/classifiers.h ファイルの表示

@@ -4,7 +4,7 @@
#include "config.h"
#include "mem_pool.h"
#include "statfile.h"
#include "tokenizers/tokenizers.h"
#include "tokenizers.h"
#include <lua.h>

/* Consider this value as 0 */

src/classifiers/bayes.c → src/libstat/classifiers/bayes.c ファイルの表示

@@ -26,7 +26,7 @@
* Bayesian classifier
*/
#include "classifiers.h"
#include "tokenizers/tokenizers.h"
#include "tokenizers.h"
#include "main.h"
#include "filter.h"
#include "cfg_file.h"

src/classifiers/classifiers.c → src/libstat/classifiers/classifiers.c ファイルの表示


src/classifiers/winnow.c → src/libstat/classifiers/winnow.c ファイルの表示

@@ -27,7 +27,7 @@
*/

#include "classifiers.h"
#include "tokenizers/tokenizers.h"
#include "tokenizers.h"
#include "main.h"
#include "filter.h"
#include "cfg_file.h"

+ 59
- 0
src/libstat/stat_api.h ファイルの表示

@@ -0,0 +1,59 @@
/* 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_ */

src/tokenizers/tokenizers.h → src/libstat/tokenizers.h ファイルの表示


src/tokenizers/osb.c → src/libstat/tokenizers/osb.c ファイルの表示


src/tokenizers/tokenizers.c → src/libstat/tokenizers/tokenizers.c ファイルの表示


+ 1
- 1
src/lua/lua_classifier.c ファイルの表示

@@ -25,7 +25,7 @@

#include "lua_common.h"
#include "cfg_file.h"
#include "classifiers/classifiers.h"
#include "classifiers.h"

/* Classifier methods */
LUA_FUNCTION_DEF (classifier, register_pre_callback);

+ 1
- 1
src/lua/lua_config.c ファイルの表示

@@ -29,7 +29,7 @@
#include "message.h"
#include "radix.h"
#include "trie.h"
#include "classifiers/classifiers.h"
#include "classifiers.h"

/***
* This module is used to configure rspamd and is normally available as global

+ 2
- 2
src/lua/lua_task.c ファイルの表示

@@ -33,8 +33,8 @@
#include "images.h"
#include "cfg_file.h"
#include "statfile.h"
#include "tokenizers/tokenizers.h"
#include "classifiers/classifiers.h"
#include "tokenizers.h"
#include "classifiers.h"
#include "binlog.h"
#include "statfile_sync.h"
#include "diff.h"

読み込み中…
キャンセル
保存