blob: c46d986cd09d6ffadc6fe29de57fdf6da88b4ee0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#ifndef WRAP_CPP
#define WRAP_CPP
#include "wrap.h"
using namespace std;
//<<*
chat* wrap::CHAT;
#ifdef DATABASE
data* wrap::DATA;
#endif
gcol* wrap::GCOL;
sman* wrap::SMAN;
modl* wrap::MODL;
//*>>
conf* wrap::CONF;
html* wrap::HTML;
#ifdef LOGGING
logd* wrap::LOGD;
#endif
#ifdef NCURSES
ncur* wrap::NCUR;
#endif
sock* wrap::SOCK;
stats* wrap::STAT;
timr* wrap::TIMR;
pool* wrap::POOL;
dynamic_wrap* wrap::WRAP;
void
wrap::system_message( string s_message )
{
#ifdef NCURSES
NCUR->print( s_message );
#endif
#ifdef SERVMSG
cout << s_message << endl;
#endif
#ifdef LOGGING
LOGD->log_simple_line( s_message + "\n" );
#endif
}
void
wrap::init_wrapper(map<string,string>* p_start_params)
{
// Init the dynamic wrapper (is needed to pass all wrapped objects through a single pointer).
WRAP = new dynamic_wrap;
// Init the config manager.
WRAP->CONF = CONF = new conf( CONFILE, p_start_params );
delete p_start_params,
// Init the statistic manager.
WRAP->STAT = STAT = new stats;
// Init the html-template manager.
WRAP->HTML = HTML = new html;
#ifdef LOGGING
// Init the system message logd
WRAP->LOGD = LOGD = new logd( CONF->get_elem("httpd.logging.systemfile"),
CONF->get_elem("httpd.logging.systemlines") );
#endif
//<<*
// Init the session manager.
WRAP->SMAN = SMAN = new sman;
//*>>
#ifdef NCURSES
WRAP->NCUR = NCUR = new ncur; // init the ncurses admin interface.
NCUR->run(); // run the thread
// Wait until ncurses interface has been initialized.
do {
usleep(1000);
} while ( ! NCUR->is_ready() );
HTML->print_cached(0);
#else
#ifdef CLI
cli* p_cli = new cli;
p_cli->run();
#endif
#endif
// Init the thread pool
WRAP->POOL = POOL = new pool;
// Init the socket manager.
WRAP->SOCK = SOCK = new sock;
//<<*
// Init the chat manager.
WRAP->CHAT = CHAT = new chat;
//*>>
// Init the system timer.
WRAP->TIMR = TIMR = new timr;
//<<*
// Init the module-loader manager.
WRAP->MODL = MODL = new modl;
// Init the garbage collector
WRAP->GCOL = GCOL = new gcol;
// Init the data manager.
#ifdef DATABASE
WRAP->DATA = DATA = new data;
#endif
//*>>
// Run threads
TIMR->run();
}
#endif
|