2011-11-14 15:57:52 +01:00
/*
* config . h , SJ
*/
# ifndef _CONFIG_H
# define _CONFIG_H
# include <syslog.h>
# include "piler-config.h"
# include "params.h"
# define PROGNAME "piler"
2013-04-08 20:46:19 +02:00
# define PILERGETD_PROGNAME "pilergetd"
2011-11-14 15:57:52 +01:00
2015-03-23 14:09:22 +01:00
# define VERSION "1.2.0-master"
2011-11-14 15:57:52 +01:00
2015-09-09 13:00:30 +02:00
# define BUILD 921
2011-11-14 15:57:52 +01:00
# define HOSTID "mailarchiver"
# define CONFIG_FILE CONFDIR " / piler.conf"
2012-01-07 00:00:36 +01:00
# define WORK_DIR DATADIR " / piler / tmp"
2011-11-19 21:25:44 +01:00
# define QUEUE_DIR DATADIR " / piler / store"
2011-11-14 15:57:52 +01:00
# define CLAMD_SOCKET " / tmp / clamd"
# define PIDFILE " / var / run / piler / piler.pid"
2013-04-08 20:46:19 +02:00
# define PILERGETD_PIDFILE " / var / run / piler / pilergetd.pid"
2011-11-14 15:57:52 +01:00
# define QUARANTINELEN 255
# define TIMEOUT 60
# define TIMEOUT_USEC 500000
# define SESSION_TIMEOUT 420
# define MAXBUFSIZE 8192
# define SMALLBUFSIZE 512
2012-09-07 15:08:50 +02:00
# define BIGBUFSIZE 131072
2012-01-07 16:40:06 +01:00
# define REALLYBIGBUFSIZE 524288
2011-11-16 14:47:47 +01:00
# define TINYBUFSIZE 128
2011-11-14 15:57:52 +01:00
# define MAXVAL 256
# define RANDOM_POOL " / dev / urandom"
# define RND_STR_LEN 36
# define BUFLEN 32
# define IPLEN 16+1
# define KEYLEN 56
# define CRLF "\n"
2012-02-10 14:35:07 +01:00
# define MEMCACHED_CLAPF_PREFIX "_piler:"
2011-11-14 15:57:52 +01:00
# define MAX_MEMCACHED_KEY_LEN 250
# define MEMCACHED_SUCCESS 0
# define MEMCACHED_FAILURE 1
2012-02-10 14:35:07 +01:00
# define MEMCACHED_COUNTERS_LAST_UPDATE MEMCACHED_CLAPF_PREFIX "counters_last_update"
# define MEMCACHED_MSGS_RCVD MEMCACHED_CLAPF_PREFIX "rcvd"
# define MEMCACHED_MSGS_VIRUS MEMCACHED_CLAPF_PREFIX "virus"
# define MEMCACHED_MSGS_DUPLICATE MEMCACHED_CLAPF_PREFIX "duplicate"
# define MEMCACHED_MSGS_IGNORE MEMCACHED_CLAPF_PREFIX "ignore"
# define MEMCACHED_MSGS_SIZE MEMCACHED_CLAPF_PREFIX "size"
2014-05-05 15:26:42 +02:00
# define MEMCACHED_MSGS_STORED_SIZE MEMCACHED_CLAPF_PREFIX "stored_size"
2011-11-14 15:57:52 +01:00
# define LOG_PRIORITY LOG_INFO
# define _LOG_INFO 3
# define _LOG_DEBUG 5
# define MAX_RCPT_TO 128
# define MIN_WORD_LEN 3
# define MAX_WORD_LEN 25
# define MAX_TOKEN_LEN 4*MAX_WORD_LEN
# define DELIMITER ' '
# define BOUNDARY_LEN 255
2011-11-16 14:47:47 +01:00
# define MAX_ATTACHMENTS 16
2012-09-11 14:11:17 +02:00
# define MAX_ZIP_RECURSION_LEVEL 2
2011-11-14 15:57:52 +01:00
/* SQL stuff */
# define SQL_SPHINX_TABLE "sph_index"
# define SQL_METADATA_TABLE "metadata"
2011-11-19 21:25:44 +01:00
# define SQL_ATTACHMENT_TABLE "attachment"
2012-08-23 10:23:58 +02:00
# define SQL_FOLDER_TABLE "folder"
2011-12-03 23:05:00 +01:00
# define SQL_RECIPIENT_TABLE "rcpt"
2011-11-19 21:25:44 +01:00
# define SQL_ARCHIVING_RULE_TABLE "archiving_rule"
2012-02-19 22:59:47 +01:00
# define SQL_RETENTION_RULE_TABLE "retention_rule"
2015-08-28 22:50:28 +02:00
# define SQL_FOLDER_RULE_TABLE "folder_rule"
2011-11-14 15:57:52 +01:00
# define SQL_COUNTER_TABLE "counter"
2012-04-27 14:39:10 +02:00
# define SQL_OPTION_TABLE "option"
2013-01-06 22:16:21 +01:00
# define SQL_DOMAIN_TABLE "domain"
2013-05-07 15:32:05 +02:00
# define SQL_CUSTOMER_TABLE "customer"
2013-08-23 13:02:51 +02:00
# define SQL_IMPORT_TABLE "import"
2015-03-23 14:09:22 +01:00
# define SQL_LEGAL_HOLD_TABLE "legal_hold"
2015-09-09 12:52:15 +02:00
# define SQL_FOLDER_MESSAGE_TABLE "folder_message"
2012-04-27 14:39:10 +02:00
# define SQL_MESSAGES_VIEW "v_messages"
2012-03-20 10:35:22 +01:00
# define SQL_ATTACHMENTS_VIEW "v_attachment"
2011-11-14 15:57:52 +01:00
2013-05-05 11:57:14 +02:00
# define SQL_PREPARED_STMT_GET_DOMAINS "SELECT `domain` FROM `" SQL_DOMAIN_TABLE "`"
2013-01-27 21:43:42 +01:00
# define SQL_PREPARED_STMT_GET_META_ID_BY_MESSAGE_ID "SELECT id FROM " SQL_METADATA_TABLE " WHERE message_id=?"
# define SQL_PREPARED_STMT_INSERT_INTO_RCPT_TABLE "INSERT INTO " SQL_RECIPIENT_TABLE " (`id`,`to`,`todomain`) VALUES(?,?,?)"
2014-02-18 10:46:23 +01:00
# define SQL_PREPARED_STMT_INSERT_INTO_SPHINX_TABLE "INSERT INTO " SQL_SPHINX_TABLE " (`id`, `from`, `to`, `fromdomain`, `todomain`, `subject`, `body`, `arrived`, `sent`, `size`, `direction`, `folder`, `attachments`, `attachment_types`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
# define SQL_PREPARED_STMT_INSERT_INTO_META_TABLE "INSERT INTO " SQL_METADATA_TABLE " (`from`,`fromdomain`,`subject`,`spam`,`arrived`,`sent`,`retained`,`size`,`hlen`,`direction`,`attachments`,`piler_id`,`message_id`,`reference`,`digest`,`bodydigest`,`vcode`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
2013-01-28 12:10:39 +01:00
# define SQL_PREPARED_STMT_INSERT_INTO_ATTACHMENT_TABLE "INSERT INTO " SQL_ATTACHMENT_TABLE " (`piler_id`,`attachment_id`,`sig`,`name`,`type`,`size`,`ptr`) VALUES(?,?,?,?,?,?,?)"
2014-09-10 14:55:07 +02:00
# define SQL_PREPARED_STMT_GET_ATTACHMENT_ID_BY_SIGNATURE "SELECT `id` FROM `" SQL_ATTACHMENT_TABLE "` WHERE `sig`=? AND `ptr`=0 AND `size`=?"
2013-01-28 12:10:39 +01:00
# define SQL_PREPARED_STMT_GET_ATTACHMENT_POINTER "SELECT `piler_id`, `attachment_id` FROM " SQL_ATTACHMENT_TABLE " WHERE id=?"
# define SQL_PREPARED_STMT_QUERY_ATTACHMENT "SELECT `attachment_id`, `ptr` FROM " SQL_ATTACHMENT_TABLE " WHERE piler_id=? ORDER BY attachment_id ASC"
2013-01-28 13:40:44 +01:00
# define SQL_PREPARED_STMT_GET_FOLDER_ID "SELECT `id` FROM " SQL_FOLDER_TABLE " WHERE `name`=? AND `parent_id`=?"
# define SQL_PREPARED_STMT_INSERT_INTO_FOLDER_TABLE "INSERT INTO `" SQL_FOLDER_TABLE "` (`name`, `parent_id`) VALUES(?,?)"
2013-03-18 10:13:26 +01:00
# define SQL_PREPARED_STMT_UPDATE_METADATA_REFERENCE "UPDATE " SQL_METADATA_TABLE " SET reference=? WHERE message_id=? AND reference=''"
2013-08-23 13:02:51 +02:00
# define SQL_PREPARED_STMT_GET_GUI_IMPORT_JOBS "SELECT id, type, username, password, server FROM " SQL_IMPORT_TABLE " WHERE started=0 ORDER BY id LIMIT 0,1"
2015-09-09 12:52:15 +02:00
# define SQL_PREPARED_STMT_INSERT_FOLDER_MESSAGE "INSERT INTO " SQL_FOLDER_MESSAGE_TABLE " (`folder_id`, `id`) VALUES(?,?)"
2011-11-14 15:57:52 +01:00
/* Error codes */
# define OK 0
# define ERR 1
# define ERR_EXISTS 2
2013-07-12 22:54:45 +02:00
# define ERR_MYDOMAINS 3
2013-06-29 15:22:07 +02:00
# define ERR_FOLDER -1
2011-11-14 15:57:52 +01:00
# define AVIR_OK 0
# define AVIR_VIRUS 1
2012-01-03 00:19:43 +01:00
# define DIRECTION_INCOMING 0
# define DIRECTION_INTERNAL 1
# define DIRECTION_OUTGOING 2
# define DIRECTION_INTERNAL_AND_OUTGOING 3
2011-11-14 15:57:52 +01:00
2012-01-07 16:40:06 +01:00
# define WRITE_TO_STDOUT 0
# define WRITE_TO_BUFFER 1
2014-05-12 01:05:44 +02:00
# define S_STATUS_UNDEF "undef"
2013-12-04 15:52:23 +01:00
# define S_STATUS_STORED "stored"
# define S_STATUS_DUPLICATE "duplicate"
2014-05-12 01:05:44 +02:00
# define S_STATUS_DISCARDED "discarded"
2013-12-04 15:52:23 +01:00
# define S_STATUS_ERROR "error"
2011-11-14 15:57:52 +01:00
# endif /* _CONFIG_H */