]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/conf.h
Support individual channel keys for pre-defined channels.
[ngircd-alex.git] / src / ngircd / conf.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
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  * Configuration management (header)
12  */
13
14
15 #ifndef __conf_h__
16 #define __conf_h__
17
18 #include <time.h>
19
20 #include "defines.h"
21 #include "array.h"
22 #include "portab.h"
23 #include "tool.h"
24 #include "ng_ipaddr.h"
25 #include "resolve.h"
26 #include "conf-ssl.h"
27
28
29 typedef struct _Conf_Oper
30 {
31         char name[CLIENT_PASS_LEN];     /* Name (ID) of IRC operator */
32         char pwd[CLIENT_PASS_LEN];      /* Password */
33         char *mask;
34 } CONF_OPER;
35
36 typedef struct _Conf_Server
37 {
38         char host[HOST_LEN];            /* Hostname */
39         char name[CLIENT_ID_LEN];       /* IRC-Client-ID */
40         char pwd_in[CLIENT_PASS_LEN];   /* Password which must be received */
41         char pwd_out[CLIENT_PASS_LEN];  /* Password to send to peer */
42         UINT16 port;                    /* Server port */
43         int group;                      /* Group of server */
44         time_t lasttry;                 /* Last connect attempt */
45         RES_STAT res_stat;              /* Status of the resolver */
46         int flags;                      /* Flags */
47         CONN_ID conn_id;                /* ID of server connection or NONE */
48         ng_ipaddr_t bind_addr;          /* source address to use for outgoing
49                                            connections */
50         ng_ipaddr_t dst_addr[2];        /* list of addresses to connect to */
51 #ifdef SSL_SUPPORT
52         bool SSLConnect;                /* connect() using SSL? */
53 #endif
54         char svs_mask[CLIENT_ID_LEN];   /* Mask of nick names that are
55                                            services */
56 } CONF_SERVER;
57
58
59 #ifdef SSL_SUPPORT
60 struct SSLOptions {
61         char *KeyFile;
62         char *CertFile;
63         char *DHFile;
64         array ListenPorts;
65         array KeyFilePassword;
66 };
67 #endif
68
69
70 struct Conf_Channel {
71         char name[CHANNEL_NAME_LEN];    /* Name of the channel */
72         char modes[CHANNEL_MODE_LEN];   /* Initial channel modes */
73         char key[CLIENT_PASS_LEN];      /* Channel key ("password", mode "k" ) */
74         char topic[COMMAND_LEN];        /* Initial topic */
75         char keyfile[512];              /* Path and name of channel key file */
76         unsigned long maxusers;         /* maximum usercount for this channel, mode "l" */
77 };
78
79
80 #define CONF_SFLAG_ONCE 1               /* Delete this entry after next disconnect */
81 #define CONF_SFLAG_DISABLED 2           /* This server configuration entry is disabled */
82
83
84 /* Name ("Nick") of the servers */
85 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
86
87 /* Server info text */
88 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
89
90 /* Global server passwort */
91 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
92
93 /* Administrative information */
94 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
95 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
96 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
97
98 /* File with MOTD text */
99 GLOBAL char Conf_MotdFile[FNAME_LEN];
100
101 /* Phrase with MOTD text */
102 GLOBAL char Conf_MotdPhrase[LINE_LEN];
103
104 /* Ports the server should listen on */
105 GLOBAL array Conf_ListenPorts;
106
107 /* Address to which the socket should be bound or empty (=all) */
108 GLOBAL char *Conf_ListenAddress;
109
110 /* User and group ID the server should run with */
111 GLOBAL uid_t Conf_UID;
112 GLOBAL gid_t Conf_GID;
113
114 /* A directory to chroot() in */
115 GLOBAL char Conf_Chroot[FNAME_LEN];
116
117 /* File with PID of daemon */
118 GLOBAL char Conf_PidFile[FNAME_LEN];
119
120 /* Timeouts for PING and PONG */
121 GLOBAL int Conf_PingTimeout;
122 GLOBAL int Conf_PongTimeout;
123
124 /* Seconds between connect attempts to other servers */
125 GLOBAL int Conf_ConnectRetry;
126
127 /* Operators */
128 GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
129 GLOBAL unsigned int Conf_Oper_Count;
130
131 /* Servers */
132 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
133
134 /* Pre-defined channels */
135 GLOBAL array Conf_Channels;
136
137 /* Pre-defined channels only */
138 GLOBAL bool Conf_PredefChannelsOnly;
139
140 /* Are IRC operators allowed to always use MODE? */
141 GLOBAL bool Conf_OperCanMode;
142
143 /* Disable all DNS functions? */
144 GLOBAL bool Conf_NoDNS;
145
146 /* Disable IDENT lookups, even when compiled with support for it */
147 GLOBAL bool Conf_NoIdent;
148
149 /*
150  * try to connect to remote systems using the ipv6 protocol,
151  * if they have an ipv6 address? (default yes)
152  */
153 GLOBAL bool Conf_ConnectIPv6;
154
155 /* same as above, but for ipv4 hosts, default: yes  */
156 GLOBAL bool Conf_ConnectIPv4;
157
158 /* If an IRC op gives chanop privileges without being a chanop,
159  * ircd2 will ignore the command. This enables a workaround:
160  * It masks the command as coming from the server */
161 GLOBAL bool Conf_OperServerMode;
162
163 /* Maximum number of connections to this server */
164 GLOBAL long Conf_MaxConnections;
165
166 /* Maximum number of channels a user can join */
167 GLOBAL int Conf_MaxJoins;
168
169 /* Maximum number of connections per IP address */
170 GLOBAL int Conf_MaxConnectionsIP;
171
172 /* Maximum length of a nick name */
173 GLOBAL unsigned int Conf_MaxNickLength;
174
175 GLOBAL void Conf_Init PARAMS((void));
176 GLOBAL bool Conf_Rehash PARAMS((void));
177 GLOBAL int Conf_Test PARAMS((void));
178
179 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
180 GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
181 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
182
183 GLOBAL bool Conf_EnableServer PARAMS(( char *Name, UINT16 Port ));
184 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
185 GLOBAL bool Conf_DisableServer PARAMS(( char *Name ));
186 GLOBAL bool Conf_AddServer PARAMS(( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd ));
187
188 GLOBAL bool Conf_IsService PARAMS((int ConfServer, char *Nick));
189
190
191 #endif
192
193
194 /* -eof- */