parent
d9dea5effd
commit
b4471cfd20
|
@ -1,4 +1,4 @@
|
|||
## $Id: Makefile.in,v 1.89 1999/06/26 10:11:06 akool Exp $
|
||||
## $Id: Makefile.in,v 1.90 1999/06/26 12:25:04 akool Exp $
|
||||
##
|
||||
## ISDN accounting for isdn4linux.
|
||||
##
|
||||
|
@ -19,6 +19,10 @@
|
|||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Log: Makefile.in,v $
|
||||
## Revision 1.90 1999/06/26 12:25:04 akool
|
||||
## isdnlog Version 3.37
|
||||
## fixed some warnings
|
||||
##
|
||||
## Revision 1.89 1999/06/26 10:11:06 akool
|
||||
## isdnlog Version 3.36
|
||||
## - EGCS 1.1.2 bug correction from Nima <nima_ghasseminejad@public.uni-hamburg.de>
|
||||
|
@ -697,7 +701,7 @@ SERVICEFILE = /etc/services
|
|||
# DON'T EDIT BELOW THIS LINE
|
||||
######################################################################
|
||||
|
||||
VERSION = 3.36
|
||||
VERSION = 3.37
|
||||
|
||||
MANPAGES = isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 \
|
||||
isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: processor.c,v 1.70 1999/06/22 19:40:46 akool Exp $
|
||||
/* $Id: processor.c,v 1.71 1999/06/26 12:25:29 akool Exp $
|
||||
*
|
||||
* ISDN accounting for isdn4linux. (log-module)
|
||||
*
|
||||
|
@ -19,6 +19,10 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: processor.c,v $
|
||||
* Revision 1.71 1999/06/26 12:25:29 akool
|
||||
* isdnlog Version 3.37
|
||||
* fixed some warnings
|
||||
*
|
||||
* Revision 1.70 1999/06/22 19:40:46 akool
|
||||
* zone-1.1 fixes
|
||||
*
|
||||
|
@ -728,6 +732,7 @@
|
|||
#include "isdnlog.h"
|
||||
#include "sys/times.h"
|
||||
#include "asn1.h"
|
||||
#include "zone.h"
|
||||
|
||||
static int HiSax = 0, hexSeen = 0, uid = UNKNOWN, lfd = 0;
|
||||
static char *asnp, *asnm;
|
||||
|
@ -963,7 +968,7 @@ void buildnumber(char *num, int oc3, int oc3a, char *result, int version,
|
|||
Q931dump(TYPE_STRING, -1, s, version);
|
||||
} /* if */
|
||||
} /* if */
|
||||
|
||||
|
||||
if (!*intern) {
|
||||
if (*provider == UNKNOWN)
|
||||
*provider = preselect;
|
||||
|
@ -3478,7 +3483,7 @@ void processRate(int chan)
|
|||
{
|
||||
call[chan].Rate.start = call[chan].connect;
|
||||
call[chan].Rate.now = call[chan].disconnect = cur_time;
|
||||
|
||||
|
||||
if (getRate(&call[chan].Rate, NULL) == UNKNOWN) {
|
||||
call[chan].tarifknown = 0;
|
||||
} else {
|
||||
|
@ -3560,7 +3565,7 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep)
|
|||
|
||||
if (msg)
|
||||
*(*msg = message) = '\0';
|
||||
|
||||
|
||||
if (tip)
|
||||
*(*tip = lcrhint) = '\0';
|
||||
|
||||
|
@ -3586,7 +3591,7 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep)
|
|||
auto int l;
|
||||
|
||||
|
||||
l = getAreacode(DTAG, call[chan].num[CALLING] + 3, &text);
|
||||
l = getAreacode(49, call[chan].num[CALLING] + 3, &text);
|
||||
print_msg(PRT_NORMAL, "getAreacode(49,%s,\"%s\")=%d\n", call[chan].num[CALLING] + 3, text, l);
|
||||
|
||||
if ((get_areacode(call[chan].num[CALLING], &l, C_NO_WARN | C_NO_EXPAND | C_NO_ERROR)))
|
||||
|
@ -3601,7 +3606,7 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep)
|
|||
static char dst[BUFSIZ], *text;
|
||||
auto int l;
|
||||
|
||||
l = getAreacode(DTAG, call[chan].num[CALLED] + 3, &text);
|
||||
l = getAreacode(49, call[chan].num[CALLED] + 3, &text);
|
||||
print_msg(PRT_NORMAL, "getAreacode(49,%s,\"%s\")=%d\n", call[chan].num[CALLED] + 3, text, l);
|
||||
if ((get_areacode(call[chan].num[CALLED], &l, C_NO_WARN | C_NO_EXPAND | C_NO_ERROR)))
|
||||
Strncpy(dst, call[chan].num[CALLED], l + 1);
|
||||
|
@ -3634,7 +3639,7 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep)
|
|||
if (msg && call[chan].tarifknown) {
|
||||
showRates(message);
|
||||
} /* if */
|
||||
|
||||
|
||||
lcRate = call[chan].Rate;
|
||||
|
||||
if ((call[chan].hint = getLeastCost(&lcRate, UNKNOWN)) != UNKNOWN) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: zone.c,v 1.8 1999/06/26 10:12:14 akool Exp $
|
||||
/* $Id: zone.c,v 1.9 1999/06/26 12:25:54 akool Exp $
|
||||
*
|
||||
* Zonenberechnung
|
||||
*
|
||||
|
@ -19,6 +19,10 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: zone.c,v $
|
||||
* Revision 1.9 1999/06/26 12:25:54 akool
|
||||
* isdnlog Version 3.37
|
||||
* fixed some warnings
|
||||
*
|
||||
* Revision 1.8 1999/06/26 10:12:14 akool
|
||||
* isdnlog Version 3.36
|
||||
* - EGCS 1.1.2 bug correction from Nima <nima_ghasseminejad@public.uni-hamburg.de>
|
||||
|
@ -98,7 +102,10 @@ struct sth {
|
|||
int numlen;
|
||||
int cc;
|
||||
} ;
|
||||
|
||||
#ifdef STANDALONE
|
||||
#define min(a,b) (a) < (b) ? (a) : (b)
|
||||
#endif
|
||||
|
||||
static struct sth *sthp;
|
||||
static int count;
|
||||
|
@ -138,7 +145,7 @@ void exitZone(int provider) {
|
|||
if(sthp[i].provider>=10000)
|
||||
_exitZone(sthp[i].provider);
|
||||
}
|
||||
|
||||
|
||||
static void _exitZone(int provider)
|
||||
{
|
||||
int i;
|
||||
|
@ -189,14 +196,14 @@ int initZone(int provider, char *path, char **msg)
|
|||
DIR *dp;
|
||||
struct dirent *ep;
|
||||
int len, i;
|
||||
|
||||
|
||||
if (msg)
|
||||
*(*msg=message)='\0';
|
||||
res = _initZone(provider, path, msg, ZONES);
|
||||
if (area_read || res)
|
||||
return res;
|
||||
|
||||
area_read = true;
|
||||
area_read = true;
|
||||
if ((p = strrchr(path, '/')) == 0) {
|
||||
dir = "./";
|
||||
file = path;
|
||||
|
@ -216,7 +223,7 @@ int initZone(int provider, char *path, char **msg)
|
|||
return res;
|
||||
}
|
||||
p[1] = '\0';
|
||||
}
|
||||
}
|
||||
if ((dp = opendir(dir)) == 0) {
|
||||
if (msg)
|
||||
snprintf (message, LENGTH,
|
||||
|
@ -230,25 +237,25 @@ int initZone(int provider, char *path, char **msg)
|
|||
int l=strlen(dir)+strlen(ep->d_name)+1;
|
||||
char *npath=malloc(l);
|
||||
strcpy(npath, dir);
|
||||
strcat(npath, ep->d_name);
|
||||
strcat(npath, ep->d_name);
|
||||
_initZone(10000+i, npath, 0, AREACODES);
|
||||
i++;
|
||||
free(npath);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
if ((p = strrchr(path, '/')) != 0) {
|
||||
free(dir);
|
||||
free(file);
|
||||
}
|
||||
}
|
||||
if (msg && strlen(message) < LENGTH-5) {
|
||||
strcat(message, " - ");
|
||||
for (i=0; i<count; i++)
|
||||
if(sthp[i].provider>=10000 && sthp[i].cc && strlen(message) < LENGTH-5)
|
||||
sprintf(message+strlen(message),"%d ",sthp[i].cc);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
static int _initZone(int provider, char *path, char **msg, bool area_only)
|
||||
{
|
||||
|
@ -274,7 +281,7 @@ static int _initZone(int provider, char *path, char **msg, bool area_only)
|
|||
if (msg)
|
||||
snprintf (message, LENGTH,
|
||||
"Zone V%s: Error: Out of mem 0", version);
|
||||
count--;
|
||||
count--;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +299,7 @@ static int _initZone(int provider, char *path, char **msg, bool area_only)
|
|||
if (msg)
|
||||
snprintf (message, LENGTH,
|
||||
"Zone V%s: Error: Out of mem 1", version);
|
||||
count--;
|
||||
count--;
|
||||
return -1;
|
||||
}
|
||||
sthp = newsthp;
|
||||
|
@ -341,7 +348,7 @@ static int _initZone(int provider, char *path, char **msg, bool area_only)
|
|||
snprintf (message, LENGTH,
|
||||
"Zone V%s: Error: gdbm_open '%s': '%s'",
|
||||
version, path, GET_ERR);
|
||||
count--;
|
||||
count--;
|
||||
return -1;
|
||||
}
|
||||
/* read info */
|
||||
|
@ -363,7 +370,7 @@ static int _initZone(int provider, char *path, char **msg, bool area_only)
|
|||
*q++ = *p++;
|
||||
*q = '\0';
|
||||
if (memcmp(dversion, version, 3)) {
|
||||
if (msg)
|
||||
if (msg)
|
||||
snprintf (message, LENGTH,
|
||||
"Zone V%s: Error: Provider %d File '%s': incompatible Dataversion %s",
|
||||
version, provider, path, dversion);
|
||||
|
@ -385,11 +392,11 @@ static int _initZone(int provider, char *path, char **msg, bool area_only)
|
|||
p++;
|
||||
tsize = strtol(p, &p, 10);
|
||||
break;
|
||||
case 'O' :
|
||||
case 'O' :
|
||||
p++;
|
||||
sthp[ocount].oz = strtol(p, &p, 10);
|
||||
break;
|
||||
case 'L' :
|
||||
case 'L' :
|
||||
p++;
|
||||
sthp[ocount].numlen = strtol(p, &p, 10);
|
||||
break;
|
||||
|
@ -421,10 +428,10 @@ static int _initZone(int provider, char *path, char **msg, bool area_only)
|
|||
sthp[ocount].pack_key = sthp[ocount].pack_key == 'S' ? 2 : 4;
|
||||
|
||||
if (area_only) {
|
||||
if (sthp[ocount].cc == 0)
|
||||
if (sthp[ocount].cc == 0)
|
||||
_exitZone(provider); /* discard this one */
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* alloc & read table */
|
||||
if ( (sthp[ocount].table = calloc(csize > 256 ? 256 : csize,
|
||||
sizeof(int)) ) == 0) {
|
||||
|
@ -477,7 +484,7 @@ static int _getZ(struct sth *sthp, char *from, char *sto) {
|
|||
char *temp;
|
||||
int res;
|
||||
|
||||
if ((res=strcmp(from, sto)) == 0)
|
||||
if ((res=strcmp(from, sto)) == 0)
|
||||
return sthp->oz;
|
||||
else if (res > 0) {
|
||||
temp=from;
|
||||
|
@ -487,7 +494,7 @@ static int _getZ(struct sth *sthp, char *from, char *sto) {
|
|||
strncpy(newfrom, from, LENGTH-1);
|
||||
while (strlen(newfrom)) {
|
||||
UL lifrom = (UL) atol(newfrom); /* keys could be long */
|
||||
US ifrom = (US) lifrom;
|
||||
US ifrom = (US) lifrom;
|
||||
if (sthp->pack_key == 2) {
|
||||
key.dptr = (char *) &ifrom;
|
||||
key.dsize = sizeof(US);
|
||||
|
@ -563,12 +570,12 @@ static int _getAreacode(struct sth *sthp, char *from, char **text) {
|
|||
newfrom[sthp->numlen] = '\0';
|
||||
while ((len=strlen(newfrom))) {
|
||||
UL lifrom = (UL) atol(newfrom); /* keys could be long */
|
||||
US ifrom = (US) lifrom;
|
||||
US ifrom = (US) lifrom;
|
||||
if (sthp->pack_key == 2) {
|
||||
if (lifrom >= 0x10000) { /* can't be, so cut a dig */
|
||||
newfrom[strlen(newfrom)-1] = '\0';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
key.dptr = (char *) &ifrom;
|
||||
key.dsize = sizeof(US);
|
||||
}
|
||||
|
@ -576,7 +583,7 @@ static int _getAreacode(struct sth *sthp, char *from, char **text) {
|
|||
if (lifrom >= 0x10000000L) { /* can't be, so cut a dig */
|
||||
newfrom[strlen(newfrom)-1] = '\0';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
key.dptr = (char *) &lifrom;
|
||||
key.dsize = sizeof(UL);
|
||||
}
|
||||
|
@ -586,17 +593,17 @@ static int _getAreacode(struct sth *sthp, char *from, char **text) {
|
|||
if (*dbv == 'G') /* GDBM has a malloced string in dptr */
|
||||
free(value.dptr);
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
if (*dbv == 'G') /* GDBM has a malloced string in dptr */
|
||||
*text = value.dptr;
|
||||
else
|
||||
else
|
||||
*text = strdup(value.dptr);
|
||||
return len;
|
||||
} /* if dptr */
|
||||
newfrom[strlen(newfrom)-1] = '\0';
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
int getAreacode(int country, char *from, char **text)
|
||||
{
|
||||
|
@ -605,9 +612,9 @@ int getAreacode(int country, char *from, char **text)
|
|||
if (sthp[i].cc == country) {
|
||||
if (sthp[i].fh == 0)
|
||||
return UNKNOWN;
|
||||
return _getAreacode(&sthp[i], from, text);
|
||||
}
|
||||
return UNKNOWN;
|
||||
return _getAreacode(&sthp[i], from, text);
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
#ifdef ZONETEST
|
||||
|
@ -639,10 +646,10 @@ static int checkZone(char *zf, char* df,int num1,int num2, bool verbose)
|
|||
free(ort2);
|
||||
}
|
||||
else
|
||||
goto no_ort;
|
||||
goto no_ort;
|
||||
}
|
||||
else
|
||||
no_ort:
|
||||
else
|
||||
no_ort:
|
||||
printf("%s %s = %d\n", from, to, ret);
|
||||
}
|
||||
else {
|
||||
|
@ -708,11 +715,11 @@ static int checkArea(char *df, int cc, char *from, int verbose) {
|
|||
printf("%s\n", msg);
|
||||
ret = getAreacode(cc, from, &text);
|
||||
if(ret != UNKNOWN) {
|
||||
printf("%s:%d '%s'\n", from, ret, text);
|
||||
printf("%s:%d '%s'\n", from, ret, text);
|
||||
free(text);
|
||||
}
|
||||
else
|
||||
printf("%s - UNKNOWN\n", from);
|
||||
printf("%s - UNKNOWN\n", from);
|
||||
exitZone(1);
|
||||
return ret;
|
||||
}
|
||||
|
@ -768,12 +775,12 @@ static int checkAllArea(char *df, char *cf, int cc, int verbose) {
|
|||
free(ort);
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(ort);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
exitZone(1);
|
||||
exitZone(1);
|
||||
if (verbose)
|
||||
printf("'%s' verified %s.\n", df, ret==0? "Ok": "NoNo");
|
||||
free(cf);
|
||||
|
@ -818,9 +825,9 @@ int main (int argc, char *argv[])
|
|||
if (df && (zf || (num1 && num2)))
|
||||
return checkZone(zf, df, num1, num2, verbose);
|
||||
if (df && num1 && cc)
|
||||
return checkArea(df, cc, snum1, verbose);
|
||||
return checkArea(df, cc, snum1, verbose);
|
||||
if (df && cf && cc)
|
||||
return checkAllArea(df, cf, cc, verbose);
|
||||
return checkAllArea(df, cf, cc, verbose);
|
||||
fprintf(stderr, "Usage:\n%s -d DBfile -v -V { -z Zonefile | num1 num2 | -a cc num}\n", basename(argv[0]));
|
||||
fprintf(stderr, "\t-d DBfile -v -V -a CC num1 \n");
|
||||
fprintf(stderr, "\t-d DBfile -c Codefile -a CC -v -V\n");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: zone.h,v 1.1 1999/06/09 19:59:23 akool Exp $
|
||||
/* $Id: zone.h,v 1.2 1999/06/26 12:26:35 akool Exp $
|
||||
*
|
||||
* Verzonungsberechnung
|
||||
*
|
||||
|
@ -19,6 +19,10 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: zone.h,v $
|
||||
* Revision 1.2 1999/06/26 12:26:35 akool
|
||||
* isdnlog Version 3.37
|
||||
* fixed some warnings
|
||||
*
|
||||
* Revision 1.1 1999/06/09 19:59:23 akool
|
||||
* isdnlog Version 3.31
|
||||
* - Release 0.91 of zone-Database (aka "Verzonungstabelle")
|
||||
|
@ -33,5 +37,6 @@
|
|||
int initZone (int provider, char *path, char **msg);
|
||||
void exitZone (int provider);
|
||||
int getZone (int provider, char *from, char *to);
|
||||
int getAreacode(int country, char *from, char **text);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue