This commit is contained in:
2023-12-26 16:40:53 -05:00
commit ab64084f63
93 changed files with 40857 additions and 0 deletions

38
include/channel.h Normal file
View File

@@ -0,0 +1,38 @@
/************************************************************************
* IRC - Internet Relay Chat, ircd/channel.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* 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 1, 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.
*/
#ifndef __channel_include__
#define __channel_include__
#define CREATE 1 /* whether a channel should be
created or just tested for existance */
#define MODEBUFLEN 200
#define NullChn ((aChannel *)0)
#define ChannelExists(n) (find_channel(n, NullChn) != NullChn)
#ifndef V28PlusOnly
#define MAXMODEPARAMS 6
#else
#include "msg.h"
#define MAXMODEPARAMS (MAXPARA-2)
#endif
#endif

69
include/class.h Normal file
View File

@@ -0,0 +1,69 @@
/************************************************************************
* IRC - Internet Relay Chat, include/class.h
* Copyright (C) 1990 Darren Reed
*
* 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 1, 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.
*/
#ifndef __class_include__
#define __class_include__
#ifndef PROTO
#if __STDC__
# define PROTO(x) x
#else
# define PROTO(x) ()
#endif
#endif
typedef struct Class {
int class;
int conFreq;
int pingFreq;
int maxLinks;
long maxSendq;
int links;
struct Class *next;
} aClass;
#define Class(x) ((x)->class)
#define ConFreq(x) ((x)->conFreq)
#define PingFreq(x) ((x)->pingFreq)
#define MaxLinks(x) ((x)->maxLinks)
#define MaxSendq(x) ((x)->maxSendq)
#define Links(x) ((x)->links)
#define ConfLinks(x) (Class(x)->links)
#define ConfMaxLinks(x) (Class(x)->maxLinks)
#define ConfClass(x) (Class(x)->class)
#define ConfConFreq(x) (Class(x)->conFreq)
#define ConfPingFreq(x) (Class(x)->pingFreq)
#define ConfSendq(x) (Class(x)->maxSendq)
#define FirstClass() classes
#define NextClass(x) ((x)->next)
extern aClass *classes;
extern aClass *find_class PROTO((int));
extern int get_conf_class PROTO((aConfItem *));
extern int get_client_class PROTO((aClient *));
extern int get_client_ping PROTO((aClient *));
extern int get_con_freq PROTO((aClass *));
extern void add_class PROTO((int, int, int, int, long));
extern void check_class PROTO((void));
extern void initclass PROTO((void));
#endif /* __class_include__ */

146
include/common.h Normal file
View File

@@ -0,0 +1,146 @@
/************************************************************************
* IRC - Internet Relay Chat, include/common.h
* Copyright (C) 1990 Armin Gruner
*
* 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 1, 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.
*/
#ifndef __common_include__
#define __common_include__
#include <time.h>
#ifdef PARAMH
#include <sys/param.h>
#endif
#ifndef PROTO
#if __STDC__
# define PROTO(x) x
#else
# define PROTO(x) ()
#endif
#endif
#ifndef NULL
#define NULL 0
#endif
#ifdef TRUE
#undef TRUE
#endif
#ifdef FALSE
#undef FALSE
#endif
#define FALSE (0)
#define TRUE (!FALSE)
#ifndef MALLOCH
char *malloc(), *calloc();
void free();
#else
#include MALLOCH
#endif
extern int matches PROTO((char *, char *));
extern int mycmp PROTO((const char *, const char *));
extern int myncmp PROTO((const char *, const char *, int));
#ifdef NEED_STRTOK
extern char *strtok PROTO((char *, char *));
#endif
#ifdef NEED_STRTOKEN
extern char *strtoken PROTO((char **, char *, char *));
#endif
#ifdef NEED_INET_ADDR
extern unsigned long inet_addr PROTO((char *));
#endif
#if defined(NEED_INET_NTOA) || defined(NEED_INET_NETOF)
#include <netinet/in.h>
#endif
#ifdef NEED_INET_NTOA
extern char *inet_ntoa PROTO((struct in_addr));
#endif
#ifdef NEED_INET_NETOF
extern int inet_netof PROTO((struct in_addr));
#endif
extern char *myctime PROTO((time_t));
extern char *strtoken PROTO((char **, char *, char *));
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#define DupString(x,y) do{x=MyMalloc(strlen(y)+1);(void)strcpy(x,y);}while(0)
extern unsigned char tolowertab[];
#undef tolower
#define tolower(c) (tolowertab[(u_char)(c)])
extern unsigned char touppertab[];
#undef toupper
#define toupper(c) (touppertab[(u_char)(c)])
#undef isalpha
#undef isdigit
#undef isxdigit
#undef isalnum
#undef isprint
#undef isascii
#undef isgraph
#undef ispunct
#undef islower
#undef isupper
#undef isspace
#undef iscntrl
extern unsigned char char_atribs[];
#define PRINT 1
#define CNTRL 2
#define ALPHA 4
#define PUNCT 8
#define DIGIT 16
#define SPACE 32
#define iscntrl(c) (char_atribs[(u_char)(c)]&CNTRL)
#define isalpha(c) (char_atribs[(u_char)(c)]&ALPHA)
#define isspace(c) (char_atribs[(u_char)(c)]&SPACE)
#define islower(c) ((char_atribs[(u_char)(c)]&ALPHA) && ((u_char)(c) > 0x5f))
#define isupper(c) ((char_atribs[(u_char)(c)]&ALPHA) && ((u_char)(c) < 0x60))
#define isdigit(c) (char_atribs[(u_char)(c)]&DIGIT)
#define isxdigit(c) (isdigit(c) || 'a' <= (c) && (c) <= 'f' || \
'A' <= (c) && (c) <= 'F')
#define isalnum(c) (char_atribs[(u_char)(c)]&(DIGIT|ALPHA))
#define isprint(c) (char_atribs[(u_char)(c)]&PRINT)
#define isascii(c) ((u_char)(c) >= 0 && (u_char)(c) <= 0x7f)
#define isgraph(c) ((char_atribs[(u_char)(c)]&PRINT) && ((u_char)(c) != 0x32))
#define ispunct(c) (!(char_atribs[(u_char)(c)]&(CNTRL|ALPHA|DIGIT)))
extern char *MyMalloc();
extern void flush_connections();
extern struct SLink *find_user_link(/* struct SLink *, struct Client * */);
#endif /* __common_include__ */

727
include/config.h Normal file
View File

