Patches by Paul Slootman

This commit is contained in:
luethje 1998-03-08 12:13:38 +00:00
parent fba173d17d
commit 64d039cff4
3 changed files with 70 additions and 61 deletions

View File

@ -1,4 +1,4 @@
/* $Id: isdnlog.c,v 1.15 1998/03/08 11:42:50 luethje Exp $
/* $Id: isdnlog.c,v 1.16 1998/03/08 12:13:38 luethje Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -19,6 +19,9 @@
* along with this program; if not, write to the Free Software
*
* $Log: isdnlog.c,v $
* Revision 1.16 1998/03/08 12:13:38 luethje
* Patches by Paul Slootman
*
* Revision 1.15 1998/03/08 11:42:50 luethje
* I4L-Meeting Wuerzburg final Edition, golden code - Service Pack number One
*
@ -83,6 +86,8 @@
/*****************************************************************************/
#define X_FD_ISSET(fd, mask) ((fd) >= 0 && FD_ISSET(fd,mask))
static void loop(void);
static void init_variables(int argc, char* argv[]);
static int set_options(int argc, char* argv[]);
@ -102,6 +107,7 @@ static char options[] = "av:sp:x:m:l:rt:c:C:w:SVTDPMh:nW:H:f:bL:NFA:2:O:";
static char msg1[] = "%s: Can't open %s (%s)\n";
static char *ptty = NULL;
static section *opt_dat = NULL;
static char **hup_argv; /* args to restart with */
/*****************************************************************************/
@ -116,41 +122,14 @@ static void exit_on_signal(int Sign)
static void hup_handler(int isig)
{
print_msg(PRT_INFO, "re-reading %s\n", CONFFILE);
discardconfig();
if (readconfig(myname) != 0)
Exit(41);
if (fprot != NULL && tmpout != NULL && *tmpout != '\0')
{
fclose(fprot);
if ((fprot = fopen(tmpout,"a")) == NULL)
{
print_msg(PRT_ERR,"Can not open file `%s': %s!\n",tmpout, strerror(errno));
Exit(46);
}
}
if (fout != NULL && outfile != NULL && *outfile != '\0')
{
fclose(fout);
if ((fout = fopen(outfile,"a")) == NULL)
{
print_msg(PRT_ERR,"Can not open file `%s': %s!\n",outfile, strerror(errno));
Exit(47);
}
}
signal(SIGHUP, hup_handler);
print_msg(PRT_INFO, "restarting %s\n", myname);
Exit(-9);
execv(myname, hup_argv);
print_msg(PRT_ERR,"Cannot restart %s: %s!\n", myname, strerror(errno));
} /* hup_handler */
/*****************************************************************************/
#define X_FD_ISSET(fd, mask) ((fd) >= 0 && FD_ISSET(fd,mask))
static void loop(void)
{
auto fd_set readmask;
@ -231,7 +210,6 @@ static void loop(void)
now();
for (Cnt = first_descr; Cnt < socket_size(sockets); Cnt++) {
if (X_FD_ISSET(sockets[Cnt].descriptor, &exceptmask)) {
if (sockets[Cnt].fp == NULL) {
@ -785,6 +763,7 @@ int main(int argc, char *argv[], char *envp[])
} /* if */
set_print_fct_for_lib(print_in_modules);
hup_argv = argv;
init_variables(argc, argv);
lastarg = set_options(argc,argv);
@ -890,8 +869,8 @@ int main(int argc, char *argv[], char *envp[])
if (!verbose || ((fprot = fopen(tmpout, "a")) != (FILE *)NULL)) {
for (i = 0; i < MAXCHAN; i++)
clearchan(i, 1);
for (i = 0; i < MAXCHAN; i++)
clearchan(i, 1);
#ifdef Q931
if (q931dmp) {

View File

@ -1,4 +1,4 @@
/* $Id: processor.c,v 1.14 1998/03/08 11:42:55 luethje Exp $
/* $Id: processor.c,v 1.15 1998/03/08 12:13:40 luethje Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -19,6 +19,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: processor.c,v $
* Revision 1.15 1998/03/08 12:13:40 luethje
* Patches by Paul Slootman
*
* Revision 1.14 1998/03/08 11:42:55 luethje
* I4L-Meeting Wuerzburg final Edition, golden code - Service Pack number One
*
@ -376,7 +379,7 @@ static void info(int chan, int reason, int state, char *msg)
if (allflags & PRT_DEBUG_GENERAL)
if (allflags & PRT_DEBUG_INFO)
print_msg(PRT_DEBUG_INFO, "%d INFO> ", chan);
(void)iprintf(s, chan, call[chan].dialin ? ilabel : olabel, left, msg, right);
print_msg(PRT_DEBUG_INFO, "%s", s);
@ -1529,7 +1532,7 @@ static void decode(int chan, register char *p, int type, int version)
pd = qmsg(TYPE_ELEMENT, version, element);
if (*pd == 'U') {
if (strncmp(pd, "UNKNOWN", 7) == 0) {
register char *p1 = p, *p2;
register int i, c;
auto char s[LONG_STRING_SIZE];
@ -1719,7 +1722,7 @@ static void decode(int chan, register char *p, int type, int version)
print_msg(PRT_DEBUG_DECODE, " DEBUG> %s: 1TR6 AOCD %i\n", st + 4, n);
} /* if */
}
else
else {
#if defined(ISDN_NL) || defined(ISDN_CH)
n = AOC_1TR6(l, p);
#else
@ -1949,23 +1952,47 @@ static void decode(int chan, register char *p, int type, int version)
} /* if */
} /* else */
} /* if */
} /* if */
p += (l * 3);
break;
case 0x29 : /* Date/Time */
tm.tm_year = strtol(p += 3, NIL, 16);
tm.tm_mon = strtol(p += 3, NIL, 16) - 1;
tm.tm_mday = strtol(p += 3, NIL, 16);
tm.tm_hour = strtol(p += 3, NIL, 16);
tm.tm_min = strtol(p += 3, NIL, 16);
if (l > 5) {
tm.tm_sec = strtol(p += 3, NIL, 16);
if (l > 6)
p += (l - 6) * 3;
} else {
tm.tm_sec = 0;
case 0x03 : /* Date/Time 1TR6 */
case 0x29 : /* Date/Time E-DSS1 */
if ((element == 0x03) && (version == VERSION_1TR6)) {
tm.tm_mday = (strtol(p+=3,NIL,16)-'0') * 10;
tm.tm_mday += strtol(p+=3,NIL,16)-'0';
p += 3; /* skip '.' */
tm.tm_mon = (strtol(p+=3,NIL,16)-'0') * 10;
tm.tm_mon += strtol(p+=3,NIL,16)-'0' - 1;
p += 3; /* skip '.' */
tm.tm_year = (strtol(p+=3,NIL,16)-'0') * 10;
tm.tm_year += strtol(p+=3,NIL,16)-'0';
if (tm.tm_year < 70)
tm.tm_year += 100;
p += 3; /* skip '-' */
tm.tm_hour = (strtol(p+=3,NIL,16)-'0') * 10;
tm.tm_hour += strtol(p+=3,NIL,16)-'0';
p += 3; /* skip ':' */
tm.tm_min = (strtol(p+=3,NIL,16)-'0') * 10;
tm.tm_min += strtol(p+=3,NIL,16)-'0';
p += 3; /* skip ':' */
tm.tm_sec = (strtol(p+=3,NIL,16)-'0') * 10;
tm.tm_sec += strtol(p+=3,NIL,16)-'0';
}
else if ((element == 0x29) && (version != VERSION_1TR6)) {
tm.tm_year = strtol(p += 3, NIL, 16);
tm.tm_mon = strtol(p += 3, NIL, 16) - 1;
tm.tm_mday = strtol(p += 3, NIL, 16);
tm.tm_hour = strtol(p += 3, NIL, 16);
tm.tm_min = strtol(p += 3, NIL, 16);
if (l > 5)
tm.tm_sec = strtol(p += 3, NIL, 16);
else
tm.tm_sec = 0;
}
else {
goto UNKNOWN_ELEMENT; /* no choice... */
}
tm.tm_wday = tm.tm_yday = 0;
tm.tm_isdst = -1;
@ -2811,9 +2838,9 @@ escape: for (c = 0; c <= sxp; c++)
default : {
register char *p1 = p, *p2 = s;
register char *p1, *p2;
register int i;
UNKNOWN_ELEMENT: p1 = p; p2 = s;
for (i = 0; i < l; i++)
p2 += sprintf(p2, "%02x ", (int)strtol(p1 += 3, NIL, 16));
@ -2926,7 +2953,7 @@ void dotrace(void)
print_msg(PRT_NORMAL, ">>>>>>> TRACE (CR=next, q=quit, d=dump, g=go):");
gets(s);
fgets(s, BUFSIZ, stdin);
if (*s == 'q')
exit(0);

View File

@ -1,4 +1,4 @@
/* $Id: isdntools.c,v 1.16 1997/06/22 22:57:08 luethje Exp $
/* $Id: isdntools.c,v 1.17 1998/03/08 12:13:49 luethje Exp $
*
* ISDN accounting for isdn4linux. (Utilities)
*
@ -19,6 +19,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdntools.c,v $
* Revision 1.17 1998/03/08 12:13:49 luethje
* Patches by Paul Slootman
*
* Revision 1.16 1997/06/22 22:57:08 luethje
* bugfixes
*
@ -176,20 +179,20 @@ static char areacodes[][2][30] = {
};
static char countrycodes[][2][30] = {
{"+30", "Greek"},
{"+31", "Nethland"},
{"+30", "Greece"},
{"+31", "Netherlands"},
{"+32", "Belgium"},
{"+33", "France"},
{"+34", "Spain"},
{"+39", "Italy"},
{"+41", "Swiss"},
{"+41", "Switzerland"},
{"+43", "Austria"},
{"+44", "Great Britain"},
{"+45", "Danmark"},
{"+45", "Denmark"},
{"+46", "Sweden"},
{"+47", "Norway"},
{"+49", "Germany"},
{"+352", "Luxembourg"},
{"+352", "Luxemburg"},
{"+1", "United States"},
{"", ""},
};