]> source.dussan.org Git - rspamd.git/commitdiff
* Make doxygen happy about structures members
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 6 Feb 2009 12:00:38 +0000 (15:00 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 6 Feb 2009 12:00:38 +0000 (15:00 +0300)
src/cfg_file.h
src/filter.h
src/hash.h
src/main.h
src/mem_pool.h
src/message.h
src/protocol.h
src/statfile.h

index b80f4081ca967404a5390ada6a0823d3f5af40c6..a7ad3eaaf00d3db99fa90cc7871518911c34cf53 100644 (file)
@@ -1,8 +1,8 @@
-/*
- * $Id$
+/**
+ * @file cfg_file.h
+ * Config file parser and config routines API
  */
 
-
 #ifndef CFG_FILE_H
 #define CFG_FILE_H
 
@@ -72,37 +72,37 @@ enum rspamd_log_type {
  * Regexp structure
  */
 struct rspamd_regexp {
-       enum rspamd_regexp_type type;                                   /** < regexp type                                                                               */
-       char *regexp_text;                                                              /** < regexp text representation                                                */
-       GRegex *regexp;                                                                 /** < glib regexp structure                                                             */
-       char *header;                                                                   /** < header name for header regexps                                    */
+       enum rspamd_regexp_type type;                                   /**< regexp type                                                                                */
+       char *regexp_text;                                                              /**< regexp text representation                                                 */
+       GRegex *regexp;                                                                 /**< glib regexp structure                                                              */
+       char *header;                                                                   /**< header name for header regexps                                             */
 };
 
 /**
  * Memcached server object
  */
 struct memcached_server {
-       struct upstream up;                                                             /** < common upstream base                                                              */
-       struct in_addr addr;                                                    /** < address of server                                                                 */
-       uint16_t port;                                                                  /** < port to connect                                                                   */
-       short alive;                                                                    /** < is this server alive                                                              */
-       short int num;                                                                  /** < number of servers in case of mirror                               */
+       struct upstream up;                                                             /**< common upstream base                                                               */
+       struct in_addr addr;                                                    /**< address of server                                                                  */
+       uint16_t port;                                                                  /**< port to connect                                                                    */
+       short alive;                                                                    /**< is this server alive                                                               */
+       short int num;                                                                  /**< number of servers in case of mirror                                */
 };
 
 /**
  * Perl module list item
  */
 struct perl_module {
-       char *path;                                                                             /** < path to module                                                                    */
-       LIST_ENTRY (perl_module) next;                                  /** < chain link                                                                                */
+       char *path;                                                                             /**< path to module                                                                             */
+       LIST_ENTRY (perl_module) next;                                  /**< chain link                                                                                 */
 };
 
 /**
  * Module option
  */
 struct module_opt {
-       char *param;                                                                    /** < parameter name                                                                    */
-       char *value;                                                                    /** < paramater value                                                                   */
+       char *param;                                                                    /**< parameter name                                                                             */
+       char *value;                                                                    /**< paramater value                                                                    */
        LIST_ENTRY (module_opt) next;                                   
 };
 
@@ -110,85 +110,85 @@ struct module_opt {
  * Statfile config definition
  */
 struct statfile {
-       char *alias;                                                                    /** < alias of statfile                                                                 */
-       char *pattern;                                                                  /** < filesystem pattern (with %r or %f)                                */
-       double weight;                                                                  /** < weight scale                                                                              */
-       char *metric;                                                                   /** < metric name                                                                               */
-       size_t size;                                                                    /** < size of statfile                                                                  */
-       struct tokenizer *tokenizer;                                    /** < tokenizer used for statfile                                               */
+       char *alias;                                                                    /**< alias of statfile                                                                  */
+       char *pattern;                                                                  /**< filesystem pattern (with %r or %f)                                 */
+       double weight;                                                                  /**< weight scale                                                                               */
+       char *metric;                                                                   /**< metric name                                                                                */
+       size_t size;                                                                    /**< size of statfile                                                                   */
+       struct tokenizer *tokenizer;                                    /**< tokenizer used for statfile                                                */
 };
 
 /**
  * Config option for importing to perl module
  */
 struct config_scalar {
-    void *pointer;                                                                     /** < pointer to data                                                                   */
+    void *pointer;                                                                     /**< pointer to data                                                                    */
     enum {
         SCALAR_TYPE_INT,
         SCALAR_TYPE_UINT,
         SCALAR_TYPE_STR,
         SCALAR_TYPE_SIZE,
-    } type;                                                                                    /** < type of data                                                                              */
+    } type;                                                                                    /**< type of data                                                                               */
 };
 
 /**
  * Structure that stores all config data
  */
 struct config_file {
-       memory_pool_t *cfg_pool;                                                /** < memory pool for config                                                    */
-       char *cfg_name;                                                                 /** < name of config file                                                               */
-       char *pid_file;                                                                 /** < name of pid file                                                                  */
-       char *temp_dir;                                                                 /** < dir for temp files                                                                */
-
-       char *bind_host;                                                                /** < bind line                                                                                 */
-       struct in_addr bind_addr;                                               /** < bind address in case of TCP socket                                */
-       uint16_t bind_port;                                                             /** < bind port in case of TCP socket                                   */
-       uint16_t bind_family;                                                   /** < bind type (AF_UNIX or AF_INET)                                    */
-
-       char *control_host;                                                             /** < bind line for controller                                                  */
-       struct in_addr control_addr;                                    /** < bind address for controller                                               */
-       uint16_t control_port;                                                  /** < bind port for controller                                                  */
-       uint16_t control_family;                                                /** < bind family for controller                                                */
-       int controller_enabled;                                                 /** < whether controller is enabled                                             */
-       char *control_password;                                                 /** < controller password                                                               */
-
-       int no_fork;                                                                    /** < if 1 do not call daemon()                                                 */
-       unsigned int workers_number;                                    /** < number of workers                                                                 */
-
-       enum rspamd_log_type log_type;                                  /** < log type                                                                                  */
-       int log_facility;                                                               /** < log facility in case of syslog                                    */
-       int log_level;                                                                  /** < log level trigger                                                                 */
-       char *log_file;                                                                 /** < path to logfile in case of file logging                   */
-       int log_fd;                                                                             /** < log descriptor in case of file logging                    */
-
-       size_t max_statfile_size;                                               /** < maximum size for statfile                                                 */
-
-       struct memcached_server memcached_servers[MAX_MEMCACHED_SERVERS];       /** < memcached servers                         */
-       size_t memcached_servers_num;                                   /** < number of memcached servers                                               */
-       memc_proto_t memcached_protocol;                                /** < memcached protocol                                                                */
-       unsigned int memcached_error_time;                              /** < memcached error time (see upstream documentation) */
-       unsigned int memcached_dead_time;                               /** < memcached dead time                                                               */
-       unsigned int memcached_maxerrors;                               /** < maximum number of errors                                                  */
-       unsigned int memcached_connect_timeout;                 /** < connection timeout                                                                */
-
-       LIST_HEAD (modulesq, perl_module) perl_modules; /** < linked list of perl modules to load                               */
-
-       LIST_HEAD (headersq, filter) header_filters;    /** < linked list of all header's filters                               */
-       LIST_HEAD (mimesq, filter) mime_filters;                /** < linked list of all mime filters                                   */
-       LIST_HEAD (messagesq, filter) message_filters;  /** < linked list of all message's filters                              */
-       LIST_HEAD (urlsq, filter) url_filters;                  /** < linked list of all url's filters                                  */
-       char *header_filters_str;                                               /** < string of header's filters                                                */
-       char *mime_filters_str;                                                 /** < string of mime's filters                                                  */
-       char *message_filters_str;                                              /** < string of message's filters                                               */
-       char *url_filters_str;                                                  /** < string for url's filters                                                  */
-       GHashTable* modules_opts;                                               /** < hash for module options indexed by module name    */
-       GHashTable* variables;                                                  /** < hash of $variables defined in config, indexed by variable name */
-       GHashTable* metrics;                                                    /** < hash of metrics indexed by metric name                    */
-       GHashTable* factors;                                                    /** < hash of factors indexed by symbol name                    */
-       GHashTable* c_modules;                                                  /** < hash of c modules indexed by module name                  */
-       GHashTable* composite_symbols;                                  /** < hash of composite symbols indexed by its name             */
-       GHashTable* statfiles;                                                  /** < hash of defined statfiles indexed by alias                */
-    GHashTable* cfg_params;                                                    /** < all cfg params indexed by its name in this structure */
+       memory_pool_t *cfg_pool;                                                /**< memory pool for config                                                             */
+       char *cfg_name;                                                                 /**< name of config file                                                                */
+       char *pid_file;                                                                 /**< name of pid file                                                                   */
+       char *temp_dir;                                                                 /**< dir for temp files                                                                 */
+
+       char *bind_host;                                                                /**< bind line                                                                                  */
+       struct in_addr bind_addr;                                               /**< bind address in case of TCP socket                                 */
+       uint16_t bind_port;                                                             /**< bind port in case of TCP socket                                    */
+       uint16_t bind_family;                                                   /**< bind type (AF_UNIX or AF_INET)                                             */
+
+       char *control_host;                                                             /**< bind line for controller                                                   */
+       struct in_addr control_addr;                                    /**< bind address for controller                                                */
+       uint16_t control_port;                                                  /**< bind port for controller                                                   */
+       uint16_t control_family;                                                /**< bind family for controller                                                 */
+       int controller_enabled;                                                 /**< whether controller is enabled                                              */
+       char *control_password;                                                 /**< controller password                                                                */
+
+       int no_fork;                                                                    /**< if 1 do not call daemon()                                                  */
+       unsigned int workers_number;                                    /**< number of workers                                                                  */
+
+       enum rspamd_log_type log_type;                                  /**< log type                                                                                   */
+       int log_facility;                                                               /**< log facility in case of syslog                                             */
+       int log_level;                                                                  /**< log level trigger                                                                  */
+       char *log_file;                                                                 /**< path to logfile in case of file logging                    */
+       int log_fd;                                                                             /**< log descriptor in case of file logging                             */
+
+       size_t max_statfile_size;                                               /**< maximum size for statfile                                                  */
+
+       struct memcached_server memcached_servers[MAX_MEMCACHED_SERVERS];       /**< memcached servers                          */
+       size_t memcached_servers_num;                                   /**< number of memcached servers                                                */
+       memc_proto_t memcached_protocol;                                /**< memcached protocol                                                                 */
+       unsigned int memcached_error_time;                              /**< memcached error time (see upstream documentation)  */
+       unsigned int memcached_dead_time;                               /**< memcached dead time                                                                */
+       unsigned int memcached_maxerrors;                               /**< maximum number of errors                                                   */
+       unsigned int memcached_connect_timeout;                 /**< connection timeout                                                                 */
+
+       LIST_HEAD (modulesq, perl_module) perl_modules; /**< linked list of perl modules to load                                */
+
+       LIST_HEAD (headersq, filter) header_filters;    /**< linked list of all header's filters                                */
+       LIST_HEAD (mimesq, filter) mime_filters;                /**< linked list of all mime filters                                    */
+       LIST_HEAD (messagesq, filter) message_filters;  /**< linked list of all message's filters                               */
+       LIST_HEAD (urlsq, filter) url_filters;                  /**< linked list of all url's filters                                   */
+       char *header_filters_str;                                               /**< string of header's filters                                                 */
+       char *mime_filters_str;                                                 /**< string of mime's filters                                                   */
+       char *message_filters_str;                                              /**< string of message's filters                                                */
+       char *url_filters_str;                                                  /**< string for url's filters                                                   */
+       GHashTable* modules_opts;                                               /**< hash for module options indexed by module name             */
+       GHashTable* variables;                                                  /**< hash of $variables defined in config, indexed by variable name */
+       GHashTable* metrics;                                                    /**< hash of metrics indexed by metric name                             */
+       GHashTable* factors;                                                    /**< hash of factors indexed by symbol name                             */
+       GHashTable* c_modules;                                                  /**< hash of c modules indexed by module name                   */
+       GHashTable* composite_symbols;                                  /**< hash of composite symbols indexed by its name              */
+       GHashTable* statfiles;                                                  /**< hash of defined statfiles indexed by alias                 */
+    GHashTable* cfg_params;                                                    /**< all cfg params indexed by its name in this structure */
 };
 
 /**
index d732a8fbc81a43fafa8fae68879108baf7a412d3..b991109f942952ff1f12ace3d8001492328d6d3e 100644 (file)
@@ -1,3 +1,8 @@
+/**
+ * @file filter.h
+ * Filters logic implemetation
+ */
+
 #ifndef RSPAMD_FILTER_H
 #define RSPAMD_FILTER_H
 
@@ -9,10 +14,6 @@
 #endif
 #include <glib.h>
 
-/**
- * Filters logic implemetation
- */
-
 struct worker_task;
 
 typedef double (*metric_cons_func)(struct worker_task *task, const char *metric_name);
@@ -24,29 +25,29 @@ enum filter_type { C_FILTER, PERL_FILTER };
  * Filter structure
  */
 struct filter {
-       char *func_name;                                                                /** < function name                                     */
-       enum filter_type type;                                                  /** < filter type (c or perl)           */
-       LIST_ENTRY (filter) next;                                               /** < chain link                                        */
+       char *func_name;                                                                /**< function name                                      */
+       enum filter_type type;                                                  /**< filter type (c or perl)            */
+       LIST_ENTRY (filter) next;                                               /**< chain link                                         */
 };
 
 /**
  * Common definition of metric
  */
 struct metric {
-       char *name;                                                                             /** < name of metric                                            */
-       char *func_name;                                                                /** < name of consolidation function            */
-       metric_cons_func func;                                                  /** < c consolidation function                          */
-       double required_score;                                                  /** < required score for this metric            */
-       struct classifier *classifier;                                  /** < classifier that is used for metric        */
+       char *name;                                                                             /**< name of metric                                                     */
+       char *func_name;                                                                /**< name of consolidation function                     */
+       metric_cons_func func;                                                  /**< c consolidation function                           */
+       double required_score;                                                  /**< required score for this metric                     */
+       struct classifier *classifier;                                  /**< classifier that is used for metric         */
 };
 
 /**
  * Result of metric processing
  */
 struct metric_result {
-       struct metric *metric;                                                  /** < pointer to metric structure                       */
-       double score;                                                                   /** < total score                                                       */
-       GHashTable *symbols;                                                    /** < symbols of metric                                         */
+       struct metric *metric;                                                  /**< pointer to metric structure                        */
+       double score;                                                                   /**< total score                                                        */
+       GHashTable *symbols;                                                    /**< symbols of metric                                          */
 };
 
 /**
index 8f87bb10e2db986c413346b8d9e710c247a686ff..4a1e973fbaf8e8025927685a9795ebb73027a04b 100644 (file)
@@ -1,17 +1,7 @@
-/*
- * =====================================================================================
- *
- *       Filename:  hash.h
- *
- *    Description:  Hash table implementation that uses memory pools from mem_pool library
- *
- *        Created:  27.01.2009 16:31:11
- *       Compiler:  gcc
- *
- *         Author:  Vsevolod Stakhov
- *        Company:  Rambler
- *
- * =====================================================================================
+/**
+ * @file hash.h
+ * Hash table implementation that allows using memory pools for storage as well as using
+ * shared memory for this purpose
  */
 
 #ifndef RSPAMD_HASH_H
 #include <glib.h>
 #include "mem_pool.h"
 
-/**
- * Hash table implementation that allows using memory pools for storage as well as using
- * shared memory for this purpose
- */
-
 struct rspamd_hash_node {
        gpointer                 key;
        gpointer                 value;
index 4bab0072d04a9617671d29fc46a85ee6d19d335e..10f9ef2151b746f424470ec0b5b61c389b55355a 100644 (file)
@@ -1,10 +1,11 @@
-#ifndef RSPAMD_MAIN_H
-#define RSPAMD_MAIN_H
-
 /**
+ * @file main.h
  * Definitions for main rspamd structures
  */
 
+#ifndef RSPAMD_MAIN_H
+#define RSPAMD_MAIN_H
+
 #include "config.h"
 
 #include <sys/types.h>
@@ -70,26 +71,26 @@ enum script_type {
  * Logic expression 
  */
 struct expression {
-       enum { EXPR_OPERAND, EXPR_OPERATION } type;                                     /** < expression type                                                           */
+       enum { EXPR_OPERAND, EXPR_OPERATION } type;                                     /**< expression type                                                            */
        union {
                void *operand;
                char operation;
-       } content;                                                                                                      /** < union for storing operand or operation code       */
-       struct expression *next;                                                                        /** < chain link                                                                        */
+       } content;                                                                                                      /**< union for storing operand or operation code        */
+       struct expression *next;                                                                        /**< chain link                                                                         */
 };
 
 /** 
  * Worker process structure 
  */
 struct rspamd_worker {
-       pid_t pid;                                                                                                      /** < pid of worker                                                                     */
-       char is_initialized;                                                                            /** < is initialized                                                            */
-       char is_dying;                                                                                          /** < if worker is going to shutdown                            */
-       struct rspamd_main *srv;                                                                        /** < pointer to server structure                                       */
-       enum process_type type;                                                                         /** < process type                                                                      */
-       struct event sig_ev;                                                                            /** < signals event                                                                     */
-       struct event bind_ev;                                                                           /** < socket events                                                                     */
-       TAILQ_ENTRY (rspamd_worker) next;                                                       /** < chain link to next worker                                         */
+       pid_t pid;                                                                                                      /**< pid of worker                                                                      */
+       char is_initialized;                                                                            /**< is initialized                                                                     */
+       char is_dying;                                                                                          /**< if worker is going to shutdown                                     */
+       struct rspamd_main *srv;                                                                        /**< pointer to server structure                                        */
+       enum process_type type;                                                                         /**< process type                                                                       */
+       struct event sig_ev;                                                                            /**< signals event                                                                      */
+       struct event bind_ev;                                                                           /**< socket events                                                                      */
+       TAILQ_ENTRY (rspamd_worker) next;                                                       /**< chain link to next worker                                          */
 };
 
 struct pidfh;
@@ -102,73 +103,73 @@ struct mime_part;
  * Server statistics
  */
 struct rspamd_stat {
-       unsigned int messages_scanned;                                                          /** < total number of messages scanned                          */
-       unsigned int messages_spam;                                                                     /** < messages treated as spam                                          */
-       unsigned int messages_ham;                                                                      /** < messages treated as ham                                           */
-       unsigned int connections_count;                                                         /**     < total connections count                                               */
-       unsigned int control_connections_count;                                         /** < connections count to control interface            */
-       unsigned int messages_learned;                                                          /** < messages learned                                                          */
+       unsigned int messages_scanned;                                                          /**< total number of messages scanned                           */
+       unsigned int messages_spam;                                                                     /**< messages treated as spam                                           */
+       unsigned int messages_ham;                                                                      /**< messages treated as ham                                            */
+       unsigned int connections_count;                                                         /**< total connections count                                            */
+       unsigned int control_connections_count;                                         /**< connections count to control interface                     */
+       unsigned int messages_learned;                                                          /**< messages learned                                                           */
 };
 
 /**
  * Struct that determine main server object (for logging purposes)
  */
 struct rspamd_main {
-       struct config_file *cfg;                                                                        /** < pointer to config structure                                       */
-       pid_t pid;                                                                                                      /** < main pid                                                                          */
+       struct config_file *cfg;                                                                        /**< pointer to config structure                                        */
+       pid_t pid;                                                                                                      /**< main pid                                                                           */
        /* Pid file structure */
-       struct pidfh *pfh;                                                                                      /** < struct pidfh for pidfile                                          */
-       enum process_type type;                                                                         /** < process type                                                                      */
-       unsigned int ev_initialized;                                                            /** < is event system is initialized                            */
-       struct rspamd_stat *stat;                                                                       /** < pointer to statistics                                                     */
+       struct pidfh *pfh;                                                                                      /**< struct pidfh for pidfile                                           */
+       enum process_type type;                                                                         /**< process type                                                                       */
+       unsigned int ev_initialized;                                                            /**< is event system is initialized                                     */
+       struct rspamd_stat *stat;                                                                       /**< pointer to statistics                                                      */
 
-       memory_pool_t *server_pool;                                                                     /** < server's memory pool                                                      */
-       statfile_pool_t *statfile_pool;                                                         /** < shared statfiles pool                                                     */
+       memory_pool_t *server_pool;                                                                     /**< server's memory pool                                                       */
+       statfile_pool_t *statfile_pool;                                                         /**< shared statfiles pool                                                      */
 
-       TAILQ_HEAD (workq, rspamd_worker) workers;                                      /** < linked list of workers                                            */
+       TAILQ_HEAD (workq, rspamd_worker) workers;                                      /**< linked list of workers                                                     */
 };
 
 /**
  * Save point object for delayed filters processing
  */
 struct save_point {
-       void *entry;                                                                                            /** < pointer to C function or perl function name       */
-       enum script_type type;                                                                          /** < where we did stop                                                         */
-       unsigned int saved;                                                                                     /** < how much time we have delayed processing          */
+       void *entry;                                                                                            /**< pointer to C function or perl function name        */
+       enum script_type type;                                                                          /**< where we did stop                                                          */
+       unsigned int saved;                                                                                     /**< how much time we have delayed processing           */
 };
 
 /**
  * Control session object
  */
 struct controller_session {
-       struct rspamd_worker *worker;                                                           /** < pointer to worker structure (controller in fact) */
+       struct rspamd_worker *worker;                                                           /**< pointer to worker structure (controller in fact) */
        enum {
                STATE_COMMAND,
                STATE_LEARN,
                STATE_REPLY,
                STATE_QUIT,
-       } state;                                                                                                        /** < current session state                                                     */
-       int sock;                                                                                                       /** < socket descriptor                                                         */
+       } state;                                                                                                        /**< current session state                                                      */
+       int sock;                                                                                                       /**< socket descriptor                                                          */
        /* Access to authorized commands */
-       int authorized;                                                                                         /** < whether this session is authorized                        */
-       memory_pool_t *session_pool;                                                            /** < memory pool for session                                           */
-       struct bufferevent *bev;                                                                        /** < buffered event for IO                                                     */
-       struct config_file *cfg;                                                                        /** < pointer to config file                                            */
-       char *learn_rcpt;                                                                                       /** < recipient for learning                                            */
-       char *learn_from;                                                                                       /** < from address for learning                                         */
-       struct tokenizer *learn_tokenizer;                                                      /** < tokenizer for learning                                            */
-       struct classifier *learn_classifier;                                            /** < classifier for learning                                           */
-       char *learn_filename;                                                                           /** < real filename for learning                                        */
-       f_str_buf_t *learn_buf;                                                                         /** < learn input                                                                       */
-       GList *parts;                                                                                           /** < extracted mime parts                                                      */
-       int in_class;                                                                                           /** < positive or negative learn                                        */
+       int authorized;                                                                                         /**< whether this session is authorized                         */
+       memory_pool_t *session_pool;                                                            /**< memory pool for session                                            */
+       struct bufferevent *bev;                                                                        /**< buffered event for IO                                                      */
+       struct config_file *cfg;                                                                        /**< pointer to config file                                                     */
+       char *learn_rcpt;                                                                                       /**< recipient for learning                                                     */
+       char *learn_from;                                                                                       /**< from address for learning                                          */
+       struct tokenizer *learn_tokenizer;                                                      /**< tokenizer for learning                                                     */
+       struct classifier *learn_classifier;                                            /**< classifier for learning                                            */
+       char *learn_filename;                                                                           /**< real filename for learning                                         */
+       f_str_buf_t *learn_buf;                                                                         /**< learn input                                                                        */
+       GList *parts;                                                                                           /**< extracted mime parts                                                       */
+       int in_class;                                                                                           /**< positive or negative learn                                         */
 };
 
 /**
  * Worker task structure
  */
 struct worker_task {
-       struct rspamd_worker *worker;                                                           /** < pointer to worker object                                          */
+       struct rspamd_worker *worker;                                                           /**< pointer to worker object                                           */
        enum {
                READ_COMMAND,
                READ_HEADER,
@@ -177,50 +178,50 @@ struct worker_task {
                WRITE_ERROR,
                WAIT_FILTER,
                CLOSING_CONNECTION,
-       } state;                                                                                                        /** < current session state                                                     */
-       size_t content_length;                                                                          /** < length of user's input                                            */
-       enum rspamd_protocol proto;                                                                     /** < protocol (rspamc or spamc)                                        */
-       enum rspamd_command cmd;                                                                        /** < command                                                                           */
-       int sock;                                                                                                       /** < socket descriptor                                                         */
-       char *helo;                                                                                                     /** < helo header value                                                         */
-       char *from;                                                                                                     /** < frmo header value                                                         */
-       GList *rcpt;                                                                                            /** < recipients list                                                           */
-       unsigned int nrcpt;                                                                                     /** < number of recipients                                                      */
-       struct in_addr from_addr;                                                                       /** < client addr in numeric form                                       */
-       f_str_buf_t *msg;                                                                                       /** < message buffer                                                            */
-       struct bufferevent *bev;                                                                        /** < buffered event for IO                                                     */
-       memcached_ctx_t *memc_ctx;                                                                      /** < memcached context associated with task            */
-       unsigned memc_busy:1;                                                                           /** < is memcached connection is busy XXX: fix this     */
-       int parts_count;                                                                                        /** < mime parts count                                                          */
-       GMimeMessage *message;                                                                          /** < message, parsed with GMime                                        */
-       GList *parts;                                                                                           /** < list of parsed parts                                                      */
-       TAILQ_HEAD (uriq, uri) urls;                                                            /** < list of parsed urls                                                       */
-       GHashTable *results;                                                                            /** < hash table of metric_result indexed by 
+       } state;                                                                                                        /**< current session state                                                      */
+       size_t content_length;                                                                          /**< length of user's input                                                     */
+       enum rspamd_protocol proto;                                                                     /**< protocol (rspamc or spamc)                                         */
+       enum rspamd_command cmd;                                                                        /**< command                                                                            */
+       int sock;                                                                                                       /**< socket descriptor                                                          */
+       char *helo;                                                                                                     /**< helo header value                                                          */
+       char *from;                                                                                                     /**< from header value                                                          */
+       GList *rcpt;                                                                                            /**< recipients list                                                            */
+       unsigned int nrcpt;                                                                                     /**< number of recipients                                                       */
+       struct in_addr from_addr;                                                                       /**< client addr in numeric form                                        */
+       f_str_buf_t *msg;                                                                                       /**< message buffer                                                                     */
+       struct bufferevent *bev;                                                                        /**< buffered event for IO                                                      */
+       memcached_ctx_t *memc_ctx;                                                                      /**< memcached context associated with task                     */
+       unsigned memc_busy:1;                                                                           /**< is memcached connection is busy XXX: fix this      */
+       int parts_count;                                                                                        /**< mime parts count                                                           */
+       GMimeMessage *message;                                                                          /**< message, parsed with GMime                                         */
+       GList *parts;                                                                                           /**< list of parsed parts                                                       */
+       TAILQ_HEAD (uriq, uri) urls;                                                            /**< list of parsed urls                                                        */
+       GHashTable *results;                                                                            /**< hash table of metric_result indexed by 
                                                                                                                                 *    metric's name                                                                     */
-       struct config_file *cfg;                                                                        /** < pointer to config object                                          */
-       struct save_point save;                                                                         /** < save point for delayed processing                         */
-       char *last_error;                                                                                       /** < last error                                                                        */
-       int error_code;                                                                                         /** < code of last error                                                        */
-       memory_pool_t *task_pool;                                                                       /** < memory pool for task                                                      */
+       struct config_file *cfg;                                                                        /**< pointer to config object                                           */
+       struct save_point save;                                                                         /**< save point for delayed processing                          */
+       char *last_error;                                                                                       /**< last error                                                                         */
+       int error_code;                                                                                         /**< code of last error                                                         */
+       memory_pool_t *task_pool;                                                                       /**< memory pool for task                                                       */
 };
 
 /**
  * Common structure representing C module context
  */
 struct module_ctx {
-       int (*header_filter)(struct worker_task *task);                         /** < pointer to headers process function                       */
-       int (*mime_filter)(struct worker_task *task);                           /** < pointer to mime parts process function            */
-       int (*message_filter)(struct worker_task *task);                        /** < pointer to the whole message process function */
-       int (*url_filter)(struct worker_task *task);                            /** < pointer to urls process function                          */
+       int (*header_filter)(struct worker_task *task);                         /**< pointer to headers process function                        */
+       int (*mime_filter)(struct worker_task *task);                           /**< pointer to mime parts process function                     */
+       int (*message_filter)(struct worker_task *task);                        /**< pointer to the whole message process function      */
+       int (*url_filter)(struct worker_task *task);                            /**< pointer to urls process function                           */
 };
 
 /**
  * Common structure for C module
  */
 struct c_module {
-       const char *name;                                                                                       /** < name                                                                                      */
-       struct module_ctx *ctx;                                                                         /** < pointer to context                                                        */
-       LIST_ENTRY (c_module) next;                                                                     /** < linked list                                                                       */
+       const char *name;                                                                                       /**< name                                                                                       */
+       struct module_ctx *ctx;                                                                         /**< pointer to context                                                         */
+       LIST_ENTRY (c_module) next;                                                                     /**< linked list                                                                        */
 };
 
 void start_worker (struct rspamd_worker *worker, int listen_sock);
index 79f029bf36ef01ffdc9d68235cfc8da4cc2544a3..719aef220bf5b62f4c5d05d45b174c5b93477fa8 100644 (file)
@@ -1,10 +1,5 @@
-#ifndef RSPAMD_MEM_POOL_H
-#define RSPAMD_MEM_POOL_H
-
-#include <sys/types.h>
-#include <glib.h>
-
 /**
+ * @file mem_pool.h
  * \brief Memory pools library.
  *
  * Memory pools library. Library is designed to implement efficient way to
  * can use pool for them
  */
 
-/** Destructor type definition */
+#ifndef RSPAMD_MEM_POOL_H
+#define RSPAMD_MEM_POOL_H
+
+#include <sys/types.h>
+#include <glib.h>
+
+
+/** 
+ * Destructor type definition 
+ */
 typedef void (*pool_destruct_func)(void *ptr);
 
 /**
  * Pool page structure
  */
 struct _pool_chain {
-       u_char *begin;                                  /** < begin of pool chain block                         */
-       u_char *pos;                                    /** < current start of free space in block      */
-       size_t len;                                             /** < length of block                                           */
-       struct _pool_chain *next;               /** < chain link                                                        */
+       u_char *begin;                                  /**< begin of pool chain block                          */
+       u_char *pos;                                    /**< current start of free space in block       */
+       size_t len;                                             /**< length of block                                            */
+       struct _pool_chain *next;               /**< chain link                                                         */
 };
 
 /**
@@ -42,37 +46,37 @@ struct _pool_chain_shared {
  * Destructors list item structure
  */
 struct _pool_destructors {
-       pool_destruct_func func;                                /** < pointer to destructor                                     */
-       void *data;                                                             /** < data to free                                                      */
-       struct _pool_destructors *prev;                 /** < chain link                                                        */
+       pool_destruct_func func;                                /**< pointer to destructor                                      */
+       void *data;                                                             /**< data to free                                                       */
+       struct _pool_destructors *prev;                 /**< chain link                                                         */
 };
 
 /**
  * Memory pool type
  */
 typedef struct memory_pool_s {
-       struct _pool_chain *cur_pool;                   /** < currently used page                                       */
-       struct _pool_chain *first_pool;                 /** < first page                                                        */
-       struct _pool_chain_shared *shared_pool; /** < shared chain                                                      */
-       struct _pool_destructors *destructors;  /** < destructors chain                                         */
+       struct _pool_chain *cur_pool;                   /**< currently used page                                        */
+       struct _pool_chain *first_pool;                 /**< first page                                                         */
+       struct _pool_chain_shared *shared_pool; /**< shared chain                                                       */
+       struct _pool_destructors *destructors;  /**< destructors chain                                          */
 } memory_pool_t;
 
 /**
  * Statistics structure
  */
 typedef struct memory_pool_stat_s {
-       size_t bytes_allocated;                                 /** < bytes that are allocated with pool allocator              */
-       size_t chunks_allocated;                                /** < number of chunks that are allocated                               */
-       size_t shared_chunks_allocated;                 /** < shared chunks allocated                                                   */
-       size_t chunks_freed;                                    /** < chunks freed                                                                              */
+       size_t bytes_allocated;                                 /**< bytes that are allocated with pool allocator               */
+       size_t chunks_allocated;                                /**< number of chunks that are allocated                                */
+       size_t shared_chunks_allocated;                 /**< shared chunks allocated                                                    */
+       size_t chunks_freed;                                    /**< chunks freed                                                                               */
 } memory_pool_stat_t;
 
 /**
  * Rwlock for locking shared memory regions
  */
 typedef struct memory_pool_rwlock_s {
-       gint *__r_lock;                                                 /** < read mutex (private)                                                              */
-       gint *__w_lock;                                                 /** < write mutex (private)                                                             */
+       gint *__r_lock;                                                 /**< read mutex (private)                                                               */
+       gint *__w_lock;                                                 /**< write mutex (private)                                                              */
 } memory_pool_rwlock_t;
 
 /**
index 7b880f22693b763e07df35001ba9b72c48b14032..6fa4ad83cafc370e9dd5ee9927bf74e8d474b3a4 100644 (file)
@@ -1,3 +1,8 @@
+/**
+ * @file message.h
+ * Message processing functions and structures
+ */
+
 #ifndef RSPAMD_MESSAGE_H
 #define RSPAMD_MESSAGE_H
 
 #include <glib.h>
 #include <gmime/gmime.h>
 
-
-/**
- * Message processing functions and structures
- */
-
 struct mime_part {
        GMimeContentType *type;
        GByteArray *content;
index 6006321198f814d79eac812c5240e884b80bfaae..243e216aa78a41c097c9217b961adc9d7ea92958 100644 (file)
@@ -1,3 +1,8 @@
+/**
+ * @file protocol.h
+ * Rspamd protocol definition
+ */
+
 #ifndef RSPAMD_PROTOCOL_H
 #define RSPAMD_PROTOCOL_H
 
@@ -8,10 +13,6 @@
 #define RSPAMD_PROTOCOL_ERROR 3
 #define RSPAMD_LENGTH_ERROR 4
 
-/**
- * Rspamd protocol definition
- */
-
 struct worker_task;
 
 enum rspamd_protocol {
index fd0d206263fe06fe80b89c1f792bb664f71be186..539fda842d6b1ed780a72b407ae3b1a07b6d75aa 100644 (file)
@@ -1,5 +1,6 @@
 /**
- * Describes common methods in accessing statistics files and caching them in memory
+ * @file statfile.h
+ * Describes common methods for accessing statistics files and caching them in memory
  */
 
 #ifndef RSPAMD_STATFILE_H
  * Common statfile header
  */
 struct stat_file_header {
-       u_char magic[3];                                                /** < magic signature ('r' 's' 'd')     */
-       u_char version[2];                                              /** < version of statfile (1.0)                 */
-       u_char padding[3];                                              /** < padding                                                   */
-       uint64_t create_time;                                   /** < create time (time_t->uint64_t)    */
+       u_char magic[3];                                                /**< magic signature ('r' 's' 'd')              */
+       u_char version[2];                                              /**< version of statfile (1.0)                  */
+       u_char padding[3];                                              /**< padding                                                    */
+       uint64_t create_time;                                   /**< create time (time_t->uint64_t)             */
 } __attribute__((__packed__));
 
 /**
  * Block of data in statfile
  */
 struct stat_file_block {
-       uint32_t hash1;                                                 /** < hash1 (also acts as index)                */                              
-       uint32_t hash2;                                                 /** < hash2                                                             */
-       float value;                                                    /** < float value                                               */
-       uint32_t last_access;                                   /** < last access to block since create time of file    */
+       uint32_t hash1;                                                 /**< hash1 (also acts as index)                 */                              
+       uint32_t hash2;                                                 /**< hash2                                                              */
+       float value;                                                    /**< float value                                                */
+       uint32_t last_access;                                   /**< last access to block since create time of file     */
 };
 
 /**
  * Statistic file
  */
 struct stat_file {
-       struct stat_file_header header;                 /** < header                                                    */
-       struct stat_file_block blocks[1];               /** < first block of data                               */
+       struct stat_file_header header;                 /**< header                                                             */
+       struct stat_file_block blocks[1];               /**< first block of data                                */
 };
 
 /**
  * Common view of statfile object
  */
 typedef struct stat_file_s {
-       char *filename;                                                 /** < name of file                                              */
-       int fd;                                                                 /** < descriptor                                                */
-       void *map;                                                              /** < mmaped area                                               */
-       time_t open_time;                                               /** < time when file was opened                 */
-       time_t access_time;                                             /** < last access time                                  */
-       size_t len;                                                             /** < length of file(in bytes)                  */
-       size_t blocks;                                                  /** < length of file in blocks                  */
-       gint *lock;                                                             /** < mutex                                                             */
+       char *filename;                                                 /**< name of file                                               */
+       int fd;                                                                 /**< descriptor                                                 */
+       void *map;                                                              /**< mmaped area                                                */
+       time_t open_time;                                               /**< time when file was opened                  */
+       time_t access_time;                                             /**< last access time                                   */
+       size_t len;                                                             /**< length of file(in bytes)                   */
+       size_t blocks;                                                  /**< length of file in blocks                   */
+       gint *lock;                                                             /**< mutex                                                              */
 } stat_file_t;
 
 /**
  * Statfiles pool
  */
 typedef struct statfile_pool_s {
-       rspamd_hash_t *files;                                   /** < hash table of opened files indexed by name        */
-       int opened;                                                             /** < number of opened files                    */
-       size_t max;                                                             /** < maximum size                                              */
-       size_t occupied;                                                /** < current size                                              */
-       memory_pool_t *pool;                                    /** < memory pool object                                */
+       rspamd_hash_t *files;                                   /**< hash table of opened files indexed by name */
+       int opened;                                                             /**< number of opened files                             */
+       size_t max;                                                             /**< maximum size                                               */
+       size_t occupied;                                                /**< current size                                               */
+       memory_pool_t *pool;                                    /**< memory pool object                                 */
 } statfile_pool_t;
 
 /**
  * Create new statfile pool
- * @param size maximum size
+ * @param max_size maximum size
  * @return statfile pool object
  */
 statfile_pool_t* statfile_pool_new (size_t max_size);