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