1 |
pippijn |
1.1 |
/* |
2 |
|
|
* Copyright © 2005-2007 Atheme Development Group. |
3 |
pippijn |
1.2 |
* Rights to this code are documented in doc/pod/license.pod. |
4 |
pippijn |
1.1 |
* |
5 |
|
|
* Global objects. |
6 |
|
|
*/ |
7 |
|
|
|
8 |
pippijn |
1.4 |
static char const rcsid[] = "$Id: global.C,v 1.3 2007-07-21 13:23:21 pippijn Exp $"; |
9 |
pippijn |
1.1 |
|
10 |
|
|
#include "atheme.h" |
11 |
pippijn |
1.4 |
#include <ermyth/crypto.h> |
12 |
|
|
#include <ermyth/database.h> |
13 |
pippijn |
1.1 |
#include "uplink.h" |
14 |
|
|
#include "internal.h" |
15 |
|
|
#include "datastream.h" |
16 |
|
|
#include "authcookie.h" |
17 |
|
|
|
18 |
pippijn |
1.4 |
protocol::handler *phandler; |
19 |
|
|
database::handler *backend; |
20 |
|
|
crypto::handler *crypter; |
21 |
|
|
|
22 |
pippijn |
1.1 |
chansvs_t chansvs; |
23 |
|
|
globsvs_t globsvs; |
24 |
|
|
opersvs_t opersvs; |
25 |
|
|
memosvs_t memosvs; |
26 |
|
|
nicksvs_t nicksvs; |
27 |
|
|
saslsvs_t saslsvs; |
28 |
|
|
gamesvs_t gamesvs; |
29 |
|
|
|
30 |
|
|
me_t me; |
31 |
pippijn |
1.4 |
cnt_t cnt; |
32 |
pippijn |
1.1 |
|
33 |
|
|
/* XXX */ |
34 |
pippijn |
1.4 |
conf_option_t config_options; |
35 |
|
|
database_t database_options; |
36 |
|
|
system_state_t system_state; |
37 |
pippijn |
1.1 |
int runflags; |
38 |
|
|
|
39 |
|
|
char *config_file; |
40 |
|
|
char *log_path; |
41 |
|
|
bool cold_start = false; |
42 |
pippijn |
1.4 |
bool database::handler::loaded = false; |
43 |
pippijn |
1.1 |
|
44 |
pippijn |
1.4 |
void |
45 |
|
|
me_t::init () |
46 |
|
|
{ |
47 |
|
|
if (netname) |
48 |
|
|
sfree (netname); |
49 |
|
|
if (hidehostsuffix) |
50 |
|
|
sfree (hidehostsuffix); |
51 |
|
|
if (adminname) |
52 |
|
|
sfree (adminname); |
53 |
|
|
if (adminemail) |
54 |
|
|
sfree (adminemail); |
55 |
|
|
if (mta) |
56 |
|
|
sfree (mta); |
57 |
|
|
|
58 |
|
|
netname |
59 |
|
|
= hidehostsuffix |
60 |
|
|
= adminname |
61 |
|
|
= adminemail |
62 |
|
|
= mta |
63 |
|
|
= NULL; |
64 |
|
|
|
65 |
|
|
recontime |
66 |
|
|
= restarttime |
67 |
|
|
= maxlogins |
68 |
|
|
= maxusers |
69 |
|
|
= maxnicks |
70 |
|
|
= maxchans |
71 |
|
|
= emaillimit |
72 |
|
|
= emailtime |
73 |
|
|
= 0; |
74 |
|
|
} |
75 |
pippijn |
1.1 |
|
76 |
pippijn |
1.4 |
void |
77 |
|
|
me_t::fini () |
78 |
|
|
{ |
79 |
|
|
sfree (netname); |
80 |
|
|
sfree (hidehostsuffix); |
81 |
|
|
sfree (adminname); |
82 |
|
|
sfree (adminemail); |
83 |
|
|
if (mta != NULL) |
84 |
|
|
sfree (mta); |
85 |
|
|
} |
86 |
pippijn |
1.1 |
|
87 |
|
|
me_t & |
88 |
|
|
me_t::operator = (const me_t &rhs) |
89 |
|
|
{ |
90 |
|
|
recontime = rhs.recontime; |
91 |
|
|
restarttime = rhs.restarttime; |
92 |
|
|
netname = sstrdup (rhs.netname); |
93 |
|
|
hidehostsuffix = sstrdup (rhs.hidehostsuffix); |
94 |
|
|
adminname = sstrdup (rhs.adminname); |
95 |
|
|
adminemail = sstrdup (rhs.adminemail); |
96 |
|
|
mta = rhs.mta ? sstrdup (rhs.mta) : NULL; |
97 |
|
|
maxlogins = rhs.maxlogins; |
98 |
|
|
maxusers = rhs.maxusers; |
99 |
|
|
maxnicks = rhs.maxnicks; |
100 |
|
|
maxchans = rhs.maxchans; |
101 |
|
|
emaillimit = rhs.emaillimit; |
102 |
|
|
emailtime = rhs.emailtime; |
103 |
|
|
auth = rhs.auth; |
104 |
|
|
|
105 |
|
|
return *this; |
106 |
|
|
} |
107 |
|
|
|
108 |
pippijn |
1.4 |
static void noop_delete (void *) throw (balloc_exception) __attribute__ ((__noreturn__)); |
109 |
|
|
static void |
110 |
|
|
noop_delete (void *) |
111 |
|
|
throw (balloc_exception) |
112 |
pippijn |
1.1 |
{ |
113 |
pippijn |
1.4 |
// We should never reach here |
114 |
|
|
throw balloc_exception (SRCINF, "Balloc has no deallocator"); |
115 |
pippijn |
1.1 |
} |
116 |
|
|
|
117 |
pippijn |
1.4 |
static void noop_delete (void *, size_t) throw (balloc_exception) __attribute__ ((__noreturn__)); |
118 |
|
|
static void |
119 |
|
|
noop_delete (void *, size_t) |
120 |
|
|
throw (balloc_exception) |
121 |
pippijn |
1.1 |
{ |
122 |
pippijn |
1.4 |
// We should never reach here |
123 |
|
|
throw balloc_exception (SRCINF, "Balloc has no deallocator"); |
124 |
pippijn |
1.1 |
} |
125 |
pippijn |
1.4 |
|
126 |
|
|
void (*NullDealloc) (void *) = &noop_delete; |
127 |
|
|
void (*NullNDealloc) (void *, size_t) = &noop_delete; |