@@ -0,0 +1,727 @@
/************************************************************************
* IRC - Internet Relay Chat, include/config.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* 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 1, 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.
*/
#ifndef __config_include__
#define __config_include__
#include "setup.h"
/* Type of host. These should be made redundant somehow. -avalon */
/* BSD Nothing Needed 4.{2,3} BSD, SunOS 3.x, 4.x */
/* HPUX Nothing needed (A.08/A.09) */
/* ULTRIX Nothing needed (4.2) */
/* OSF Nothing needed (1.2) */
#undef AIX /* IBM ugly so-called Unix, AIX */
#undef MIPS /* MIPS Unix */
/* SGI Nothing needed (IRIX 4.0.4) */
#undef SVR3 /* SVR3 stuff - being worked on where poss. */
#undef DYNIXPTX /* Sequents Brain-dead Posix implement. */
#undef SOL20 /* Solaris2 */
#undef ESIX /* ESIX */
#undef NEXT /* NeXTStep */
#undef SVR4
/*
* NOTE: It is important to set this to the correct "domain" for your server.
* Define this for the correct "domain" that your server is in. This
* is important for certain stats. -mlv
*/
#define DOMAINNAME "iastate.edu"
/* Random Number Generator Seed
*
* Set this to an 8-character random text string.
* Do not use the default text.
* If people are able to defeat the IP-spoofing protection on your
* server, consider changing the value and recompiling.
*/
#define RANDOM_SEED "12345678"
/*
* Define this if you'd like to run two or more servers on the same port
* of one machine, using IP aliasing. --Jamey
*
*/
#undef VIRTUAL_HOST
/*
** Define this to prevent mixed case userids that clonebots use.
** It is strongly advised to define this, unless you have a known reason
** not to.
*/
#define DISALLOW_MIXED_CASE
/*
** The mixed case patch can optionally notify opers when an invalid uid
** is received by the server. However, this can get to be very annoying
** when auto connect bots with invalid ids try connecting. Define at
** your own discretion
*/
#define NOTIFY_OPS_INVALID_UID
/*
** Clone bot detection on registration.
** This feature blocks connections if more than CHECK_CLONE_LIMIT
** clients connect from the same host within CHECK_CLONE_PERIOD seconds.
**
** The feature is enabled CHECK_CLONE_DELAY seconds after the server
** is started.
**
** Define CHECK_CLONE is you want this feature.
*/
#define CHECK_CLONE
#define CHECK_CLONE_LIMIT 5 /* recommended value 5 */
#define CHECK_CLONE_PERIOD 20 /* recommended value 20 */
#define CHECK_CLONE_DELAY 120 /* 120 secs should be ok */
/*
** Nick flood limit
** Minimum time between nick changes.
** (The first two changes are allowed quickly after another however).
**
** Define NICK_DELAY if you want this feature.
*/
#define NICK_DELAY 30 /* recommended value 30 */
/*
** Default LIST command parameters.
** Undefine if you like having your server flooded by mIRC users.
*/
#define DEFAULT_LIST_PARAM "T<10"
/*
** Define this if you wish to output a *file* to a K lined client rather
** than the K line comment (the comment field is treated as a filename)
*/
#undef COMMENT_IS_FILE
/* Do these work? I dunno... */
#undef VMS /* Should work for IRC client, not server */
#undef MAIL50 /* If you're running VMS 5.0 */
#undef PCS /* PCS Cadmus MUNIX, use with BSD flag! */
/*
* NOTE: On some systems, valloc() causes many problems.
*/
#undef VALLOC /* Define this if you have valloc(3) */
#ifdef APOLLO
#define RESTARTING_SYSTEMCALLS
#endif /* read/write are restarted after signals
defining this 1, gets siginterrupt call
compiled, which attempts to remove this
behaviour (apollo sr10.1/bsd4.3 needs
this) */
/*
* If your host supports varargs and has vsprintf(), vprintf() and vscanf()
* C calls in its library, then you can define USE_VARARGS to use varargs
* instead of imitation variable arg passing.
*/
#define USE_VARARGS
/*
* Define this if you want to find an existing bug.
* It makes your server EAT cpu time though...
* NEVER define this unless you are debugging a reproducable problem
* under test circumstances.
*/
#undef DEBUGMODE /* define DEBUGMODE to enable debugging mode.*/
/*
* defining FORCE_CORE will automatically "unlimit core", forcing the
* server to dump a core file whenever it has a fatal error. -mlv
*/
#define FORCE_CORE
/*
* NPATH is path to backup file for NOTE.
*/
/* #define NPATH "/usr/lib/irc/.ircdnote" */
/*
* Full pathnames and defaults of irc system's support files. Please note that
* these are only the recommened names and paths. Change as needed.
* You must define these to something, even if you don't really want them.
*/
#define DPATH "/usr/local/lib/ircd" /* dir where all ircd stuff is */
#define SPATH "/usr/local/bin/ircd" /* path to server executeable */
#define CPATH "ircd.conf" /* server configuration file */
#define MPATH "ircd.motd" /* server MOTD file */
#define LPATH "/tmp/ircd.log" /* Where the debug file lives, if DEBUGMODE */
#define PPATH "ircd.pid" /* file for server pid */
/* Define this if you want to keep a log of all G-lines that have been added
* and the changes that are made by U-lined servers or local operators. Do
* this; you can simply append this log to your ircd.conf to add the G-lines
* as K-lines!
*/
#define GPATH "gline.log"
/*
* Define this filename to maintain a list of persons who log
* into this server. Logging will stop when the file does not exist.
* Logging will be disable also if you do not define this.
* FNAME_USERLOG just logs user connections, FNAME_OPERLOG logs every
* successful use of /oper. These are either full paths or files within DPATH.
*/
#define FNAME_USERLOG "/usr/local/lib/ircd/users" /* */
/* #define FNAME_OPERLOG "/usr/local/lib/ircd/opers" /* */
/* CHROOTDIR
*
* Define for value added security if you are a rooter.
*
* All files you access must be in the directory you define as DPATH.
* (This may effect the PATH locations above, though you can symlink it)
*
* You may want to define IRC_UID and IRC_GID
*/
#undef CHROOTDIR
/* RELIABLE_CLOCK
*
* Define this if your host has an externally controlled system clock,
* like running xntp.
* If nobody defines this, it still works: The clock will be used of the
* server that was started first.
*/
#undef RELIABLE_CLOCK
/* ENABLE_SUMMON
*
* The SUMMON command requires the ircd to be run as group tty in order
* to work properly in many cases. If you are on a machine where it
* won't work, or simply don't want local users to be summoned, undefine
* this.
*/
#undef ENABLE_SUMMON /* local summon */
#undef ENABLE_USERS /* enables local /users (same as who/finger output) */
/* SHOW_ALL_INVISIBLE_USERS
*
* If this is defined operators on your server will see *ALL* +i users on the
* net. This can be advantagous when tracking clones. (Chaos)
* Only O:'s are affected, for o:'s (local operators) invisible users on
* other servers still have their privacy... -- Niels
*/
#define SHOW_ALL_INVISIBLE_USERS
/* SHOW_INVISIBLE_LUSERS
*
* As defined this will show the correct invisible count for anyone who does
* LUSERS on your server. On a large net this doesnt mean much, but on a
* small net it might be an advantage to undefine it.
* (This will get defined for you if you're using userload (stats w). -mlv)
*/
#define SHOW_INVISIBLE_LUSERS
/* OPER_KILL
*
* If you dont believe operators should be allowed to use the /KILL command
* or believe it is uncessary for them to use it, then leave OPER_KILL
* undefined. This will not affect other operators or servers issuing KILL
* commands however. OPER_REHASH and OPER_RESTART allow operators to
* issue the REHASH and RESTART commands when connected to your server.
* Left undefined they increase the security of your server from wayward
* operators and accidents. Defining OPER_REMOTE removes the restriction
* that O-lines only become fully effective for people on the 'same network'
* as the server. Undefined, it increases the secrity of the server by
* placing restrictions on where people can use operator powers from.
* The 'LOCOP_' #defines are for making the respective commands available
* to 'local' operators.
*/
#define OPER_KILL
#define OPER_REHASH
#define OPER_RESTART
#define OPER_DIE
#define OPER_REMOTE
#define LOCOP_REHASH
#undef LOCOP_RESTART
#undef LOCOP_DIE
/* MAXIMUM LINKS
*
* This define is useful for leaf nodes and gateways. It keeps you from
* connecting to too many places. It works by keeping you from
* connecting to more than "n" nodes which you have C:blah::blah:6667
* lines for.
*
* Note that any number of nodes can still connect to you. This only
* limits the number that you actively reach out to connect to.
*
* Leaf nodes are nodes which are on the edge of the tree. If you want
* to have a backup link, then sometimes you end up connected to both
* your primary and backup, routing traffic between them. To prevent
* this, #define MAXIMUM_LINKS 1 and set up both primary and
* secondary with C:blah::blah:6667 lines. THEY SHOULD NOT TRY TO
* CONNECT TO YOU, YOU SHOULD CONNECT TO THEM.
*
* Gateways such as the server which connects Australia to the US can
* do a similar thing. Put the American nodes you want to connect to
* in with C:blah::blah:6667 lines, and the Australian nodes with
* C:blah::blah lines. Have the Americans put you in with C:blah::blah
* lines. Then you will only connect to one of the Americans.
*
* This value is only used if you don't have server classes defined, and
* a server is in class 0 (the default class if none is set).
*
*/
#define MAXIMUM_LINKS 1
/*
* If your server is running as a a HUB Server then define this.
* A HUB Server has many servers connect to it at the same as opposed
* to a leaf which just has 1 server (typically the uplink). Define this
* correctly for performance reasons.
*/
#undef HUB
/* R_LINES: The conf file now allows the existence of R lines, or
* restrict lines. These allow more freedom in the ability to restrict
* who is to sign on and when. What the R line does is call an outside
* program which returns a reply indicating whether to let the person on.
* Because there is another program involved, Delays and overhead could
* result. It is for this reason that there is a line in config.h to
* decide whether it is something you want or need. -Hoppie
*
* The default is no R_LINES as most people probably don't need it. --Jto
*/
#undef R_LINES
#ifdef R_LINES
/* Also, even if you have R lines defined, you might not want them to be
checked everywhere, since it could cost lots of time and delay. Therefore,
The following two options are also offered: R_LINES_REHASH rechecks for
R lines after a rehash, and R_LINES_OFTEN, which rechecks it as often
as it does K lines. Note that R_LINES_OFTEN is *very* likely to cause
a resource drain, use at your own risk. R_LINES_REHASH shouldn't be too
bad, assuming the programs are fairly short. */
#define R_LINES_REHASH
#define R_LINES_OFTEN
#endif
/*
* NOTE: defining CMDLINE_CONFIG and installing ircd SUID or SGID is a MAJOR
* security problem - they can use the "-f" option to read any files
* that the 'new' access lets them. Note also that defining this is
* a major security hole if your ircd goes down and some other user
* starts up the server with a new conf file that has some extra
* O-lines. So don't use this unless you're debugging.
*/
#undef CMDLINE_CONFIG /* allow conf-file to be specified on command line */
/*
* To use m4 as a preprocessor on the ircd.conf file, define M4_PREPROC.
* The server will then call m4 each time it reads the ircd.conf file,
* reading m4 output as the server's ircd.conf file.
*/
#undef M4_PREPROC
/*
* If you wish to have the server send 'vital' messages about server
* through syslog, define USE_SYSLOG. Only system errors and events critical
* to the server are logged although if this is defined with FNAME_USERLOG,
* syslog() is used instead of the above file. It is not recommended that
* this option is used unless you tell the system administrator beforehand
* and obtain their permission to send messages to the system log files.
*/
#undef USE_SYSLOG
#ifdef USE_SYSLOG
/*
* If you use syslog above, you may want to turn some (none) of the
* spurious log messages for KILL/SQUIT off.
*/
#undef SYSLOG_KILL /* log all operator kills to syslog */
#undef SYSLOG_SQUIT /* log all remote squits for all servers to syslog */
#undef SYSLOG_CONNECT /* log remote connect messages for other all servs */
#undef SYSLOG_USERS /* send userlog stuff to syslog */
#undef SYSLOG_OPER /* log all users who successfully become an Op */
/*
* If you want to log to a different facility than DAEMON, change
* this define.
*/
#define LOG_FACILITY LOG_DAEMON
#endif /* USE_SYSLOG */
/*
* define this if you want to use crypted passwords for operators in your
* ircd.conf file. See ircd/crypt/README for more details on this.
*/
#define CRYPT_OPER_PASSWORD
/*
* If you want to store encrypted passwords in N-lines for server links,
* define this. For a C/N pair in your ircd.conf file, the password
* need not be the same for both, as long as hte opposite end has the
* right password in the opposite line. See INSTALL doc for more details.
*/
#undef CRYPT_LINK_PASSWORD
/*
* define this if you enable summon and if you want summon to look for the
* least idle tty a user is logged in on.
*/
#define LEAST_IDLE
/*
* IDLE_FROM_MSG
*
* Idle-time nullified only from privmsg, if undefined idle-time
* is nullified from everything except ping/pong.
* Added 3.8.1992, kny@cs.hut.fi (nam)
*/
#define IDLE_FROM_MSG
/*
* Max amount of internal send buffering when socket is stuck (bytes)
*/
#define MAXSENDQLENGTH 2000000 /* Recommended value: 300000 for leaves */
/* 2000000 for backbones */
/*
* BUFFERPOOL is the maximum size of the total of all sendq's.
* Recommended value is leaves: 3 * MAXSENDQLENGTH, for hubs: 5 - 7 *.
*/
#define BUFFERPOOL (6 * MAXSENDQLENGTH)
/*
* use these to setup a Unix domain socket to connect clients/servers to.
*/
#define UNIXPORT
/*
* IRC_UID
*
* If you start the server as root but wish to have it run as another user,
* define IRC_UID to that UID. This should only be defined if you are running
* as root and even then perhaps not.
*/
#undef IRC_UID
#undef IRC_GID
#ifdef notdef
#define IRC_UID 65534 /* eg for what to do to enable this feature */
#define IRC_GID 65534
#endif
/*
* CLIENT_FLOOD
*
* this controls the number of bytes the server will allow a client to
* send to the server without processing before disconnecting the client for
* flooding it. Values greater than 8000 make no difference to the server.
*/
#define CLIENT_FLOOD 1024
/* Define this if you want the server to accomplish ircII standard */
/* Sends an extra NOTICE in the beginning of client connection */
#undef IRCII_KLUDGE
/* STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP */
/* You shouldn't change anything below this line, unless absolutely needed. */
#ifdef OPER_KILL
/* LOCAL_KILL_ONLY
*
* To be used, OPER_KILL must be defined.
* LOCAL_KILL_ONLY restricts KILLs to clients which are connected to the
* server the Operator is connected to (ie lets them deal with local
* problem users or 'ghost' clients
*
* NOTE: #define'ing this on an IRC net with servers which have a version
* earlier than 2.7 is prohibited. Such an action and subsequent use
* of KILL for non-local clients should be punished by removal of the
* server's links (if only for ignoring this warning!).
*/
#undef LOCAL_KILL_ONLY
#endif
/*
* Port where ircd resides. NOTE: This *MUST* be greater than 1024 if you
* plan to run ircd under any other uid than root.
*/
#define PORTNUM 6667 /* Recommended values: 6667 or 6666 */
/*
* Maximum number of network connections your server will allow. This should
* never exceed max. number of open file descrpitors and wont increase this.
* Should remain LOW as possible. Most sites will usually have under 30 or so
* connections. A busy hub or server may need this to be as high as 50 or 60.
* Making it over 100 decreases any performance boost gained from it being low.
* if you have a lot of server connections, it may be worth splitting the load
* over 2 or more servers.
* 1 server = 1 connection, 1 user = 1 connection.
* This should be at *least* 3: 1 listen port, 1 dns port + 1 client
*/
#define MAXCONNECTIONS 254
/*
* this defines the length of the nickname history. each time a user changes
* nickname or signs off, their old nickname is added to the top of the list.
* The following sizes are recommended:
* 8MB or less core memory : 500 (at least 1/4 of max users)
* 8MB-16MB core memory : 500-750 (1/4 -> 1/2 of max users)
* 16MB-32MB core memory : 750-1000 (1/2 -> 3/4 of max users)
* 32MB or more core memory : 1000+ (> 3/4 if max users)
* where max users is the expected maximum number of users.
* (100 nicks/users ~ 25k)
* NOTE: this is directly related to the amount of memory ircd will use whilst
* resident and running - it hardly ever gets swapped to disk! You can
* ignore these recommendations- they only are meant to serve as a guide
*/
#define NICKNAMEHISTORYLENGTH 800
/*
* Time interval to wait and if no messages have been received, then check for
* PINGFREQUENCY and CONNECTFREQUENCY
*/
#define TIMESEC 60 /* Recommended value: 60 */
/*
* If daemon doesn't receive anything from any of its links within
* PINGFREQUENCY seconds, then the server will attempt to check for
* an active link with a PING message. If no reply is received within
* (PINGFREQUENCY * 2) seconds, then the connection will be closed.
*/
#define PINGFREQUENCY 120 /* Recommended value: 120 */
/*
* If the connection to to uphost is down, then attempt to reconnect every
* CONNECTFREQUENCY seconds.
*/
#define CONNECTFREQUENCY 600 /* Recommended value: 600 */
/*
* Often net breaks for a short time and it's useful to try to
* establishing the same connection again faster than CONNECTFREQUENCY
* would allow. But, to keep trying on bad connection, we require
* that connection has been open for certain minimum time
* (HANGONGOODLINK) and we give the net few seconds to steady
* (HANGONRETRYDELAY). This latter has to be long enough that the
* other end of the connection has time to notice it broke too.
*/
#define HANGONRETRYDELAY 10 /* Recommended value: 10 seconds */
#define HANGONGOODLINK 300 /* Recommended value: 5 minutes */
/*
* Number of seconds to wait for write to complete if stuck.
*/
#define WRITEWAITDELAY 15 /* Recommended value: 15 */
/*
* Number of seconds to wait for a connect(2) call to complete.
* NOTE: this must be at *LEAST* 10. When a client connects, it has
* CONNECTTIMEOUT - 10 seconds for its host to respond to an ident lookup
* query and for a DNS answer to be retrieved.
* This value should consider the fact that users whose clients do not
* support NOSPOOF will have to type /QUOTE PING <bignumber> before
* registration.
*/
#define CONNECTTIMEOUT 90 /* Recommended value: 90 */
/*
* Max time from the nickname change that still causes KILL
* automaticly to switch for the current nick of that user. (seconds)
*/
#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */
/*
* Max number of channels a user is allowed to join.
*/
#define MAXCHANNELSPERUSER 10 /* Recommended value: 10 */
/*
* Maximum number of silences a user may set; recommended value: 15
*/
#define MAXSILES 15
/*
* SendQ-Always causes the server to put all outbound data into the sendq and
* flushing the sendq at the end of input processing. This should cause more
* efficient write's to be made to the network.
* There *shouldn't* be any problems with this method.
* -avalon
*/
#define SENDQ_ALWAYS
/* ------------------------- END CONFIGURATION SECTION -------------------- */
#define MOTD MPATH
#define MYNAME SPATH
#define CONFIGFILE CPATH
#define IRCD_PIDFILE PPATH
#ifdef __osf__
#define OSF
/* OSF defines BSD to be its version of BSD */
#undef BSD
#include <sys/param.h>
#ifndef BSD
#define BSD
#endif
#endif
#ifdef _SEQUENT_ /* Dynix 1.4 or 2.0 Generic Define.. */
#undef BSD
#define SYSV /* Also #define SYSV */
#endif
#ifdef ultrix
#define ULTRIX
#endif
#ifdef __hpux
#define HPUX
#endif
#ifdef sgi
#define SGI
#endif
#ifdef DEBUGMODE
extern void debug();
# define Debug(x) debug x
# define LOGFILE LPATH
#else
# define Debug(x) ;
# if VMS
# define LOGFILE "NLA0:"
# else
# define LOGFILE "/dev/null"
# endif
#endif
#ifndef ENABLE_SUMMON
# undef LEAST_IDLE
#endif
#if defined(mips) || defined(PCS)
#undef SYSV
#endif
#ifdef MIPS
#undef BSD
#define BSD 1 /* mips only works in bsd43 environment */
#endif
#ifdef sequent /* Dynix (sequent OS) */
#define SEQ_NOFILE 128 /* set to your current kernel impl, */
#endif /* max number of socket connections */
#ifdef _SEQUENT_
#define DYNIXPTX
#endif
#ifdef BSD_RELIABLE_SIGNALS
# if defined(SYSV_UNRELIABLE_SIGNALS) || defined(POSIX_SIGNALS)
error You stuffed up config.h signals #defines use only one.
# endif
#define HAVE_RELIABLE_SIGNALS
#endif
#ifdef SYSV_UNRELIABLE_SIGNALS
# ifdef POSIX_SIGNALS
error You stuffed up config.h signals #defines use only one.
# endif
#undef HAVE_RELIABLE_SIGNALS
#endif
#ifdef POSIX_SIGNALS
#define HAVE_RELIABLE_SIGNALS
#endif
/*
* safety margin so we can always have one spare fd, for motd/authd or
* whatever else. -4 allows "safety" margin of 1 and space reserved.
*/
#define MAXCLIENTS (MAXCONNECTIONS-4)
#ifdef HAVECURSES
# define DOCURSES
#else
# undef DOCURSES
#endif
#ifdef HAVETERMCAP
# define DOTERMCAP
#else
# undef DOTERMCAP
#endif
#ifndef UNIXPORT
#undef UNIXPORTPATH
#endif
#if defined(CLIENT_FLOOD)
# if (CLIENT_FLOOD > 8000) || (CLIENT_FLOOD < 512)
error CLIENT_FLOOD needs redefining.
# endif
#else
error CLIENT_FLOOD undefined
#endif
/*
* Some ugliness for AIX platforms.
*/
#ifdef AIX
# include <sys/machine.h>
# if BYTE_ORDER == BIG_ENDIAN
# define BIT_ZERO_ON_LEFT
# endif
# if BYTE_ORDER == LITTLE_ENDIAN
# define BIT_ZERO_ON_RIGHT
# endif
/*
* this one is used later in sys/types.h (or so i believe). -avalon
*/
# define BSD_INCLUDES
#endif
#define Reg1 register
#define Reg2 register
#define Reg3 register
#define Reg4 register
#define Reg5 register
#define Reg6 register
#define Reg7 register
#define Reg8 register
#define Reg9 register
#define Reg10 register
#endif /* __config_include__ */

727
include/config.h.dist Normal file
View File

