1 |
/** |
2 |
* global.h: Global data |
3 |
* |
4 |
* Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
5 |
* Rights to this code are as documented in COPYING. |
6 |
* |
7 |
* |
8 |
* Portions of this file were derived from sources bearing the following license: |
9 |
* Copyright © 2003-2004 E. Will et al. |
10 |
* Copyright © 2005-2006 Atheme Development Group |
11 |
* Rights to this code are as documented in doc/pod/license.pod. |
12 |
* |
13 |
* $Id: global.h,v 1.5 2007-09-16 18:54:42 pippijn Exp $ |
14 |
*/ |
15 |
|
16 |
#ifndef _GLOBAL_H |
17 |
#define _GLOBAL_H |
18 |
|
19 |
/* me, a struct containing basic configuration options and some dynamic |
20 |
* information about our uplink and program state */ |
21 |
struct me_t |
22 |
{ |
23 |
char *name; /* server's name on IRC */ |
24 |
char *desc; /* server's description */ |
25 |
char *actual; /* the reported name of the uplink */ |
26 |
char *vhost; /* IP we bind outgoing stuff to */ |
27 |
unsigned recontime; /* time between reconnection attempts */ |
28 |
unsigned restarttime; /* time before restarting */ |
29 |
char *netname; /* IRC network name */ |
30 |
char *hidehostsuffix; /* host suffix for P10 +x etc */ |
31 |
char *adminname; /* SRA's name (for ADMIN) */ |
32 |
char *adminemail; /* SRA's email (for ADMIN */ |
33 |
char *mta; /* path to mta program */ |
34 |
char *numeric; /* server numeric */ |
35 |
|
36 |
int maxfd; /* how many fds do we have? */ |
37 |
unsigned mdlimit; /* metadata entry limit */ |
38 |
time_t start; /* starting time */ |
39 |
server_t *me; /* pointer to our server struct */ |
40 |
bool connected; /* are we connected? */ |
41 |
bool bursting; /* are we bursting? */ |
42 |
bool recvsvr; /* received server peer */ |
43 |
|
44 |
unsigned maxlogins; /* maximum logins per username */ |
45 |
unsigned maxusers; /* maximum usernames from one email */ |
46 |
unsigned maxnicks; /* maximum nicks from one username */ |
47 |
unsigned maxchans; /* maximum chans from one username */ |
48 |
unsigned auth; /* registration auth type */ |
49 |
unsigned emaillimit; /* maximum number of emails sent */ |
50 |
time_t emailtime; /* ... in this amount of time */ |
51 |
|
52 |
time_t uplinkpong; /* when the uplink last sent a PONG */ |
53 |
|
54 |
char *execname; /* executable name */ |
55 |
|
56 |
int argc; |
57 |
char **argv; |
58 |
|
59 |
void init (); |
60 |
void cleanup (); |
61 |
|
62 |
me_t &operator = (const me_t &rhs); |
63 |
~me_t () |
64 |
{ |
65 |
cleanup (); |
66 |
} |
67 |
}; |
68 |
|
69 |
E me_t me; |
70 |
|
71 |
/* values for me.auth */ |
72 |
#define AUTH_NONE 0 |
73 |
#define AUTH_EMAIL 1 |
74 |
|
75 |
/* config_options, a struct containing other global configuration options */ |
76 |
struct conf_option_t |
77 |
{ |
78 |
char *chan; /* channel we join/msg */ |
79 |
|
80 |
unsigned flood_msgs; /* messages determining flood */ |
81 |
time_t flood_time; /* time determining flood */ |
82 |
time_t kline_time; /* default expire for klines */ |
83 |
unsigned commit_interval; /* interval between commits */ |
84 |
|
85 |
bool silent; /* stop sending WALLOPS? */ |
86 |
bool join_chans; /* join registered channels? */ |
87 |
bool leave_chans; /* leave channels when empty? */ |
88 |
bool secure; /* require /msg <service>@host? */ |
89 |
|
90 |
unsigned defuflags; /* default username flags */ |
91 |
unsigned defcflags; /* default channel flags */ |
92 |
|
93 |
bool raw; /* enable raw/inject? */ |
94 |
|
95 |
char *global; /* nick for global noticer */ |
96 |
char *languagefile; /* path to language file (if any) */ |
97 |
|
98 |
bool verbose_wallops; /* verbose wallops? :) */ |
99 |
bool use_privmsg; /* use privmsg instead of notice */ |
100 |
|
101 |
unsigned default_clone_limit; /* default clone limit */ |
102 |
}; |
103 |
|
104 |
struct database_t |
105 |
{ |
106 |
char *user; |
107 |
char *pass; |
108 |
char *database; |
109 |
char *host; |
110 |
unsigned port; |
111 |
}; |
112 |
|
113 |
/* keep track of how many of what we have */ |
114 |
struct cnt_t |
115 |
{ |
116 |
unsigned event; |
117 |
unsigned soper; |
118 |
unsigned svsignore; |
119 |
unsigned tld; |
120 |
unsigned kline; |
121 |
unsigned server; |
122 |
unsigned user; |
123 |
unsigned chan; |
124 |
unsigned chanuser; |
125 |
unsigned myuser; |
126 |
unsigned mynick; |
127 |
unsigned mychan; |
128 |
unsigned chanacs; |
129 |
unsigned node; |
130 |
unsigned bin; |
131 |
unsigned bout; |
132 |
unsigned uplink; |
133 |
unsigned operclass; |
134 |
unsigned myuser_access; |
135 |
}; |
136 |
|
137 |
E cnt_t cnt; |
138 |
E database_t database_options; |
139 |
E conf_option_t config_options; |
140 |
|
141 |
/* run flags */ |
142 |
E int runflags; |
143 |
|
144 |
#define RF_LIVE 0x00000001 /* don't fork */ |
145 |
#define RF_SHUTDOWN 0x00000002 /* shut down */ |
146 |
#define RF_STARTING 0x00000004 /* starting up */ |
147 |
#define RF_RESTART 0x00000008 /* restart */ |
148 |
#define RF_REHASHING 0x00000010 /* rehashing */ |
149 |
|
150 |
/* conf.c */ |
151 |
E bool conf_parse (char *); |
152 |
E void conf_init (void); |
153 |
E bool conf_rehash (void); |
154 |
E bool conf_check (void); |
155 |
|
156 |
/* confparse.c */ |
157 |
E void config_free (config_file_t *cfptr); |
158 |
E config_file_t *config_load (char *filename); |
159 |
E config_entry_t *config_find (config_entry_t *ceptr, char *name); |
160 |
|
161 |
/* node.c */ |
162 |
E void init_nodes (void); |
163 |
/* The following currently only do uplinks -- jilles */ |
164 |
E void mark_all_illegal (void); |
165 |
E void unmark_all_illegal (void); |
166 |
E void remove_illegals (void); |
167 |
|
168 |
/* atheme.c */ |
169 |
E bool cold_start; |
170 |
E char *config_file; |
171 |
|
172 |
/* version.c */ |
173 |
E char const website[]; |
174 |
E char const generation[]; |
175 |
E char const creation[]; |
176 |
E char const platform[]; |
177 |
E char const version[]; |
178 |
E char const revision[]; |
179 |
E char const osinfo[]; |
180 |
E char const * const infotext[]; |
181 |
|
182 |
#endif |