0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-15 16:38:20 +02:00

ircd: Merge the defaults/ircd_defs stuff for now.

ircd/rb: Move some lowish level macros down to rb.
This commit is contained in:
Jason Volk 2016-07-12 22:22:05 -07:00
parent ffb2f63850
commit 7cea4c784d
12 changed files with 151 additions and 244 deletions

View file

@ -22,39 +22,14 @@
* USA
*/
#ifndef INCLUDED_defaults_h
#define INCLUDED_defaults_h
#ifndef _IRCD_SYSTEM_H
#define _IRCD_SYSTEM_H
/* /!\ DANGER WILL ROBINSON! DANGER! /!\
*
* Do not mess with these values unless you know what you are doing!
*/
#include "stdinc.h"
/* Below are the elements for default paths. */
typedef enum {
IRCD_PATH_PREFIX,
IRCD_PATH_MODULES,
IRCD_PATH_AUTOLOAD_MODULES,
IRCD_PATH_ETC,
IRCD_PATH_LOG,
IRCD_PATH_USERHELP,
IRCD_PATH_OPERHELP,
IRCD_PATH_IRCD_EXEC,
IRCD_PATH_IRCD_CONF,
IRCD_PATH_IRCD_MOTD,
IRCD_PATH_IRCD_LOG,
IRCD_PATH_IRCD_PID,
IRCD_PATH_IRCD_OMOTD,
IRCD_PATH_BANDB,
IRCD_PATH_BIN,
IRCD_PATH_LIBEXEC,
IRCD_PATH_COUNT
} ircd_path_t;
extern const char *ircd_paths[IRCD_PATH_COUNT];
/* The below are used as defaults if not found in the configuration file (or on ircd warm-up).
* Don't change these - edit the conf file instead.
*/
@ -87,35 +62,51 @@ extern const char *ircd_paths[IRCD_PATH_COUNT];
#define MIN_SPAM_NUM 5
#define MIN_SPAM_TIME 60
/*
* Directory paths and filenames for UNIX systems.
* IRCD_PREFIX is set using ./configure --prefix, see INSTALL.
* Do not change these without corresponding changes in the build system.
*
* IRCD_PREFIX = prefix for all directories,
* DPATH = root directory of installation,
* BINPATH = directory for binary files,
* ETCPATH = directory for configuration files,
* LOGPATH = directory for logfiles,
* MODPATH = directory for modules,
* AUTOMODPATH = directory for autoloaded modules
*/
#define DPATH IRCD_PREFIX
#define BINPATH IRCD_PREFIX "/bin"
#define MODPATH MODULE_DIR
#define AUTOMODPATH MODULE_DIR "/autoload"
#define ETCPATH ETC_DIR
#define LOGPATH LOG_DIR
#define UHPATH HELP_DIR "/users"
#define HPATH HELP_DIR "/opers"
#define SPATH BINPATH "/" PROGRAM_PREFIX "/" BRANDING_NAME /* ircd executable */
#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */
#define MPATH ETCPATH "/ircd.motd" /* MOTD file */
#define LPATH LOGPATH "/ircd.log" /* ircd logfile */
#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */
#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */
#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */
#define HOSTLEN 63 /* Length of hostname. Updated to */
/* comply with RFC1123 */
/* Longest hostname we're willing to work with.
* Due to DNSBLs this is more than HOSTLEN.
*/
#define IRCD_RES_HOSTLEN 255
#define USERLEN 10
#define REALLEN 50
#define CHANNELLEN 200
#define LOC_CHANNELLEN 50
/* reason length of klines, parts, quits etc */
/* for quit messages, note that a client exit server notice
* :012345678901234567890123456789012345678901234567890123456789123 NOTICE * :*** Notice -- Client exiting: 012345678901234567 (0123456789@012345678901234567890123456789012345678901234567890123456789123) [] [1111:2222:3333:4444:5555:6666:7777:8888]
* takes at most 246 bytes (including CRLF and '\0') and together with the
* quit reason should fit in 512 */
#define REASONLEN 260 /* kick/part/quit */
#define BANREASONLEN 390 /* kline/dline */
#define AWAYLEN TOPICLEN
#define KILLLEN 200 /* with Killed (nick ()) added this should fit in quit */
/* 23+1 for \0 */
#define KEYLEN 24
#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */
#define OPERNICKLEN (NICKLEN*2) /* Length of OPERNICKs. */
#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5)
#define MAX_DATE_STRING 32 /* maximum string length for a date string */
#define HELPLEN 400
/*
* message return values
*/
#define CLIENT_EXITED -2
#define CLIENT_PARSE_ERROR -1
#define CLIENT_OK 1
/* Read buffer size */
#define READBUF_SIZE 16384
/* Below are somewhat configurable settings (though it's probably a bad idea
* to blindly mess with them). If in any doubt, leave them alone.
@ -153,4 +144,63 @@ extern const char *ircd_paths[IRCD_PATH_COUNT];
# define SOMAXCONN 25
#endif
#endif /* INCLUDED_defaults_h */
/*
* Directory paths and filenames for UNIX systems.
* IRCD_PREFIX is set using ./configure --prefix, see INSTALL.
* Do not change these without corresponding changes in the build system.
*
* IRCD_PREFIX = prefix for all directories,
* DPATH = root directory of installation,
* BINPATH = directory for binary files,
* ETCPATH = directory for configuration files,
* LOGPATH = directory for logfiles,
* MODPATH = directory for modules,
* AUTOMODPATH = directory for autoloaded modules
*/
#define DPATH IRCD_PREFIX
#define BINPATH IRCD_PREFIX "/bin"
#define MODPATH RB_MODULE_DIR
#define MODULE_DIR RB_MODULE_DIR
#define AUTOMODPATH RB_MODULE_DIR "/autoload"
#define ETCPATH RB_ETC_DIR "/charybdis"
#define LOGPATH RB_LOG_DIR
#define UHPATH RB_HELP_DIR "/users"
#define HPATH RB_HELP_DIR "/opers"
#define SPATH RB_BIN_DIR "/" BRANDING_NAME /* ircd executable */
#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */
#define MPATH ETCPATH "/ircd.motd" /* MOTD file */
#define LPATH LOGPATH "/ircd.log" /* ircd logfile */
#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */
#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */
#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */
/* Below are the elements for default paths. */
typedef enum
{
IRCD_PATH_PREFIX,
IRCD_PATH_MODULES,
IRCD_PATH_AUTOLOAD_MODULES,
IRCD_PATH_ETC,
IRCD_PATH_LOG,
IRCD_PATH_USERHELP,
IRCD_PATH_OPERHELP,
IRCD_PATH_IRCD_EXEC,
IRCD_PATH_IRCD_CONF,
IRCD_PATH_IRCD_MOTD,
IRCD_PATH_IRCD_LOG,
IRCD_PATH_IRCD_PID,
IRCD_PATH_IRCD_OMOTD,
IRCD_PATH_BANDB,
IRCD_PATH_BIN,
IRCD_PATH_LIBEXEC,
IRCD_PATH_COUNT
}
ircd_path_t;
extern const char *ircd_paths[IRCD_PATH_COUNT];
#endif // _IRCD_SYSTEM_H