@@ -0,0 +1,727 @@
/************************************************************************
* IRC - Internet Relay Chat, include/config.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* 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 1, 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.
*/
#ifndef __config_include__
#define __config_include__
#include "setup.h"
/* Type of host. These should be made redundant somehow. -avalon */
/* BSD Nothing Needed 4.{2,3} BSD, SunOS 3.x, 4.x */
/* HPUX Nothing needed (A.08/A.09) */
/* ULTRIX Nothing needed (4.2) */
/* OSF Nothing needed (1.2) */
#undef AIX /* IBM ugly so-called Unix, AIX */
#undef MIPS /* MIPS Unix */
/* SGI Nothing needed (IRIX 4.0.4) */
#undef SVR3 /* SVR3 stuff - being worked on where poss. */
#undef DYNIXPTX /* Sequents Brain-dead Posix implement. */
#undef SOL20 /* Solaris2 */
#undef ESIX /* ESIX */
#undef NEXT /* NeXTStep */
#undef SVR4
/*
* NOTE: It is important to set this to the correct "domain" for your server.
* Define this for the correct "domain" that your server is in. This
* is important for certain stats. -mlv
*/
#define DOMAINNAME "iastate.edu"
/* Random Number Generator Seed
*
* Set this to an 8-character random text string.
* Do not use the default text.
* If people are able to defeat the IP-spoofing protection on your
* server, consider changing the value and recompiling.
*/
#define RANDOM_SEED "12345678"
/*
* Define this if you'd like to run two or more servers on the same port
* of one machine, using IP aliasing. --Jamey
*
*/
#undef VIRTUAL_HOST
/*
** Define this to prevent mixed case userids that clonebots use.
** It is strongly advised to define this, unless you have a known reason
** not to.
*/
#define DISALLOW_MIXED_CASE
/*
** The mixed case patch can optionally notify opers when an invalid uid
** is received by the server. However, this can get to be very annoying
** when auto connect bots with invalid ids try connecting. Define at
** your own discretion
*/
#define NOTIFY_OPS_INVALID_UID
/*
** Clone bot detection on registration.
** This feature blocks connections if more than CHECK_CLONE_LIMIT
** clients connect from the same host within CHECK_CLONE_PERIOD seconds.
**
** The feature is enabled CHECK_CLONE_DELAY seconds after the server
** is started.
**
** Define CHECK_CLONE is you want this feature.
*/
#define CHECK_CLONE
#define CHECK_CLONE_LIMIT 5 /* recommended value 5 */
#define CHECK_CLONE_PERIOD 20 /* recommended value 20 */
#define CHECK_CLONE_DELAY 120 /* 120 secs should be ok */
/*
** Nick flood limit
** Minimum time between nick changes.
** (The first two changes are allowed quickly after another however).
**
** Define NICK_DELAY if you want this feature.
*/
#define NICK_DELAY 30 /* recommended value 30 */
/*
** Default LIST command parameters.
** Undefine if you like having your server flooded by mIRC users.
*/
#define DEFAULT_LIST_PARAM "T<10"
/*
** Define this if you wish to output a *file* to a K lined client rather
** than the K line comment (the comment field is treated as a filename)
*/
#undef COMMENT_IS_FILE
/* Do these work? I dunno... */
#undef VMS /* Should work for IRC client, not server */
#undef MAIL50 /* If you're running VMS 5.0 */
#undef PCS /* PCS Cadmus MUNIX, use with BSD flag! */
/*
* NOTE: On some systems, valloc() causes many problems.
*/
#undef VALLOC /* Define this if you have valloc(3) */
#ifdef APOLLO
#define RESTARTING_SYSTEMCALLS
#endif /* read/write are restarted after signals
defining this 1, gets siginterrupt call
compiled, which attempts to remove this
behaviour (apollo sr10.1/bsd4.3 needs
this) */
/*
* If your host supports varargs and has vsprintf(), vprintf() and vscanf()
* C calls in its library, then you can define USE_VARARGS to use varargs
* instead of imitation variable arg passing.
*/
#define USE_VARARGS
/*
* Define this if you want to find an existing bug.
* It makes your server EAT cpu time though...
* NEVER define this unless you are debugging a reproducable problem
* under test circumstances.
*/
#undef DEBUGMODE /* define DEBUGMODE to enable debugging mode.*/
/*
* defining FORCE_CORE will automatically "unlimit core", forcing the
* server to dump a core file whenever it has a fatal error. -mlv
*/
#define FORCE_CORE
/*
* NPATH is path to backup file for NOTE.
*/
/* #define NPATH "/usr/lib/irc/.ircdnote" */
/*
* Full pathnames and defaults of irc system's support files. Please note that
* these are only the recommened names and paths. Change as needed.
* You must define these to something, even if you don't really want them.
*/
#define DPATH "/usr/local/lib/ircd" /* dir where all ircd stuff is */
#define SPATH "/usr/local/bin/ircd" /* path to server executeable */
#define CPATH "ircd.conf" /* server configuration file */
#define MPATH "ircd.motd" /* server MOTD file */
#define LPATH "/tmp/ircd.log" /* Where the debug file lives, if DEBUGMODE */
#define PPATH "ircd.pid" /* file for server pid */
/* Define this if you want to keep a log of all G-lines that have been added
* and the changes that are made by U-lined servers or local operators. Do
* this; you can simply append this log to your ircd.conf to add the G-lines
* as K-lines!
*/
#define GPATH "gline.log"
/*
* Define this filename to maintain a list of persons who log
* into this server. Logging will stop when the file does not exist.
* Logging will be disable also if you do not define this.
* FNAME_USERLOG just logs user connections, FNAME_OPERLOG logs every
* successful use of /oper. These are either full paths or files within DPATH.
*/
#define FNAME_USERLOG "/usr/local/lib/ircd/users" /* */
/* #define FNAME_OPERLOG "/usr/local/lib/ircd/opers" /* */
/* CHROOTDIR
*
* Define for value added security if you are a rooter.
*
* All files you access must be in the directory you define as DPATH.
* (This may effect the PATH locations above, though you can symlink it)
*
* You may want to define IRC_UID and IRC_GID
*/
#undef CHROOTDIR
/* RELIABLE_CLOCK
*
* Define this if your host has an externally controlled system clock,
* like running xntp.
* If nobody defines this, it still works: The clock will be used of the
* server that was started first.
*/
#undef RELIABLE_CLOCK
/* ENABLE_SUMMON
*
* The SUMMON command requires the ircd to be run as group tty in order
* to work properly in many cases. If you are on a machine where it
* won't work, or simply don't want local users to be summoned, undefine
* this.
*/
#undef ENABLE_SUMMON /* local summon */
#undef ENABLE_USERS /* enables local /users (same as who/finger output) */
/* SHOW_ALL_INVISIBLE_USERS
*
* If this is defined operators on your server will see *ALL* +i users on the
* net. This can be advantagous when tracking clones. (Chaos)
* Only O:'s are affected, for o:'s (local operators) invisible users on
* other servers still have their privacy... -- Niels
*/
#define SHOW_ALL_INVISIBLE_USERS
/* SHOW_INVISIBLE_LUSERS
*
* As defined this will show the correct invisible count for anyone who does
* LUSERS on your server. On a large net this doesnt mean much, but on a
* small net it might be an advantage to undefine it.
* (This will get defined for you if you're using userload (stats w). -mlv)
*/
#define SHOW_INVISIBLE_LUSERS
/* OPER_KILL
*
* If you dont believe operators should be allowed to use the /KILL command
* or believe it is uncessary for them to use it, then leave OPER_KILL
* undefined. This will not affect other operators or servers issuing KILL
* commands however. OPER_REHASH and OPER_RESTART allow operators to
* issue the REHASH and RESTART commands when connected to your server.
* Left undefined they increase the security of your server from wayward
* operators and accidents. Defining OPER_REMOTE removes the restriction
* that O-lines only become fully effective for people on the 'same network'
* as the server. Undefined, it increases the secrity of the server by
* placing restrictions on where people can use operator powers from.
* The 'LOCOP_' #defines are for making the respective commands available
* to 'local' operators.
*/
#define OPER_KILL
#define OPER_REHASH
#define OPER_RESTART
#define OPER_DIE
#define OPER_REMOTE
#define LOCOP_REHASH
#undef LOCOP_RESTART
#undef LOCOP_DIE
/* MAXIMUM LINKS
*
* This define is useful for leaf nodes and gateways. It keeps you from
* connecting to too many places. It works by keeping you from
* connecting to more than "n" nodes which you have C:blah::blah:6667
* lines for.
*
* Note that any number of nodes can still connect to you. This only
* limits the number that you actively reach out to connect to.
*
* Leaf nodes are nodes which are on the edge of the tree. If you want
* to have a backup link, then sometimes you end up connected to both
* your primary and backup, routing traffic between them. To prevent
* this, #define MAXIMUM_LINKS 1 and set up both primary and
* secondary with C:blah::blah:6667 lines. THEY SHOULD NOT TRY TO
* CONNECT TO YOU, YOU SHOULD CONNECT TO THEM.
*
* Gateways such as the server which connects Australia to the US can
* do a similar thing. Put the American nodes you want to connect to
* in with C:blah::blah:6667 lines, and the Australian nodes with
* C:blah::blah lines. Have the Americans put you in with C:blah::blah
* lines. Then you will only connect to one of the Americans.
*
* This value is only used if you don't have server classes defined, and
* a server is in class 0 (the default class if none is set).
*
*/
#define MAXIMUM_LINKS 1
/*
* If your server is running as a a HUB Server then define this.
* A HUB Server has many servers connect to it at the same as opposed
* to a leaf which just has 1 server (typically the uplink). Define this
* correctly for performance reasons.
*/
#undef HUB
/* R_LINES: The conf file now allows the existence of R lines, or
* restrict lines. These allow more freedom in the ability to restrict
* who is to sign on and when. What the R line does is call an outside
* program which returns a reply indicating whether to let the person on.
* Because there is another program involved, Delays and overhead could
* result. It is for this reason that there is a line in config.h to
* decide whether it is something you want or need. -Hoppie
*
* The default is no R_LINES as most people probably don't need it. --Jto
*/
#undef R_LINES
#ifdef R_LINES
/* Also, even if you have R lines defined, you might not want them to be
checked everywhere, since it could cost lots of time and delay. Therefore,
The following two options are also offered: R_LINES_REHASH rechecks for
R lines after a rehash, and R_LINES_OFTEN, which rechecks it as often
as it does K lines. Note that R_LINES_OFTEN is *very* likely to cause
a resource drain, use at your own risk. R_LINES_REHASH shouldn't be too
bad, assuming the programs are fairly short. */
#define R_LINES_REHASH
#define R_LINES_OFTEN
#endif
/*
* NOTE: defining CMDLINE_CONFIG and installing ircd SUID or SGID is a MAJOR
* security problem - they can use the "-f" option to read any files
* that the 'new' access lets them. Note also that defining this is
* a major security hole if your ircd goes down and some other user
* starts up the server with a new conf file that has some extra
* O-lines. So don't use this unless you're debugging.
*/
#undef CMDLINE_CONFIG /* allow conf-file to be specified on command line */
/*
* To use m4 as a preprocessor on the ircd.conf file, define M4_PREPROC.
* The server will then call m4 each time it reads the ircd.conf file,
* reading m4 output as the server's ircd.conf file.
*/
#undef M4_PREPROC
/*
* If you wish to have the server send 'vital' messages about server
* through syslog, define USE_SYSLOG. Only system errors and events critical
* to the server are logged although if this is defined with FNAME_USERLOG,
* syslog() is used instead of the above file. It is not recommended that
* this option is used unless you tell the system administrator beforehand
* and obtain their permission to send messages to the system log files.
*/
#undef USE_SYSLOG
#ifdef USE_SYSLOG
/*
* If you use syslog above, you may want to turn some (none) of the
* spurious log messages for KILL/SQUIT off.
*/
#undef SYSLOG_KILL /* log all operator kills to syslog */
#undef SYSLOG_SQUIT /* log all remote squits for all servers to syslog */
#undef SYSLOG_CONNECT /* log remote connect messages for other all servs */
#undef SYSLOG_USERS /* send userlog stuff to syslog */
#undef SYSLOG_OPER /* log all users who successfully become an Op */
/*
* If you want to log to a different facility than DAEMON, change
* this define.
*/
#define LOG_FACILITY LOG_DAEMON
#endif /* USE_SYSLOG */
/*
* define this if you want to use crypted passwords for operators in your
* ircd.conf file. See ircd/crypt/README for more details on this.
*/
#define CRYPT_OPER_PASSWORD
/*
* If you want to store encrypted passwords in N-lines for server links,
* define this. For a C/N pair in your ircd.conf file, the password
* need not be the same for both, as long as hte opposite end has the
* right password in the opposite line. See INSTALL doc for more details.
*/
#undef CRYPT_LINK_PASSWORD
/*
* define this if you enable summon and if you want summon to look for the
* least idle tty a user is logged in on.
*/
#define LEAST_IDLE
/*
* IDLE_FROM_MSG
*
* Idle-time nullified only from privmsg, if undefined idle-time
* is nullified from everything except ping/pong.
* Added 3.8.1992, kny@cs.hut.fi (nam)
*/
#define IDLE_FROM_MSG
/*
* Max amount of internal send buffering when socket is stuck (bytes)
*/
#define MAXSENDQLENGTH 2000000 /* Recommended value: 300000 for leaves */
/* 2000000 for backbones */
/*
* BUFFERPOOL is the maximum size of the total of all sendq's.
* Recommended value is leaves: 3 * MAXSENDQLENGTH, for hubs: 5 - 7 *.
*/
#define BUFFERPOOL (6 * MAXSENDQLENGTH)
/*
* use these to setup a Unix domain socket to connect clients/servers to.
*/
#define UNIXPORT
/*
* IRC_UID
*
* If you start the server as root but wish to have it run as another user,
* define IRC_UID to that UID. This should only be defined if you are running
* as root and even then perhaps not.
*/
#undef IRC_UID
#undef IRC_GID
#ifdef notdef
#define IRC_UID 65534 /* eg for what to do to enable this feature */
#define IRC_GID 65534
#endif
/*
* CLIENT_FLOOD
*
* this controls the number of bytes the server will allow a client to
* send to the server without processing before disconnecting the client for
* flooding it. Values greater than 8000 make no difference to the server.
*/
#define CLIENT_FLOOD 1024
/* Define this if you want the server to accomplish ircII standard */
/* Sends an extra NOTICE in the beginning of client connection */
#undef IRCII_KLUDGE
/* STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP */
/* You shouldn't change anything below this line, unless absolutely needed. */
#ifdef OPER_KILL
/* LOCAL_KILL_ONLY
*
* To be used, OPER_KILL must be defined.
* LOCAL_KILL_ONLY restricts KILLs to clients which are connected to the
* server the Operator is connected to (ie lets them deal with local
* problem users or 'ghost' clients
*
* NOTE: #define'ing this on an IRC net with servers which have a version
* earlier than 2.7 is prohibited. Such an action and subsequent use
* of KILL for non-local clients should be punished by removal of the
* server's links (if only for ignoring this warning!).
*/
#undef LOCAL_KILL_ONLY
#endif
/*
* Port where ircd resides. NOTE: This *MUST* be greater than 1024 if you
* plan to run ircd under any other uid than root.
*/
#define PORTNUM 6667 /* Recommended values: 6667 or 6666 */
/*
* Maximum number of network connections your server will allow. This should
* never exceed max. number of open file descrpitors and wont increase this.
* Should remain LOW as possible. Most sites will usually have under 30 or so
* connections. A busy hub or server may need this to be as high as 50 or 60.
* Making it over 100 decreases any performance boost gained from it being low.
* if you have a lot of server connections, it may be worth splitting the load
* over 2 or more servers.
* 1 server = 1 connection, 1 user = 1 connection.
* This should be at *least* 3: 1 listen port, 1 dns port + 1 client
*/
#define MAXCONNECTIONS 254
/*
* this defines the length of the nickname history. each time a user changes
* nickname or signs off, their old nickname is added to the top of the list.
* The following sizes are recommended:
* 8MB or less core memory : 500 (at least 1/4 of max users)
* 8MB-16MB core memory : 500-750 (1/4 -> 1/2 of max users)
* 16MB-32MB core memory : 750-1000 (1/2 -> 3/4 of max users)
* 32MB or more core memory : 1000+ (> 3/4 if max users)
* where max users is the expected maximum number of users.
* (100 nicks/users ~ 25k)
* NOTE: this is directly related to the amount of memory ircd will use whilst
* resident and running - it hardly ever gets swapped to disk! You can
* ignore these recommendations- they only are meant to serve as a guide
*/
#define NICKNAMEHISTORYLENGTH 800
/*
* Time interval to wait and if no messages have been received, then check for
* PINGFREQUENCY and CONNECTFREQUENCY
*/
#define TIMESEC 60 /* Recommended value: 60 */
/*
* If daemon doesn't receive anything from any of its links within
* PINGFREQUENCY seconds, then the server will attempt to check for
* an active link with a PING message. If no reply is received within
* (PINGFREQUENCY * 2) seconds, then the connection will be closed.
*/
#define PINGFREQUENCY 120 /* Recommended value: 120 */
/*
* If the connection to to uphost is down, then attempt to reconnect every
* CONNECTFREQUENCY seconds.
*/
#define CONNECTFREQUENCY 600 /* Recommended value: 600 */
/*
* Often net breaks for a short time and it's useful to try to
* establishing the same connection again faster than CONNECTFREQUENCY
* would allow. But, to keep trying on bad connection, we require
* that connection has been open for certain minimum time
* (HANGONGOODLINK) and we give the net few seconds to steady
* (HANGONRETRYDELAY). This latter has to be long enough that the
* other end of the connection has time to notice it broke too.
*/
#define HANGONRETRYDELAY 10 /* Recommended value: 10 seconds */
#define HANGONGOODLINK 300 /* Recommended value: 5 minutes */
/*
* Number of seconds to wait for write to complete if stuck.
*/
#define WRITEWAITDELAY 15 /* Recommended value: 15 */
/*
* Number of seconds to wait for a connect(2) call to complete.
* NOTE: this must be at *LEAST* 10. When a client connects, it has
* CONNECTTIMEOUT - 10 seconds for its host to respond to an ident lookup
* query and for a DNS answer to be retrieved.
* This value should consider the fact that users whose clients do not
* support NOSPOOF will have to type /QUOTE PING <bignumber> before
* registration.
*/
#define CONNECTTIMEOUT 90 /* Recommended value: 90 */
/*
* Max time from the nickname change that still causes KILL
* automaticly to switch for the current nick of that user. (seconds)
*/
#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */
/*
* Max number of channels a user is allowed to join.
*/
#define MAXCHANNELSPERUSER 10 /* Recommended value: 10 */
/*
* Maximum number of silences a user may set; recommended value: 15
*/
#define MAXSILES 15
/*
* SendQ-Always causes the server to put all outbound data into the sendq and
* flushing the sendq at the end of input processing. This should cause more
* efficient write's to be made to the network.
* There *shouldn't* be any problems with this method.
* -avalon
*/
#define SENDQ_ALWAYS
/* ------------------------- END CONFIGURATION SECTION -------------------- */
#define MOTD MPATH
#define MYNAME SPATH
#define CONFIGFILE CPATH
#define IRCD_PIDFILE PPATH
#ifdef __osf__
#define OSF
/* OSF defines BSD to be its version of BSD */
#undef BSD
#include <sys/param.h>
#ifndef BSD
#define BSD
#endif
#endif
#ifdef _SEQUENT_ /* Dynix 1.4 or 2.0 Generic Define.. */
#undef BSD
#define SYSV /* Also #define SYSV */
#endif
#ifdef ultrix
#define ULTRIX
#endif
#ifdef __hpux
#define HPUX
#endif
#ifdef sgi
#define SGI
#endif
#ifdef DEBUGMODE
extern void debug();
# define Debug(x) debug x
# define LOGFILE LPATH
#else
# define Debug(x) ;
# if VMS
# define LOGFILE "NLA0:"
# else
# define LOGFILE "/dev/null"
# endif
#endif
#ifndef ENABLE_SUMMON
# undef LEAST_IDLE
#endif
#if defined(mips) || defined(PCS)
#undef SYSV
#endif
#ifdef MIPS
#undef BSD
#define BSD 1 /* mips only works in bsd43 environment */
#endif
#ifdef sequent /* Dynix (sequent OS) */
#define SEQ_NOFILE 128 /* set to your current kernel impl, */
#endif /* max number of socket connections */
#ifdef _SEQUENT_
#define DYNIXPTX
#endif
#ifdef BSD_RELIABLE_SIGNALS
# if defined(SYSV_UNRELIABLE_SIGNALS) || defined(POSIX_SIGNALS)
error You stuffed up config.h signals #defines use only one.
# endif
#define HAVE_RELIABLE_SIGNALS
#endif
#ifdef SYSV_UNRELIABLE_SIGNALS
# ifdef POSIX_SIGNALS
error You stuffed up config.h signals #defines use only one.
# endif
#undef HAVE_RELIABLE_SIGNALS
#endif
#ifdef POSIX_SIGNALS
#define HAVE_RELIABLE_SIGNALS
#endif
/*
* safety margin so we can always have one spare fd, for motd/authd or
* whatever else. -4 allows "safety" margin of 1 and space reserved.
*/
#define MAXCLIENTS (MAXCONNECTIONS-4)
#ifdef HAVECURSES
# define DOCURSES
#else
# undef DOCURSES
#endif
#ifdef HAVETERMCAP
# define DOTERMCAP
#else
# undef DOTERMCAP
#endif
#ifndef UNIXPORT
#undef UNIXPORTPATH
#endif
#if defined(CLIENT_FLOOD)
# if (CLIENT_FLOOD > 8000) || (CLIENT_FLOOD < 512)
error CLIENT_FLOOD needs redefining.
# endif
#else
error CLIENT_FLOOD undefined
#endif
/*
* Some ugliness for AIX platforms.
*/
#ifdef AIX
# include <sys/machine.h>
# if BYTE_ORDER == BIG_ENDIAN
# define BIT_ZERO_ON_LEFT
# endif
# if BYTE_ORDER == LITTLE_ENDIAN
# define BIT_ZERO_ON_RIGHT
# endif
/*
* this one is used later in sys/types.h (or so i believe). -avalon
*/
# define BSD_INCLUDES
#endif
#define Reg1 register
#define Reg2 register
#define Reg3 register
#define Reg4 register
#define Reg5 register
#define Reg6 register
#define Reg7 register
#define Reg8 register
#define Reg9 register
#define Reg10 register
#endif /* __config_include__ */

163
include/dbuf.h Normal file
View File

@@ -0,0 +1,163 @@
/************************************************************************
* IRC - Internet Relay Chat, include/dbuf.h
* Copyright (C) 1990 Markku Savela
*
* 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 1, 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.
*/
#ifndef __dbuf_include__
#define __dbuf_include__
#ifndef PROTO
#ifdef __STDC__
# define PROTO(x) x
#else
# define PROTO(x) ()
#endif /* __STDC__ */
#endif /* ! PROTO */
/*
** dbuf is a collection of functions which can be used to
** maintain a dynamic buffering of a byte stream.
** Functions allocate and release memory dynamically as
** required [Actually, there is nothing that prevents
** this package maintaining the buffer on disk, either]
*/
/*
** These structure definitions are only here to be used
** as a whole, *DO NOT EVER REFER TO THESE FIELDS INSIDE
** THE STRUCTURES*! It must be possible to change the internal
** implementation of this package without changing the
** interface.
*/
#if !defined(_SEQUENT_)
typedef struct dbuf
{
u_int length; /* Current number of bytes stored */
u_int offset; /* Offset to the first byte */
struct dbufbuf *head; /* First data buffer, if length > 0 */
/* added by mnystrom@mit.edu: */
struct dbufbuf *tail; /* last data buffer, if length > 0 */
} dbuf;
#else
typedef struct dbuf
{
uint length; /* Current number of bytes stored */
uint offset; /* Offset to the first byte */
struct dbufbuf *head; /* First data buffer, if length > 0 */
/* added by mnystrom@mit.edu: */
struct dbufbuf *tail; /* last data buffer, if length > 0 */
} dbuf;
#endif
/*
** And this 'dbufbuf' should never be referenced outside the
** implementation of 'dbuf'--would be "hidden" if C had such
** keyword...
** If it was possible, this would compile to be exactly 1 memory
** page in size. 2048 bytes seems to be the most common size, so
** as long as a pointer is 4 bytes, we get 2032 bytes for buffer
** data after we take away a bit for malloc to play with. -avalon
*/
typedef struct dbufbuf
{
struct dbufbuf *next; /* Next data buffer, NULL if this is last */
char data[2032]; /* Actual data stored here */
} dbufbuf;
/*
** dbuf_put
** Append the number of bytes to the buffer, allocating more
** memory as needed. Bytes are copied into internal buffers
** from users buffer.
**
** returns > 0, if operation successfull
** < 0, if failed (due memory allocation problem)
*/
int dbuf_put PROTO((dbuf *, char *, int));
/* Dynamic buffer header */
/* Pointer to data to be stored */
/* Number of bytes to store */
/*
** dbuf_get
** Remove number of bytes from the buffer, releasing dynamic
** memory, if applicaple. Bytes are copied from internal buffers
** to users buffer.
**
** returns the number of bytes actually copied to users buffer,
** if >= 0, any value less than the size of the users
** buffer indicates the dbuf became empty by this operation.
**
** Return 0 indicates that buffer was already empty.
**
** Negative return values indicate some unspecified
** error condition, rather fatal...
*/
int dbuf_get PROTO(( dbuf *, char *, int));
/* Dynamic buffer header */
/* Pointer to buffer to receive the data */
/* Max amount of bytes that can be received */
/*
** dbuf_map, dbuf_delete
** These functions are meant to be used in pairs and offer
** a more efficient way of emptying the buffer than the
** normal 'dbuf_get' would allow--less copying needed.
**
** map returns a pointer to a largest contiguous section
** of bytes in front of the buffer, the length of the
** section is placed into the indicated "long int"
** variable. Returns NULL *and* zero length, if the
** buffer is empty.
**
** delete removes the specified number of bytes from the
** front of the buffer releasing any memory used for them.
**
** Example use (ignoring empty condition here ;)
**
** buf = dbuf_map(&dyn, &count);
** <process N bytes (N <= count) of data pointed by 'buf'>
** dbuf_delete(&dyn, N);
**
** Note: delete can be used alone, there is no real binding
** between map and delete functions...
*/
char *dbuf_map PROTO((dbuf *, int *));
/* Dynamic buffer header */
/* Return number of bytes accessible */
int dbuf_delete PROTO((dbuf *, int));
/* Dynamic buffer header */
/* Number of bytes to delete */
/*
** DBufLength
** Return the current number of bytes stored into the buffer.
** (One should use this instead of referencing the internal
** length field explicitly...)
*/
#define DBufLength(dyn) ((dyn)->length)
/*
** DBufClear
** Scratch the current content of the buffer. Release all
** allocated buffers and make it empty.
*/
#define DBufClear(dyn) dbuf_delete((dyn),DBufLength(dyn))
extern int dbuf_getmsg PROTO((dbuf *, char *, int));
#endif /* __dbuf_include__ */

242
include/h.h Normal file
View File

@@ -0,0 +1,242 @@
/************************************************************************
* IRC - Internet Relay Chat, include/h.h
* Copyright (C) 1992 Darren Reed
*
* 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 1, 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.
*/
/*
* "h.h". - Headers file.
*
* Most of the externs and prototypes thrown in here to 'cleanup' things.
* -avalon
*/
extern time_t nextconnect, nextdnscheck, nextping, now;
extern aClient *client, me, *local[];
extern aChannel *channel;
extern struct stats *ircstp;
extern int bootopt;
extern aChannel *find_channel PROTO((char *, aChannel *));
extern void remove_user_from_channel PROTO((aClient *, aChannel *));
extern void del_invite PROTO((aClient *, aChannel *));
extern int del_silence PROTO((aClient *, char *));
extern void send_user_joins PROTO((aClient *, aClient *));
extern void clean_channelname PROTO((char *));
extern int can_send PROTO((aClient *, aChannel *));
extern int is_chan_op PROTO((aClient *, aChannel *));
extern int is_zombie PROTO((aClient *, aChannel *));
extern int has_voice PROTO((aClient *, aChannel *));
extern int count_channels PROTO((aClient *));
extern aClient *find_client PROTO((char *, aClient *));
extern aClient *find_name PROTO((char *, aClient *));
extern aClient *find_person PROTO((char *, aClient *));
extern aClient *find_server PROTO((char *, aClient *));
extern aClient *find_match_server PROTO((char *));
extern aClient *find_service PROTO((char *, aClient *));
extern aClient *find_userhost PROTO((char *, char *, aClient *, int *));
extern int attach_conf PROTO((aClient *, aConfItem *));
extern aConfItem *attach_confs PROTO((aClient*, const char *, int));
extern aConfItem *attach_confs_host PROTO((aClient*, char *, int));
extern int attach_Iline PROTO((aClient *, struct hostent *, char *));
extern aConfItem *conf, *find_me PROTO(()), *find_admin PROTO(());
extern aGline *gline;
extern aConfItem *count_cnlines PROTO((Link *));
extern void det_confs_butmask PROTO((aClient *, int));
extern int detach_conf PROTO((aClient *, aConfItem *));
extern aConfItem *det_confs_butone PROTO((aClient *, aConfItem *));
extern aConfItem *find_conf PROTO((Link *, char*, int));
extern aConfItem *find_conf_exact PROTO((char *, char *, char *, int));
extern aConfItem *find_conf_host PROTO((Link *, char *, int));
extern aConfItem *find_conf_ip PROTO((Link *, char *, char *, int));
extern aConfItem *find_conf_name PROTO((char *, int));
extern int find_kill PROTO((aClient *));
extern int find_restrict PROTO((aClient *));
extern int rehash PROTO((aClient *, aClient *, int));
extern int initconf PROTO((int));
extern char *MyMalloc PROTO((int)), *MyRealloc PROTO((char *, int));
extern char *debugmode, *configfile, *sbrk0;
extern char *getfield PROTO((char *));
extern void get_sockhost PROTO((aClient *, char *));
extern char *rpl_str PROTO((int)), *err_str PROTO((int));
extern char *strerror PROTO((int));
extern int dgets PROTO((int, char *, int));
extern char *inetntoa PROTO((char *));
extern int dbufalloc, dbufblocks, debuglevel, errno, h_errno;
extern int highest_fd, debuglevel, portnum, debugtty, maxusersperchannel;
extern int readcalls, udpfd, resfd;
extern aClient *add_connection PROTO((aClient *, int));
extern int add_listener PROTO((aConfItem *));
extern void add_local_domain PROTO((char *, int));
extern int check_client PROTO((aClient *));
extern int check_server PROTO((aClient *, struct hostent *, \
aConfItem *, aConfItem *));
extern int check_server_init PROTO((aClient *));
extern void close_connection PROTO((aClient *));
extern void close_listeners PROTO(());
extern int connect_server PROTO((aConfItem *, aClient *, struct hostent *));
extern void get_my_name PROTO((aClient *, char *, int));
extern int get_sockerr PROTO((aClient *));
extern int inetport PROTO((aClient *, char *, int));
extern void init_sys PROTO(());
extern int read_message PROTO((time_t));
extern void report_error PROTO((char *, aClient *));
extern void set_non_blocking PROTO((int, aClient *));
extern int setup_ping PROTO(());
extern void summon PROTO((aClient *, char *, char *, char *));
extern int unixport PROTO((aClient *, char *, int));
extern int utmp_open PROTO(());
extern int utmp_read PROTO((int, char *, char *, char *, int));
extern int utmp_close PROTO((int));
extern void start_auth PROTO((aClient *));
extern void read_authports PROTO((aClient *));
extern void send_authports PROTO((aClient *));
extern void restart PROTO((char *));
extern void send_channel_modes PROTO((aClient *, aChannel *));
extern void server_reboot PROTO(());
extern void terminate PROTO(()), write_pidfile PROTO(());
extern void end_ping PROTO((aClient *));
extern void cancel_ping PROTO((aClient *, aClient *));
extern void send_queued PROTO((aClient *));
/*VARARGS2*/
extern void sendto_one();
extern void vsendto_one();
/*VARARGS4*/
extern void sendto_channel_butone();
/*VARARGS2*/
extern void sendto_serv_butone();
/*VARARGS2*/
extern void sendto_common_channels();
/*VARARGS3*/
extern void sendto_channel_butserv();
/*VARARGS3*/
extern void sendto_match_servs();
/*VARARGS5*/
extern void sendto_match_butone();
/*VARARGS3*/
extern void sendto_all_butone();
/*VARARGS1*/
extern void sendto_ops();
/*VARARGS2*/
extern void sendto_lops_butone();
/*VARARGS3*/
extern void sendto_ops_butone();
/*VARARGS3*/
extern void sendto_prefix_one();
extern void vsendto_prefix_one();
/*VARARGS4*/
extern int exit_client_msg();
extern int writecalls, writeb[];
extern int deliver_it PROTO((aClient *, char *, int));
extern int check_registered PROTO((aClient *));
extern int check_registered_user PROTO((aClient *));
extern char *get_client_name PROTO((aClient *, int));
extern char *get_client_host PROTO((aClient *));
extern char *my_name_for_link PROTO((char *, aConfItem *));
extern char *myctime PROTO((time_t)), *date PROTO((time_t));
extern int exit_client PROTO((aClient *, aClient *, aClient *, char *));
extern void initstats PROTO(()), tstats PROTO((aClient *, char *));
extern int parse PROTO((aClient *, char *, char *, struct Message *));
extern int do_numeric PROTO((int, aClient *, aClient *, int, char **));
extern int hunt_server PROTO((aClient *,aClient *,char *,int,int,char **));
extern aClient *next_client PROTO((aClient *, char *));
extern int m_umode PROTO((aClient *, aClient *, int, char **));
extern int m_names PROTO((aClient *, aClient *, int, char **));
extern int m_server_estab PROTO((aClient *, aConfItem *, aConfItem *));
extern void send_umode PROTO((aClient *, aClient *, int, int, char *));
extern void send_umode_out PROTO((aClient*, aClient *, int));
extern void free_client PROTO((aClient *));
extern void free_link PROTO((Link *));
extern void free_conf PROTO((aConfItem *));
extern void free_class PROTO((aClass *));
extern void free_user PROTO((anUser *, aClient *));
extern void free_gline PROTO((aGline *, aGline *));
extern Link *make_link PROTO(());
extern Dlink *add_dlink PROTO((Dlink **, aClient *));
extern void remove_dlink PROTO((Dlink **, Dlink *));
extern anUser *make_user PROTO((aClient *));
extern aConfItem *make_conf PROTO(());
extern aClass *make_class PROTO(());
extern aServer *make_server PROTO((aClient *));
extern aClient *make_client PROTO((aClient *));
extern aGline *make_gline PROTO((char *, char *, char *, time_t));
extern aGline *find_gline PROTO((char *, char *, aGline **));
extern Link *find_user_link PROTO((Link *, aClient *));
extern int IsMember PROTO((aClient *, aChannel *));
extern char *pretty_mask PROTO((char *));
extern void add_client_to_list PROTO((aClient *));
extern void checklist PROTO(());
extern void remove_client_from_list PROTO((aClient *));
extern void initlists PROTO(());
extern void add_class PROTO((int, int, int, int, long));
extern void fix_class PROTO((aConfItem *, aConfItem *));
extern long get_sendq PROTO((aClient *));
extern int get_con_freq PROTO((aClass *));
extern int get_client_ping PROTO((aClient *));
extern int get_client_class PROTO((aClient *));
extern int get_conf_class PROTO((aConfItem *));
extern void report_classes PROTO((aClient *));
extern struct hostent *get_res PROTO((char *));
extern struct hostent *gethost_byaddr PROTO((struct in_addr *, Link *));
extern struct hostent *gethost_byname PROTO((char *, Link *));
extern void flush_cache PROTO(());
extern int init_resolver PROTO((int));
extern time_t timeout_query_list PROTO((void));
extern time_t expire_cache PROTO((void));
extern void del_queries PROTO((char *));
extern void clear_channel_hash_table PROTO(());
extern void clear_client_hash_table PROTO(());
extern int add_to_client_hash_table PROTO((char *, aClient *));
extern int del_from_client_hash_table PROTO((char *, aClient *));
extern int add_to_channel_hash_table PROTO((char *, aChannel *));
extern int del_from_channel_hash_table PROTO((char *, aChannel *));
extern aChannel *hash_find_channel PROTO((char *, aChannel *));
extern aClient *hash_find_client PROTO((char *, aClient *));
extern aClient *hash_find_nickserver PROTO((char *, aClient *));
extern aClient *hash_find_server PROTO((char *, aClient *));
extern void add_history PROTO((aClient *));
extern aClient *get_history PROTO((char *, time_t));
extern void initwhowas PROTO(());
extern void off_history PROTO((aClient *));
extern int dopacket PROTO((aClient *, char *, int));
/*VARARGS2*/
extern void debug();
#if defined(DEBUGMODE)
extern void send_usage PROTO((aClient *, char *));
extern void send_listinfo PROTO((aClient *, char *));
extern void count_memory PROTO((aClient *, char *));
#endif
char *crule_parse PROTO((char *));
int crule_eval PROTO((char *));
void crule_free PROTO((char **));

37
include/hash.h Normal file
View File

@@ -0,0 +1,37 @@
/************************************************************************
* IRC - Internet Relay Chat, include/hash.h
* Copyright (C) 1991 Darren Reed
*
* 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 1, 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.
*/
#ifndef __hash_include__
#define __hash_include__
typedef struct hashentry {
int hits;
int links;
void *list;
} aHashEntry;
#ifndef DEBUGMODE
#define HASHSIZE 10007 /* prime number */
#define CHANNELHASHSIZE 2003 /* prime number */
#else
extern int HASHSIZE;
extern int CHANNELHASHSIZE;
#endif
#endif /* __hash_include__ */

50
include/inet.h Normal file
View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that: (1) source distributions retain this entire copyright
* notice and comment, and (2) distributions including binaries display
* the following acknowledgement: ``This product includes software
* developed by the University of California, Berkeley and its contributors''
* in the documentation or other materials provided with the distribution
* and in all advertising materials mentioning features or use of this
* software. Neither the name of the University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#)inet.h 5.4 (Berkeley) 6/1/90
*/
/* External definitions for functions in inet(3) */
#include "config.h" /* for system definitions */
#ifdef __alpha
#define __u_l unsigned int
#else
#define __u_l unsigned long
#endif
#ifdef __STDC__
extern __u_l inet_addr(char *);
extern char *inet_ntoa(char *);
extern __u_l inet_makeaddr(int , int);
extern __u_l inet_network(char *);
extern __u_l inet_lnaof(struct in_addr);
extern __u_l inet_netof(struct in_addr);
#else
extern __u_l inet_addr();
extern char *inet_ntoa();
#ifndef HPUX
extern __u_l inet_makeaddr();
#endif
#endif
#ifndef HPUX
extern __u_l inet_network();
extern __u_l inet_lnaof();
extern __u_l inet_netof();
#endif
#undef __u_l

187
include/msg.h Normal file
View File

@@ -0,0 +1,187 @@
/************************************************************************
* IRC - Internet Relay Chat, include/msg.h
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
* 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 1, 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.
*/
#ifndef __msg_include__
#define __msg_include__
#define MSG_PRIVATE "PRIVMSG" /* PRIV */
#define MSG_WHO "WHO" /* WHO -> WHOC */
#define MSG_WHOIS "WHOIS" /* WHOI */
#define MSG_WHOWAS "WHOWAS" /* WHOW */
#define MSG_USER "USER" /* USER */
#define MSG_NICK "NICK" /* NICK */
#define MSG_SERVER "SERVER" /* SERV */
#define MSG_LIST "LIST" /* LIST */
#define MSG_TOPIC "TOPIC" /* TOPI */
#define MSG_INVITE "INVITE" /* INVI */
#define MSG_VERSION "VERSION" /* VERS */
#define MSG_QUIT "QUIT" /* QUIT */
#define MSG_SQUIT "SQUIT" /* SQUI */
#define MSG_KILL "KILL" /* KILL */
#define MSG_INFO "INFO" /* INFO */
#define MSG_LINKS "LINKS" /* LINK */
#define MSG_SUMMON "SUMMON" /* SUMM */
#define MSG_STATS "STATS" /* STAT */
#define MSG_USERS "USERS" /* USER -> USRS */
#define MSG_HELP "HELP" /* HELP */
#define MSG_ERROR "ERROR" /* ERRO */
#define MSG_AWAY "AWAY" /* AWAY */
#define MSG_CONNECT "CONNECT" /* CONN */
#define MSG_UPING "UPING" /* UPIN */
#define MSG_MAP "MAP" /* MAP */
#define MSG_PING "PING" /* PING */
#define MSG_PONG "PONG" /* PONG */
#define MSG_OPER "OPER" /* OPER */
#define MSG_PASS "PASS" /* PASS */
#define MSG_WALLOPS "WALLOPS" /* WALL */
#define MSG_TIME "TIME" /* TIME */
#define MSG_SETTIME "SETTIME" /* SETT */
#define MSG_RPING "RPING" /* RPIN */
#define MSG_RPONG "RPONG" /* RPON */
#define MSG_NAMES "NAMES" /* NAME */
#define MSG_ADMIN "ADMIN" /* ADMI */
#define MSG_TRACE "TRACE" /* TRAC */
#define MSG_NOTICE "NOTICE" /* NOTI */
#define MSG_JOIN "JOIN" /* JOIN */
#define MSG_PART "PART" /* PART */
#define MSG_LUSERS "LUSERS" /* LUSE */
#define MSG_MOTD "MOTD" /* MOTD */
#define MSG_MODE "MODE" /* MODE */
#define MSG_KICK "KICK" /* KICK */
#define MSG_SERVICE "SERVICE" /* SERV -> SRVI */
#define MSG_USERHOST "USERHOST" /* USER -> USRH */
#define MSG_ISON "ISON" /* ISON */
#define MSG_NOTE "NOTE" /* NOTE */
#define MSG_SQUERY "SQUERY" /* SQUE */
#define MSG_SERVLIST "SERVLIST" /* SERV -> SLIS */
#define MSG_SERVSET "SERVSET" /* SERV -> SSET */
#define MSG_REHASH "REHASH" /* REHA */
#define MSG_RESTART "RESTART" /* REST */
#define MSG_CLOSE "CLOSE" /* CLOS */
#define MSG_DIE "DIE"
#define MSG_HASH "HASH" /* HASH */
#define MSG_DNS "DNS" /* DNS -> DNSS */
#define MSG_SILENCE "SILENCE" /* SILE */
#define MSG_GLINE "GLINE" /* GLIN */
#define MAXPARA 15
extern int m_private(), m_topic(), m_join(), m_part(), m_mode();
extern int m_ping(), m_pong(), m_wallops(), m_kick();
extern int m_nick(), m_error(), m_notice();
extern int m_invite(), m_quit(), m_kill();
extern int m_motd(), m_who(), m_whois(), m_user(), m_list();
extern int m_server(), m_info(), m_links(), m_summon(), m_stats();
extern int m_users(), m_version(), m_help();
extern int m_squit(), m_away(), m_connect(), m_uping(), m_map();
extern int m_oper(), m_pass(), m_trace();
extern int m_time(), m_settime(), m_rping(), m_rpong(), m_names(), m_admin();
extern int m_lusers(), m_umode(), m_note(), m_close();
extern int m_motd(), m_whowas(), m_silence();
extern int m_service(), m_userhost(), m_ison();
extern int m_service(), m_servset(), m_servlist(), m_squery();
extern int m_gline();
#if defined(OPER_REHASH) || defined(LOCOP_REHASH)
extern int m_rehash();
#endif
#if defined(OPER_RESTART) || defined(LOCOP_RESTART)
extern int m_restart();
#endif
#if defined(OPER_DIE) || defined(LOCOP_DIE)
extern int m_die();
#endif
extern int m_hash(), m_dns();
#ifdef MSGTAB
struct Message msgtab[] = {
{ MSG_PRIVATE, m_private, 0, MAXPARA, 1 ,0L },
{ MSG_NICK, m_nick, 0, MAXPARA, 1 ,0L },
{ MSG_NOTICE, m_notice, 0, MAXPARA, 1 ,0L },
{ MSG_JOIN, m_join, 0, MAXPARA, 1 ,0L },
{ MSG_MODE, m_mode, 0, MAXPARA, 1 ,0L },
{ MSG_QUIT, m_quit, 0, MAXPARA, 1 ,0L },
{ MSG_PART, m_part, 0, MAXPARA, 1 ,0L },
{ MSG_TOPIC, m_topic, 0, MAXPARA, 1 ,0L },
{ MSG_INVITE, m_invite, 0, MAXPARA, 1 ,0L },
{ MSG_KICK, m_kick, 0, MAXPARA, 1 ,0L },
{ MSG_WALLOPS, m_wallops, 0, MAXPARA, 1 ,0L },
{ MSG_PING, m_ping, 0, MAXPARA, 1 ,0L },
{ MSG_PONG, m_pong, 0, MAXPARA, 1 ,0L },
{ MSG_ERROR, m_error, 0, MAXPARA, 1 ,0L },
{ MSG_KILL, m_kill, 0, MAXPARA, 1 ,0L },
{ MSG_USER, m_user, 0, MAXPARA, 1 ,0L },
{ MSG_AWAY, m_away, 0, MAXPARA, 1 ,0L },
{ MSG_ISON, m_ison, 0, 1, 1 ,0L },
{ MSG_SERVER, m_server, 0, MAXPARA, 1 ,0L },
{ MSG_SQUIT, m_squit, 0, MAXPARA, 1 ,0L },
{ MSG_WHOIS, m_whois, 0, MAXPARA, 1 ,0L },
{ MSG_WHO, m_who, 0, MAXPARA, 1 ,0L },
{ MSG_WHOWAS, m_whowas, 0, MAXPARA, 1 ,0L },
{ MSG_LIST, m_list, 0, MAXPARA, 1 ,0L },
{ MSG_NAMES, m_names, 0, MAXPARA, 1 ,0L },
{ MSG_USERHOST,m_userhost, 0, 1, 1 ,0L },
{ MSG_TRACE, m_trace, 0, MAXPARA, 1 ,0L },
{ MSG_PASS, m_pass, 0, MAXPARA, 1 ,0L },
{ MSG_LUSERS, m_lusers, 0, MAXPARA, 1 ,0L },
{ MSG_TIME, m_time, 0, MAXPARA, 1 ,0L },
{ MSG_SETTIME, m_settime, 0, MAXPARA, 1 ,0L },
{ MSG_RPING, m_rping, 0, MAXPARA, 1 ,0L },
{ MSG_RPONG, m_rpong, 0, MAXPARA, 1 ,0L },
{ MSG_OPER, m_oper, 0, MAXPARA, 1 ,0L },
{ MSG_CONNECT, m_connect, 0, MAXPARA, 1 ,0L },
{ MSG_UPING, m_uping, 0, MAXPARA, 1 ,0L },
{ MSG_MAP, m_map, 0, MAXPARA, 1 ,0L },
{ MSG_VERSION, m_version, 0, MAXPARA, 1 ,0L },
{ MSG_STATS, m_stats, 0, MAXPARA, 1 ,0L },
{ MSG_LINKS, m_links, 0, MAXPARA, 1 ,0L },
{ MSG_ADMIN, m_admin, 0, MAXPARA, 1 ,0L },
{ MSG_USERS, m_users, 0, MAXPARA, 1 ,0L },
{ MSG_SUMMON, m_summon, 0, MAXPARA, 1 ,0L },
{ MSG_HELP, m_help, 0, MAXPARA, 1 ,0L },
{ MSG_INFO, m_info, 0, MAXPARA, 1 ,0L },
{ MSG_MOTD, m_motd, 0, MAXPARA, 1 ,0L },
{ MSG_CLOSE, m_close, 0, MAXPARA, 1 ,0L },
{ MSG_SILENCE, m_silence, 0, MAXPARA, 1 ,0L },
{ MSG_GLINE, m_gline, 0, MAXPARA, 1 ,0L },
{ MSG_NOTE, m_note, 0, 1, 1 ,0L },
#undef USE_SERVICES
#ifdef USE_SERVICES
{ MSG_SERVICE, m_service, 0, MAXPARA, 1 ,0L },
{ MSG_SERVSET, m_servset, 0, MAXPARA, 1 ,0L },
{ MSG_SQUERY, m_squery, 0, MAXPARA, 1 ,0L },
{ MSG_SERVLIST,m_servlist, 0, MAXPARA, 1 ,0L },
#endif
{ MSG_HASH, m_hash, 0, MAXPARA, 1 ,0L },
{ MSG_DNS, m_dns, 0, MAXPARA, 1 ,0L },
#if defined(OPER_REHASH) || defined(LOCOP_REHASH)
{ MSG_REHASH, m_rehash, 0, MAXPARA, 1 ,0L },
#endif
#if defined(OPER_RESTART) || defined(LOCOP_RESTART)
{ MSG_RESTART, m_restart, 0, MAXPARA, 1 ,0L },
#endif
#if defined(OPER_DIE) || defined(LOCOP_DIE)
{ MSG_DIE, m_die, 0, MAXPARA, 1 ,0L },
#endif
{ (char *) 0, (int (*)()) 0 , 0, 0, 0, 0L}
};
#else
extern struct Message msgtab[];
#endif
#endif /* __msg_include__ */

248
include/nameser.h Normal file
View File

@@ -0,0 +1,248 @@
/*
* Copyright (c) 1983, 1989 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that: (1) source distributions retain this entire copyright
* notice and comment, and (2) distributions including binaries display
* the following acknowledgement: ``This product includes software
* developed by the University of California, Berkeley and its contributors''
* in the documentation or other materials provided with the distribution
* and in all advertising materials mentioning features or use of this
* software. Neither the name of the University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#)nameser.h 5.24 (Berkeley) 6/1/90
*/
/*
* Define constants based on rfc883
*/
#define PACKETSZ 512 /* maximum packet size */
#define MAXDNAME 256 /* maximum domain name */
#define MAXCDNAME 255 /* maximum compressed domain name */
#define MAXLABEL 63 /* maximum length of domain label */
/* Number of bytes of fixed size data in query structure */
#define QFIXEDSZ 4
/* number of bytes of fixed size data in resource record */
#define RRFIXEDSZ 10
/*
* Internet nameserver port number
*/
#define NAMESERVER_PORT 53
/*
* Currently defined opcodes
*/
#define QUERY 0x0 /* standard query */
#define IQUERY 0x1 /* inverse query */
#define STATUS 0x2 /* nameserver status query */
/*#define xxx 0x3 /* 0x3 reserved */
/* non standard */
#define UPDATEA 0x9 /* add resource record */
#define UPDATED 0xa /* delete a specific resource record */
#define UPDATEDA 0xb /* delete all nemed resource record */
#define UPDATEM 0xc /* modify a specific resource record */
#define UPDATEMA 0xd /* modify all named resource record */
#define ZONEINIT 0xe /* initial zone transfer */
#define ZONEREF 0xf /* incremental zone referesh */
/*
* Currently defined response codes
*/
#ifdef NOERROR /* defined by solaris2 in */
#undef NOERROR /* <sys/stream.h> to be -1 */
#endif
#define NOERROR 0 /* no error */
#define FORMERR 1 /* format error */
#define SERVFAIL 2 /* server failure */
#define NXDOMAIN 3 /* non existent domain */
#define NOTIMP 4 /* not implemented */
#define REFUSED 5 /* query refused */
/* non standard */
#define NOCHANGE 0xf /* update failed to change db */
/*
* Type values for resources and queries
*/
#define T_A 1 /* host address */
#define T_NS 2 /* authoritative server */
#define T_MD 3 /* mail destination */
#define T_MF 4 /* mail forwarder */
#define T_CNAME 5 /* connonical name */
#define T_SOA 6 /* start of authority zone */
#define T_MB 7 /* mailbox domain name */
#define T_MG 8 /* mail group member */
#define T_MR 9 /* mail rename name */
#define T_NULL 10 /* null resource record */
#define T_WKS 11 /* well known service */
#define T_PTR 12 /* domain name pointer */
#define T_HINFO 13 /* host information */
#define T_MINFO 14 /* mailbox information */
#define T_MX 15 /* mail routing information */
#define T_TXT 16 /* text strings */
/* non standard */
#define T_UINFO 100 /* user (finger) information */
#define T_UID 101 /* user ID */
#define T_GID 102 /* group ID */
#define T_UNSPEC 103 /* Unspecified format (binary data) */
/* Query type values which do not appear in resource records */
#define T_AXFR 252 /* transfer zone of authority */
#define T_MAILB 253 /* transfer mailbox records */
#define T_MAILA 254 /* transfer mail agent records */
#define T_ANY 255 /* wildcard match */
/*
* Values for class field
*/
#define C_IN 1 /* the arpa internet */
#define C_CHAOS 3 /* for chaos net at MIT */
#define C_HS 4 /* for Hesiod name server at MIT */
/* Query class values which do not appear in resource records */
#define C_ANY 255 /* wildcard match */
/*
* Status return codes for T_UNSPEC conversion routines
*/
#define CONV_SUCCESS 0
#define CONV_OVERFLOW -1
#define CONV_BADFMT -2
#define CONV_BADCKSUM -3
#define CONV_BADBUFLEN -4
#ifndef BYTE_ORDER
#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(MIPSEL) || \
defined(BIT_ZERO_ON_RIGHT) || defined(sequent) || defined(i386) ||\
defined(___vax__) || defined(__ns32000__) || defined(__sun386__) ||\
defined(__alpha)
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
defined(MIPSEB) || defined(__hpux) || defined(__convex__) || \
defined(__pyr__) || defined(__mc68000__) || defined(__sparc__) ||\
defined(_IBMR2) || defined (BIT_ZERO_ON_LEFT)
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif /* BYTE_ORDER */
#ifndef BYTE_ORDER
/* you must determine what the correct bit order is for your compiler */
UNDEFINED_BIT_ORDER;
#endif
/*
* Structure for query header, the order of the fields is machine and
* compiler dependent, in our case, the bits within a byte are assignd
* least significant first, while the order of transmition is most
* significant first. This requires a somewhat confusing rearrangement.
*/
typedef struct {
u_short id; /* query identification number */
#if BYTE_ORDER == BIG_ENDIAN
/* fields in third byte */
u_char qr:1; /* response flag */
u_char opcode:4; /* purpose of message */
u_char aa:1; /* authoritive answer */
u_char tc:1; /* truncated message */
u_char rd:1; /* recursion desired */
/* fields in fourth byte */
u_char ra:1; /* recursion available */
u_char pr:1; /* primary server required (non standard) */
u_char unused:2; /* unused bits */
u_char rcode:4; /* response code */
#endif
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
/* fields in third byte */
u_char rd:1; /* recursion desired */
u_char tc:1; /* truncated message */
u_char aa:1; /* authoritive answer */
u_char opcode:4; /* purpose of message */
u_char qr:1; /* response flag */
/* fields in fourth byte */
u_char rcode:4; /* response code */
u_char unused:2; /* unused bits */
u_char pr:1; /* primary server required (non standard) */
u_char ra:1; /* recursion available */
#endif
/* remaining bytes */
u_short qdcount; /* number of question entries */
u_short ancount; /* number of answer entries */
u_short nscount; /* number of authority entries */
u_short arcount; /* number of resource entries */
} HEADER;
/*
* Defines for handling compressed domain names
*/
#define INDIR_MASK 0xc0
/*
* Structure for passing resource records around.
*/
struct rrec {
short r_zone; /* zone number */
short r_class; /* class number */
short r_type; /* type number */
#ifdef __alpha
u_int r_ttl; /* time to live */
#else
u_long r_ttl; /* time to live */
#endif
int r_size; /* size of data area */
char *r_data; /* pointer to data */
};
extern u_short _getshort();
#ifdef __alpha
extern u_int _getlong();
#else
extern u_long _getlong();
#endif
/*
* Inline versions of get/put short/long.
* Pointer is advanced; we assume that both arguments
* are lvalues and will already be in registers.
* cp MUST be u_char *.
*/
#define GETSHORT(s, cp) { \
(s) = *(cp)++ << 8; \
(s) |= *(cp)++; \
}
#define GETLONG(l, cp) { \
(l) = *(cp)++ << 8; \
(l) |= *(cp)++; (l) <<= 8; \
(l) |= *(cp)++; (l) <<= 8; \
(l) |= *(cp)++; \
}
#define PUTSHORT(s, cp) { \
*(cp)++ = (s) >> 8; \
*(cp)++ = (s); \
}
/*
* Warning: PUTLONG destroys its first argument.
*/
#define PUTLONG(l, cp) { \
(cp)[3] = l; \
(cp)[2] = (l >>= 8); \
(cp)[1] = (l >>= 8); \
(cp)[0] = l >> 8; \
(cp) += sizeof(u_long); \
}

