void debug(const char *function, int line, const char *prefix, char *buffer)
{
/* if we have a new debug count, we add a mark */
void debug(const char *function, int line, const char *prefix, char *buffer)
{
/* if we have a new debug count, we add a mark */
last_debug = debug_count;
if (!nooutput)
printf("\033[34m--------------------- %04d.%02d.%02d %02d:%02d:%02d %06d\033[36m\n", now_tm->tm_year+1900, now_tm->tm_mon+1, now_tm->tm_mday, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec, debug_count%1000000);
last_debug = debug_count;
if (!nooutput)
printf("\033[34m--------------------- %04d.%02d.%02d %02d:%02d:%02d %06d\033[36m\n", now_tm->tm_year+1900, now_tm->tm_mon+1, now_tm->tm_mday, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec, debug_count%1000000);
fprintf(debug_fp, "--------------------- %04d.%02d.%02d %02d:%02d:%02d %06d\n", now_tm->tm_year+1900, now_tm->tm_mon+1, now_tm->tm_mday, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec, debug_count%1000000);
}
fprintf(debug_fp, "--------------------- %04d.%02d.%02d %02d:%02d:%02d %06d\n", now_tm->tm_year+1900, now_tm->tm_mon+1, now_tm->tm_mday, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec, debug_count%1000000);
}
if (debug_newline)
printf("\033[32m%06d %s\033[37m%s", debug_count%1000000, prefix?prefix:"", prefix?" ":"");
if (function)
if (debug_newline)
printf("\033[32m%06d %s\033[37m%s", debug_count%1000000, prefix?prefix:"", prefix?" ":"");
if (function)
if (function)
fprintf(debug_fp, "%s%s(in %s() line %d): %s", prefix?prefix:"", prefix?" ":"", function, line, buffer);
else
if (function)
fprintf(debug_fp, "%s%s(in %s() line %d): %s", prefix?prefix:"", prefix?" ":"", function, line, buffer);
else
if (options.deb)
debug(function, line, "ERROR", buffer);
if (options.deb)
debug(function, line, "ERROR", buffer);
if (function)
fprintf(stderr, "ERROR (in %s() line %d) %s", function, line, buffer);
else
if (function)
fprintf(stderr, "ERROR (in %s() line %d) %s", function, line, buffer);
else
memset(&schedp, 0, sizeof(schedp));
schedp.sched_priority = 0;
sched_setscheduler(0, SCHED_OTHER, &schedp);
memset(&schedp, 0, sizeof(schedp));
schedp.sched_priority = 0;
sched_setscheduler(0, SCHED_OTHER, &schedp);
fprintf(stderr, "\n***\n -> Missing 'main' ruleset, causing ALL calls to be disconnected.\n***\n\n");
PDEBUG(DEBUG_LOG, "Missing 'main' ruleset, causing ALL calls to be disconnected.\n");
sleep(2);
fprintf(stderr, "\n***\n -> Missing 'main' ruleset, causing ALL calls to be disconnected.\n***\n\n");
PDEBUG(DEBUG_LOG, "Missing 'main' ruleset, causing ALL calls to be disconnected.\n");
sleep(2);
goto usage;
}
/* create lock and lock! */
SPRINT(lock, "%s/lcr.lock", options.lock);
goto usage;
}
/* create lock and lock! */
SPRINT(lock, "%s/lcr.lock", options.lock);
fprintf(stderr, "Cannot create lock file: %s\n", lock);
fprintf(stderr, "Check options.conf to change to path with permissions for you.\n");
goto free;
}
fprintf(stderr, "Cannot create lock file: %s\n", lock);
fprintf(stderr, "Check options.conf to change to path with permissions for you.\n");
goto free;
}
if (errno == EWOULDBLOCK)
fprintf(stderr, "LCR: Another LCR process is running. Please kill the other one.\n");
else fprintf(stderr, "Locking process failed: errno=%d\n", errno);
if (errno == EWOULDBLOCK)
fprintf(stderr, "LCR: Another LCR process is running. Please kill the other one.\n");
else fprintf(stderr, "Locking process failed: errno=%d\n", errno);
+#ifdef WITH_GSM
+ /* handle gsm */
+ if (options.gsm && 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 while configure!\n");
+ goto free;
+ }
+#endif
+
PERROR_RUNTIME("No interfaces specified or failed to parse interface.conf.\n");
fprintf(stderr, "No interfaces specified or failed to parse interface.conf.\n");
goto free;
PERROR_RUNTIME("No interfaces specified or failed to parse interface.conf.\n");
fprintf(stderr, "No interfaces specified or failed to parse interface.conf.\n");
goto free;
- fprintf(stderr, "Warning: Unknown error %d while locking paging, exitting...\n", errno);
+ fprintf(stderr, "Warning: Unknown error %d while locking paging.\n", errno);
memset(&schedp, 0, sizeof(schedp));
schedp.sched_priority = options.schedule;
ret = sched_setscheduler(0, SCHED_RR, &schedp);
memset(&schedp, 0, sizeof(schedp));
schedp.sched_priority = options.schedule;
ret = sched_setscheduler(0, SCHED_RR, &schedp);
PERROR("Scheduling failed with given priority %d (errno = %d).\nCheck options.conf 'schedule', exitting...\n", options.schedule, errno);
goto free;
}
PERROR("Scheduling failed with given priority %d (errno = %d).\nCheck options.conf 'schedule', exitting...\n", options.schedule, errno);
goto free;
}
/*** main loop ***/
SPRINT(tracetext, "%s %s started, waiting for calls...", NAME, VERSION_STRING);
/*** main loop ***/
SPRINT(tracetext, "%s %s started, waiting for calls...", NAME, VERSION_STRING);
- start_trace(0, NULL, NULL, NULL, 0, 0, 0, tracetext);
+ start_trace(-1, NULL, NULL, NULL, 0, 0, 0, tracetext);
PERROR("LCR was stalling %d.%d seconds\n", ((int)((now_d-last_d)*10.0))/10, (int)((now_d-last_d)*10.0));
}
/* all loops must be counted from the beginning since nodes might get freed during handler */
PERROR("LCR was stalling %d.%d seconds\n", ((int)((now_d-last_d)*10.0))/10, (int)((now_d-last_d)*10.0));
}
/* all loops must be counted from the beginning since nodes might get freed during handler */
debug_prefix = prefix_string;
SPRINT(prefix_string, "ep%ld", epoint->ep_serial);
debug_count++;
debug_prefix = prefix_string;
SPRINT(prefix_string, "ep%ld", epoint->ep_serial);
debug_count++;
PDEBUG(DEBUG_MSG, "Warning: message %s from port %d to endpoint %d. endpoint doesn't have an application.\n", messages_txt[message->type], message->id_from, message->id_to);
}
PDEBUG(DEBUG_MSG, "Warning: message %s from port %d to endpoint %d. endpoint doesn't have an application.\n", messages_txt[message->type], message->id_from, message->id_to);
}
PDEBUG(DEBUG_MSG, "Warning: message %s from port %d to endpoint %d. endpoint doesn't exist anymore.\n", messages_txt[message->type], message->id_from, message->id_to);
}
break;
PDEBUG(DEBUG_MSG, "Warning: message %s from port %d to endpoint %d. endpoint doesn't exist anymore.\n", messages_txt[message->type], message->id_from, message->id_to);
}
break;
PDEBUG(DEBUG_MSG, "Warning: message %s from endpoint %d to join %d. join doesn't exist anymore\n", messages_txt[message->type], message->id_from, message->id_to);
}
break;
PDEBUG(DEBUG_MSG, "Warning: message %s from endpoint %d to join %d. join doesn't exist anymore\n", messages_txt[message->type], message->id_from, message->id_to);
}
break;
PDEBUG(DEBUG_MSG, "Warning: message %s from join %d to endpoint %d. endpoint doesn't have an application.\n", messages_txt[message->type], message->id_from, message->id_to);
}
PDEBUG(DEBUG_MSG, "Warning: message %s from join %d to endpoint %d. endpoint doesn't have an application.\n", messages_txt[message->type], message->id_from, message->id_to);
}
PDEBUG(DEBUG_MSG, "Warning: message %s from join %d to endpoint %d. endpoint doesn't exist anymore.\n", messages_txt[message->type], message->id_from, message->id_to);
}
break;
PDEBUG(DEBUG_MSG, "Warning: message %s from join %d to endpoint %d. endpoint doesn't exist anymore.\n", messages_txt[message->type], message->id_from, message->id_to);
}
break;
PDEBUG(DEBUG_MSG, "Warning: message %s from endpoint %d to port %d. port doesn't exist anymore\n", messages_txt[message->type], message->id_from, message->id_to);
}
break;
PDEBUG(DEBUG_MSG, "Warning: message %s from endpoint %d to port %d. port doesn't exist anymore\n", messages_txt[message->type], message->id_from, message->id_to);
}
break;
// debug_usleep(1, __FILE__, __LINE__, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec);
/* do idle checking */
// debug_usleep(1, __FILE__, __LINE__, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec);
/* do idle checking */
PDEBUG(DEBUG_IDLETIME, "Idle time : %d%%\n", idletime/10000);
idletime = 0;
idlecheck = now;
}
/* did we do nothing? so we wait to give time to other processes */
PDEBUG(DEBUG_IDLETIME, "Idle time : %d%%\n", idletime/10000);
idletime = 0;
idlecheck = now;
}
/* did we do nothing? so we wait to give time to other processes */
// pthread_mutex_unlock(&mutex_lcr); // unlock LCR
debug_usleep(4000, __FILE__, __LINE__, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec);
// pthread_mutex_lock(&mutex_lcr); // lock LCR
// pthread_mutex_unlock(&mutex_lcr); // unlock LCR
debug_usleep(4000, __FILE__, __LINE__, now_tm->tm_hour, now_tm->tm_min, now_tm->tm_sec);
// pthread_mutex_lock(&mutex_lcr); // lock LCR
}
SPRINT(tracetext, "%s terminated", NAME);
printf("%s\n", tracetext);
}
SPRINT(tracetext, "%s terminated", NAME);
printf("%s\n", tracetext);
- start_trace(0, NULL, NULL, NULL, 0, 0, 0, tracetext);
+ start_trace(-1, NULL, NULL, NULL, 0, 0, 0, tracetext);
if (quit)
add_trace((char *)"signal", NULL, "%d", quit);
end_trace();
if (quit)
add_trace((char *)"signal", NULL, "%d", quit);
end_trace();
memset(&schedp, 0, sizeof(schedp));
schedp.sched_priority = options.schedule;
sched_setscheduler(0, SCHED_OTHER, &schedp);
}
/* reset signals */
memset(&schedp, 0, sizeof(schedp));
schedp.sched_priority = options.schedule;
sched_setscheduler(0, SCHED_OTHER, &schedp);
}
/* reset signals */
- start_trace(0, NULL, NULL, NULL, 0, 0, 0, tracetext); \
+ start_trace(-1, NULL, NULL, NULL, 0, 0, 0, tracetext); \
if (ret) add_trace("blocks", NULL, "%d", b); \
end_trace(); \
printf("\n******************************\n\007"); \
if (ret) add_trace("blocks", NULL, "%d", b); \
end_trace(); \
printf("\n******************************\n\007"); \
PERROR_RUNTIME("************************************************\n");
PERROR_RUNTIME("** BUG detected in %s, line %d, function %s\n", file, line, function);
PERROR_RUNTIME("** p_isdn_crypt_listen = %d\n", pmisdn->p_isdn_crypt_listen);
PERROR_RUNTIME("************************************************\n");
PERROR_RUNTIME("** BUG detected in %s, line %d, function %s\n", file, line, function);
PERROR_RUNTIME("** p_isdn_crypt_listen = %d\n", pmisdn->p_isdn_crypt_listen);
PERROR_RUNTIME("************************************************\n");
PERROR_RUNTIME("** BUG detected in %s, line %d, function %s\n", file, line, function);
PERROR_RUNTIME("** b_port not in list.\n");
PERROR_RUNTIME("************************************************\n");
PERROR_RUNTIME("** BUG detected in %s, line %d, function %s\n", file, line, function);
PERROR_RUNTIME("** b_port not in list.\n");