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