363
include/numeric.h Normal file
View File

@@ -0,0 +1,363 @@
/************************************************************************
* IRC - Internet Relay Chat, include/numeric.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* 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 1, 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.
*/
/*
* -- Run -- 30 Sept 1994
*
* Added RPL_MAP, RPL_MAPMORE, RPL_MAPEND
*/
/*
* -- Run -- 22 Sept 1994
*
* Added RPL_TRACEPING
*/
/*
* -- Tonto -- 18 Aug 1994
*
* Added RPL_STATSDLINE
*/
/*
* -- SIO -- 11 Aug 1993
*
* Added RPL_TOPICWHOTIME
*/
/*
* -- Avalon -- 1 Sep 1992
*
* Added RPL_TRACELOG, RPL_STATSOLINE
*/
/*
* -- Avalon -- 13 Aug 1992
*
* Added ERR_BADCHANNELKEY, ERR_KEYSET
*/
/*
* -- Avalon -- 10 Aug 1992
*
* Added RPL_SUMMONING
*/
/*
* -- Avalon -- 5 Jul 1992
*
* Added ERR_NICKCOLLISION
*/
/*
* -- Avalon -- 14 Jul 1992
*
* Added RPL_UNAWAY, RPL_NOWAWAY, ERR_NOORIGIN, ERR_FILEERROR, ERR_NOLOGIN,
* ERR_SUMMONDISABLED, ERR_USERSDISABLED, RPL_USERSSTART, RPL_USERS,
* RPL_ENDOFUSERS, RPL_NOUSERS
*/
/*
* -- Avalon -- 12 Jul 1992
*
* Added RPL_CLOSING RPL_CLOSEEND
*/
/*
* -- Avalon -- 10-11 Jul 1992
*
* Added RPL_MOTD, RPL_MOTDSTART, RPL_ENDOFMOTD, ERR_NOMOTD,
* RPL_INFO, RPL_INFOSTART, RPL_ENDOFINFO, ERR_CANTKILLSERVER,
* RPL_LUSERCLIENT, RPL_LUSEROP, RPL_LUSERUNKNOWN, RPL_LUSERCHAN, RPL_LUSERME,
* RPL_STATSUPTIME, RPL_ADMINLOC1, RPL_ADMINLOC2, RPL_ADMINME,
* RPL_ADMINEMAIL, ERR_NOADMININFO
*/
/*
* -- Avalon -- 28 Jun 1992
*
* Added ERR_BADCHANMASK and RPL_ENDOFWHOWAS
*/
/*
* -- Avalon -- 13 May 1992
*
* Added RPL_STATSLLINE
*/
/*
* -- Avalon -- 12 Jan 1992
*
* Added RPL_TRACELINK
*/
/*
* -- Wumpus -- 30 Nov 1991
*
* It's very important that you never change what a numeric means --
* you can delete old ones (maybe) and add new ones, but never ever
* take a number and make it suddenly mean something else, or change
* an old number just for the hell of it.
*/
/*
* -- avalon -- 19 Nov 1991
* Added ERR_USERSDONTMATCH
*
* -- avalon -- 06 Nov 1991
* Added RPL_BANLIST, RPL_BANLISTEND, ERR_BANNEDFROMCHAN
*
* -- avalon -- 15 Oct 1991
* Added RPL_TRACEs (201-209)
* Added RPL_STATSs (211-219)
*/
/* -- Jto -- 16 Jun 1990
* A couple of new numerics added...
*/
/* -- Jto -- 03 Jun 1990
* Added ERR_YOUWILLBEBANNED and Check defines (sigh, had to put 'em here..)
* Added ERR_UNKNOWNMODE...
* Added ERR_CANNOTSENDTOCHAN...
*/
/*
* Reserve numerics 000-099 for server-client connections where the client
* is local to the server. If any server is passed a numeric in this range
* from another server then it is remapped to 100-199. -avalon
*/
#define RPL_WELCOME 001
#define RPL_YOURHOST 002
#define RPL_CREATED 003
#define RPL_MYINFO 004
#define RPL_MAP 005
#define RPL_MAPMORE 006
#define RPL_MAPEND 007
/*
* Errors are in the range from 400-599 currently and are grouped by what
* commands they come from.
*/
#define ERR_NOSUCHNICK 401
#define ERR_NOSUCHSERVER 402
#define ERR_NOSUCHCHANNEL 403
#define ERR_CANNOTSENDTOCHAN 404
#define ERR_TOOMANYCHANNELS 405
#define ERR_WASNOSUCHNICK 406
#define ERR_TOOMANYTARGETS 407
#define ERR_NOSUCHSERVICE 408
#define ERR_NOORIGIN 409
#define ERR_NORECIPIENT 411
#define ERR_NOTEXTTOSEND 412
#define ERR_NOTOPLEVEL 413
#define ERR_WILDTOPLEVEL 414
#define ERR_UNKNOWNCOMMAND 421
#define ERR_NOMOTD 422
#define ERR_NOADMININFO 423
#define ERR_FILEERROR 424
#define ERR_NONICKNAMEGIVEN 431
#define ERR_ERRONEUSNICKNAME 432
#define ERR_NICKNAMEINUSE 433
#define ERR_SERVICENAMEINUSE 434
#define ERR_SERVICECONFUSED 435
#define ERR_NICKCOLLISION 436
#define ERR_BANNICKCHANGE 437
#define ERR_NICKTOOFAST 438
#define ERR_USERNOTINCHANNEL 441
#define ERR_NOTONCHANNEL 442
#define ERR_USERONCHANNEL 443
#define ERR_NOLOGIN 444
#define ERR_SUMMONDISABLED 445
#define ERR_USERSDISABLED 446
#define ERR_NOTREGISTERED 451
#define ERR_NEEDMOREPARAMS 461
#define ERR_ALREADYREGISTRED 462
#define ERR_NOPERMFORHOST 463
#define ERR_PASSWDMISMATCH 464
#define ERR_YOUREBANNEDCREEP 465
#define ERR_YOUWILLBEBANNED 466
#define ERR_KEYSET 467
#define ERR_CHANNELISFULL 471
#define ERR_UNKNOWNMODE 472
#define ERR_INVITEONLYCHAN 473
#define ERR_BANNEDFROMCHAN 474
#define ERR_BADCHANNELKEY 475
#define ERR_BADCHANMASK 476
#define ERR_BANLISTFULL 478
#define ERR_NOPRIVILEGES 481
#define ERR_CHANOPRIVSNEEDED 482
#define ERR_CANTKILLSERVER 483
#define ERR_ISCHANSERVICE 484
#define ERR_NOOPERHOST 491
#define ERR_NOSERVICEHOST 492
#define ERR_UMODEUNKNOWNFLAG 501
#define ERR_USERSDONTMATCH 502
#define ERR_SILELISTFULL 511
#define ERR_NOSUCHGLINE 512
#define ERR_BADPING 513
/*
* Numberic replies from server commands.
* These are currently in the range 200-399.
*/
#define RPL_NONE 300
#define RPL_AWAY 301
#define RPL_USERHOST 302
#define RPL_ISON 303
#define RPL_TEXT 304
#define RPL_UNAWAY 305
#define RPL_NOWAWAY 306
#define RPL_WHOISUSER 311
#define RPL_WHOISSERVER 312
#define RPL_WHOISOPERATOR 313
#define RPL_WHOWASUSER 314
/* rpl_endofwho below (315) */
#define RPL_ENDOFWHOWAS 369
#define RPL_WHOISCHANOP 316 /* redundant and not needed but reserved */
#define RPL_WHOISIDLE 317
#define RPL_ENDOFWHOIS 318
#define RPL_WHOISCHANNELS 319
#define RPL_LISTSTART 321
#define RPL_LIST 322
#define RPL_LISTEND 323
#define RPL_CHANNELMODEIS 324
#define RPL_CREATIONTIME 329
#define RPL_NOTOPIC 331
#define RPL_TOPIC 332
#define RPL_TOPICWHOTIME 333
#define RPL_LISTUSAGE 334
#define RPL_INVITING 341
#define RPL_SUMMONING 342
#define RPL_VERSION 351
#define RPL_WHOREPLY 352
#define RPL_ENDOFWHO 315
#define RPL_NAMREPLY 353
#define RPL_ENDOFNAMES 366
#define RPL_KILLDONE 361
#define RPL_CLOSING 362
#define RPL_CLOSEEND 363
#define RPL_LINKS 364
#define RPL_ENDOFLINKS 365
/* rpl_endofnames above (366) */
#define RPL_BANLIST 367
#define RPL_ENDOFBANLIST 368
/* rpl_endofwhowas above (369) */
#define RPL_INFO 371
#define RPL_MOTD 372
#define RPL_INFOSTART 373
#define RPL_ENDOFINFO 374
#define RPL_MOTDSTART 375
#define RPL_ENDOFMOTD 376
#define RPL_YOUREOPER 381
#define RPL_REHASHING 382
#define RPL_YOURESERVICE 383
#define RPL_MYPORTIS 384
#define RPL_NOTOPERANYMORE 385
#define RPL_TIME 391
#define RPL_USERSSTART 392
#define RPL_USERS 393
#define RPL_ENDOFUSERS 394
#define RPL_NOUSERS 395
#define RPL_TRACELINK 200
#define RPL_TRACECONNECTING 201
#define RPL_TRACEHANDSHAKE 202
#define RPL_TRACEUNKNOWN 203
#define RPL_TRACEOPERATOR 204
#define RPL_TRACEUSER 205
#define RPL_TRACESERVER 206
#define RPL_TRACESERVICE 207
#define RPL_TRACENEWTYPE 208
#define RPL_TRACECLASS 209
#define RPL_STATSLINKINFO 211
#define RPL_STATSCOMMANDS 212
#define RPL_STATSCLINE 213
#define RPL_STATSNLINE 214
#define RPL_STATSILINE 215
#define RPL_STATSKLINE 216
#define RPL_STATSQLINE 217
#define RPL_STATSYLINE 218
#define RPL_ENDOFSTATS 219
#define RPL_UMODEIS 221
#define RPL_SERVICEINFO 231
#define RPL_ENDOFSERVICES 232
#define RPL_SERVICE 233
#define RPL_SERVLIST 234
#define RPL_SERVLISTEND 235
#define RPL_STATSLLINE 241
#define RPL_STATSUPTIME 242
#define RPL_STATSOLINE 243
#define RPL_STATSHLINE 244
#define RPL_STATSSLINE 245
#define RPL_STATSTLINE 246
#define RPL_STATSGLINE 247
#define RPL_STATSULINE 248
#define RPL_STATSDEBUG 249
#define RPL_STATSCONN 250
#define RPL_LUSERCLIENT 251
#define RPL_LUSEROP 252
#define RPL_LUSERUNKNOWN 253
#define RPL_LUSERCHANNELS 254
#define RPL_LUSERME 255
#define RPL_ADMINME 256
#define RPL_ADMINLOC1 257
#define RPL_ADMINLOC2 258
#define RPL_ADMINEMAIL 259
#define RPL_TRACELOG 261
#define RPL_TRACEPING 262
#define RPL_SILELIST 271
#define RPL_ENDOFSILELIST 272
#define RPL_STATSDLINE 275
#define RPL_GLIST 280
#define RPL_ENDOFGLIST 281

141
include/patchlevel.h Normal file
View File

@@ -0,0 +1,141 @@
/************************************************************************
* IRC - Internet Relay Chat, include/patchlevel.h
*
* 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 1, 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.
*/
/*
* PATCHes
*
* Only put here ADDED special stuff, for instance: ".mu3" or ".ban"
* Please start the patchlevel with a '.'
*
* IMPORTANT: Since u2.9 there is a new format of this file. The reason
* is that this way it shouldn't be needed anymore for the user to edit
* this manually !!!
* If you do, be sure you know what you are doing!
*
* For patch devellopers:
* To make a diff of your patch, edit any of the below lines containing
* a "" (an EMPTY string). Your patch will then succeed, with only an
* offset, on the first empty place in the users patchlevel.h.
* Do not change anyother line, the '\' are to make sure that the 'fuzz'
* will stay 0. --Run
*
*/
#define PATCH1 \
\
\
\
".32"
/*
Deliberate empty lines
*/
#define PATCH2 \
\
\
\
""
/*
Deliberate empty lines
*/
#define PATCH3 \
\
\
\
""
/*
Deliberate empty lines
*/
#define PATCH4 \
\
\
\
""
/*
Deliberate empty lines
*/
#define PATCH5 \
\
\
\
""
/*
Deliberate empty lines
*/
#define PATCH6 \
\
\
\
""
/*
Deliberate empty lines
*/
#define PATCH7 \
\
\
\
""
/*
Deliberate empty lines
*/
#define PATCH8 \
\
\
\
""
/*
Deliberate empty lines
*/
#ifdef TESTNET
#define PATCH9 \
\
\
\
".testnet"
#else
#define PATCH9 ""
#endif
/*
Deliberate empty lines
*/
/* Do NOT edit those: */
#ifndef BASE_VERSION
#define BASE_VERSION "u2.9"
#endif
#ifndef MAJOR_PROTOCOL
#define MAJOR_PROTOCOL "09"
#endif