View file

@ -1,120 +0,0 @@
/*
* charybdis: An advanced IRCd.
* ircd_defs.h: A header for ircd global definitions.
*
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
* Copyright (C) 1996-2002 Hybrid Development Team
* Copyright (C) 2002-2004 ircd-ratbox development team
* Copyright (C) 2005-2006 Charybdis development team
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
/*
* NOTE: NICKLEN and TOPICLEN do not live here anymore. Set it with configure
* Otherwise there are no user servicable part here.
*/
/* ircd_defs.h - Global size definitions for record entries used
* througout ircd. Please think 3 times before adding anything to this
* file.
*/
#ifndef INCLUDED_ircd_defs_h
#define INCLUDED_ircd_defs_h
#include "defaults.h"
/*
* This ensures that __attribute__((deprecated)) is not used in for example
* sun CC, since it's a GNU-specific extension. -nenolod
*/
#ifdef __GNUC__
#define IRC_DEPRECATED __attribute__((deprecated))
#else
#define IRC_DEPRECATED
#endif
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#define HOSTLEN 63 /* Length of hostname. Updated to */
/* comply with RFC1123 */
/* Longest hostname we're willing to work with.
* Due to DNSBLs this is more than HOSTLEN.
*/
#define IRCD_RES_HOSTLEN 255
#define USERLEN 10
#define REALLEN 50
#define CHANNELLEN 200
#define LOC_CHANNELLEN 50
/* reason length of klines, parts, quits etc */
/* for quit messages, note that a client exit server notice
* :012345678901234567890123456789012345678901234567890123456789123 NOTICE * :*** Notice -- Client exiting: 012345678901234567 (0123456789@012345678901234567890123456789012345678901234567890123456789123) [] [1111:2222:3333:4444:5555:6666:7777:8888]
* takes at most 246 bytes (including CRLF and '\0') and together with the
* quit reason should fit in 512 */
#define REASONLEN 260 /* kick/part/quit */
#define BANREASONLEN 390 /* kline/dline */
#define AWAYLEN TOPICLEN
#define KILLLEN 200 /* with Killed (nick ()) added this should fit in quit */
/* 23+1 for \0 */
#define KEYLEN 24
#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */
#define OPERNICKLEN (NICKLEN*2) /* Length of OPERNICKs. */
#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5)
#define MAX_DATE_STRING 32 /* maximum string length for a date string */
#define HELPLEN 400
/*
* message return values
*/
#define CLIENT_EXITED -2
#define CLIENT_PARSE_ERROR -1
#define CLIENT_OK 1
#ifdef RB_IPV6
#ifndef AF_INET6
#error "AF_INET6 not defined"
#endif
#else /* #ifdef RB_IPV6 */
#ifndef AF_INET6
#define AF_INET6 AF_MAX /* Dummy AF_INET6 declaration */
#endif
#endif /* #ifdef RB_IPV6 */
#ifdef RB_IPV6
#define PATRICIA_BITS 128
#else
#define PATRICIA_BITS 32
#endif
/* Read buffer size */
#define READBUF_SIZE 16384
#endif /* INCLUDED_ircd_defs_h */

