/* * Copyright © 2003-2004 E. Will et al. * Copyright © 2005-2006 Atheme Development Group * Rights to this code are as documented in doc/pod/license.pod. * * Global data * * $Id: global.h,v 1.4 2007/09/09 20:05:51 pippijn Exp $ */ #ifndef _GLOBAL_H #define _GLOBAL_H /* me, a struct containing basic configuration options and some dynamic * information about our uplink and program state */ struct me_t { char *name; /* server's name on IRC */ char *desc; /* server's description */ char *actual; /* the reported name of the uplink */ char *vhost; /* IP we bind outgoing stuff to */ unsigned recontime; /* time between reconnection attempts */ unsigned restarttime; /* time before restarting */ char *netname; /* IRC network name */ char *hidehostsuffix; /* host suffix for P10 +x etc */ char *adminname; /* SRA's name (for ADMIN) */ char *adminemail; /* SRA's email (for ADMIN */ char *mta; /* path to mta program */ char *numeric; /* server numeric */ int maxfd; /* how many fds do we have? */ unsigned mdlimit; /* metadata entry limit */ time_t start; /* starting time */ server_t *me; /* pointer to our server struct */ bool connected; /* are we connected? */ bool bursting; /* are we bursting? */ bool recvsvr; /* received server peer */ unsigned maxlogins; /* maximum logins per username */ unsigned maxusers; /* maximum usernames from one email */ unsigned maxnicks; /* maximum nicks from one username */ unsigned maxchans; /* maximum chans from one username */ unsigned auth; /* registration auth type */ unsigned emaillimit; /* maximum number of emails sent */ time_t emailtime; /* ... in this amount of time */ time_t uplinkpong; /* when the uplink last sent a PONG */ char *execname; /* executable name */ int argc; char **argv; void init (); void fini (); me_t &operator = (const me_t &rhs); ~me_t () { fini (); } }; E me_t me; /* values for me.auth */ #define AUTH_NONE 0 #define AUTH_EMAIL 1 /* config_options, a struct containing other global configuration options */ struct conf_option_t { char *chan; /* channel we join/msg */ unsigned flood_msgs; /* messages determining flood */ time_t flood_time; /* time determining flood */ time_t kline_time; /* default expire for klines */ unsigned commit_interval; /* interval between commits */ bool silent; /* stop sending WALLOPS? */ bool join_chans; /* join registered channels? */ bool leave_chans; /* leave channels when empty? */ bool secure; /* require /msg @host? */ unsigned defuflags; /* default username flags */ unsigned defcflags; /* default channel flags */ bool raw; /* enable raw/inject? */ char *global; /* nick for global noticer */ char *languagefile; /* path to language file (if any) */ bool verbose_wallops; /* verbose wallops? :) */ bool use_privmsg; /* use privmsg instead of notice */ unsigned default_clone_limit; /* default clone limit */ }; struct database_t { char *user; char *pass; char *database; char *host; unsigned port; }; /* keep track of how many of what we have */ struct cnt_t { unsigned event; unsigned soper; unsigned svsignore; unsigned tld; unsigned kline; unsigned server; unsigned user; unsigned chan; unsigned chanuser; unsigned myuser; unsigned mynick; unsigned mychan; unsigned chanacs; unsigned node; unsigned bin; unsigned bout; unsigned uplink; unsigned operclass; unsigned myuser_access; }; struct system_state_t { unsigned node; unsigned event; time_t currtime; unsigned maxfd; }; E system_state_t system_state; E cnt_t cnt; E database_t database_options; E conf_option_t config_options; #define NOW system_state.currtime /* run flags */ E int runflags; #define RF_LIVE 0x00000001 /* don't fork */ #define RF_SHUTDOWN 0x00000002 /* shut down */ #define RF_STARTING 0x00000004 /* starting up */ #define RF_RESTART 0x00000008 /* restart */ #define RF_REHASHING 0x00000010 /* rehashing */ /* conf.c */ E bool conf_parse (char *); E void conf_init (void); E bool conf_rehash (void); E bool conf_check (void); /* confparse.c */ E void config_free (config_file_t *cfptr); E config_file_t *config_load (char *filename); E config_entry_t *config_find (config_entry_t *ceptr, char *name); /* node.c */ E void init_nodes (void); /* The following currently only do uplinks -- jilles */ E void mark_all_illegal (void); E void unmark_all_illegal (void); E void remove_illegals (void); /* atheme.c */ E bool cold_start; E char *config_file; /* version.c */ E char const website[]; E char const generation[]; E char const creation[]; E char const platform[]; E char const version[]; E char const revision[]; E char const osinfo[]; E char const * const infotext[]; #endif