63
include/res.h Normal file
View File

@@ -0,0 +1,63 @@
/*
* irc2.7.2/ircd/res.h (C)opyright 1992 Darren Reed.
*/
#ifndef __res_include__
#define __res_include__
#define RES_INITLIST 1
#define RES_CALLINIT 2
#define RES_INITSOCK 4
#define RES_INITDEBG 8
#define RES_INITCACH 16
#define MAXPACKET 1024
#define MAXALIASES 35
#define MAXADDRS 35
#define AR_TTL 600 /* TTL in seconds for dns cache entries */
struct hent {
char *h_name; /* official name of host */
char *h_aliases[MAXALIASES]; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
/* list of addresses from name server */
struct in_addr h_addr_list[MAXADDRS];
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
};
typedef struct reslist {
int id;
int sent; /* number of requests sent */
int srch;
time_t ttl;
char type;
char retries; /* retry counter */
char sends; /* number of sends (>1 means resent) */
char resend; /* send flag. 0 == dont resend */
time_t sentat;
time_t timeout;
struct in_addr addr;
char *name;
struct reslist *next;
Link cinfo;
struct hent he;
} ResRQ;
typedef struct cache {
time_t expireat;
time_t ttl;
struct hostent he;
struct cache *hname_next, *hnum_next, *list_next;
} aCache;
typedef struct cachetable {
aCache *num_list;
aCache *name_list;
} CacheTable;
#define ARES_CACSIZE 101
#define MAXCACHED 81
#endif /* __res_include__ */

78
include/resolv.h Normal file
View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that: (1) source distributions retain this entire copyright
* notice and comment, and (2) distributions including binaries display
* the following acknowledgement: ``This product includes software
* developed by the University of California, Berkeley and its contributors''
* in the documentation or other materials provided with the distribution
* and in all advertising materials mentioning features or use of this
* software. Neither the name of the University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#)resolv.h 5.10.1 (Berkeley) 6/1/90
*/
/*
* Resolver configuration file.
* Normally not present, but may contain the address of the
* inital name server(s) to query and the domain search list.
*/
#ifndef _PATH_RESCONF
#define _PATH_RESCONF "/etc/resolv.conf"
#endif
/*
* Global defines and variables for resolver stub.
*/
#define MAXNS 3 /* max # name servers we'll track */
#define MAXDFLSRCH 3 /* # default domain levels to try */
#define MAXDNSRCH 6 /* max # domains in search path */
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
#define MAXSERVICES 2 /* max # of services to search */
#define RES_TIMEOUT 5 /* min. seconds between retries */
struct state {
int retrans; /* retransmition time interval */
int retry; /* number of times to retransmit */
long options; /* option flags - see below. */
int nscount; /* number of name servers */
struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */
#define nsaddr nsaddr_list[0] /* for backward compatibility */
unsigned short id; /* current packet id */
char defdname[MAXDNAME]; /* default domain */
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
unsigned short order[MAXSERVICES+1]; /* search service order */
};
#define RES_SERVICE_NONE 0
#define RES_SERVICE_BIND 1
#define RES_SERVICE_LOCAL 2
/*
* Resolver options
*/
#define RES_INIT 0x0001 /* address initialized */
#define RES_DEBUG 0x0002 /* print debug messages */
#define RES_AAONLY 0x0004 /* authoritative answers only */
#define RES_USEVC 0x0008 /* use virtual circuit */
#define RES_PRIMARY 0x0010 /* query primary server only */
#define RES_IGNTC 0x0020 /* ignore trucation errors */
#define RES_RECURSE 0x0040 /* recursion desired */
#define RES_DEFNAMES 0x0080 /* use default domain name */
#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
#define RES_DNSRCH 0x0200 /* search up local domain tree */
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
extern struct state _res;
extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time();

41
include/sock.h Normal file
View File

@@ -0,0 +1,41 @@
/************************************************************************
* IRC - Internet Relay Chat, include/sock.h
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
* 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 1, 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.
*/
/*
* $Id: sock.h,v 1.1.1.1 1996/05/05 22:25:20 klmitch Exp $
*
* $Log: sock.h,v $
* Revision 1.1.1.1 1996/05/05 22:25:20 klmitch
* initial entry
*
* Revision 6.1 1991/07/04 21:04:35 gruner
* Revision 2.6.1 [released]
*
* Revision 6.0 1991/07/04 18:05:04 gruner
* frozen beta revision 2.6.1
*
*/
#ifndef FD_ZERO
#define FD_ZERO(set) (((set)->fds_bits[0]) = 0)
#define FD_SET(s1, set) (((set)->fds_bits[0]) |= 1 << (s1))
#define FD_ISSET(s1, set) (((set)->fds_bits[0]) & (1 << (s1)))
#define FD_SETSIZE 30
#endif

622
include/struct.h Normal file
View File

@@ -0,0 +1,622 @@
/************************************************************************
* IRC - Internet Relay Chat, include/struct.h
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
* 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 1, 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.
*/
#ifndef __struct_include__
#define __struct_include__
#include "config.h"
#include "common.h"
#include "sys.h"
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#ifdef STDDEFH
# include <stddef.h>
#endif
#ifdef USE_SYSLOG
# include <syslog.h>
# ifdef SYSSYSLOGH
# include <sys/syslog.h>
# endif
#endif
#ifdef pyr
#include <sys/time.h>
#endif
typedef struct ConfItem aConfItem;
typedef struct Gline aGline;
typedef struct Client aClient;
typedef struct Channel aChannel;
typedef struct User anUser;
typedef struct Server aServer;
typedef struct SLink Link;
typedef struct SMode Mode;
typedef struct DSlink Dlink;
#ifndef VMSP
#include "class.h"
#include "dbuf.h" /* THIS REALLY SHOULDN'T BE HERE!!! --msa */
#endif
#define HOSTLEN 63 /* Length of hostname. Updated to */
/* comply with RFC1123 */
#define NICKLEN 9 /* Necessary to put 9 here instead of 10
** if s_msg.c/m_nick has been corrected.
** This preserves compatibility with old
** servers --msa
*/
#define USERLEN 10
#define REALLEN 50
#define TOPICLEN 160
#define CHANNELLEN 200
#define PASSWDLEN 20
#define KEYLEN 23
#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */
#define MAXRECIPIENTS 20
#define MAXBANS 30
#define MAXBANLENGTH 1024
#define MAXSILELENGTH 128
#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5)
#ifdef USE_SERVICES
#include "service.h"
#endif
/*
** 'offsetof' is defined in ANSI-C. The following definition
** is not absolutely portable (I have been told), but so far
** it has worked on all machines I have needed it. The type
** should be size_t but... --msa
*/
#ifndef offsetof
#define offsetof(t,m) (int)((&((t *)0L)->m))
#endif
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
/*
** flags for bootup options (command line flags)
*/
#define BOOT_CONSOLE 1
#define BOOT_QUICK 2
#define BOOT_DEBUG 4
#define BOOT_INETD 8
#define BOOT_TTY 16
#define BOOT_OPER 32
#define BOOT_AUTODIE 64
#define STAT_PING -7
#define STAT_LOG -6 /* logfile for -x */
#define STAT_MASTER -5 /* Local ircd master before identification */
#define STAT_CONNECTING -4
#define STAT_HANDSHAKE -3
#define STAT_ME -2
#define STAT_UNKNOWN -1
#define STAT_SERVER 0
#define STAT_CLIENT 1
#define STAT_SERVICE 2 /* Services not implemented yet */
/*
* status macros.
*/
#define IsRegisteredUser(x) ((x)->status == STAT_CLIENT)
#define IsRegistered(x) ((x)->status >= STAT_SERVER)
#define IsConnecting(x) ((x)->status == STAT_CONNECTING)
#define IsHandshake(x) ((x)->status == STAT_HANDSHAKE)
#define IsMe(x) ((x)->status == STAT_ME)
#define IsUnknown(x) ((x)->status == STAT_UNKNOWN || \
(x)->status == STAT_MASTER)
#define IsServer(x) ((x)->status == STAT_SERVER)
#define IsClient(x) ((x)->status == STAT_CLIENT)
#define IsLog(x) ((x)->status == STAT_LOG)
#define IsService(x) ((x)->status == STAT_SERVICE)
#define IsPing(x) ((x)->status == STAT_PING)
#define SetMaster(x) ((x)->status = STAT_MASTER)
#define SetConnecting(x) ((x)->status = STAT_CONNECTING)
#define SetHandshake(x) ((x)->status = STAT_HANDSHAKE)
#define SetMe(x) ((x)->status = STAT_ME)
#define SetUnknown(x) ((x)->status = STAT_UNKNOWN)
#define SetServer(x) ((x)->status = STAT_SERVER)
#define SetClient(x) ((x)->status = STAT_CLIENT)
#define SetLog(x) ((x)->status = STAT_LOG)
#define SetService(x) ((x)->status = STAT_SERVICE)
#define SetPing(x) ((x)->status = STAT_PING)
#define FLAGS_PINGSENT 0x0001 /* Unreplied ping sent */
#define FLAGS_DEADSOCKET 0x0002 /* Local socket is dead--Exiting soon */
#define FLAGS_KILLED 0x0004 /* Prevents "QUIT" from being sent for this */
#define FLAGS_OPER 0x0008 /* Operator */
#define FLAGS_LOCOP 0x0010 /* Local operator -- SRB */
#define FLAGS_INVISIBLE 0x0020 /* makes user invisible */
#define FLAGS_WALLOP 0x0040 /* send wallops to them */
#define FLAGS_SERVNOTICE 0x0080 /* server notices such as kill */
#define FLAGS_BLOCKED 0x0100 /* socket is in a blocked condition */
#define FLAGS_UNIX 0x0200 /* socket is in the unix domain, not inet */
#define FLAGS_CLOSING 0x0400 /* set when closing to suppress errors */
#define FLAGS_LISTEN 0x0800 /* used to mark clients which we listen() on */
#define FLAGS_CHKACCESS 0x1000 /* ok to check clients access if set */
#define FLAGS_DOINGDNS 0x2000 /* client is waiting for a DNS response */
#define FLAGS_AUTH 0x4000 /* client is waiting on rfc931 response */
#define FLAGS_WRAUTH 0x8000 /* set if we havent writen to ident server */
#define FLAGS_LOCAL 0x10000 /* set for local clients */
#define FLAGS_GOTID 0x20000 /* successful ident lookup achieved */
#define FLAGS_DOID 0x40000 /* I-lines say must use ident return */
#define FLAGS_NONL 0x80000 /* No \n in buffer */
#define FLAGS_TS8 0x100000 /* Why do you want to know? */
#define FLAGS_PING 0x200000 /* Socket is waiting for udp ping response */
#define FLAGS_ASKEDPING 0x400000 /* Client asked for udp ping */
#define FLAGS_MAP 0x800000 /* Show server on the map */
#define FLAGS_JUNCTION 0x1000000 /* Junction causing the net.burst */
#define FLAGS_DEAF 0x2000000 /* Makes user deaf */
#define FLAGS_NOKICK 0x4000000 /* prevents the possibility of KICK or MODE
-o on the user; can only be set by server
connections, not by local users */
#define SEND_UMODES (FLAGS_INVISIBLE|FLAGS_OPER|FLAGS_WALLOP|FLAGS_DEAF|FLAGS_NOKICK)
#define ALL_UMODES (SEND_UMODES|FLAGS_SERVNOTICE|FLAGS_LOCOP)
/* FLAGS_LOCOP was originally left out; this was a bug */
#define FLAGS_ID (FLAGS_DOID|FLAGS_GOTID)
/*
* flags macros.
*/
#define IsOper(x) ((x)->flags & FLAGS_OPER)
#define IsLocOp(x) ((x)->flags & FLAGS_LOCOP)
#define IsInvisible(x) ((x)->flags & FLAGS_INVISIBLE)
#define IsDeaf(x) ((x)->flags & FLAGS_DEAF)
#define IsAnOper(x) ((x)->flags & (FLAGS_OPER|FLAGS_LOCOP))
#define IsPerson(x) ((x)->user && IsClient(x))
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
#define SendWallops(x) ((x)->flags & FLAGS_WALLOP)
#define SendServNotice(x) ((x)->flags & FLAGS_SERVNOTICE)
#define IsUnixSocket(x) ((x)->flags & FLAGS_UNIX)
#define IsListening(x) ((x)->flags & FLAGS_LISTEN)
#define DoAccess(x) ((x)->flags & FLAGS_CHKACCESS)
#define IsLocal(x) ((x)->flags & FLAGS_LOCAL)
#define IsDead(x) ((x)->flags & FLAGS_DEADSOCKET)
#define IsJunction(x) ((x)->flags & FLAGS_JUNCTION)
#define SetOper(x) ((x)->flags |= FLAGS_OPER)
#define SetLocOp(x) ((x)->flags |= FLAGS_LOCOP)
#define SetInvisible(x) ((x)->flags |= FLAGS_INVISIBLE)
#define SetWallops(x) ((x)->flags |= FLAGS_WALLOP)
#define SetUnixSock(x) ((x)->flags |= FLAGS_UNIX)
#define SetDNS(x) ((x)->flags |= FLAGS_DOINGDNS)
#define DoingDNS(x) ((x)->flags & FLAGS_DOINGDNS)
#define SetAccess(x) ((x)->flags |= FLAGS_CHKACCESS)
#define DoingAuth(x) ((x)->flags & FLAGS_AUTH)
#define NoNewLine(x) ((x)->flags & FLAGS_NONL)
#define DoPing(x) ((x)->flags & FLAGS_PING)
#define SetAskedPing(x) ((x)->flags |= FLAGS_ASKEDPING)
#define AskedPing(x) ((x)->flags & FLAGS_ASKEDPING)
#define SetJunction(x) ((x)->flags |= FLAGS_JUNCTION)
#define ClearOper(x) ((x)->flags &= ~FLAGS_OPER)
#define ClearInvisible(x) ((x)->flags &= ~FLAGS_INVISIBLE)
#define ClearWallops(x) ((x)->flags &= ~FLAGS_WALLOP)
#define ClearDNS(x) ((x)->flags &= ~FLAGS_DOINGDNS)
#define ClearAuth(x) ((x)->flags &= ~FLAGS_AUTH)
#define ClearAccess(x) ((x)->flags &= ~FLAGS_CHKACCESS)
#define ClearPing(x) ((x)->flags &= ~FLAGS_PING)
#define ClearAskedPing(x) ((x)->flags &= ~FLAGS_ASKEDPING)
/*
* defined debugging levels
*/
#define DEBUG_FATAL 0
#define DEBUG_ERROR 1 /* report_error() and other errors that are found */
#define DEBUG_NOTICE 3
#define DEBUG_DNS 4 /* used by all DNS related routines - a *lot* */
#define DEBUG_INFO 5 /* general usful info */
#define DEBUG_NUM 6 /* numerics */
#define DEBUG_SEND 7 /* everything that is sent out */
#define DEBUG_DEBUG 8 /* anything to do with debugging, ie unimportant :) */
#define DEBUG_MALLOC 9 /* malloc/free calls */
#define DEBUG_LIST 10 /* debug list use */
/*
* defines for curses in client
*/
#define DUMMY_TERM 0
#define CURSES_TERM 1
#define TERMCAP_TERM 2
struct ConfItem {
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
int clients; /* Number of *LOCAL* clients using this */
struct in_addr ipnum; /* ip number of host field */
char *host;
char *passwd;
char *name;
int port;
time_t hold; /* Hold action until this time (calendar time) */
#ifndef VMSP
aClass *class; /* Class of connection */
#endif
struct ConfItem *next;
};
#define CONF_ILLEGAL 0x80000000
#define CONF_MATCH 0x40000000
#define CONF_QUARANTINED_SERVER 0x0001
#define CONF_CLIENT 0x0002
#define CONF_CONNECT_SERVER 0x0004
#define CONF_NOCONNECT_SERVER 0x0008
#define CONF_LOCOP 0x0010
#define CONF_OPERATOR 0x0020
#define CONF_ME 0x0040
#define CONF_KILL 0x0080
#define CONF_ADMIN 0x0100
#ifdef R_LINES
#define CONF_RESTRICT 0x0200
#endif
#define CONF_CLASS 0x0400
#define CONF_SERVICE 0x0800
#define CONF_LEAF 0x1000
#define CONF_LISTEN_PORT 0x2000
#define CONF_HUB 0x4000
#define CONF_UWORLD 0x8000
#define CONF_CRULEALL 0x00200000
#define CONF_CRULEAUTO 0x00400000
#define CONF_TLINES 0x00800000
#define CONF_OPS (CONF_OPERATOR | CONF_LOCOP)
#define CONF_SERVER_MASK (CONF_CONNECT_SERVER | CONF_NOCONNECT_SERVER)
#define CONF_CLIENT_MASK (CONF_CLIENT | CONF_SERVICE | CONF_OPS | \
CONF_SERVER_MASK)
#define CONF_CRULE (CONF_CRULEALL | CONF_CRULEAUTO)
#define IsIllegal(x) ((x)->status & CONF_ILLEGAL)
struct Gline {
struct Gline *next;
char *host;
char *reason;
char *name;
time_t expire;
int active;
};
#define GLINE_ACTIVE 1
#define GLINE_INACTIVE 0
/*
* Client structures
*/
struct User {
struct User *nextu;
aClient *server; /* client structure of server */
Dlink *clink; /* own Dlink in server->serv->client struct */
Link *channel; /* chain of channel pointer blocks */
Link *invited; /* chain of invite pointer blocks */
Link *silence; /* chain of silence pointer blocks */
char *away; /* pointer to away message */
time_t last;
int refcnt; /* Number of times this block is referenced */
int joined; /* number of channels joined */
char username[USERLEN+1];
char host[HOSTLEN+1];
#ifdef LIST_DEBUG
aClient *bcptr;
#endif
};
struct Server {
struct Server *nexts;
aClient *up; /* Server one closer to me */
Dlink *down; /* List with downlink servers */
Dlink *updown; /* own Dlink in up->serv->down struct */
Dlink *client; /* List with clients for this server */
anUser *user; /* who activated this connection */
char by[NICKLEN+1];
aConfItem *nline; /* N-line pointer for this server */
time_t timestamp; /* Remotely determined connect try time */
time_t ghost; /* Local time at which a new server caused a Ghost */
u_short prot; /* Major protocol */
#ifdef LIST_DEBUG
aClient *bcptr;
#endif
};
struct Client {
struct Client *next,*prev, *hnext;
anUser *user; /* ...defined, if this is a User */
aServer *serv; /* ...defined, if this is a server */
#ifdef USE_SERVICES
aService *service;
#endif
int hashv; /* raw hash value */
time_t lasttime; /* ...should be only LOCAL clients? --msa */
time_t firsttime; /* time client was created */
time_t since; /* last time we parsed something */
time_t lastnick; /* TimeStamp on nick */
long flags; /* client flags */
aClient *from; /* == self, if Local Client, *NEVER* NULL! */
int fd; /* >= 0, for local clients */
int hopcount; /* number of servers to this 0 = local */
short status; /* Client type */
char name[HOSTLEN+1]; /* Unique name of the client, nick or host */
char username[USERLEN+1]; /* username here now for auth stuff */
char info[REALLEN+1]; /* Free form additional client information */
/*
** The following fields are allocated only for local clients
** (directly connected to *this* server with a socket.
** The first of them *MUST* be the "count"--it is the field
** to which the allocation is tied to! *Never* refer to
** these fields, if (from != self).
*/
int count; /* Amount of data in buffer */
char buffer[BUFSIZE]; /* Incoming message buffer */
short lastsq; /* # of 2k blocks when sendqueued called last*/
#ifdef NICK_DELAY
time_t nextnick; /* Next time that a nick change is allowed */
#endif
u_long cookie; /* Random number the user must PONG */
dbuf sendQ; /* Outgoing message queue--if socket full */
dbuf recvQ; /* Hold for data incoming yet to be parsed */
long sendM; /* Statistics: protocol messages send */
long sendK; /* Statistics: total k-bytes send */
long receiveM; /* Statistics: protocol messages received */
long receiveK; /* Statistics: total k-bytes received */
u_short sendB; /* counters to count upto 1-k lots of bytes */
u_short receiveB; /* sent and received. */
aClient *acpt; /* listening client which we accepted from */
Link *confs; /* Configuration record associated */
int authfd; /* fd for rfc931 authentication */
struct in_addr ip; /* keep real ip# too */
unsigned short port; /* and the remote port# too :-) */
struct hostent *hostp;
aChannel *listing;
#ifdef pyr
struct timeval lw;
#endif
char sockhost[HOSTLEN+1]; /* This is the host name from the socket
** and after which the connection was
** accepted.
*/
char passwd[PASSWDLEN+1];
};
#define CLIENT_LOCAL_SIZE sizeof(aClient)
#define CLIENT_REMOTE_SIZE offsetof(aClient,count)
/*
* statistics structures
*/
struct stats {
unsigned int is_cl; /* number of client connections */
unsigned int is_sv; /* number of server connections */
unsigned int is_ni; /* connection but no idea who it was */
unsigned short is_cbs; /* bytes sent to clients */
unsigned short is_cbr; /* bytes received to clients */
unsigned short is_sbs; /* bytes sent to servers */
unsigned short is_sbr; /* bytes received to servers */
unsigned long is_cks; /* k-bytes sent to clients */
unsigned long is_ckr; /* k-bytes received to clients */
unsigned long is_sks; /* k-bytes sent to servers */
unsigned long is_skr; /* k-bytes received to servers */
time_t is_cti; /* time spent connected by clients */
time_t is_sti; /* time spent connected by servers */
unsigned int is_ac; /* connections accepted */
unsigned int is_ref; /* accepts refused */
unsigned int is_unco; /* unknown commands */
unsigned int is_wrdi; /* command going in wrong direction */
unsigned int is_unpf; /* unknown prefix */
unsigned int is_empt; /* empty message */
unsigned int is_num; /* numeric message */
unsigned int is_kill; /* number of kills generated on collisions */
unsigned int is_fake; /* MODE 'fakes' */
unsigned int is_asuc; /* successful auth requests */
unsigned int is_abad; /* bad auth requests */
unsigned int is_udp; /* packets recv'd on udp port */
unsigned int is_loc; /* local connections made */
};
/* mode structure for channels */
struct SMode {
unsigned int mode;
int limit;
char key[KEYLEN+1];
};
/* Message table structure */
struct Message {
char *cmd;
int (* func)();
unsigned int count;
int parameters;
char flags;
/* bit 0 set means that this command is allowed to be used
* only on the average of once per 2 seconds -SRB */
unsigned long bytes;
};
/* general link structure used for chains */
struct SLink {
struct SLink *next;
union {
aClient *cptr;
aChannel *chptr;
aConfItem *aconf;
char *cp;
struct {
char *banstr;
char *who;
time_t when;
} ban;
} value;
int flags;
};
struct DSlink {
struct DSlink *next;
struct DSlink *prev;
union {
aClient *cptr;
aChannel *chptr;
aConfItem *aconf;
char *cp;
} value;
};
/* channel structure */
struct Channel {
struct Channel *nextch, *prevch, *hnextch;
int hashv; /* raw hash value */
Mode mode;
time_t creationtime;
char topic[TOPICLEN+1];
char topic_nick[NICKLEN+1];
time_t topic_time;
int users;
Link *members;
Link *invites;
Link *banlist;
char chname[1];
};
/*
** Channel Related macros follow
*/
/* Channel related flags */
#define CHFL_CHANOP 0x0001 /* Channel operator */
#define CHFL_VOICE 0x0002 /* the power to speak */
#define CHFL_DEOPPED 0x0004 /* Is de-opped by a server */
#define CHFL_SERVOPOK 0x0008 /* Server op allowed */
#define CHFL_ZOMBIE 0x0010 /* Kicked from channel */
#define CHFL_BAN 0x0020 /* ban channel flag */
#define CHFL_OVERLAP (CHFL_CHANOP|CHFL_VOICE)
/* Channel Visibility macros */
#define MODE_CHANOP CHFL_CHANOP
#define MODE_VOICE CHFL_VOICE
#define MODE_PRIVATE 0x0004
#define MODE_SECRET 0x0008
#define MODE_MODERATED 0x0010
#define MODE_TOPICLIMIT 0x0020
#define MODE_INVITEONLY 0x0040
#define MODE_NOPRIVMSGS 0x0080
#define MODE_KEY 0x0100
#define MODE_BAN 0x0200
#define MODE_LIMIT 0x0400
#define MODE_LISTED 0x10000
/*
* mode flags which take another parameter (With PARAmeterS)
*/
#define MODE_WPARAS (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT)
/*
* Undefined here, these are used in conjunction with the above modes in
* the source.
#define MODE_DEL 0x20000000
#define MODE_ADD 0x40000000
*/
#define HoldChannel(x) (!(x))
/* name invisible */
#define SecretChannel(x) ((x) && ((x)->mode.mode & MODE_SECRET))
/* channel not shown but names are */
#define HiddenChannel(x) ((x) && ((x)->mode.mode & MODE_PRIVATE))
/* channel visible */
#define ShowChannel(v,c) (PubChannel(c) || IsMember((v),(c)))
#define PubChannel(x) ((!x) || ((x)->mode.mode &\
(MODE_PRIVATE | MODE_SECRET)) == 0)
#define is_listed(x) ((x)->mode.mode & MODE_LISTED)
#define IsChannelName(name) ((name) && (*(name) == '#' || *(name) == '&'))
/* Misc macros */
#define BadPtr(x) (!(x) || (*(x) == '\0'))
#define isvalid(c) (((c) >= 'A' && (c) <= '~') || isdigit(c) || (c) == '-')
#define MyConnect(x) ((x)->fd >= 0)
#define MyClient(x) (MyConnect(x) && IsClient(x))
#define MyOper(x) (MyConnect(x) && IsOper(x))
#define Protocol(x) ((x)->serv->prot)
#define TStime() (now+TSoffset)
/* String manipulation macros */
/* strncopynt --> strncpyzt to avoid confusion, sematics changed
N must be now the number of bytes in the array --msa */
#define strncpyzt(x, y, N) do{(void)strncpy(x,y,N);x[N-1]='\0';}while(0)
#define StrEq(x,y) (!strcmp((x),(y)))
/* used in SetMode() in channel.c and m_umode() in s_msg.c */
#define MODE_NULL 0
#define MODE_ADD 0x40000000
#define MODE_DEL 0x20000000
/* return values for hunt_server() */
#define HUNTED_NOSUCH (-1) /* if the hunted server is not found */
#define HUNTED_ISME 0 /* if this server should execute the command */
#define HUNTED_PASS 1 /* if message passed onwards successfully */
/* used when sending to #mask or $mask */
#define MATCH_SERVER 1
#define MATCH_HOST 2
/* used for async dns values */
#define ASYNC_NONE (-1)
#define ASYNC_CLIENT 0
#define ASYNC_CONNECT 1
#define ASYNC_CONF 2
#define ASYNC_PING 3
/* This is not used, and as soon as it is, I have to check if
make_server has been called before... --Run
#define ASYNC_SERVER 4
*/
/* misc variable externs */
extern char *version, *infotext[];
extern char *generation, *creation;
extern time_t TSoffset;
/* misc defines */
#define CPTR_KILLED -2
#define UTMP "/etc/utmp"
#define COMMA ","
#define UDP_PORT "7007"
#define MINOR_PROTOCOL "04"
#define MAJOR_PROTOCOL "09"
#define BASE_VERSION "u2.9"
#endif /* __struct_include__ */

