|
@@ -20,6 +20,9 @@
|
|
#include "udp_server.h"
|
|
#include "udp_server.h"
|
|
#include "globals.h"
|
|
#include "globals.h"
|
|
|
|
|
|
|
|
+#include <signal.h>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
#ifdef DEBUG_DMALLOC
|
|
#ifdef DEBUG_DMALLOC
|
|
#include <dmalloc.h>
|
|
#include <dmalloc.h>
|
|
@@ -28,6 +31,20 @@
|
|
|
|
|
|
static char id[]="@(#) $Id$";
|
|
static char id[]="@(#) $Id$";
|
|
static char version[]="sip_router 0.6";
|
|
static char version[]="sip_router 0.6";
|
|
|
|
+static char flags[]="NOCR:"
|
|
|
|
+#ifdef NOCR
|
|
|
|
+"On"
|
|
|
|
+#else
|
|
|
|
+"Off"
|
|
|
|
+#endif
|
|
|
|
+", MACROEATER:"
|
|
|
|
+#ifdef MACROEATER
|
|
|
|
+"On"
|
|
|
|
+#else
|
|
|
|
+"Off"
|
|
|
|
+#endif
|
|
|
|
+;
|
|
|
|
+
|
|
static char help_msg[]= "\
|
|
static char help_msg[]= "\
|
|
Usage: sip_router -l address [-l address] [options]\n\
|
|
Usage: sip_router -l address [-l address] [options]\n\
|
|
Options:\n\
|
|
Options:\n\
|
|
@@ -196,7 +213,17 @@ int main_loop()
|
|
return -1;
|
|
return -1;
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+/* added by jku; allows for regular exit on a specific signal;
|
|
|
|
+ good for profiling which only works if exited regularly and
|
|
|
|
+ not by default signal handlers
|
|
|
|
+*/
|
|
|
|
+
|
|
|
|
+static void sig_usr(int signo)
|
|
|
|
+{
|
|
|
|
+ DPrint("INT received, program terminates\n");
|
|
|
|
+ exit(0);
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -209,6 +236,12 @@ int main(int argc, char** argv)
|
|
char *tmp;
|
|
char *tmp;
|
|
struct utsname myname;
|
|
struct utsname myname;
|
|
|
|
|
|
|
|
+ /* added by jku: add exit handler */
|
|
|
|
+ if (signal(SIGINT, sig_usr) == SIG_ERR ) {
|
|
|
|
+ DPrint("ERROR: no signal handler can be installed\n");
|
|
|
|
+ goto error;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* process command line (get port no, cfg. file path etc) */
|
|
/* process command line (get port no, cfg. file path etc) */
|
|
opterr=0;
|
|
opterr=0;
|
|
while((c=getopt(argc,argv,"f:p:l:n:rRvdDEVh"))!=-1){
|
|
while((c=getopt(argc,argv,"f:p:l:n:rRvdDEVh"))!=-1){
|
|
@@ -266,6 +299,7 @@ int main(int argc, char** argv)
|
|
break;
|
|
break;
|
|
case 'V':
|
|
case 'V':
|
|
printf("version: %s\n", version);
|
|
printf("version: %s\n", version);
|
|
|
|
+ printf("flags: %s\n", flags );
|
|
printf("%s\n",id);
|
|
printf("%s\n",id);
|
|
exit(0);
|
|
exit(0);
|
|
break;
|
|
break;
|