X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=main.c;h=6e912077f442af350c0459f42cd6403a84d244f5;hp=1aa2d8b232a12b569cac53e41fdef9b6e531bc02;hb=2106a9212ce6610b01f7019d5acf92ee1af5c8d8;hpb=da91d7d85fe092122e35ece52695f98345738359 diff --git a/main.c b/main.c index 1aa2d8b..6e91207 100644 --- a/main.c +++ b/main.c @@ -10,12 +10,10 @@ \*****************************************************************************/ #include "main.h" -#include "config.h" -#ifdef WITH_GSM_MS -extern "C" { -#include -} +#ifdef PACKAGE_VERSION +#undef PACKAGE_VERSION #endif +#include "config.h" //MESSAGES @@ -86,6 +84,7 @@ void debug(const char *function, int line, const char *prefix, char *buffer) fprintf(debug_fp, "%s%s(in %s() line %d): %s", prefix?prefix:"", prefix?" ":"", function, line, buffer); else fprintf(debug_fp, "%s%s: %s", prefix?prefix:"", prefix?" ":"", buffer); + fflush(debug_fp); } } @@ -143,9 +142,6 @@ void _printerror(const char *function, int line, const char *fmt, ...) void sighandler(int sigset) { struct sched_param schedp; -#ifdef WITH_GSM_MS - int wait_ms = 0; -#endif if (sigset == SIGHUP) return; @@ -153,13 +149,6 @@ void sighandler(int sigset) return; fprintf(stderr, "LCR: Signal received: %d\n", sigset); PDEBUG(DEBUG_LOG, "Signal received: %d\n", sigset); -#ifdef WITH_GSM_MS - if (!wait_ms) { - wait_ms = 1; - dispatch_signal(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL); - return; - } -#endif if (!quit) { quit = sigset; /* set scheduler & priority */ @@ -177,7 +166,7 @@ void sighandler(int sigset) */ int main(int argc, char *argv[]) { -#if defined WITH_GSM_BS || defined WITH_GSM_MS +#if 0 double now_d, last_d; int all_idle; #endif @@ -380,24 +369,22 @@ int main(int argc, char *argv[]) #if defined WITH_GSM_BS || defined WITH_GSM_MS /* init gsm */ - if (options.gsm && gsm_init()) { + if (gsm_init()) { fprintf(stderr, "GSM initialization failed.\n"); goto free; } -#else - if (options.gsm) { - fprintf(stderr, "GSM is enabled, but not compiled. Use --with-gsm-bs or --with-gsm-ms while configure!\n"); - goto free; - } #endif +#if 0 +init is done when interface is up #ifdef WITH_GSM_BS - if (options.gsm && gsm_bs_init()) { + if (gsm_bs_init()) { fprintf(stderr, "GSM BS initialization failed.\n"); goto free; } #endif +#endif #ifdef WITH_GSM_MS - if (options.gsm && gsm_ms_init()) { + if (gsm_ms_init()) { fprintf(stderr, "GSM MS initialization failed.\n"); goto free; } @@ -464,11 +451,11 @@ int main(int argc, char *argv[]) printf("%s\n", tracetext); end_trace(); quit = 0; -#if defined WITH_GSM_BS || defined WITH_GSM_MS +#if 0 GET_NOW(); #endif while(!quit) { -#if defined WITH_GSM_BS || defined WITH_GSM_MS +#if 0 last_d = now_d; GET_NOW(); if (now_d-last_d > 1.0) { @@ -480,23 +467,14 @@ int main(int argc, char *argv[]) /* must be processed after all queues, so they are empty */ if (select_main(1, NULL, NULL, NULL)) all_idle = 0; - /* handle gsm */ - if (options.gsm) { - if (handle_gsm()) - all_idle = 0; -#ifdef WITH_GSM_MS - if (handle_gsm_ms(&quit)) - all_idle = 0; -#endif - } if (all_idle) { usleep(10000); } #else - if (options.polling) + if (options.polling) { if (!select_main(1, NULL, NULL, NULL)) usleep(10000); - else + } else select_main(0, NULL, NULL, NULL); #endif } @@ -601,17 +579,18 @@ free: mISDN_deinitialize(); /* free gsm */ - if (options.gsm) { +#if 0 +exit is done when interface is down #ifdef WITH_GSM_BS - gsm_bs_exit(0); + gsm_bs_exit(0); +#endif #endif #ifdef WITH_GSM_MS - gsm_ms_exit(0); + gsm_ms_exit(0); #endif #if defined WITH_GSM_BS || defined WITH_GSM_MS - gsm_exit(0); + gsm_exit(0); #endif - } /* close loopback, if used by GSM or remote */ if (mISDNloop.sock > -1)