114
include/sys.h Normal file
View File

@@ -0,0 +1,114 @@
/************************************************************************
* IRC - Internet Relay Chat, include/sys.h
* Copyright (C) 1990 University of Oulu, Computing Center
*
* 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 1, 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.
*/
#ifndef __sys_include__
#define __sys_include__
#ifdef ISC202
#include <net/errno.h>
#else
#include <sys/errno.h>
#endif
#include "setup.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/param.h>
#ifdef UNISTDH
#include <unistd.h>
#endif
#ifdef STDLIBH
#include <stdlib.h>
#endif
#ifdef STRINGSH
#include <strings.h>
#else
# ifdef STRINGH
# include <string.h>
# endif
#endif
#define strcasecmp mycmp
#define strncasecmp myncmp
#ifdef NOINDEX
#define index strchr
#define rindex strrchr
/*
extern char *index PROTO((char *, char));
extern char *rindex PROTO((char *, char));
*/
#endif
#ifdef AIX
#include <sys/select.h>
#endif
#if defined(HPUX )|| defined(AIX)
#include <time.h>
#ifdef AIX
#include <sys/time.h>
#endif
#else
#include <sys/time.h>
#endif
#if !defined(DEBUGMODE)
#define MyFree(x) if ((x) != NULL) free(x)
#else
#define free(x) MyFree(x)
#endif
#ifdef NEXT
#define VOIDSIG int /* whether signal() returns int of void */
#else
#define VOIDSIG void /* whether signal() returns int of void */
#endif
#ifdef SOL20
#define OPT_TYPE char /* opt type for get/setsockopt */
#else
#define OPT_TYPE void
#endif
/* Different name on NetBSD and FreeBSD --Skip */
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
#define dn_skipname __dn_skipname
#endif
extern VOIDSIG dummy();
#ifdef DYNIXPTX
#define NO_U_TYPES
typedef unsigned short n_short; /* short as received from the net */
typedef unsigned long n_long; /* long as received from the net */
typedef unsigned long n_time; /* ms since 00:00 GMT, byte rev */
#define _NETINET_IN_SYSTM_INCLUDED
#endif
#ifdef NO_U_TYPES
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long u_long;
typedef unsigned int u_int;
#endif
#ifdef USE_VARARGS
#include <varargs.h>
#endif
#endif /* __sys_include__ */

49
include/userload.h Normal file
View File

@@ -0,0 +1,49 @@
/****************************************************************************
* Userload module by Michael L. VanLoon (mlv) <michaelv@iastate.edu>
* Written 2/93. Originally grafted into irc2.7.2g 4/93.
*
* IRC - Internet Relay Chat, ircd/userload.h
* Copyright (C) 1990 University of Oulu, Computing Center
*
* 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 1, 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.
****************************************************************************/
/* This needs to be defined for the counts to be correct--it should be the
* default anyway, as opers shouldn't be superior to lusers except where
* absolutely necessary, and here it isn't necessary. */
#ifndef SHOW_INVISIBLE_LUSERS
#define SHOW_INVISIBLE_LUSERS
#endif
struct current_load_struct {
u_short client_count, local_count, conn_count;
u_long entries;
};
extern struct current_load_struct current_load_data;
struct load_entry {
struct load_entry *prev;
u_short client_count, local_count, conn_count;
long time_incr;
};
extern struct load_entry *load_list_head, *load_list_tail,
*load_free_head, *load_free_tail;
extern void initload PROTO ((void));
extern void update_load PROTO ((void));
extern void calc_load PROTO ((aClient *, char *));

93
include/whowas.h Normal file
View File

@@ -0,0 +1,93 @@
/************************************************************************
* IRC - Internet Relay Chat, include/whowas.h
* Copyright (C) 1990 Markku Savela
*
* 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 1, 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.
*/
/*
* $Id: whowas.h,v 1.1.1.1 1996/05/05 22:25:20 klmitch Exp $
*
* $Log: whowas.h,v $
* Revision 1.1.1.1 1996/05/05 22:25:20 klmitch
* initial entry
*
* Revision 6.1 1991/07/04 21:04:39 gruner
* Revision 2.6.1 [released]
*
* Revision 6.0 1991/07/04 18:05:08 gruner
* frozen beta revision 2.6.1
*
*/
#ifndef __whowas_include__
#define __whowas_include__
#ifndef PROTO
#if __STDC__
# define PROTO(x) x
#else
# define PROTO(x) ()
#endif /* __STDC__ */
#endif /* ! PROTO */
/*
** WHOWAS structure moved here from whowas.c
*/
typedef struct aname {
anUser *ww_user;
aClient *ww_online;
time_t ww_logout;
char ww_nick[NICKLEN+1];
char ww_info[REALLEN+1];
char *ww_server;
} aName;
/*
** add_history
** Add the currently defined name of the client to history.
** usually called before changing to a new name (nick).
** Client must be a fully registered user (specifically,
** the user structure must have been allocated).
*/
void add_history PROTO((aClient *));
/*
** off_history
** This must be called when the client structure is about to
** be released. History mechanism keeps pointers to client
** structures and it must know when they cease to exist. This
** also implicitly calls AddHistory.
*/
void off_history PROTO((aClient *));
/*
** get_history
** Return the current client that was using the given
** nickname within the timelimit. Returns NULL, if no
** one found...
*/
aClient *get_history PROTO((char *, time_t));
/* Nick name */
/* Time limit in seconds */
int m_whowas PROTO((aClient *, aClient *, int, char *[]));
/*
** for debugging...counts related structures stored in whowas array.
*/
void count_whowas_memory PROTO((int *, int *, u_long *));
#endif /* __whowas_include__ */