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.49 2008/03/18 20:12:47 fw Exp $
13 * Configuration management (header)
26 #include "ng_ipaddr.h"
28 typedef struct _Conf_Oper
30 char name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */
31 char pwd[CLIENT_PASS_LEN]; /* Password */
35 typedef struct _Conf_Server
37 char host[HOST_LEN]; /* Hostname */
38 char name[CLIENT_ID_LEN]; /* IRC-Client-ID */
39 char pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */
40 char pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */
41 UINT16 port; /* Server port */
42 int group; /* Group of server */
43 time_t lasttry; /* Last connect attempt */
44 RES_STAT res_stat; /* Status of the resolver */
45 int flags; /* Flags */
46 CONN_ID conn_id; /* ID of server connection or NONE */
47 ng_ipaddr_t bind_addr; /* source address to use for outgoing connections */
48 ng_ipaddr_t dst_addr[2]; /* list of addresses to connect to */
51 typedef struct _Conf_Channel
53 char name[CHANNEL_NAME_LEN]; /* Name of the channel */
54 char modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
55 char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
56 unsigned long maxusers; /* maximum usercount for this channel, mode "l" */
57 array topic; /* Initial topic */
61 #define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
62 #define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
65 /* Name ("Nick") of the servers */
66 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
68 /* Server info text */
69 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
71 /* Global server passwort */
72 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
74 /* Administrative information */
75 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
76 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
77 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
79 /* File with MOTD text */
80 GLOBAL char Conf_MotdFile[FNAME_LEN];
82 /* Phrase with MOTD text */
83 GLOBAL char Conf_MotdPhrase[LINE_LEN];
85 /* Ports the server should listen on */
86 GLOBAL array Conf_ListenPorts;
88 /* Address to which the socket should be bound or empty (=all) */
89 GLOBAL char Conf_ListenAddress[16];
91 /* User and group ID the server should run with */
92 GLOBAL uid_t Conf_UID;
93 GLOBAL gid_t Conf_GID;
95 /* A directory to chroot() in */
96 GLOBAL char Conf_Chroot[FNAME_LEN];
98 /* File with PID of daemon */
99 GLOBAL char Conf_PidFile[FNAME_LEN];
101 /* Timeouts for PING and PONG */
102 GLOBAL int Conf_PingTimeout;
103 GLOBAL int Conf_PongTimeout;
105 /* Seconds between connect attempts to other servers */
106 GLOBAL int Conf_ConnectRetry;
109 GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
110 GLOBAL unsigned int Conf_Oper_Count;
113 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
115 /* Pre-defined channels */
116 GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
117 GLOBAL unsigned int Conf_Channel_Count;
118 /* Pre-defined channels only */
119 GLOBAL bool Conf_PredefChannelsOnly;
121 /* Are IRC operators allowed to always use MODE? */
122 GLOBAL bool Conf_OperCanMode;
124 /* Disable all DNS functions? */
125 GLOBAL bool Conf_NoDNS;
127 /* listen for incoming ipv6 connections if OS supports it (default: yes)? */
128 GLOBAL bool Conf_ListenIPv6;
130 /* listen for incoming ipv4 connections if OS supports it (default: yes)? */
131 GLOBAL bool Conf_ListenIPv4;
134 * try to connect to remote systems using the ipv6 protocol,
135 * if they have an ipv6 address? (default yes)
137 GLOBAL bool Conf_ConnectIPv6;
139 /* same as above, but for ipv4 hosts, default: yes */
140 GLOBAL bool Conf_ConnectIPv4;
142 /* If an IRC op gives chanop privileges without being a chanop,
143 * ircd2 will ignore the command. This enables a workaround:
144 * It masks the command as coming from the server */
145 GLOBAL bool Conf_OperServerMode;
147 /* Maximum number of connections to this server */
148 GLOBAL long Conf_MaxConnections;
150 /* Maximum number of channels a user can join */
151 GLOBAL int Conf_MaxJoins;
153 /* Maximum number of connections per IP address */
154 GLOBAL int Conf_MaxConnectionsIP;
156 /* Maximum length of a nick name */
157 GLOBAL unsigned int Conf_MaxNickLength;
159 GLOBAL void Conf_Init PARAMS((void));
160 GLOBAL bool Conf_Rehash PARAMS((void));
161 GLOBAL int Conf_Test PARAMS((void));
163 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
164 GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
165 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
167 GLOBAL bool Conf_EnableServer PARAMS(( char *Name, UINT16 Port ));
168 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
169 GLOBAL bool Conf_DisableServer PARAMS(( char *Name ));
170 GLOBAL bool Conf_AddServer PARAMS(( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd ));