/* $Id: dbmail.h 2017 2006-03-07 05:58:02Z aaron $ Copyright (C) 1999-2004 IC & S dbmail@ic-s.nl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /** * \file dbmail.h * header file for a general configuration */ #ifndef _DBMAIL_H #define _DBMAIL_H #ifdef HAVE_CONFIG_H #include "config.h" #else #define VERSION "2.1" #define PACKAGE "dbmail" #endif #define _XOPEN_SOURCE /* glibc2 */ #define __EXTENSIONS__ /* solaris */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef AUTHLDAP #include #endif #include "dbmailtypes.h" #include "debug.h" #include "dsn.h" #include "acl.h" #include "misc.h" #include "pipe.h" #include "db.h" #include "auth.h" #include "sort.h" #include "imap4.h" #include "imapcommands.h" #include "memblock.h" #include "server.h" #include "serverchild.h" #include "pool.h" #include "pop3.h" #include "quota.h" #include "lmtp.h" #include "dm_md5.h" #include "dm_cidr.h" #include "dm_imaputil.h" #include "dm_base64.h" #include "dm_getopt.h" #include "dm_match.h" #ifdef SIEVE #include #include #endif #include "sievecmd.h" #include "timsieve.h" #ifdef HAVE_CRYPT_H #include #endif #ifdef HAVE_ENDIAN_H #include #endif #include "dbmail-message.h" #include "dbmail-user.h" #include "dbmail-mailbox.h" #include "dbmail-imapsession.h" #define GETCONFIGVALUE(key, sect, var) \ config_get_value(key, sect, var); \ if (strlen(var) == 0) \ trace(TRACE_DEBUG, "%s, %s: no value for "#key" in section "#sect, \ __FILE__, __func__ ); \ trace(TRACE_DEBUG, "%s, %s: key "#key" section "#sect" var "#var" value [%s]", \ __FILE__, __func__, \ var) /* No final ';' so macro can be called "like a function" */ #define CONFIG_ERROR_LEVEL TRACE_WARNING #define COPYRIGHT "(c) 1999-2004 IC&S, 2004-2006 NFG, The Netherlands" /** default directory and extension for pidfiles */ #define DEFAULT_PID_DIR "@DM_STATEDIR@" #define DEFAULT_PID_EXT ".pid" /** default configuration file */ #define DEFAULT_CONFIG_FILE "@DM_CONFDIR@/dbmail.conf" /** default log files */ #define DEFAULT_LOG_FILE "@DM_LOGDIR@/dbmail.log" #define DEFAULT_ERROR_LOG "@DM_LOGDIR@/dbmail.err" /** username of user that is owner of all mailboxes */ #define SHARED_MAILBOX_USERNAME "__public__" /** prefix for #Users namespace */ #define NAMESPACE_USER "#Users" /** prefix for public namespace */ #define NAMESPACE_PUBLIC "#Public" /** seperator for namespaces and mailboxes and submailboxes */ #define MAILBOX_SEPARATOR "/" /** username for owner of public folders */ #define PUBLIC_FOLDER_USER "__public__" /* FIXME: Any consumers of this should * be using POSTMASTER from dbmail.conf! */ #define DEFAULT_POSTMASTER "DBMAIL-MAILER@dbmail" #define AUTO_NOTIFY_SENDER "autonotify@dbmail" #define AUTO_NOTIFY_SUBJECT "NEW MAIL NOTIFICATION" /* Must be at least 998 or 1000 by RFC's */ #define MAX_LINE_SIZE 1024 /** default table prefix */ #define DEFAULT_DBPFX "dbmail_" #define MATCH(x,y) strcasecmp((x),(y))==0 #define min(x,y) ((x)<=(y)?(x):(y)) #define max(x,y) ((x)>=(y)?(x):(y)) /** * \brief read configuration from filename * \param cfilename name of configuration file * \return * - -1 on error * - 0 on success */ int config_read(const char *config_filename); /** * free all memory taken up by config. */ void config_free(void); /** * \brief get configuration value for an item * \param name name of configuration item * \param service_name name of service * \param value value of configuration item name * \return 0 * \attention value is set to a string beginning with a '\\0' * if no configuration item with name is found in items. */ int config_get_value(const field_t name, const char *service_name, /*@out@*/ field_t value); /* some common used functions reading config options */ /** \brief get parameters for database connection \param db_params list of database parameters (db_param_t) */ void GetDBParams(db_param_t * db_params); /** \brief set the overall trace level, using the value in cfg_items \param service_name name of service to get trace level for. \attention trace level is set to TRACE_ERROR if no trace level value is found * for service. */ void SetTraceLevel(const char *service_name); void pidfile_create(const char *pidFile, pid_t pid); void config_get_logfiles(serverConfig_t *config); char * config_get_pidfile(serverConfig_t *config, const char *name); #endif