diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:46 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:46 +0200 |
| commit | 56187184e11b085b82584d3b088c62f427aae83c (patch) | |
| tree | 8f8387e750a62581966900a42dade265d34c3146 /src/wrap.cpp | |
| parent | d3a0d11f93c1ebe38b4301c9bef952bfd24d01a1 (diff) | |
tagging yhttpd-0.7.1yhttpd-0.7.1
Diffstat (limited to 'src/wrap.cpp')
| -rwxr-xr-x | src/wrap.cpp | 143 |
1 files changed, 12 insertions, 131 deletions
diff --git a/src/wrap.cpp b/src/wrap.cpp index e071cc9..81c6679 100755 --- a/src/wrap.cpp +++ b/src/wrap.cpp @@ -5,147 +5,28 @@ using namespace std; -//<<* -chat* wrap::CHAT = NULL; -#ifdef DATABASE -data* wrap::DATA = NULL; -#endif -gcol* wrap::GCOL = NULL; -sman* wrap::SMAN = NULL; -modl* wrap::MODL = NULL; -//*>> -conf* wrap::CONF = NULL; -html* wrap::HTML = NULL; -#ifdef LOGGING -logd* wrap::LOGD = NULL; -#endif +conf* wrap::CONF; +html* wrap::HTML; +logd* wrap::LOGD; +modl* wrap::MODL; #ifdef NCURSES -ncur* wrap::NCUR = NULL; +ncur* wrap::NCUR; #endif -sock* wrap::SOCK = NULL; -stats* wrap::STAT = NULL; -timr* wrap::TIMR = NULL; -pool* wrap::POOL = NULL; -dynamic_wrap* wrap::WRAP = NULL; +sock* wrap::SOCK; +stats* wrap::STAT; +timr* wrap::TIMR; +dynamic_wrap* wrap::WRAP; void wrap::system_message( string s_message ) { #ifdef NCURSES - if(NCUR) - { - NCUR->print( s_message ); - } - - else - { - cout << s_message << endl; - } + wrap::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_main_loop_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_main_loop_params ); - delete p_main_loop_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; - //*>> - // Init the socket manager. - int i_port = tool::string2int( wrap::CONF->get_elem( "httpd.serverport" ) ); - -#ifndef OPENSSL - - WRAP->SOCK = SOCK = new sock; -#else - - WRAP->SOCK = SOCK = new sslsock; -#endif - - // create the server socket and set it up to accept connections. - if(SOCK->_make_server_socket ( i_port ) <= 0) - { - system_message(SOCKER1); - exit(-1); - } - -#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 + cout << s_message << endl; #endif - - // Init the thread pool - WRAP->POOL = POOL = new pool; - - //<<* - // 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(); + wrap::LOGD->log_simple_line( s_message + "\n" ); } - #endif |
