]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/conf.h
70de20af9edbb6321b739eac123124baa74e5575
[ngircd-alex.git] / src / ngircd / conf.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
4  *
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.
10  */
11
12 #ifndef __conf_h__
13 #define __conf_h__
14
15 /**
16  * @file
17  * Configuration management (header)
18  */
19
20 #include <time.h>
21
22 #include "defines.h"
23 #include "array.h"
24 #include "portab.h"
25 #include "tool.h"
26 #include "ng_ipaddr.h"
27 #include "proc.h"
28 #include "conf-ssl.h"
29
30 /**
31  * Configured IRC operator.
32  * Please note the the name of the IRC operaor and his nick have nothing to
33  * do with each other! The IRC operator is only identified by the name and
34  * password configured in this structure.
35  */
36 struct Conf_Oper {
37         char name[CLIENT_PASS_LEN];     /**< Name (ID) */
38         char pwd[CLIENT_PASS_LEN];      /**< Password */
39         char *mask;                     /**< Allowed host mask */
40 };
41
42 /**
43  * Configured server.
44  * Peers to which this daemon should establish an outgoing server link must
45  * have set a port number; all other servers are allowed to connect to this one.
46  */
47 typedef struct _Conf_Server
48 {
49         char host[HOST_LEN];            /**< Hostname */
50         char name[CLIENT_ID_LEN];       /**< IRC client ID */
51         char pwd_in[CLIENT_PASS_LEN];   /**< Password which must be received */
52         char pwd_out[CLIENT_PASS_LEN];  /**< Password to send to the peer */
53         UINT16 port;                    /**< Server port to connect to */
54         int group;                      /**< Group ID of this server */
55         time_t lasttry;                 /**< Time of last connection attempt */
56         PROC_STAT res_stat;             /**< Status of the resolver */
57         int flags;                      /**< Server flags */
58         CONN_ID conn_id;                /**< ID of server connection or NONE */
59         ng_ipaddr_t bind_addr;          /**< Source address to use for outgoing
60                                              connections */
61         ng_ipaddr_t dst_addr[2];        /**< List of addresses to connect to */
62 #ifdef SSL_SUPPORT
63         bool SSLConnect;                /**< Establish connection using SSL? */
64 #endif
65         char svs_mask[CLIENT_ID_LEN];   /**< Mask of nicknames that should be
66                                              treated and counted as services */
67 } CONF_SERVER;
68
69
70 #ifdef SSL_SUPPORT
71 /** Configuration options required for SSL support */
72 struct SSLOptions {
73         char *KeyFile;                  /**< SSL key file */
74         char *CertFile;                 /**< SSL certificate file */
75         char *DHFile;                   /**< File containing DH parameters */
76         array ListenPorts;              /**< Array of listening SSL ports */
77         array KeyFilePassword;          /**< Key file password */
78         char *CipherList;               /**< Set SSL cipher list to use */
79 };
80 #endif
81
82
83 /** Pre-defined channels */
84 struct Conf_Channel {
85         char name[CHANNEL_NAME_LEN];    /**< Name of the channel */
86         char modes[CHANNEL_MODE_LEN];   /**< Initial channel modes */
87         char key[CLIENT_PASS_LEN];      /**< Channel key ("password", mode "k" ) */
88         char topic[COMMAND_LEN];        /**< Initial topic */
89         char keyfile[512];              /**< Path and name of channel key file */
90         unsigned long maxusers;         /**< User limit for this channel, mode "l" */
91 };
92
93
94 #define CONF_SFLAG_ONCE 1               /* Delete this entry after next disconnect */
95 #define CONF_SFLAG_DISABLED 2           /* This server configuration entry is disabled */
96
97
98 /** Name (ID, "nick") of this server */
99 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
100
101 /** Server info text */
102 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
103
104 /** Global server passwort */
105 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
106
107 /** Administrative information */
108 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
109 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
110 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
111
112 /** Network name (optional, no spaces allowed) */
113 GLOBAL char Conf_Network[CLIENT_INFO_LEN];
114
115 /** Message of the day (MOTD) of this server */
116 GLOBAL array Conf_Motd;
117
118 /** Help text of this server */
119 GLOBAL array Conf_Helptext;
120
121 /** Array of ports this server should listen on */
122 GLOBAL array Conf_ListenPorts;
123
124 /** Address to which sockets should be bound to or empty (=all) */
125 GLOBAL char *Conf_ListenAddress;
126
127 /** User and group ID this daemon should run with */
128 GLOBAL uid_t Conf_UID;
129 GLOBAL gid_t Conf_GID;
130
131 /** The directory to chroot() into */
132 GLOBAL char Conf_Chroot[FNAME_LEN];
133
134 /** Full path and name of a file to which the PID of daemon should be written */
135 GLOBAL char Conf_PidFile[FNAME_LEN];
136
137 /** Timeout (in seconds) for PING commands */
138 GLOBAL int Conf_PingTimeout;
139
140 /** Timeout (in seconds) for PONG replies */
141 GLOBAL int Conf_PongTimeout;
142
143 /** Seconds between connection attempts to other servers */
144 GLOBAL int Conf_ConnectRetry;
145
146 /** Array of configured IRC operators */
147 GLOBAL array Conf_Opers;
148
149 /** Array of configured IRC servers */
150 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
151
152 /** Array of pre-defined channels */
153 GLOBAL array Conf_Channels;
154
155 /** String containing all locally allowed channel prefixes for new channels */
156 GLOBAL char Conf_AllowedChannelTypes[8];
157
158 /** Flag indicating if IRC operators are allowed to always use MODE (true) */
159 GLOBAL bool Conf_OperCanMode;
160
161 /** Flag indicating if IRC operators get AutoOp in persistent (+P) channels */
162 GLOBAL bool Conf_OperChanPAutoOp;
163
164 /**
165  * If true, mask channel MODE commands of IRC operators to the server.
166  * Background: ircd2 will ignore channel MODE commands if an IRC operator
167  * gives channel operator privileges to someone without being a channel operator
168  * himself. This enables a workaround: it masks the MODE command as coming
169  * from the IRC server and not the IRC operator.
170  */
171 GLOBAL bool Conf_OperServerMode;
172
173 /** Flag indicating if remote IRC operators are allowed to manage this server */
174 GLOBAL bool Conf_AllowRemoteOper;
175
176 /** Cloaked hostname of the clients */
177 GLOBAL char Conf_CloakHost[CLIENT_ID_LEN];
178
179 /** Cloaked hostname for clients that did +x */
180 GLOBAL char Conf_CloakHostModeX[CLIENT_ID_LEN];
181
182 /** Salt for hostname hash for cloaked hostnames */
183 GLOBAL char Conf_CloakHostSalt[CLIENT_ID_LEN];
184
185 /** Use nickname as user name? */
186 GLOBAL bool Conf_CloakUserToNick;
187
188 /** Enable all DNS functions? */
189 GLOBAL bool Conf_DNS;
190
191 /** Enable IDENT lookups, even when compiled with support for it */
192 GLOBAL bool Conf_Ident;
193
194 /** Enable "more privacy" mode and "censor" some user-related information */
195 GLOBAL bool Conf_MorePrivacy;
196
197 /** Enable "NOTICE *" messages on connect */
198 GLOBAL bool Conf_NoticeBeforeRegistration;
199
200 /** Enable all usage of PAM, even when compiled with support for it */
201 GLOBAL bool Conf_PAM;
202
203 /** Don't require all clients to send a password an to be PAM authenticated */
204 GLOBAL bool Conf_PAMIsOptional;
205
206 /** Disable all CTCP commands except for /me ? */
207 GLOBAL bool Conf_ScrubCTCP;
208
209 /** Default user modes for new local clients */
210 GLOBAL char Conf_DefaultUserModes[CLIENT_MODE_LEN];
211
212 /*
213  * try to connect to remote systems using the ipv6 protocol,
214  * if they have an ipv6 address? (default yes)
215  */
216 GLOBAL bool Conf_ConnectIPv6;
217
218 /** Try to connect to remote systems using the IPv4 protocol (true) */
219 GLOBAL bool Conf_ConnectIPv4;
220
221 /** Idle timout (seconds), after which the daemon should exit */
222 GLOBAL int Conf_IdleTimeout;
223
224 /** Maximum number of simultaneous connections to this server */
225 GLOBAL int Conf_MaxConnections;
226
227 /** Maximum number of channels a user can join */
228 GLOBAL int Conf_MaxJoins;
229
230 /** Maximum number of connections per IP address */
231 GLOBAL int Conf_MaxConnectionsIP;
232
233 /** Maximum length of a nickname */
234 GLOBAL unsigned int Conf_MaxNickLength;
235
236 /** Maximum number of channels returned to /list */
237 GLOBAL int Conf_MaxListSize;
238
239 #ifndef STRICT_RFC
240
241 /** Require "AUTH PING-PONG" on login */
242 GLOBAL bool Conf_AuthPing;
243
244 #endif
245
246 #ifdef SYSLOG
247
248 /* Syslog "facility" */
249 GLOBAL int Conf_SyslogFacility;
250
251 #endif
252
253 GLOBAL void Conf_Init PARAMS((void));
254 GLOBAL bool Conf_Rehash PARAMS((void));
255 GLOBAL int Conf_Test PARAMS((void));
256
257 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
258 GLOBAL bool Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
259 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
260
261 GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
262 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
263 GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
264 GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
265
266 GLOBAL bool Conf_NickIsService PARAMS((int ConfServer, const char *Nick));
267 GLOBAL bool Conf_NickIsBlocked PARAMS((const char *Nick));
268
269 #ifdef SSL_SUPPORT
270 GLOBAL bool Conf_SSLInUse PARAMS((void));
271 #endif
272
273 /* Password required by WEBIRC command */
274 GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
275
276 #ifdef DEBUG
277 GLOBAL void Conf_DebugDump PARAMS((void));
278 #endif
279
280
281 #endif
282
283
284 /* -eof- */