unrealircd

- supernets unrealircd source & configuration
git clone git://git.acid.vegas/unrealircd.git
Log | Files | Refs | Archive | README | LICENSE

config.h (12440B)

      1 /*
      2  *   Unreal Internet Relay Chat Daemon, include/config.h
      3  *   Copyright (C) 1990 Jarkko Oikarinen
      4  *
      5  *   $Id$
      6  *
      7  *   This program is free software; you can redistribute it and/or modify
      8  *   it under the terms of the GNU General Public License as published by
      9  *   the Free Software Foundation; either version 1, or (at your option)
     10  *   any later version.
     11  *
     12  *   This program is distributed in the hope that it will be useful,
     13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  *   GNU General Public License for more details.
     16  *
     17  *   You should have received a copy of the GNU General Public License
     18  *   along with this program; if not, write to the Free Software
     19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20  */
     21 
     22 #ifndef	__config_include__
     23 #define	__config_include__
     24 
     25 #include "setup.h"
     26 
     27 /* IMPORTANT:
     28  * Under normal conditions, you should not have to edit this file.  Run
     29  * the ./Config script in the root directory instead!
     30  *
     31  * Windows is not a normal condition, edit this file if you use it. :-)
     32  */
     33 
     34 /* Additional flags to give FreeBSD's malloc, only play with this if you
     35  * know what you're doing.
     36  */
     37 #define MALLOC_FLAGS_EXTRA ""
     38 
     39 /* I/O Engine: determine what method to use.
     40  * So, the way this works is we determine using the preprocessor
     41  * what polling backend to use for the eventloop.  We prefer epoll,
     42  * followed by kqueue, followed by poll, and then finally select.
     43  * Kind of ugly, but it gets the job done.  You can also fiddle with
     44  * this to determine what backend is used.
     45  */
     46 #ifndef _WIN32
     47 # ifdef HAVE_EPOLL
     48 #  define BACKEND_EPOLL
     49 # else
     50 #  ifdef HAVE_KQUEUE
     51 #   define BACKEND_KQUEUE
     52 #  else
     53 #   ifdef HAVE_POLL
     54 #    define BACKEND_POLL
     55 #   else
     56 #    define BACKEND_SELECT
     57 #   endif
     58 #  endif
     59 # endif
     60 #else
     61 # define BACKEND_SELECT
     62 #endif
     63 
     64 /* Define the ircd module suffix, should be .so on UNIX, and .dll on Windows. */
     65 #ifndef _WIN32
     66 # define MODULE_SUFFIX	".so"
     67 #else
     68 # define MODULE_SUFFIX	".dll"
     69 #endif
     70 
     71 /* Permit remote /rehash */
     72 #define REMOTE_REHASH
     73 
     74 /*
     75 ** Freelinks garbage collector -Stskeeps
     76 **
     77 ** GARBAGE_COLLECT_EVERY - how many seconds between every garbage collect
     78 ** HOW_MANY_FREELINKS_ALLOWED - how many freelinks allowed
     79 */
     80 #ifndef GARBAGE_COLLECT_EVERY
     81 #define GARBAGE_COLLECT_EVERY 		600	/* default: 600 (10 mins) */
     82 #endif
     83 
     84 #define HOW_MANY_FREELINKS_ALLOWED 	200	/* default: 200 */
     85 
     86 /*
     87  * read/write are restarted after signals defining this 1, gets
     88  * siginterrupt call compiled, which attempts to remove this
     89  * behaviour (apollo sr10.1/bsd4.3 needs this)
     90  */
     91 #ifdef APOLLO
     92 #define	RESTARTING_SYSTEMCALLS
     93 #endif
     94 
     95 /* DEBUGMODE: This should only be used when tracing a problem. It creates
     96  * an insane amount of log output which can be very useful for debugging.
     97  * You should *NEVER* enable this setting on production servers.
     98  */
     99 /* #undef	DEBUGMODE */
    100 
    101 /*
    102  * Full pathnames and defaults of irc system's support files.
    103  */
    104 #define	CPATH		CONFDIR"/unrealircd.conf"	/* server configuration file */
    105 #define	MPATH		CONFDIR"/ircd.motd"	/* server MOTD file */
    106 #define SMPATH		CONFDIR"/ircd.smotd"    /* short MOTD file */
    107 #define RPATH   	CONFDIR"/ircd.rules"	/* server rules file */
    108 #define OPATH   	CONFDIR"/oper.motd"	/* Operators MOTD file */
    109 #define	LPATH		LOGDIR"/debug.log"	/* Where the debug file lives, if DEBUGMODE */
    110 #define VPATH		CONFDIR"/ircd.svsmotd"	/* Services MOTD append. */
    111 #define BPATH		CONFDIR"/bot.motd"	/* Bot MOTD */
    112 #define IRCDTUNE 	PERMDATADIR"/ircd.tune"	/* tuning .. */
    113 
    114 /** FAKELAG_CONFIGURABLE makes it possible to make certain classes exempted
    115  * from 'fake lag' (that is, the artificial delay that is added by the ircd
    116  * to prevent flooding, which causes the messages/commands of the user to
    117  * slow down). Naturally, incorrect use of this feature can cause SEVERE
    118  * issues, in fact it can easily bring your whole IRCd down if one of the
    119  * users with class::options::nofakelag does a good flood at full speed.
    120  * Hence, this is disabled by default, and you need to explicitly enable it
    121  * here IF YOU KNOW WHAT YOU ARE DOING. People complaining their ircd
    122  * ""crashed"" because of this setting will be shot. </DISCLAIMER>
    123  * Common usage for this are: a trusted bot ran by an IRCOp, that you only
    124  * want to give "flood access" and nothing else, and other such things.
    125  */
    126 #define FAKELAG_CONFIGURABLE
    127 
    128 /* The default value for class::sendq */
    129 #define DEFAULT_SENDQ	3000000
    130 /* The default value for class::recvq */
    131 #define	DEFAULT_RECVQ	8000
    132 
    133 /* You can define the nickname of NickServ here (usually "NickServ").
    134  * This is ONLY used for the ""infamous IDENTIFY feature"", which is:
    135  * whenever a user connects with a server password but there isn't
    136  * a server password set, the password is sent to NickServ in an
    137  * 'IDENTIFY <pass>' message.
    138  */
    139 #define NickServ "NickServ"
    140 
    141 /*   STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP  */
    142 
    143 /* You shouldn't change anything below this line, unless absolutely needed. */
    144 
    145 /*
    146  * Maximum number of network connections your server will allow.
    147  * On *NIX this is configured via ./Config so don't set it here.
    148  * The setting below is the Windows (default) setting and isn't actually
    149  * the maximum number of network connections but the highest FD (File
    150  * Descriptor) that we can deal with.
    151  *
    152  * 2004-10-13: 1024 -> 4096
    153  */
    154 #ifdef _WIN32
    155  #define MAXCONNECTIONS	10240
    156 #else
    157  /* Non-Windows: */
    158  #if (!defined(MAXCONNECTIONS_REQUEST) || (MAXCONNECTIONS_REQUEST < 1)) && \
    159       (defined(HAVE_POLL) || defined(HAVE_EPOLL) || defined(HAVE_KQUEUE))
    160   /* Have poll/epoll/kqueue and either no --with-maxconnections or
    161    * --with-maxconnections=0, either of which indicates 'automatic' mode.
    162    * At the time of writing we will try a limit of 16384.
    163    * It will automatically be lowered at boottime if we can only use
    164    * 4096, 2048 or 1024. No problem.
    165    */
    166   #define MAXCONNECTIONS 16384
    167  #elif defined(MAXCONNECTIONS_REQUEST) && (MAXCONNECTIONS_REQUEST >= 1)
    168   /* --with-maxconnections=something */
    169   #define MAXCONNECTIONS MAXCONNECTIONS_REQUEST
    170  #else
    171   /* Automatic mode, but we only have select(). Bummer... */
    172   #define MAXCONNECTIONS 1024
    173  #endif
    174 #endif
    175 
    176 /* Number of file descriptors reserved for non-incoming-clients.
    177  * One of which may be used by auth, the rest are really reserved.
    178  * They can be used for outgoing server links, listeners, logging, etc.
    179  */
    180 #if MAXCONNECTIONS > 1024
    181  #define CLIENTS_RESERVE 8
    182 #else
    183  #define CLIENTS_RESERVE 4
    184 #endif
    185 
    186 /*
    187  * this defines the length of the nickname history.  each time a user changes
    188  * nickname or signs off, their old nickname is added to the top of the list.
    189  * The following sizes are recommended:
    190  * 8MB or less  core memory : 500	(at least 1/4 of max users)
    191  * 8MB-16MB     core memory : 500-750	(1/4 -> 1/2 of max users)
    192  * 16MB-32MB    core memory : 750-1000	(1/2 -> 3/4 of max users)
    193  * 32MB or more core memory : 1000+	(> 3/4 of max users)
    194  * where max users is the expected maximum number of users.
    195  * (100 nicks/users ~ 25k)
    196  * NOTE: this is directly related to the amount of memory ircd will use whilst
    197  *	 resident and running - it hardly ever gets swapped to disk! You can
    198  *	 ignore these recommendations- they only are meant to serve as a guide
    199  * NOTE: But the *Minimum* ammount should be 100, in order to make nick
    200  *       chasing possible for mode and kick.
    201  */
    202 #ifndef NICKNAMEHISTORYLENGTH
    203 #define NICKNAMEHISTORYLENGTH 2000
    204 #endif
    205 
    206 /*
    207  * Maximum delay for socket loop (in miliseconds, so 1000 = 1 second). 
    208  * This means any other events and such may be delayed up to this value
    209  * when there is no socket data waiting for us (no clients sending anything).
    210  * Was 2000ms in 3.2.x, 1000ms for versions below 3.4-alpha4.
    211  * 500ms in UnrealIRCd 4 (?)
    212  * 250ms in UnrealIRCd 5 and UnrealIRCd 6.
    213  */
    214 #define SOCKETLOOP_MAX_DELAY 250
    215 
    216 /* After how much time should we timeout downloads:
    217  * DOWNLOAD_CONNECT_TIMEOUT: for the DNS and connect() / TLS_connect() call
    218  * DOWNLOAD_TRANSFER_TIMEOUT: for the complete transfer (including connect)
    219  * This can't be in the configuration file, as we need it while
    220  * fetching the configuration file.. ;)
    221  */
    222 #define DOWNLOAD_CONNECT_TIMEOUT 15
    223 #define DOWNLOAD_TRANSFER_TIMEOUT 45
    224 
    225 /* Maximum number of HTTP redirects to follow.
    226  * Keep this reasonably low, as this may delay booting up to
    227  * DOWNLOAD_TRANSFER_TIMEOUT * DOWNLOAD_MAX_REDIRECTS
    228  */
    229 #define DOWNLOAD_MAX_REDIRECTS 2
    230 
    231 /*
    232  * Max time from the nickname change that still causes KILL
    233  * automaticly to switch for the current nick of that user. (seconds)
    234  */
    235 #define KILLCHASETIMELIMIT 30
    236 
    237 /* Detect slow spamfilters? This requires a little more cpu time when processing
    238  * any spamfilter (like on text/connect/..) but will save you from slowing down
    239  * your IRCd to a near-halt (well, in most cases.. there are still cases like when
    240  * it goes into a loop that it will still stall completely... forever..).
    241  * This is kinda experimental, and requires getrusage.
    242  */
    243 #ifndef _WIN32
    244 #define SPAMFILTER_DETECTSLOW
    245 #endif
    246 
    247 /* Maximum number of ModData objects that may be attached to an object */
    248 /* UnrealIRCd 4.0.0 - 4.0.13:  8,     8, 4, 4
    249  * UnrealIRCd 4.0.14+       : 12,     8, 4, 4
    250  * UnrealIRCd 5.0.0         : 12,  8, 8, 4, 4, 500, 500
    251  * UnrealIRCd 6.0.0         : 24, 12, 8, 4, 4, 500, 500
    252  */
    253 #define MODDATA_MAX_CLIENT		 24
    254 #define MODDATA_MAX_LOCAL_CLIENT	 12
    255 #define MODDATA_MAX_CHANNEL		  8
    256 #define MODDATA_MAX_MEMBER		  4
    257 #define MODDATA_MAX_MEMBERSHIP		  4
    258 #define MODDATA_MAX_LOCAL_VARIABLE	500
    259 #define MODDATA_MAX_GLOBAL_VARIABLE	500
    260 
    261 /** Size of the member modes buffer, so can be max this-1 modes
    262  * assigned to an individual user (and thus max prefixes as well).
    263  * The default is 8, so 7 max modes, and is a bit tight.
    264  * It allows for vhoaq (5) and then 2 additional ones from 3rd
    265  * party modules.
    266  */
    267 #define MEMBERMODESLEN	8
    268 
    269 /* If EXPERIMENTAL is #define'd then all users will receive a notice about
    270  * this when they connect, along with a pointer to bugs.unrealircd.org where
    271  * they can report any problems. This is mainly to help UnrealIRCd development.
    272  */
    273 #undef EXPERIMENTAL
    274 
    275 /* Default TLS cipherlist (except for TLS1.3, see further down).
    276  * This can be changed via set::ssl::options::ciphers in the config file.
    277  */
    278 #define UNREALIRCD_DEFAULT_CIPHERS "EECDH+CHACHA20 EECDH+AESGCM EECDH+AES+SHA384 EECDH+AES+SHA256"
    279 
    280 /* Default TLS 1.3 ciphersuites.
    281  * This can be changed via set::ssl::options::ciphersuites in the config file.
    282  */
    283 #define UNREALIRCD_DEFAULT_CIPHERSUITES "TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256"
    284 
    285 /* Default TLS curves for ECDH(E)
    286  * This can be changed via set::ssl::options::ecdh-curve in the config file.
    287  * NOTE: This requires openssl 1.0.2 or newer, otherwise these defaults
    288  *       are not applied, due to the missing openssl API call.
    289  */
    290 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
    291 #define UNREALIRCD_DEFAULT_ECDH_CURVES "X25519:secp521r1:secp384r1:prime256v1"
    292 #else
    293 #define UNREALIRCD_DEFAULT_ECDH_CURVES "secp521r1:secp384r1:prime256v1"
    294 #endif
    295 
    296 /* ------------------------- END CONFIGURATION SECTION -------------------- */
    297 #define MOTD MPATH
    298 #define RULES RPATH
    299 #define	MYNAME BINDIR "/unrealircd"
    300 #define	CONFIGFILE CPATH
    301 #define	IRCD_PIDFILE PIDFILE
    302 
    303 #ifdef DEBUGMODE
    304  #define LOGFILE LPATH
    305 #else
    306  #define LOGFILE "/dev/null"
    307 #endif
    308 
    309 #if defined(DEFAULT_RECVQ)
    310 #    if (DEFAULT_RECVQ < 512)
    311      error DEFAULT_RECVQ needs redefining.
    312 #    endif
    313 #else
    314      error DEFAULT_RECVQ undefined
    315 #endif
    316 #if (NICKNAMEHISTORYLENGTH < 100)
    317 #  define NICKNAMEHISTORYLENGTH 100
    318 #endif
    319 
    320 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
    321     ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
    322     !defined(__cplusplus)
    323  #define GCC_TYPECHECKING
    324 
    325  /* copied from cURL: */
    326 
    327  #define _UNREAL_WARNING(id, message) \
    328    static void __attribute__((__warning__(message))) \
    329    __attribute__((__unused__)) __attribute__((__noinline__)) \
    330    id(void) { __asm__(""); }
    331 
    332  #define _UNREAL_ERROR(id, message) \
    333    static void __attribute__((__error__(message))) \
    334    __attribute__((__unused__)) __attribute__((__noinline__)) \
    335    id(void) { __asm__(""); }
    336 #endif
    337 
    338 #ifndef __has_feature
    339  #define __has_feature(x) 0  // Compatibility with non-clang compilers.
    340 #endif
    341 #ifndef __has_extension
    342  #define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
    343 #endif
    344 
    345 #endif				/* __config_include__ */
    346