2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * Please read the file COPYING, README and AUTHORS for more information.
11 * $Id: conf.h,v 1.42 2006/12/29 14:09:50 fw Exp $
13 * Configuration management (header)
26 typedef struct _Conf_Oper
28 char name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */
29 char pwd[CLIENT_PASS_LEN]; /* Password */
33 typedef struct _Conf_Server
35 char host[HOST_LEN]; /* Hostname */
36 char ip[16]; /* IP address (Resolver) */
37 char name[CLIENT_ID_LEN]; /* IRC-Client-ID */
38 char pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */
39 char pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */
40 UINT16 port; /* Server port */
41 int group; /* Group of server */
42 time_t lasttry; /* Last connect attempt */
43 RES_STAT res_stat; /* Status of the resolver */
44 int flags; /* Flags */
45 CONN_ID conn_id; /* ID of server connection or NONE */
48 typedef struct _Conf_Channel
50 char name[CHANNEL_NAME_LEN]; /* Name of the channel */
51 char modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
52 char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
53 unsigned long maxusers; /* maximum usercount for this channel, mode "l" */
54 array topic; /* Initial topic */
58 #define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
59 #define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
62 /* Name ("Nick") of the servers */
63 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
65 /* Server info text */
66 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
68 /* Global server passwort */
69 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
71 /* Administrative information */
72 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
73 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
74 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
76 /* File with MOTD text */
77 GLOBAL char Conf_MotdFile[FNAME_LEN];
79 /* Phrase with MOTD text */
80 GLOBAL char Conf_MotdPhrase[LINE_LEN];
82 /* Ports the server should listen on */
83 GLOBAL array Conf_ListenPorts;
85 /* Address to which the socket should be bound or empty (=all) */
86 GLOBAL char Conf_ListenAddress[16];
88 /* User and group ID the server should run with */
89 GLOBAL uid_t Conf_UID;
90 GLOBAL gid_t Conf_GID;
92 /* A directory to chroot() in */
93 GLOBAL char Conf_Chroot[FNAME_LEN];
95 /* File with PID of daemon */
96 GLOBAL char Conf_PidFile[FNAME_LEN];
98 /* Timeouts for PING and PONG */
99 GLOBAL int Conf_PingTimeout;
100 GLOBAL int Conf_PongTimeout;
102 /* Seconds between connect attempts to other servers */
103 GLOBAL int Conf_ConnectRetry;
106 GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
107 GLOBAL unsigned int Conf_Oper_Count;
110 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
112 /* Pre-defined channels */
113 GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
114 GLOBAL unsigned int Conf_Channel_Count;
115 /* Pre-defined channels only */
116 GLOBAL bool Conf_PredefChannelsOnly;
118 /* Are IRC operators allowed to always use MODE? */
119 GLOBAL bool Conf_OperCanMode;
121 /* If an IRC op gives chanop privileges without being a chanop,
122 * ircd2 will ignore the command. This enables a workaround:
123 * It masks the command as coming from the server */
124 GLOBAL bool Conf_OperServerMode;
126 /* Maximum number of connections to this server */
127 GLOBAL long Conf_MaxConnections;
129 /* Maximum number of channels a user can join */
130 GLOBAL int Conf_MaxJoins;
132 /* Maximum number of connections per IP address */
133 GLOBAL int Conf_MaxConnectionsIP;
136 GLOBAL void Conf_Init PARAMS((void));
137 GLOBAL void Conf_Rehash PARAMS((void));
138 GLOBAL int Conf_Test PARAMS((void));
140 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
141 GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
142 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
144 GLOBAL bool Conf_EnableServer PARAMS(( char *Name, UINT16 Port ));
145 GLOBAL bool Conf_DisableServer PARAMS(( char *Name ));
146 GLOBAL bool Conf_AddServer PARAMS(( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd ));