From d9d954e58d6acf8c3de95402110e691f0bc29688 Mon Sep 17 00:00:00 2001 From: Super User Date: Mon, 24 Mar 2008 11:13:44 +0100 Subject: socket api work modified: apppbx.cpp modified: cause.c modified: dss1.cpp modified: dss1.h modified: ie.cpp modified: interface.c modified: mISDN.cpp modified: mISDN.h modified: main.c modified: main.h modified: message.c modified: options.c modified: port.cpp modified: q931.h modified: route.c modified: socket_server.c modified: tones.c --- mISDN.cpp | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'mISDN.cpp') diff --git a/mISDN.cpp b/mISDN.cpp index 1583211..75cdadf 100644 --- a/mISDN.cpp +++ b/mISDN.cpp @@ -96,18 +96,19 @@ int mISDN_initialize(void) return(-1); } - /* initialize stuff of the NT lib */ + /* open debug, if enabled and not only stack debugging */ + if (options.deb && (options.deb != DEBUG_STACK)) + { + SPRINT(debug_log, "%s/debug.log", INSTALL_DATA); + debug_fp = fopen(debug_log, "a"); + } + if (options.deb & DEBUG_STACK) { - global_debug = 0xffffffff & ~DBGM_MSG; -// global_debug = DBGM_L3DATA; + SPRINT(debug_stack, "%s/debug_mISDN.log", INSTALL_DATA); + mISDN_debug_init(DBGM_ALL, debug_stack, debug_stack, debug_stack); } else - global_debug = DBGM_MAN; - SPRINT(debug_log, "%s/debug.log", INSTALL_DATA); - if (options.deb & DEBUG_LOG) - mISDN_debug_init(global_debug, debug_log, debug_log, debug_log); - else - mISDN_debug_init(global_debug, NULL, NULL, NULL); + mISDN_debug_init(0, NULL, NULL, NULL); /* init mlayer3 */ init_layer3(4); // buffer of 4 @@ -121,6 +122,10 @@ void mISDN_deinitialize(void) mISDN_debug_close(); + if (debug_fp) + fclose(debug_fp); + debug_fp = NULL; + if (mISDNsocket > -1) close(mISDNsocket); } @@ -182,6 +187,7 @@ void mISDN_deinitialize(void) unsigned char buff[1025]; debug_close(); + global_debug = 0; if (mISDNdevice >= 0) { @@ -2473,6 +2479,15 @@ int mISDN_handler(void) if (!mISDNport) { PERROR("message belongs to no mISDNport: prim(0x%x) addr(0x%x) msg->len(%d)\n", frm->prim, frm->addr, msg->len); + // show a list of all mISDNports and their address +#if 0 + mISDNport = mISDNport_first; + while(mISDNport) + { + PERROR(" port %s %x -> %x\n", mISDNport->name, (frm->addr&MASTER_ID_MASK), (unsigned int)(mISDNport->upper_id&MASTER_ID_MASK)); + mISDNport = mISDNport->next; + } +#endif goto out; } -- cgit v1.2.3-55-g7522