| 1 |
pippijn |
1.5 |
/** |
| 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 |
pippijn |
1.3 |
* Copyright © 2003-2004 E. Will et al. |
| 10 |
|
|
* Copyright © 2005-2006 Atheme Development Group |
| 11 |
pippijn |
1.2 |
* Rights to this code are as documented in doc/pod/license.pod. |
| 12 |
pippijn |
1.1 |
* |
| 13 |
pippijn |
1.5 |
* $Id: global.h,v 1.4 2007-09-09 20:05:51 pippijn Exp $ |
| 14 |
pippijn |
1.1 |
*/ |
| 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 |
pippijn |
1.3 |
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 |
pippijn |
1.1 |
|
| 52 |
pippijn |
1.3 |
time_t uplinkpong; /* when the uplink last sent a PONG */ |
| 53 |
pippijn |
1.1 |
|
| 54 |
pippijn |
1.3 |
char *execname; /* executable name */ |
| 55 |
pippijn |
1.1 |
|
| 56 |
|
|
int argc; |
| 57 |
|
|
char **argv; |
| 58 |
|
|
|
| 59 |
pippijn |
1.3 |
void init (); |
| 60 |
|
|
void fini (); |
| 61 |
|
|
|
| 62 |
pippijn |
1.1 |
me_t &operator = (const me_t &rhs); |
| 63 |
pippijn |
1.3 |
~me_t () |
| 64 |
|
|
{ |
| 65 |
|
|
fini (); |
| 66 |
|
|
} |
| 67 |
pippijn |
1.1 |
}; |
| 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 |
pippijn |
1.3 |
struct conf_option_t |
| 77 |
pippijn |
1.1 |
{ |
| 78 |
pippijn |
1.3 |
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 |
pippijn |
1.1 |
|
| 85 |
pippijn |
1.3 |
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 |
pippijn |
1.1 |
|
| 90 |
pippijn |
1.3 |
unsigned defuflags; /* default username flags */ |
| 91 |
|
|
unsigned defcflags; /* default channel flags */ |
| 92 |
pippijn |
1.1 |
|
| 93 |
pippijn |
1.3 |
bool raw; /* enable raw/inject? */ |
| 94 |
pippijn |
1.1 |
|
| 95 |
pippijn |
1.3 |
char *global; /* nick for global noticer */ |
| 96 |
|
|
char *languagefile; /* path to language file (if any) */ |
| 97 |
pippijn |
1.1 |
|
| 98 |
pippijn |
1.3 |
bool verbose_wallops; /* verbose wallops? :) */ |
| 99 |
|
|
bool use_privmsg; /* use privmsg instead of notice */ |
| 100 |
pippijn |
1.1 |
|
| 101 |
pippijn |
1.3 |
unsigned default_clone_limit; /* default clone limit */ |
| 102 |
pippijn |
1.1 |
}; |
| 103 |
|
|
|
| 104 |
pippijn |
1.3 |
struct database_t |
| 105 |
pippijn |
1.1 |
{ |
| 106 |
|
|
char *user; |
| 107 |
|
|
char *pass; |
| 108 |
|
|
char *database; |
| 109 |
|
|
char *host; |
| 110 |
pippijn |
1.3 |
unsigned port; |
| 111 |
pippijn |
1.1 |
}; |
| 112 |
|
|
|
| 113 |
|
|
/* keep track of how many of what we have */ |
| 114 |
pippijn |
1.3 |
struct cnt_t |
| 115 |
pippijn |
1.1 |
{ |
| 116 |
pippijn |
1.3 |
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 |
pippijn |
1.1 |
}; |
| 136 |
|
|
|
| 137 |
pippijn |
1.3 |
struct system_state_t |
| 138 |
pippijn |
1.1 |
{ |
| 139 |
pippijn |
1.3 |
unsigned node; |
| 140 |
|
|
unsigned event; |
| 141 |
pippijn |
1.1 |
time_t currtime; |
| 142 |
pippijn |
1.3 |
unsigned maxfd; |
| 143 |
pippijn |
1.1 |
}; |
| 144 |
|
|
|
| 145 |
pippijn |
1.3 |
E system_state_t system_state; |
| 146 |
|
|
E cnt_t cnt; |
| 147 |
|
|
E database_t database_options; |
| 148 |
|
|
E conf_option_t config_options; |
| 149 |
pippijn |
1.1 |
|
| 150 |
pippijn |
1.3 |
#define NOW system_state.currtime |
| 151 |
pippijn |
1.1 |
|
| 152 |
|
|
/* run flags */ |
| 153 |
|
|
E int runflags; |
| 154 |
|
|
|
| 155 |
pippijn |
1.3 |
#define RF_LIVE 0x00000001 /* don't fork */ |
| 156 |
|
|
#define RF_SHUTDOWN 0x00000002 /* shut down */ |
| 157 |
|
|
#define RF_STARTING 0x00000004 /* starting up */ |
| 158 |
|
|
#define RF_RESTART 0x00000008 /* restart */ |
| 159 |
|
|
#define RF_REHASHING 0x00000010 /* rehashing */ |
| 160 |
pippijn |
1.1 |
|
| 161 |
|
|
/* conf.c */ |
| 162 |
|
|
E bool conf_parse (char *); |
| 163 |
|
|
E void conf_init (void); |
| 164 |
|
|
E bool conf_rehash (void); |
| 165 |
|
|
E bool conf_check (void); |
| 166 |
|
|
|
| 167 |
pippijn |
1.3 |
/* confparse.c */ |
| 168 |
pippijn |
1.1 |
E void config_free (config_file_t *cfptr); |
| 169 |
|
|
E config_file_t *config_load (char *filename); |
| 170 |
|
|
E config_entry_t *config_find (config_entry_t *ceptr, char *name); |
| 171 |
|
|
|
| 172 |
|
|
/* node.c */ |
| 173 |
|
|
E void init_nodes (void); |
| 174 |
|
|
/* The following currently only do uplinks -- jilles */ |
| 175 |
|
|
E void mark_all_illegal (void); |
| 176 |
|
|
E void unmark_all_illegal (void); |
| 177 |
|
|
E void remove_illegals (void); |
| 178 |
|
|
|
| 179 |
|
|
/* atheme.c */ |
| 180 |
|
|
E bool cold_start; |
| 181 |
|
|
E char *config_file; |
| 182 |
|
|
|
| 183 |
|
|
/* version.c */ |
| 184 |
pippijn |
1.4 |
E char const website[]; |
| 185 |
pippijn |
1.3 |
E char const generation[]; |
| 186 |
|
|
E char const creation[]; |
| 187 |
|
|
E char const platform[]; |
| 188 |
|
|
E char const version[]; |
| 189 |
|
|
E char const revision[]; |
| 190 |
|
|
E char const osinfo[]; |
| 191 |
|
|
E char const * const infotext[]; |
| 192 |
pippijn |
1.1 |
|
| 193 |
|
|
#endif |