View file

@ -32,7 +32,7 @@
#ifndef INCLUDED_s_log_h
#define INCLUDED_s_log_h
#include "ircd_defs.h"
#include "defaults.h"
typedef enum ilogfile
{

View file

@ -30,7 +30,6 @@
#include <openssl/rsa.h>
#endif
#include "ircd_defs.h"
#include "class.h"
#include "client.h"

View file

@ -26,7 +26,6 @@
#define INCLUDED_send_h
#include <rb/rb.h>
#include "ircd_defs.h"
struct Client;
struct Channel;

View file

@ -22,7 +22,7 @@
*/
#include <rb/rb.h>
#include "ircd_defs.h" /* Needed for some reasons here -- dwr */
#include "defaults.h" /* Needed for some reasons here -- dwr */
/* AIX requires this to be the first thing in the file. */
#ifdef __GNUC__
@ -47,69 +47,11 @@ char *alloca ();
# endif
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef STRING_WITH_STRINGS
# include <string.h>
# include <strings.h>
#else
# ifdef HAVE_STRING_H
# include <string.h>
# else
# ifdef HAVE_STRINGS_H
# include <strings.h>
# endif
# endif
#endif
#ifdef HAVE_STDDEF_H
#include <stddef.h>
#endif
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include <stdarg.h>
#include <signal.h>
#include <dirent.h>
#include <ctype.h>
#include <limits.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/time.h>
#include <sys/types.h>
#include <sys/file.h>
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include <sys/stat.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#else
extern int errno;
#endif
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#if defined(__INTEL_COMPILER) || defined(__GNUC__)
# ifdef __unused
# undef __unused

View file

@ -24,7 +24,7 @@
#ifndef INCLUDED_tgchange_h
#define INCLUDED_tgchange_h
#include "ircd_defs.h"
#include "defaults.h"
#include "client.h"
#include "channel.h"

View file

@ -48,6 +48,17 @@ char *alloca();
#ifdef __GNUC__
/*
* This ensures that __attribute__((deprecated)) is not used in for example
* sun CC, since it's a GNU-specific extension. -nenolod
*/
#ifdef __GNUC__
#define IRC_DEPRECATED __attribute__((deprecated))
#else
#define IRC_DEPRECATED
#endif
#ifdef rb_likely
#undef rb_likely
#endif
@ -62,6 +73,9 @@ char *alloca();
#define rb_likely(x) __builtin_expect(!!(x), 1)
#define rb_unlikely(x) __builtin_expect(!!(x), 0)
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ */
#define UNUSED(x) x
@ -270,4 +284,32 @@ while(0)
#define RB_UIO_MAXIOV 16
#endif
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifdef RB_IPV6
#ifndef AF_INET6
#error "AF_INET6 not defined"
#endif
#else /* #ifdef RB_IPV6 */
#ifndef AF_INET6
#define AF_INET6 AF_MAX /* Dummy AF_INET6 declaration */
#endif
#endif /* #ifdef RB_IPV6 */
#ifdef RB_IPV6
#define PATRICIA_BITS 128
#else
#define PATRICIA_BITS 32
#endif
#endif // _RB_SYSTEM_H

View file

@ -24,7 +24,6 @@
#include <ircd/stdinc.h>
#include <ircd/client.h>
#include <ircd/ircd_defs.h>
#include <ircd/parse.h>
#include <ircd/authproc.h>
#include <ircd/match.h>

View file

@ -32,8 +32,6 @@
#define WE_ARE_MEMORY_C
#include <ircd/stdinc.h>
#include <ircd/ircd_defs.h>
#include <ircd/defaults.h>
#include <ircd/logger.h>
#include <ircd/s_conf.h>
#include <ircd/newconf.h>

View file

@ -35,7 +35,6 @@
#include <ircd/hash.h>
#include <ircd/match.h>
#include <ircd/ircd.h>
#include <ircd/ircd_defs.h>
#include <ircd/numeric.h>
#include <ircd/packet.h>
#include <ircd/s_conf.h>

View file

@ -28,7 +28,6 @@
#include <ircd/hash.h>
#include <ircd/match.h>
#include <ircd/ircd.h>
#include <ircd/ircd_defs.h>
#include <ircd/numeric.h>
#include <ircd/s_serv.h>
#include <ircd/s_user.h>