isdnlog Version 3.33

- big step in using the new zone files
  - *This*is*not*a*production*ready*isdnlog*!!
  - Maybe the last release before the I4L meeting in Nuernberg
This commit is contained in:
Andreas Kool 1999-06-15 20:08:20 +00:00
parent 81ea88bee4
commit 4ab0fd8f1b
41 changed files with 2973 additions and 2651 deletions

View File

@ -19,6 +19,12 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
## ##
## $Log$ ## $Log$
## Revision 1.85 1999/06/13 14:06:53 akool
## isdnlog Version 3.32
##
## - new option "-U1" (or "ignoreCOLP=1") to ignore CLIP/COLP Frames
## - TEI management decoded
##
## Revision 1.84 1999/06/09 19:57:22 akool ## Revision 1.84 1999/06/09 19:57:22 akool
## isdnlog Version 3.31 ## isdnlog Version 3.31
## - Release 0.91 of zone-Database (aka "Verzonungstabelle") ## - Release 0.91 of zone-Database (aka "Verzonungstabelle")
@ -670,7 +676,7 @@ SERVICEFILE = /etc/services
# DON'T EDIT BELOW THIS LINE # DON'T EDIT BELOW THIS LINE
###################################################################### ######################################################################
VERSION = 3.32 VERSION = 3.33
MANPAGES = isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 \ MANPAGES = isdnlog/callerid.conf.5 isdnlog/isdn.conf.5 \
isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 \ isdnlog/isdnformat.5 isdnlog/isdnlog.5 isdnlog/isdnlog.8 \
@ -706,7 +712,8 @@ ISDNLOG_OBJS = isdnlog/isdnlog.o isdnlog/processor.o isdnlog/functions.o \
isdnlog/server.o isdnlog/start_prog.o isdnlog/messages.o \ isdnlog/server.o isdnlog/start_prog.o isdnlog/messages.o \
connect/connect.o connect/socket.o tools/tools.o \ connect/connect.o connect/socket.o tools/tools.o \
connect/conv_address.o isdnlog/user_access.o \ connect/conv_address.o isdnlog/user_access.o \
tools/isdnconf.o tools/rate.o tools/holiday.o \ tools/isdnconf.o \
tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
isdnlog/asn1.o isdnlog/asn1_generic.o isdnlog/asn1_aoc.o \ isdnlog/asn1.o isdnlog/asn1_generic.o isdnlog/asn1_aoc.o \
isdnlog/asn1_address.o isdnlog/asn1_diversion.o \ isdnlog/asn1_address.o isdnlog/asn1_diversion.o \
isdnlog/asn1_basic_service.o isdnlog/asn1_comp.o \ isdnlog/asn1_basic_service.o isdnlog/asn1_comp.o \
@ -727,11 +734,11 @@ endif
ISDNREP_OBJS = isdnrep/rep_main.o tools/tools.o tools/isdnconf.o \ ISDNREP_OBJS = isdnrep/rep_main.o tools/tools.o tools/isdnconf.o \
isdnlog/messages.o isdnrep/isdnrep.o \ isdnlog/messages.o isdnrep/isdnrep.o \
tools/rate.o tools/holiday.o \ tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
$(LIBISDNDIR)/libisdn.a $(LIBISDNDIR)/libisdn.a
ISDNCONF_OBJS= isdnconf/isdnconf.o tools/tools.o tools/isdnconf.o \ ISDNCONF_OBJS= isdnconf/isdnconf.o tools/tools.o tools/isdnconf.o \
tools/rate.o tools/holiday.o \ tools/rate.o tools/zone.o tools/country.o tools/holiday.o \
$(LIBISDNDIR)/libisdn.a $(LIBISDNDIR)/libisdn.a
ISDNLOG = bin/isdnlog ISDNLOG = bin/isdnlog

View File

@ -3979,6 +3979,12 @@ Nun die Eintraege im einzelnen:
Hiermit wird die Version der Tarifdatenbank angegeben. Hiermit wird die Version der Tarifdatenbank angegeben.
V:Versionsstring (Vorschlag: 1.0-Germany [18-Mar-1999]) V:Versionsstring (Vorschlag: 1.0-Germany [18-Mar-1999])
-> U:
Damit wird das Währungsformat und die Anzahl der Dezimalstellen
angegeben, z.B.
U:%.3 DM
-> P: -> P:
Hiermit beginnt die Definition des (naechsten) Providers. Hiermit beginnt die Definition des (naechsten) Providers.
@ -4023,6 +4029,15 @@ von isdnlog noch gesondert verwendet werden, und sollten daher zumindest
genug Informationen enthalten, um eine Kontaktaufnahme mit der jeweiligen genug Informationen enthalten, um eine Kontaktaufnahme mit der jeweiligen
Telefongesellschaft zu ermoeglichen. Telefongesellschaft zu ermoeglichen.
-> D:
Damit wird die Art der Inlandsverzonung (D steht für Domestic) angegeben.
Der Name wird mit dem Eintrag in der isdn.conf
ZONEFILE=/usr/lib/isdn/zone-de-%s.dat
zum Pfad zur Verzonungstabelle zusammengebaut. Mehrere Provider können
dieselbe Verzonungstabelle nutzen.
Nun folgen die eigentlichen Tarifinformationen. Es wird zuerst die Nun folgen die eigentlichen Tarifinformationen. Es wird zuerst die
Tarifzone, und danach die Kosten innerhalb dieser Zone angegeben. Es koennen Tarifzone, und danach die Kosten innerhalb dieser Zone angegeben. Es koennen

View File

@ -116,8 +116,8 @@ AC_PROG_MAKE_SET
AC_PATH_PROGS(BZIP2, bzip2, /usr/bin/bzip2, $PATH:/bin:/usr/bin:/usr/local/bin) AC_PATH_PROGS(BZIP2, bzip2, /usr/bin/bzip2, $PATH:/bin:/usr/bin:/usr/local/bin)
dnl Checks for libraries. dnl Checks for libraries.
AC_CHECK_LIB(dbm, dbm_open, DBMLIB=-ldbm; AC_DEFINE(HAVE_LIBDBM), AC_CHECK_LIB(gdbm, gdbm_open, DBMLIB=-lgdbm; AC_DEFINE(HAVE_LIBGDBM),
AC_CHECK_LIB(gdbm, gdbm_open, DBMLIB=-lgdbm; AC_DEFINE(HAVE_LIBGDBM), AC_CHECK_LIB(dbm, dbm_open, DBMLIB=-ldbm; AC_DEFINE(HAVE_LIBDBM),
AC_CHECK_LIB(db, dbm_open, DBMLIB=-ldb; AC_DEFINE(HAVE_LIBDB)))) AC_CHECK_LIB(db, dbm_open, DBMLIB=-ldb; AC_DEFINE(HAVE_LIBDB))))
AC_CHECK_POSTGRES AC_CHECK_POSTGRES
AC_CHECK_MYSQLDB AC_CHECK_MYSQLDB

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
V:1.1-Austria [12-Apr-1999] V:1.20-Austria [05-Jun-1999]
W:1 Montag W:1 Montag
W:2 Dienstag W:2 Dienstag

View File

@ -20,6 +20,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.31 1999/06/13 14:07:28 akool
* isdnlog Version 3.32
*
* - new option "-U1" (or "ignoreCOLP=1") to ignore CLIP/COLP Frames
* - TEI management decoded
*
* Revision 1.30 1999/06/09 19:58:12 akool * Revision 1.30 1999/06/09 19:58:12 akool
* isdnlog Version 3.31 * isdnlog Version 3.31
* - Release 0.91 of zone-Database (aka "Verzonungstabelle") * - Release 0.91 of zone-Database (aka "Verzonungstabelle")
@ -231,6 +237,7 @@
*/ */
#include "isdnconf.h" #include "isdnconf.h"
#include "tools/zone.h"
/*****************************************************************************/ /*****************************************************************************/
#define ZAUNPFAHL 1 /* FIXME: Michi: Offset */ #define ZAUNPFAHL 1 /* FIXME: Michi: Offset */
@ -881,7 +888,7 @@ retry:
DTAGRate = Rate.Charge; DTAGRate = Rate.Charge;
#if 0 #if 0
print_msg(PRT_NORMAL, "DEBUG::tz=%d, zone=%d, Hour=%02d, P=%d, %s lasthour=%d, lastprovider=%d, now=%s", tz, *p, hour, provider, getProvidername(provider), lasthour, lastprovider, ctime(&Rate.start)); print_msg(PRT_NORMAL, "DEBUG::tz=%d, zone=%d, Hour=%02d, P=%d, %s lasthour=%d, lastprovider=%d, now=%s", tz, *p, hour, provider, getProvider(provider), lasthour, lastprovider, ctime(&Rate.start));
#endif #endif
if (lastprovider == UNKNOWN) { if (lastprovider == UNKNOWN) {
@ -898,7 +905,7 @@ retry:
if (lastprovider == UNKNOWN) if (lastprovider == UNKNOWN)
px = ""; px = "";
else else
px = getProvidername(lastprovider); px = getProvider(lastprovider);
print_msg(PRT_NORMAL, " %02d:00 .. %02d:59 %s%02d:%s%*s = %s %s (%s) [DTAG: %s %s]\n", print_msg(PRT_NORMAL, " %02d:00 .. %02d:59 %s%02d:%s%*s = %s %s (%s) [DTAG: %s %s]\n",
lasthour, hour - 1, vbn, lastprovider, px, lasthour, hour - 1, vbn, lastprovider, px,
@ -930,7 +937,7 @@ retry:
if (lastprovider == UNKNOWN) if (lastprovider == UNKNOWN)
px = ""; px = "";
else else
px = getProvidername(lastprovider); px = getProvider(lastprovider);
if ((lasthour == 7) && (hour == 7)) if ((lasthour == 7) && (hour == 7))
print_msg(PRT_NORMAL, " immer %s%02d:%s%*s = %s %s (%s) [DTAG: %s %s]\n", print_msg(PRT_NORMAL, " immer %s%02d:%s%*s = %s %s (%s) [DTAG: %s %s]\n",
@ -959,7 +966,7 @@ retry:
for (provider = 0; provider < MAXPROVIDER; provider++) for (provider = 0; provider < MAXPROVIDER; provider++)
if (used[provider]) { if (used[provider]) {
print_msg(PRT_NORMAL, "%s%02d:%s%*s(%d hours)\n", vbn, provider, getProvidername(provider), max(WIDTH, strlen(getProvidername(provider))) - strlen(getProvidername(provider)), "", hours[provider]); print_msg(PRT_NORMAL, "%s%02d:%s%*s(%d hours)\n", vbn, provider, getProvider(provider), max(WIDTH, strlen(getProvider(provider))) - strlen(getProvider(provider)), "", hours[provider]);
useds++; useds++;
if (hours[provider] < maxhour) { if (hours[provider] < maxhour) {
@ -973,7 +980,7 @@ retry:
if (ignoreprovider != leastprovider) { if (ignoreprovider != leastprovider) {
print_msg(PRT_NORMAL, "OOOPS: More than 5 providers used. Retry with %s%02d:%s ignored\n", print_msg(PRT_NORMAL, "OOOPS: More than 5 providers used. Retry with %s%02d:%s ignored\n",
vbn, leastprovider, getProvidername(leastprovider)); vbn, leastprovider, getProvider(leastprovider));
ignoreprovider = leastprovider; ignoreprovider = leastprovider;
goto retry; goto retry;
@ -1002,6 +1009,8 @@ static void showWorld(int duration)
if ((p = strchr(s, '\n'))) if ((p = strchr(s, '\n')))
*p = 0; *p = 0;
/* Fixme */
#define abroad(x,y) 1
if (abroad(s, areacode)) { if (abroad(s, areacode)) {
memset(&Rate, 0, sizeof(Rate)); memset(&Rate, 0, sizeof(Rate));
@ -1012,7 +1021,7 @@ static void showWorld(int duration)
n = 0; n = 0;
for (Rate.prefix = 0; Rate.prefix < MAXPROVIDER; Rate.prefix++) { for (Rate.prefix = 0; Rate.prefix < MAXPROVIDER; Rate.prefix++) {
Rate.zone = getZone(Rate.prefix, areacode); Rate.zone = getZone(Rate.prefix, myarea, areacode);
if (Rate.zone != UNKNOWN) { if (Rate.zone != UNKNOWN) {
@ -1030,7 +1039,7 @@ static void showWorld(int duration)
#if 0 #if 0
if (provider = getLeastCost(&Rate, UNKNOWN)) { if (provider = getLeastCost(&Rate, UNKNOWN)) {
print_msg(PRT_NORMAL, "%-50s %s %s%d:%s (%s)\n", print_msg(PRT_NORMAL, "%-50s %s %s%d:%s (%s)\n",
s, areacode, vbn, provider, getProvidername(provider), explainRate(&Rate)); s, areacode, vbn, provider, getProvider(provider), explainRate(&Rate));
break; break;
} /* if */ } /* if */
#endif #endif
@ -1042,7 +1051,7 @@ static void showWorld(int duration)
print_msg(PRT_NORMAL, "%-46s %-9s %s%d:%s (%s)\n", print_msg(PRT_NORMAL, "%-46s %-9s %s%d:%s (%s)\n",
s, areacode, vbn, sort[0].prefix, s, areacode, vbn, sort[0].prefix,
getProvidername(sort[0].prefix), sort[0].explain); getProvider(sort[0].prefix), sort[0].explain);
} /* if */ } /* if */
} }
@ -1062,9 +1071,10 @@ int main(int argc, char *argv[], char *envp[])
section *conf_dat = NULL; section *conf_dat = NULL;
char *myname = basename(argv[0]); char *myname = basename(argv[0]);
FILE *fp; FILE *fp;
COUNTRY *Country;
RATE Rate; RATE Rate;
char *msg; char *msg;
char country[BUFSIZ]; char *country;
static char usage[] = "%s: usage: %s [ -%s ]\n"; static char usage[] = "%s: usage: %s [ -%s ]\n";
@ -1224,7 +1234,7 @@ int main(int argc, char *argv[], char *envp[])
initHoliday(holifile, NULL); initHoliday(holifile, NULL);
initRate("/etc/isdn/rate.conf", "/usr/lib/isdn/rate-de.dat", "/usr/lib/isdn/countries-de.dat", NULL, NULL); initRate("/etc/isdn/rate.conf", "/usr/lib/isdn/rate-de.dat", "/usr/lib/isdn/zone-de-%s.gdbm", NULL);
/* initRate(NULL, "/usr/lib/isdn/rate-de.dat", "/usr/lib/isdn/countries-de.dat", NULL, NULL); */ /* initRate(NULL, "/usr/lib/isdn/rate-de.dat", "/usr/lib/isdn/countries-de.dat", NULL, NULL); */
currency = strdup("DM"); currency = strdup("DM");
vbn = strdup("010"); vbn = strdup("010");
@ -1257,8 +1267,8 @@ int main(int argc, char *argv[], char *envp[])
} }
else { else {
if (isalpha(*areacode)) { if (isalpha(*areacode)) {
if (abroad(areacode, country)) if (getCountry(areacode, &Country))
strcpy(areacode, country); strcpy(areacode, Country->Code[0]);
} /* if */ } /* if */
zone = area_diff(NULL, areacode); zone = area_diff(NULL, areacode);
@ -1282,11 +1292,11 @@ int main(int argc, char *argv[], char *envp[])
zone2 = zone; zone2 = zone;
#if 0 #if 0
else else
zone2 = getZone(DTAG, areacode); zone2 = getZone(DTAG, myarea, areacode);
#endif #endif
if (zone2 == UNKNOWN) { if (zone2 == UNKNOWN) {
if (abroad(areacode, country)) if (getCountrycode(areacode, &country))
print_msg(PRT_NORMAL, "Ein %d Sekunden langes Gespraech nach %s (%s) kostet am %s", print_msg(PRT_NORMAL, "Ein %d Sekunden langes Gespraech nach %s (%s) kostet am %s",
duration, country, areacode, ctime(&Rate.start)); duration, country, areacode, ctime(&Rate.start));
else else
@ -1309,7 +1319,7 @@ int main(int argc, char *argv[], char *envp[])
if (zone != UNKNOWN) if (zone != UNKNOWN)
Rate.zone = zone; Rate.zone = zone;
else else
Rate.zone = getZone(Rate.prefix, areacode); Rate.zone = getZone(Rate.prefix, myarea, areacode);
if (Rate.zone != UNKNOWN) { if (Rate.zone != UNKNOWN) {

View File

@ -19,6 +19,11 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* *
* $Log$ * $Log$
* Revision 1.23 1999/06/03 18:50:27 akool
* isdnlog Version 3.30
* - rate-de.dat V:1.02-Germany [03-Jun-1999 19:49:22]
* - small fixes
*
* Revision 1.22 1999/04/19 19:24:35 akool * Revision 1.22 1999/04/19 19:24:35 akool
* isdnlog Version 3.18 * isdnlog Version 3.18
* *
@ -107,7 +112,7 @@
* (first dialed digit comes with SETUP-Frame) * (first dialed digit comes with SETUP-Frame)
* *
* Revision 1.14 1998/09/09 12:49:31 paul * Revision 1.14 1998/09/09 12:49:31 paul
* fixed crash when using mysql (call to Providername() was omitted) * fixed crash when using mysql (call to Provider() was omitted)
* *
* Revision 1.13 1998/06/21 11:52:43 akool * Revision 1.13 1998/06/21 11:52:43 akool
* First step to let isdnlog generate his own AOCD messages * First step to let isdnlog generate his own AOCD messages
@ -412,8 +417,8 @@ void logger(int chan)
mysql_db_set.currency_factor = currency_factor; mysql_db_set.currency_factor = currency_factor;
strcpy(mysql_db_set.currency, currency); strcpy(mysql_db_set.currency, currency);
mysql_db_set.pay = call[chan].pay; mysql_db_set.pay = call[chan].pay;
/* Fixme: getProvidername() should be changed to call[chan].Rate.Provider */ /* Fixme: getProvider() should be changed to call[chan].Rate.Provider */
strcpy(mysql_db_set.provider, getProvidername(call[chan].provider)); strcpy(mysql_db_set.provider, getProvider(call[chan].provider));
mysql_dbAdd(&mysql_db_set); mysql_dbAdd(&mysql_db_set);
#endif #endif
} /* logger */ } /* logger */

View File

@ -19,6 +19,12 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* *
* $Log$ * $Log$
* Revision 1.44 1999/06/13 14:07:44 akool
* isdnlog Version 3.32
*
* - new option "-U1" (or "ignoreCOLP=1") to ignore CLIP/COLP Frames
* - TEI management decoded
*
* Revision 1.43 1999/05/22 10:18:28 akool * Revision 1.43 1999/05/22 10:18:28 akool
* isdnlog Version 3.29 * isdnlog Version 3.29
* *
@ -1111,7 +1117,7 @@ int main(int argc, char *argv[], char *envp[])
register int i, res = 0; register int i, res = 0;
auto int lastarg; auto int lastarg;
auto char rlogfile[PATH_MAX]; auto char rlogfile[PATH_MAX];
auto char *version, *cversion; auto char *version;
auto char **devices = NULL; auto char **devices = NULL;
sigset_t unblock_set; sigset_t unblock_set;
#ifdef TESTCENTER #ifdef TESTCENTER
@ -1331,11 +1337,11 @@ int main(int argc, char *argv[], char *envp[])
if (!Q931dmp && *version) if (!Q931dmp && *version)
print_msg(PRT_NORMAL, "%s\n", version); print_msg(PRT_NORMAL, "%s\n", version);
initRate(rateconf, ratefile, countryfile, &version, &cversion); initCountry(countryfile, &version);
if (!Q931dmp && *version)
if (!Q931dmp && *cversion) print_msg(PRT_NORMAL, "%s\n", version);
print_msg(PRT_NORMAL, "%s\n", cversion);
initRate(rateconf, ratefile, zonefile, &version);
if (!Q931dmp && *version) if (!Q931dmp && *version)
print_msg(PRT_NORMAL, "%s\n", version); print_msg(PRT_NORMAL, "%s\n", version);

View File

@ -19,6 +19,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.66 1999/06/13 14:07:50 akool
* isdnlog Version 3.32
*
* - new option "-U1" (or "ignoreCOLP=1") to ignore CLIP/COLP Frames
* - TEI management decoded
*
* Revision 1.65 1999/06/09 19:58:26 akool * Revision 1.65 1999/06/09 19:58:26 akool
* isdnlog Version 3.31 * isdnlog Version 3.31
* - Release 0.91 of zone-Database (aka "Verzonungstabelle") * - Release 0.91 of zone-Database (aka "Verzonungstabelle")
@ -932,9 +938,9 @@ void buildnumber(char *num, int oc3, int oc3a, char *result, int version,
auto char s[BUFSIZ]; auto char s[BUFSIZ];
if (*provider < 100) if (*provider < 100)
sprintf(s, "Via provider \"%s%02d\", %s", vbn, *provider, getProvidername(*provider)); sprintf(s, "Via provider \"%s%02d\", %s", vbn, *provider, getProvider(*provider));
else else
sprintf(s, "Via provider \"%s%03d\", %s", vbn, *provider - 100, getProvidername(*provider)); sprintf(s, "Via provider \"%s%03d\", %s", vbn, *provider - 100, getProvider(*provider));
Q931dump(TYPE_STRING, -1, s, version); Q931dump(TYPE_STRING, -1, s, version);
} /* if */ } /* if */
@ -944,8 +950,8 @@ void buildnumber(char *num, int oc3, int oc3a, char *result, int version,
if (*provider == UNKNOWN) if (*provider == UNKNOWN)
*provider = preselect; *provider = preselect;
if (!dir && (who == CALLED)) if (*num && !dir && (who == CALLED) && getArea(*provider, num))
*sondernummer = is_sonderrufnummer(num); *sondernummer = strlen(num);
} /* if */ } /* if */
if (Q931dmp) { if (Q931dmp) {
@ -3452,19 +3458,15 @@ static void addlist(int chan, int type, int mode) /* mode :: 0 = Add new entry,
void processRate(int chan) void processRate(int chan)
{ {
if (call[chan].zone != UNKNOWN) { call[chan].Rate.start = call[chan].connect;
call[chan].Rate.prefix = call[chan].provider; call[chan].Rate.now = call[chan].disconnect = cur_time;
call[chan].Rate.zone = call[chan].zone;
call[chan].Rate.start = call[chan].connect;
call[chan].Rate.now = call[chan].disconnect = cur_time;
if (getRate(&call[chan].Rate, NULL) == UNKNOWN) if (getRate(&call[chan].Rate, NULL) == UNKNOWN) {
call[chan].tarifknown = 0; call[chan].tarifknown = 0;
else { } else {
call[chan].tarifknown = 1; call[chan].tarifknown = 1;
call[chan].pay = call[chan].Rate.Charge; call[chan].pay = call[chan].Rate.Charge;
} /* else */ } /* else */
} /* if */
} /* processRate */ } /* processRate */
@ -3498,13 +3500,13 @@ static void processLCR(int chan, char *hint)
if ((call[chan].provider != preselect) && (prepreis != -1.00) && (prepreis != call[chan].pay)) if ((call[chan].provider != preselect) && (prepreis != -1.00) && (prepreis != call[chan].pay))
sprintf(sy, " saving vs. preselect (%s%02d:%s) %s %s", sprintf(sy, " saving vs. preselect (%s%02d:%s) %s %s",
vbn, preselect, getProvidername(preselect), vbn, preselect, getProvider(preselect),
currency, currency,
double2str(prepreis - call[chan].pay, 6, 3, DEB)); double2str(prepreis - call[chan].pay, 6, 3, DEB));
if ((call[chan].hint != UNKNOWN) && (call[chan].hint != bestRate.prefix)) if ((call[chan].hint != UNKNOWN) && (call[chan].hint != bestRate.prefix))
sprintf(sz, " saving vs. hint (%s%02d:%s) %s %s", sprintf(sz, " saving vs. hint (%s%02d:%s) %s %s",
vbn, call[chan].hint, getProvidername(call[chan].hint), vbn, call[chan].hint, getProvider(call[chan].hint),
currency, currency,
double2str(hintpreis - call[chan].pay, 6, 3, DEB)); double2str(hintpreis - call[chan].pay, 6, 3, DEB));
@ -3534,31 +3536,20 @@ static void showRates(char *message)
static void prepareRate(int chan, char **msg, char **tip, int viarep) static void prepareRate(int chan, char **msg, char **tip, int viarep)
{ {
auto int zone = UNKNOWN;
auto RATE lcRate, ckRate; auto RATE lcRate, ckRate;
auto char pro[BUFSIZ];
static char message[BUFSIZ]; static char message[BUFSIZ];
static char lcrhint[BUFSIZ]; static char lcrhint[BUFSIZ];
if (msg) if (msg)
*(*msg = message) = '\0'; *(*msg = message) = '\0';
if (tip) if (tip)
*(*tip = lcrhint) = '\0'; *(*tip = lcrhint) = '\0';
call[chan].Rate.Provider = ""; clearRate (&call[chan].Rate);
call[chan].Rate.Zone = "";
call[chan].Rate.Day = "";
call[chan].Rate.Hour = "";
call[chan].Rate.Duration = 0;
call[chan].Rate.Price = 0;
call[chan].Rate.Units = 0;
call[chan].Rate.Charge = 0;
call[chan].Rate.Time = 0;
call[chan].Rate.Rest = 0;
if (call[chan].intern[CALLED]) { if (call[chan].intern[CALLED]) {
call[chan].Rate.zone = UNZONE;
call[chan].zone = INTERN; call[chan].zone = INTERN;
call[chan].tarifknown = 0; call[chan].tarifknown = 0;
@ -3568,10 +3559,17 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep)
return; return;
} /* if */ } /* if */
zone = getZone(call[chan].provider, call[chan].num[CALLED]); call[chan].Rate.prefix = call[chan].provider;
call[chan].Rate.src = call[chan].num[CALLING];
call[chan].Rate.dst = call[chan].num[CALLED];
if (!zone) { /* FreeCall */ if (getRate(&call[chan].Rate, msg)==UNKNOWN)
call[chan].zone = FREECALL; return;
if (msg)
*(*msg = message) = '\0';
if (call[chan].Rate.zone == FREECALL) { /* FreeCall */
call[chan].tarifknown = 0; call[chan].tarifknown = 0;
if (msg) if (msg)
@ -3580,26 +3578,7 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep)
return; return;
} /* if */ } /* if */
if (zone == UNKNOWN) { if (call[chan].Rate.zone == UNKNOWN)
if (call[chan].local[CALLED])
zone = LOCALCALL;
else {
zone = area_diff(NULL, call[chan].num[CALLED]);
switch (zone) {
case AREA_ERROR :
case AREA_UNKNOWN : zone = UNKNOWN; break;
case AREA_LOCAL : zone = CITYCALL; break;
case AREA_R50 : zone = REGIOCALL; break;
case AREA_FAR : zone = GERMANCALL; break;
case AREA_ABROAD : zone = UNKNOWN; break;
} /* switch */
} /* else */
} /* if */
call[chan].zone = zone;
if (zone == UNKNOWN)
call[chan].tarifknown = 0; call[chan].tarifknown = 0;
else else
processRate(chan); processRate(chan);
@ -3607,24 +3586,8 @@ static void prepareRate(int chan, char **msg, char **tip, int viarep)
if (viarep) if (viarep)
return; return;
if (msg) { if (msg && call[chan].tarifknown)
if (call[chan].tarifknown) showRates(message);
showRates(message);
else {
if (call[chan].provider < 100)
sprintf(pro, "%s%02d", vbn, call[chan].provider);
else
sprintf(pro, "%s%03d", vbn, call[chan].provider - 100);
if (call[chan].zone == UNKNOWN)
sprintf(message, "CHARGE: Uh-oh: No zone info for provider %s, number %s",
pro, call[chan].num[CALLED]);
else
sprintf(message, "CHARGE: Uh-oh: No charge info for provider %s, zone %d, number %s",
pro, call[chan].zone, call[chan].num[CALLED]);
} /* else */
} /* if */
lcRate = call[chan].Rate; lcRate = call[chan].Rate;
@ -3661,7 +3624,7 @@ static void LCR(int chan, char *s)
print_msg(PRT_NORMAL, ">> LCR: OUTGOING SETUP(%s)\n", s + 5); print_msg(PRT_NORMAL, ">> LCR: OUTGOING SETUP(%s)\n", s + 5);
print_msg(PRT_NORMAL, ">> LCR: from TEI %d, to number \"%s\", Provider=%s%d:%s, Sonderrufnummer=%d, InternalCall=%d, LocalCall=%d\n", print_msg(PRT_NORMAL, ">> LCR: from TEI %d, to number \"%s\", Provider=%s%d:%s, Sonderrufnummer=%d, InternalCall=%d, LocalCall=%d\n",
call[chan].tei, call[chan].num[CALLED], vbn, call[chan].provider, getProvidername(call[chan].provider), call[chan].tei, call[chan].num[CALLED], vbn, call[chan].provider, getProvider(call[chan].provider),
call[chan].sondernummer[CALLED], call[chan].intern[CALLED], call[chan].local[CALLED]); call[chan].sondernummer[CALLED], call[chan].intern[CALLED], call[chan].local[CALLED]);
if (!call[chan].intern[CALLED]) { /* keine Hausinternen Gespr„che */ if (!call[chan].intern[CALLED]) { /* keine Hausinternen Gespr„che */

View File

@ -24,6 +24,11 @@
* *
* *
* $Log$ * $Log$
* Revision 1.67 1999/06/09 19:58:44 akool
* isdnlog Version 3.31
* - Release 0.91 of zone-Database (aka "Verzonungstabelle")
* - "rate-de.dat" V:1.02-Germany [09-Jun-1999 21:45:26]
*
* Revision 1.66 1999/06/03 18:50:46 akool * Revision 1.66 1999/06/03 18:50:46 akool
* isdnlog Version 3.30 * isdnlog Version 3.30
* - rate-de.dat V:1.02-Germany [03-Jun-1999 19:49:22] * - rate-de.dat V:1.02-Germany [03-Jun-1999 19:49:22]
@ -905,7 +910,7 @@ int read_logfile(char *myname)
/* FIXME: */ /* FIXME: */
initHoliday(holifile, NULL); initHoliday(holifile, NULL);
initRate("/etc/isdn/rate.conf", "/usr/lib/isdn/rate-de.dat", "/usr/lib/isdn/countries-de.dat", NULL, NULL); initRate("/etc/isdn/rate.conf", "/usr/lib/isdn/rate-de.dat", "/usr/lib/isdn/rate-de-%s.gdbm", NULL);
currency = strdup("DM"); currency = strdup("DM");
vbn = strdup("010"); vbn = strdup("010");
interns0 = 3; interns0 = 3;
@ -1283,7 +1288,7 @@ static int print_bottom(double unit, char *start, char *stop)
else else
*sx = 0; *sx = 0;
print_line3(NULL, "Provider", string, getProvidername(i), print_line3(NULL, "Provider", string, getProvider(i),
usage_provider[i], usage_provider[i],
double2clock(duration_provider[i]), double2clock(duration_provider[i]),
print_currency(pay_provider[i], 0), sx); print_currency(pay_provider[i], 0), sx);
@ -1740,7 +1745,7 @@ static int print_line(int status, one_call *cur_call, int computed, char *overla
{ {
register char *p; register char *p;
p = (cur_call->provider > 0) ? getProvidername(cur_call->provider) : ""; p = (cur_call->provider > 0) ? getProvider(cur_call->provider) : "";
if (cur_call->dir == DIALIN) if (cur_call->dir == DIALIN)
p = ""; p = "";

File diff suppressed because it is too large Load Diff

View File

@ -10,16 +10,17 @@
# for collecting and preparing most of the call charges. # for collecting and preparing most of the call charges.
V:1.40-Austria [01-Jun-1999] V:1.56-Austria [11-Jun-1999]
F:%.3f öS U:%.3f öS
P:01,1 Telekom Austria P:01,1 Telekom Austria
C:Tarif: Minimumtarif (ATS 1.116 / Impuls) C:Tarif: Minimumtarif (ATS 1.116 / Impuls)
D:pta # Verzonung
Z:0 FreePhone Z:0 FreePhone
T:*/*=0/72 T:*/*=0/72
A:+43800 A:122, 133, 144, +43800
Z:1 Regionalzone Z:1 Regionalzone
T:1-5/08-12=1.116/57.6 Tageszeit 1 T:1-5/08-12=1.116/57.6 Tageszeit 1
@ -241,10 +242,11 @@ A:+43717
P:01,2 Telekom Austria P:01,2 Telekom Austria
C:Tarif: Standartarif (ATS 1.056 / Impuls) C:Tarif: Standartarif (ATS 1.056 / Impuls)
D:pta # Verzonung
Z:0 FreePhone Z:0 FreePhone
T:*/*=0/72 T:*/*=0/72
A:+43800 A:122, 133, 144, +43800
Z:1 Regionalzone Z:1 Regionalzone
T:1-5/08-12=1.056/57.6 Tageszeit 1 T:1-5/08-12=1.056/57.6 Tageszeit 1
@ -466,10 +468,11 @@ A:+43717
P:01,3 Telekom Austria P:01,3 Telekom Austria
C:Tarif: Geschäftstarif 1 (ATS 0.996 / Impuls) C:Tarif: Geschäftstarif 1 (ATS 0.996 / Impuls)
D:pta # Verzonung
Z:0 FreePhone Z:0 FreePhone
T:*/*=0/72 T:*/*=0/72
A:+43800 A:122, 133, 144, +43800
Z:1 Regionalzone Z:1 Regionalzone
T:1-5/08-12=0.996/57.6 Tageszeit 1 T:1-5/08-12=0.996/57.6 Tageszeit 1
@ -691,10 +694,11 @@ A:+43717
P:01,4 Telekom Austria P:01,4 Telekom Austria
C:Tarif: Geschäftstarif 2 (ATS 0.936 / Impuls) C:Tarif: Geschäftstarif 2 (ATS 0.936 / Impuls)
D:pta # Verzonung
Z:0 FreePhone Z:0 FreePhone
T:*/*=0/72 T:*/*=0/72
A:+43800 A:122, 133, 144, +43800
Z:1 Regionalzone Z:1 Regionalzone
T:1-5/08-12=0.936/57.6 Tageszeit 1 T:1-5/08-12=0.936/57.6 Tageszeit 1
@ -915,6 +919,7 @@ T:E,H/*=0.936/15 Sparzeit
A:+43717 A:+43717
P:02 UTA P:02 UTA
C:Fixme: Bundesland-Verzonung nicht implementiert
Z:1 Bundeslandzone Z:1 Bundeslandzone
T:*/*=1.00(60)/1 Geschäftszeit T:*/*=1.00(60)/1 Geschäftszeit
T:*/*=0.88(60)/1 Freizeit T:*/*=0.88(60)/1 Freizeit
@ -1386,6 +1391,7 @@ T:1-5/18-8=2.112(60)/1 Sparzeit
T:E,H/*=2.112(60)/1 Sparzeit T:E,H/*=2.112(60)/1 Sparzeit
P:12 1012 P:12 1012
D:1012 # Verzonung
Z:1 Nah Z:1 Nah
T:1-5/8-18=1.00(60)/60/1 Tag T:1-5/8-18=1.00(60)/60/1 Tag
T:1-5/18-8=0.90(60)/60/1 Nacht T:1-5/18-8=0.90(60)/60/1 Nacht
@ -1610,7 +1616,8 @@ Z:6 Euro City
T:1-5/8-18=3.76(60)/4.79/1 Tag T:1-5/8-18=3.76(60)/4.79/1 Tag
T:1-5/18-8=3.46(60)/5.20/1 Nacht T:1-5/18-8=3.46(60)/5.20/1 Nacht
T:E,H/*=3.46(60)/5.20/1 Weekend T:E,H/*=3.46(60)/5.20/1 Weekend
A:Amsterdam, Brüssel, Frankfurt, London, Luxemburg, Mailand, Paris, Zürich A:Amsterdam, Brüssel, Frankfurt, London, Luxemburg City, Mailand, Paris
A:Zürich
Z:7 Welt 1 Z:7 Welt 1
T:*/*=6.66(60)/2.70/1 rund um die Uhr T:*/*=6.66(60)/2.70/1 rund um die Uhr
A:Hawaii, Amerikanische Jungferninseln, Puerto Rico, Vereinigte Staaten (USA) A:Hawaii, Amerikanische Jungferninseln, Puerto Rico, Vereinigte Staaten (USA)

View File

@ -3,7 +3,7 @@ CC=gcc -m486 -O2 -pg -Wall -DSTANDALONE -I. -I.. -I../isdnlog
all: rate zone country holiday rate-at all: rate zone country holiday rate-at
rate: rate.u zone.u country.u holiday.u rate: rate.u zone.u country.u holiday.u
${CC} -o rate rate.u country.u holiday.u ${CC} -lgdbm -o rate rate.u zone.u country.u holiday.u
zone: zone.c zone.h zone: zone.c zone.h
${CC} -DZONETEST -lgdbm -o zone zone.c ${CC} -DZONETEST -lgdbm -o zone zone.c

View File

@ -19,6 +19,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.2 1999/06/03 18:51:11 akool
* isdnlog Version 3.30
* - rate-de.dat V:1.02-Germany [03-Jun-1999 19:49:22]
* - small fixes
*
* Revision 1.1 1999/05/27 18:19:57 akool * Revision 1.1 1999/05/27 18:19:57 akool
* first release of the new country decoding module * first release of the new country decoding module
* *
@ -33,6 +38,17 @@
* void initCountry(char *path, char **msg) * void initCountry(char *path, char **msg)
* initialisiert die Länderdatenbank * initialisiert die Länderdatenbank
* *
* int getCountry (char *name, COUTRY **country)
* sucht das Land oder die Vorwahl *name und
* stellt den Eintrag in **country zur Verfügung.
* Rückgabewert ist der phonetische Abstand
* (0 = exakte Übereinsatimmung)
*
* int getCountrycode (char *number, char **name)
* sucht die passende Auslandsvorwahl zu *number
* liefert den Namen des Landes in *name
* Rückgabewert ist die Länge der Vorwahl
*
*/ */
#define _COUNTRY_C_ #define _COUNTRY_C_
@ -46,7 +62,7 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#if 0 #if 1
extern const char *basename (const char *name); extern const char *basename (const char *name);
#endif #endif
#else #else
@ -367,7 +383,7 @@ int getCountry (char *name, COUNTRY **country)
} }
return UNKNOWN; return UNKNOWN;
} }
xname=xlat(name); xname=xlat(name);
for (i=0; i<nCountry; i++) { for (i=0; i<nCountry; i++) {
@ -391,6 +407,27 @@ int getCountry (char *name, COUNTRY **country)
return m; return m;
} }
int getCountrycode(char *number, char **name)
{
int i, j, l, m;
if (name)
*name="";
m=UNKNOWN;
for (i=0; i<nCountry; i++) {
for (j=0; j<Country[i].nCode; j++) {
l=strlen(Country[i].Code[j]);
if (l>m && strncmp (number, Country[i].Code[j], l)==0) {
m=l;
if (name) *name=Country[i].Name;
}
}
}
return m;
}
#ifdef COUNTRYTEST #ifdef COUNTRYTEST
void main (int argc, char *argv[]) void main (int argc, char *argv[])
{ {
@ -402,11 +439,16 @@ void main (int argc, char *argv[])
printf ("%s\n", msg); printf ("%s\n", msg);
for (i=1; i<argc; i++) { for (i=1; i<argc; i++) {
#if 0
d=getCountry(argv[i], &country); d=getCountry(argv[i], &country);
if (country==NULL) if (country==NULL)
printf ("<%s> unknown country!\n", argv[i]); printf ("<%s> unknown country!\n", argv[i]);
else else
printf ("<%s>=<%s> d=%d\n", argv[i], country->Name, d); printf ("<%s>=<%s> d=%d\n", argv[i], country->Name, d);
#else
d=getCountrycode (argv[i], &msg);
printf ("<%s>=<%s> d=%d\n", argv[i], msg, d);
#endif
} }
} }
#endif #endif

View File

@ -19,6 +19,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.2 1999/06/03 18:51:19 akool
* isdnlog Version 3.30
* - rate-de.dat V:1.02-Germany [03-Jun-1999 19:49:22]
* - small fixes
*
* Revision 1.1 1999/05/27 18:19:58 akool * Revision 1.1 1999/05/27 18:19:58 akool
* first release of the new country decoding module * first release of the new country decoding module
* *
@ -36,8 +41,9 @@ typedef struct {
int nCode; int nCode;
} COUNTRY; } COUNTRY;
int initCountry(char *path, char **msg); int initCountry (char *path, char **msg);
void exitCountry(void); void exitCountry (void);
int getCountry(char *name, COUNTRY **country); int getCountry (char *name, COUNTRY **country);
int getCountrycode (char *number, char **name);
#endif #endif

View File

@ -19,6 +19,20 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.12 1999/05/22 10:19:21 akool
* isdnlog Version 3.29
*
* - processing of "sonderrufnummern" much more faster
* - detection for sonderrufnummern of other provider's implemented
* (like 01929:FreeNet)
* - Patch from Oliver Lauer <Oliver.Lauer@coburg.baynet.de>
* - Patch from Markus Schoepflin <schoepflin@ginit.de>
* - easter computing corrected
* - rate-de.dat 1.02-Germany [22-May-1999 11:37:33] (from rate-CVS)
* - countries-de.dat 1.02-Germany [22-May-1999 11:37:47] (from rate-CVS)
* - new option "-B" added (see README)
* (using "isdnlog -B16 ..." isdnlog now works in the Netherlands!)
*
* Revision 1.11 1999/05/09 18:24:18 akool * Revision 1.11 1999/05/09 18:24:18 akool
* isdnlog Version 3.25 * isdnlog Version 3.25
* *
@ -123,7 +137,7 @@
/* /*
* Schnittstelle: * Schnittstelle:
* *
* int initHoliday(char *path) * int initHoliday(char *path, char **msg)
* initialisiert die Feiertagsberechnung, liest die Feiertagsdatei * initialisiert die Feiertagsberechnung, liest die Feiertagsdatei
* und gibt die Anzahl der Feiertage zurück, im Fehlerfall -1 * und gibt die Anzahl der Feiertage zurück, im Fehlerfall -1
* *
@ -166,7 +180,10 @@ typedef struct {
char *name; char *name;
} HOLIDATE; } HOLIDATE;
static char *defaultWeekday[] = { "", static char *defaultWeekday[] = { "", /* not used */
"", /* empty "Everyday" */
"Workday",
"Weekend",
"Monday", "Monday",
"Tuesday", "Tuesday",
"Wednesday", "Wednesday",
@ -174,9 +191,7 @@ static char *defaultWeekday[] = { "",
"Friday", "Friday",
"Saturday", "Saturday",
"Sunday", "Sunday",
"Workday", "Holiday" };
"Weekend",
"Holiday" };
static int line = 0; static int line = 0;
static char *Weekday[COUNT(defaultWeekday)] = { NULL, }; static char *Weekday[COUNT(defaultWeekday)] = { NULL, };
@ -202,8 +217,8 @@ static void warning (char *file, char *fmt, ...)
static julian date2julian(int y, int m, int d) static julian date2julian(int y, int m, int d)
{ {
if (m<3) {m+=9; y--;} else m-=3; if (m<3) {m+=9; y--;} else m-=3;
return (146097*(y/100))/4+(1461*(y%100))/4+(153*m+2)/5+d; return (146097*(y/100))/4+(1461*(y%100))/4+(153*m+2)/5+d;
} }
#if 0 /* not used by now */ #if 0 /* not used by now */
@ -320,10 +335,11 @@ int initHoliday(char *path, char **msg)
s+=2; while (isblank(*s)) s++; s+=2; while (isblank(*s)) s++;
if (isdigit(*s)) { if (isdigit(*s)) {
d=strtol(s,&s,10); d=strtol(s,&s,10);
if (d<1 || d>7) { if (d<1 || d>7) {
warning(path, "invalid weekday %d", d); warning(path, "invalid weekday %d", d);
continue; continue;
} }
d+=MONDAY-1;
} else if (*s=='W') { } else if (*s=='W') {
d=WORKDAY; d=WORKDAY;
s++; s++;
@ -362,6 +378,7 @@ int initHoliday(char *path, char **msg)
d=atof(strsep(&date,".")); d=atof(strsep(&date,"."));
m=atof(strsep(&date,".")); m=atof(strsep(&date,"."));
} }
Holiday=(HOLIDATE*)realloc(Holiday,(nHoliday+1)*sizeof(HOLIDATE)); Holiday=(HOLIDATE*)realloc(Holiday,(nHoliday+1)*sizeof(HOLIDATE));
Holiday[nHoliday].day=d; Holiday[nHoliday].day=d;
Holiday[nHoliday].month=m; Holiday[nHoliday].month=m;
@ -370,7 +387,8 @@ int initHoliday(char *path, char **msg)
break; break;
case 'V': /* V:xxx Version der Datenbank */ case 'V': /* V:xxx Version der Datenbank */
strcpy(version, s+2); s+=2; while(isblank(*s)) s++;
strcpy(version, s);
break; break;
default: default:
@ -380,7 +398,7 @@ int initHoliday(char *path, char **msg)
fclose(stream); fclose(stream);
if (msg) snprintf (message, LENGTH, "Holiday Version %s loaded [%d entries from %s]", if (msg) snprintf (message, LENGTH, "Holiday Version %s loaded [%d entries from %s]",
version, nHoliday, path); version, nHoliday, path);
return nHoliday; return nHoliday;
} }
@ -407,48 +425,36 @@ static int isHoliday(struct tm *tm, char **name)
int isDay(struct tm *tm, bitfield mask, char **name) int isDay(struct tm *tm, bitfield mask, char **name)
{ {
julian day; julian day;
char *s; int holiday;
char *holiname;
static char buffer[BUFSIZ]; static char buffer[BUFSIZ];
int holiday;
holiday = isHoliday(tm, &s); holiday=isHoliday(tm, &holiname);
if ((mask & (1<<HOLIDAY)) && holiday) { if ((mask & (1<<HOLIDAY)) && holiday) {
if (name) sprintf (*name=buffer, "%s (%s)", Weekday[HOLIDAY], s); if (name) sprintf (*name=buffer, "%s (%s)", Weekday[HOLIDAY], holiname);
return HOLIDAY; return HOLIDAY;
} }
day=(date2julian(tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday)-6)%7+1; day=(date2julian(tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday)-6)%7+MONDAY;
if ((mask & (1<<WEEKEND)) && day>5 && !holiday) { if ((mask & (1<<WEEKEND)) && (day==SATURDAY || day==SUNDAY)) {
if (name) sprintf (*name=buffer, "%s (%s)", Weekday[WEEKEND], Weekday[day]); if (name) sprintf (*name=buffer, "%s (%s)", Weekday[WEEKEND], Weekday[day]);
return WEEKEND; return WEEKEND;
} }
if ((mask & (1<<WORKDAY)) && day<6 && !holiday) { if ((mask & (1<<WORKDAY)) && day!=SATURDAY && day!=SUNDAY && !holiday) {
if (name) sprintf (*name=buffer, "%s (%s)", Weekday[WORKDAY], Weekday[day]); if (name) sprintf (*name=buffer, "%s (%s)", Weekday[WORKDAY], Weekday[day]);
return WORKDAY; return WORKDAY;
} }
if (mask & (1<<EVERYDAY)) { if (mask & (1<<day)) {
if(name) if (name) sprintf(*name=buffer, "%s", Weekday[day]);
{
if(holiday)
sprintf(*name=buffer, "%s (%s)", Weekday[day], s);
else
sprintf(*name=buffer, "%s", Weekday[day]);
}
return day; return day;
} }
if (mask & (1<<day)) { if (mask & (1<<EVERYDAY)) {
if(name) if (name) sprintf(*name=buffer, "%s", Weekday[day]);
{
if(holiday)
sprintf(*name=buffer, "%s (%s)", Weekday[day], s);
else
sprintf(*name=buffer, "%s", Weekday[day]);
}
return day; return day;
} }
@ -472,13 +478,13 @@ void main (int argc, char *argv[])
tm.tm_year=atoi(strsep(argv+i,"."))-1900; tm.tm_year=atoi(strsep(argv+i,"."))-1900;
d=isDay(&tm,1<<HOLIDAY,&name); d=isDay(&tm,1<<HOLIDAY,&name);
printf ("%02d.%02d.%04d\t%d = %s\n", tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900,d,d?name:"no Holiday"); printf ("%02d.%02d.%04d\t%2d = %s\n", tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900,d,d?name:"no Holiday");
d=isDay(&tm,1<<WEEKEND,&name); d=isDay(&tm,1<<WEEKEND,&name);
printf ("%02d.%02d.%04d\t%d = %s\n", tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900,d,d?name:"no Weekend"); printf ("%02d.%02d.%04d\t%2d = %s\n", tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900,d,d?name:"no Weekend");
d=isDay(&tm,1<<WORKDAY,&name); d=isDay(&tm,1<<WORKDAY,&name);
printf ("%02d.%02d.%04d\t%d = %s\n", tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900,d,d?name:"no Workday"); printf ("%02d.%02d.%04d\t%2d = %s\n", tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900,d,d?name:"no Workday");
d=isDay(&tm,SOMEDAY,&name); d=isDay(&tm,SOMEDAY,&name);
printf ("%02d.%02d.%04d\t%d = %s\n", tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900,d,d?name:"no Day (Uh?)"); printf ("%02d.%02d.%04d\t%2d = %s\n", tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900,d,d?name:"no Day (Uh?)");
} }
} }
#endif #endif

View File

@ -19,6 +19,15 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.5 1999/04/19 19:25:33 akool
* isdnlog Version 3.18
*
* - countries-at.dat added
* - spelling corrections in "countries-de.dat" and "countries-us.dat"
* - LCR-function of isdnconf now accepts a duration (isdnconf -c .,duration)
* - "rate-at.dat" and "rate-de.dat" extended/fixed
* - holiday.c and rate.c fixed (many thanks to reinelt@eunet.at)
*
* Revision 1.4 1999/04/14 13:17:21 akool * Revision 1.4 1999/04/14 13:17:21 akool
* isdnlog Version 3.14 * isdnlog Version 3.14
* *
@ -74,17 +83,17 @@
#ifndef _HOLIDAY_H_ #ifndef _HOLIDAY_H_
#define _HOLIDAY_H_ #define _HOLIDAY_H_
#define MONDAY 1 #define EVERYDAY 1
#define TUESDAY 2 #define WORKDAY 2
#define WEDNESDAY 3 #define WEEKEND 3
#define THURSDAY 4 #define MONDAY 4
#define FRIDAY 5 #define TUESDAY 5
#define SATURDAY 6 #define WEDNESDAY 6
#define SUNDAY 7 #define THURSDAY 7
#define WORKDAY 8 #define FRIDAY 8
#define WEEKEND 9 #define SATURDAY 9
#define HOLIDAY 10 #define SUNDAY 10
#define EVERYDAY 11 #define HOLIDAY 11
typedef unsigned long bitfield; typedef unsigned long bitfield;

View File

@ -20,6 +20,18 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.28 1999/05/13 11:39:47 akool
* isdnlog Version 3.28
*
* - "-u" Option corrected
* - "ausland.dat" removed
* - "countries-de.dat" fully integrated
* you should add the entry
* "COUNTRYFILE = /usr/lib/isdn/countries-de.dat"
* into section "[ISDNLOG]" of your config file!
* - rate-de.dat V:1.02-Germany [13-May-1999 12:26:24]
* - countries-de.dat V:1.02-Germany [13-May-1999 12:26:26]
*
* Revision 1.27 1999/05/04 19:33:37 akool * Revision 1.27 1999/05/04 19:33:37 akool
* isdnlog Version 3.24 * isdnlog Version 3.24
* *
@ -1059,8 +1071,8 @@ static int _readconfig(char *_myname)
callfile = NULL; callfile = NULL;
callfmt = NULL; callfmt = NULL;
holifile = NULL; holifile = NULL;
rateconf = NULL;
countryfile = NULL; countryfile = NULL;
rateconf = NULL;
ratefile = NULL; ratefile = NULL;
lcdfile = NULL; lcdfile = NULL;
start_procs.infoargs = NULL; start_procs.infoargs = NULL;
@ -1202,11 +1214,14 @@ static int Set_Globals(section *SPtr)
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_CALLFMT)) != NULL) if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_CALLFMT)) != NULL)
callfmt = CEPtr->value; callfmt = CEPtr->value;
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_HOLIFILE)) != NULL)
holifile = CEPtr->value;
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_COUNTRYFILE)) != NULL) if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_COUNTRYFILE)) != NULL)
countryfile = CEPtr->value; countryfile = CEPtr->value;
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_HOLIFILE)) != NULL) if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_ZONEFILE)) != NULL)
holifile = CEPtr->value; zonefile = CEPtr->value;
if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_RATECONF)) != NULL) if ((CEPtr = Get_Entry(Ptr->entries,CONF_ENT_RATECONF)) != NULL)
rateconf = CEPtr->value; rateconf = CEPtr->value;

View File

@ -127,7 +127,7 @@ void rate_1001(void) {
double Tarif[] = { 1.116, 1.056, 0.996, 0.936, 0.816 }; double Tarif[] = { 1.116, 1.056, 0.996, 0.936, 0.816 };
char *Zone[][2] = {{"FreePhone", "+43800" }, char *Zone[][2] = {{ "FreePhone", "122,133,144,+43800" },
{ "Regionalzone", "+43660" }, { "Regionalzone", "+43660" },
{ "Fernzone 1", "" }, { "Fernzone 1", "" },
{ "Fernzone 2", "Österreich" }, { "Fernzone 2", "Österreich" },
@ -202,6 +202,7 @@ void rate_1001(void) {
rprintf ("Telekom Austria", "P:01,%d", t+1); rprintf ("Telekom Austria", "P:01,%d", t+1);
sprintf (s, "%s (ATS %.3f / Impuls)", Name[t], Tarif[t]); sprintf (s, "%s (ATS %.3f / Impuls)", Name[t], Tarif[t]);
rprintf (s, "C:Tarif:"); rprintf (s, "C:Tarif:");
rprintf ("# Verzonung", "D:pta");
for (z=0; z<COUNT(Zone); z++) { for (z=0; z<COUNT(Zone); z++) {
printf ("\n"); printf ("\n");
rprintf (Zone[z][0], "Z:%d", z); rprintf (Zone[z][0], "Z:%d", z);
@ -273,6 +274,7 @@ void rate_1002(void) {
printf ("\n"); printf ("\n");
rprintf ("UTA", "P:02"); rprintf ("UTA", "P:02");
rprintf ("Bundesland-Verzonung nicht implementiert", "C:Fixme:");
for (z=0; z<COUNT(Zone); z++) { for (z=0; z<COUNT(Zone); z++) {
rprintf (Zone[z][0], "Z:%d", z+1); rprintf (Zone[z][0], "Z:%d", z+1);
rprintf ("Geschäftszeit", "T:*/*=%.2f(60)/1", Tarif[z][0]); rprintf ("Geschäftszeit", "T:*/*=%.2f(60)/1", Tarif[z][0]);
@ -548,6 +550,7 @@ void rate_1012(void) {
printf ("\n"); printf ("\n");
rprintf ("1012", "P:12"); rprintf ("1012", "P:12");
rprintf ("# Verzonung", "D:1012");
for (z=0; z<COUNT(Zone); z++) { for (z=0; z<COUNT(Zone); z++) {
rprintf (Zone[z][0], "Z:%d", z+1); rprintf (Zone[z][0], "Z:%d", z+1);
if (z<3) { if (z<3) {
@ -776,8 +779,7 @@ void rate_1066(void) {
{ "Mobilfunk", "+43663,+43664,+43676,+43699" }, { "Mobilfunk", "+43663,+43664,+43676,+43699" },
{ "Euro 1", "Deutschland, Frankreich, Großbritannien, Nordirland, Italien, Liechtenstein, Schweiz, Slowakei, Slowenien, Tschechien, Ungarn" }, { "Euro 1", "Deutschland, Frankreich, Großbritannien, Nordirland, Italien, Liechtenstein, Schweiz, Slowakei, Slowenien, Tschechien, Ungarn" },
{ "Euro 2", "Andorra, Belarus, Belgien, Bosnien-Herzegowina, Bulgarien, Dänemark, Estland, Finnland, Griechenland, Irland, Jugoslawien, Kroatien, Luxemburg, Monaco, Niederlande, Norwegen, Polen, Portugal, Rumänien, San Marino, Schweden, Spanien, Tunesien, Türkei, Ukraine, Vatikanstadt, Zypern" }, { "Euro 2", "Andorra, Belarus, Belgien, Bosnien-Herzegowina, Bulgarien, Dänemark, Estland, Finnland, Griechenland, Irland, Jugoslawien, Kroatien, Luxemburg, Monaco, Niederlande, Norwegen, Polen, Portugal, Rumänien, San Marino, Schweden, Spanien, Tunesien, Türkei, Ukraine, Vatikanstadt, Zypern" },
/* Fixme: nur Stadt Luxemburg! (wie nennen wir's?) */ { "Euro City", "Amsterdam, Brüssel, Frankfurt, London, Luxemburg City, Mailand, Paris, Zürich" },
{ "Euro City", "Amsterdam, Brüssel, Frankfurt, London, Luxemburg, Mailand, Paris, Zürich" },
{ "Welt 1", "Hawaii, Amerikanische Jungferninseln, Puerto Rico, Vereinigte Staaten (USA), Kanada" }, { "Welt 1", "Hawaii, Amerikanische Jungferninseln, Puerto Rico, Vereinigte Staaten (USA), Kanada" },
{ "Welt 2", "Albanien, Antarktis, Armenien, Aserbaidschan, Australien, Bahamas, Chile, Weihnachtsinseln, Kokosinseln, Dominikanische Republik, Georgien, Gibraltar, Guadeloupe, Französisch-Guayana, Hongkong, Island, Israel, Japan, Lettland, Libyen, Litauen, Mazedonien, Malaysia, Malta, Marokko, Martinique, Mayotte, Moldau, Neuseeland, Niederländische Antillen, Philippinen, Russische Föderation, Reunion, St. Pierre und Miquelon, Singapur, Südafrika, Südkorea, Saipan" }, { "Welt 2", "Albanien, Antarktis, Armenien, Aserbaidschan, Australien, Bahamas, Chile, Weihnachtsinseln, Kokosinseln, Dominikanische Republik, Georgien, Gibraltar, Guadeloupe, Französisch-Guayana, Hongkong, Island, Israel, Japan, Lettland, Libyen, Litauen, Mazedonien, Malaysia, Malta, Marokko, Martinique, Mayotte, Moldau, Neuseeland, Niederländische Antillen, Philippinen, Russische Föderation, Reunion, St. Pierre und Miquelon, Singapur, Südafrika, Südkorea, Saipan" },
{ "Welt 3", "Ägypten, Angola, Argentinien, Aruba, Ascension, Bahrain, Barbados, Belize, Benin, Bermuda, Bhutan, Bolivien, Botsuana, Brasilien, Brunei, Burkina Faso, Burundi, Caymaninseln, China, Costa Rica, Dschibuti, Dominica, Ecuador, El Salvador, Färöer-Inseln, Falklandinseln, Fidschi, Französisch-Polynesien, Gabun, Gambia, Ghana, Grenada, Grönland, Guatemala, Haiti, Honduras, Indien, Indonesien, Iran, Jamaika, Jordanien, Katar, Kenia, Kirgisistan, Kolumbien, Nordkorea, Kongo, Kuba, Kuwait, Laos, Lesotho, Libanon, Liberia, Macau, Malawi, Malediven, Marshallinseln, Mauretanien, Mauritius, Mexiko, Montserrat, Nepal, Neukaledonien, Nicaragua, Nigeria, Norfolk-Inseln, Panama, Paraguay, Peru, Ruanda, Sambia, Saudi-Arabien, Salomonen, Simbabwe, Somalia, St. Helena, Saint Kitts und Nevis, St. Lucia, Saint Vincent und die Grenadinen, Sudan, Syrien, Tadschikistan, Tansania, Taiwan, Thailand, Trinidad und Tobago, Turkmenistan, Uruguay, Usbekistan, Vanuatu, Venezuela, Vereinigte Arabische Emirate" }, { "Welt 3", "Ägypten, Angola, Argentinien, Aruba, Ascension, Bahrain, Barbados, Belize, Benin, Bermuda, Bhutan, Bolivien, Botsuana, Brasilien, Brunei, Burkina Faso, Burundi, Caymaninseln, China, Costa Rica, Dschibuti, Dominica, Ecuador, El Salvador, Färöer-Inseln, Falklandinseln, Fidschi, Französisch-Polynesien, Gabun, Gambia, Ghana, Grenada, Grönland, Guatemala, Haiti, Honduras, Indien, Indonesien, Iran, Jamaika, Jordanien, Katar, Kenia, Kirgisistan, Kolumbien, Nordkorea, Kongo, Kuba, Kuwait, Laos, Lesotho, Libanon, Liberia, Macau, Malawi, Malediven, Marshallinseln, Mauretanien, Mauritius, Mexiko, Montserrat, Nepal, Neukaledonien, Nicaragua, Nigeria, Norfolk-Inseln, Panama, Paraguay, Peru, Ruanda, Sambia, Saudi-Arabien, Salomonen, Simbabwe, Somalia, St. Helena, Saint Kitts und Nevis, St. Lucia, Saint Vincent und die Grenadinen, Sudan, Syrien, Tadschikistan, Tansania, Taiwan, Thailand, Trinidad und Tobago, Turkmenistan, Uruguay, Usbekistan, Vanuatu, Venezuela, Vereinigte Arabische Emirate" },
@ -853,8 +855,8 @@ void main (int argc, char *argv[])
printf ("# Many thanks to Daniela Bruder <dbruder@sime.com>\n"); printf ("# Many thanks to Daniela Bruder <dbruder@sime.com>\n");
printf ("# for collecting and preparing most of the call charges.\n\n\n"); printf ("# for collecting and preparing most of the call charges.\n\n\n");
printf ("V:1.40-Austria [01-Jun-1999]\n\n"); printf ("V:1.56-Austria [11-Jun-1999]\n\n");
printf ("F:%%.3f öS\n"); printf ("U:%%.3f öS\n");
#if 0 #if 0
rate_1066(); rate_1066();

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,20 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.8 1999/05/22 10:19:30 akool
* isdnlog Version 3.29
*
* - processing of "sonderrufnummern" much more faster
* - detection for sonderrufnummern of other provider's implemented
* (like 01929:FreeNet)
* - Patch from Oliver Lauer <Oliver.Lauer@coburg.baynet.de>
* - Patch from Markus Schoepflin <schoepflin@ginit.de>
* - easter computing corrected
* - rate-de.dat 1.02-Germany [22-May-1999 11:37:33] (from rate-CVS)
* - countries-de.dat 1.02-Germany [22-May-1999 11:37:47] (from rate-CVS)
* - new option "-B" added (see README)
* (using "isdnlog -B16 ..." isdnlog now works in the Netherlands!)
*
* Revision 1.7 1999/05/13 11:40:07 akool * Revision 1.7 1999/05/13 11:40:07 akool
* isdnlog Version 3.28 * isdnlog Version 3.28
* *
@ -101,12 +115,20 @@
#define _RATE_H_ #define _RATE_H_
typedef struct { typedef struct {
int prefix; int prefix; /* Providerkennung */
int zone; int zone; /* Zonennummer */
time_t start; char *src; /* eigene Telefonnummer */
time_t now; char *dst; /* gerufene Nummer */
time_t start; /* Verbindungsaufbau */
time_t now; /* momentane Zeit */
int domestic; /* Inlandsverbindung */
int _area; /* interner(!) Länderindex */
int _zone; /* interner(!) Zonenindex */
char *Provider; /* Name des Providers */ char *Provider; /* Name des Providers */
char *Country; /* Landesname (Ausland) */
char *Zone; /* Name der Zone */ char *Zone; /* Name der Zone */
char *Service; /* Name des Dienstes (S:-Tag) */
char *Flags; /* Inhalt des F:-Tags */
char *Day; /* Wochen- oder Feiertag */ char *Day; /* Wochen- oder Feiertag */
char *Hour; /* Bezeichnung des Tarifs */ char *Hour; /* Bezeichnung des Tarifs */
double Basic; /* Grundpreis einer Verbindung */ double Basic; /* Grundpreis einer Verbindung */
@ -118,15 +140,17 @@ typedef struct {
time_t Rest; /* bezahlte, aber noch nicht verbrauchte Zeit */ time_t Rest; /* bezahlte, aber noch nicht verbrauchte Zeit */
} RATE; } RATE;
int is_sonderrufnummer(char *num); #define UNZONE -2
int abroad(char *key, char *result);
void exitRate(void); void exitRate(void);
int initRate(char *conf, char *dat, char *countries, char **msg, char **cmsg); int initRate(char *conf, char *dat, char *dom, char **msg);
char *getProvidername(int prefix); char *getProvider(int prefix);
int getZone(int prefix, char *num); int getArea(int prefix, char *number);
void clearRate (RATE *Rate);
int getRate(RATE *Rate, char **msg); int getRate(RATE *Rate, char **msg);
int getLeastCost(RATE *Rate, int skip); int getLeastCost(RATE *Rate, int skip);
int guessZone (RATE *Rate, int units); int guessZone (RATE *Rate, int aoc_units);
char *explainRate (RATE *Rate); char *explainRate (RATE *Rate);
char *printRate (double value);
#endif #endif

View File

@ -19,6 +19,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.28 1999/06/03 18:51:22 akool
* isdnlog Version 3.30
* - rate-de.dat V:1.02-Germany [03-Jun-1999 19:49:22]
* - small fixes
*
* Revision 1.27 1999/05/22 10:19:33 akool * Revision 1.27 1999/05/22 10:19:33 akool
* isdnlog Version 3.29 * isdnlog Version 3.29
* *
@ -670,12 +675,13 @@ char *vnum(int chan, int who)
return(retstr[retnum]); return(retstr[retnum]);
} }
else { else {
if (!memcmp(call[chan].num[who], countryprefix, strlen(countryprefix))) { /* Ausland */ if (!memcmp(call[chan].num[who], countryprefix, strlen(countryprefix)) &&
register int i; memcmp(call[chan].num[who], mycountry, strlen(mycountry))) { /* Ausland */
auto char s[BUFSIZ]; register int i;
auto char *s;
i = abroad(call[chan].num[who], s); i = getCountrycode(call[chan].num[who], &s);
if (i) { if (i) {
Strncpy(call[chan].areacode[who], call[chan].num[who], i + 1); Strncpy(call[chan].areacode[who], call[chan].num[who], i + 1);
@ -692,6 +698,7 @@ char *vnum(int chan, int who)
} /* if */ } /* if */
} /* if */ } /* if */
/* Fixme: raus damit */
if (!memcmp(call[chan].num[who], "+49173", 5)) { if (!memcmp(call[chan].num[who], "+49173", 5)) {
strcpy(call[chan].area[who], "D2 Mobilfunknetz"); strcpy(call[chan].area[who], "D2 Mobilfunknetz");
l = 6; l = 6;
@ -1048,7 +1055,7 @@ go: if (!ndigit)
case 'P' : s = sx; case 'P' : s = sx;
if (call[chan].provider != -1) if (call[chan].provider != -1)
sprintf(sx, " via %s", getProvidername(call[chan].provider)); sprintf(sx, " via %s", getProvider(call[chan].provider));
else else
*sx = 0; *sx = 0;
p = s + strlen(s); p = s + strlen(s);

View File

@ -20,6 +20,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.44 1999/06/13 14:08:28 akool
* isdnlog Version 3.32
*
* - new option "-U1" (or "ignoreCOLP=1") to ignore CLIP/COLP Frames
* - TEI management decoded
*
* Revision 1.43 1999/06/03 18:51:25 akool * Revision 1.43 1999/06/03 18:51:25 akool
* isdnlog Version 3.30 * isdnlog Version 3.30
* - rate-de.dat V:1.02-Germany [03-Jun-1999 19:49:22] * - rate-de.dat V:1.02-Germany [03-Jun-1999 19:49:22]
@ -459,6 +465,7 @@
#include "policy.h" #include "policy.h"
#include "libisdn.h" #include "libisdn.h"
#include "holiday.h" #include "holiday.h"
#include "country.h"
#include "rate.h" #include "rate.h"
/****************************************************************************/ /****************************************************************************/
@ -740,9 +747,10 @@
#define CONF_ENT_CALLFMT "CALLFMT" #define CONF_ENT_CALLFMT "CALLFMT"
#define CONF_ENT_HOLIFILE "HOLIDAYS" #define CONF_ENT_HOLIFILE "HOLIDAYS"
#define CONF_ENT_COUNTRYFILE "COUNTRYFILE"
#define CONF_ENT_ZONEFILE "ZONEFILE"
#define CONF_ENT_RATECONF "RATECONF" #define CONF_ENT_RATECONF "RATECONF"
#define CONF_ENT_RATEFILE "RATEFILE" #define CONF_ENT_RATEFILE "RATEFILE"
#define CONF_ENT_COUNTRYFILE "COUNTRYFILE"
#define CONF_ENT_LCDFILE "LCDFILE" #define CONF_ENT_LCDFILE "LCDFILE"
#define CONF_ENT_VBOXVER "VBOXVERSION" #define CONF_ENT_VBOXVER "VBOXVERSION"
@ -1019,6 +1027,7 @@ _EXTERN char* callfile = NULL;
_EXTERN char* callfmt = NULL; _EXTERN char* callfmt = NULL;
_EXTERN char* holifile = NULL; _EXTERN char* holifile = NULL;
_EXTERN char* countryfile = NULL; _EXTERN char* countryfile = NULL;
_EXTERN char* zonefile = NULL;
_EXTERN char* rateconf = NULL; _EXTERN char* rateconf = NULL;
_EXTERN char* ratefile = NULL; _EXTERN char* ratefile = NULL;
_EXTERN char* lcdfile = NULL; _EXTERN char* lcdfile = NULL;
@ -1040,8 +1049,9 @@ _EXTERN char* rebootcmd;
_EXTERN char* logfile; _EXTERN char* logfile;
_EXTERN char* callfile; _EXTERN char* callfile;
_EXTERN char* callfmt; _EXTERN char* callfmt;
_EXTERN char* countryfile;
_EXTERN char* holifile; _EXTERN char* holifile;
_EXTERN char* countryfile;
_EXTERN char* zonefile;
_EXTERN char* rateconf; _EXTERN char* rateconf;
_EXTERN char* ratefile; _EXTERN char* ratefile;
_EXTERN char* lcdfile; _EXTERN char* lcdfile;

View File

@ -19,6 +19,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Log$ * $Log$
* Revision 1.2 1999/06/09 20:58:09 akool
* CVS-Tags added
*
* *
* Interface: * Interface:
* *
@ -47,7 +50,10 @@
/* Fixme: basename() ist bei libc5 anscheinend nicht definiert /* Fixme: basename() ist bei libc5 anscheinend nicht definiert
* könnte da mal jemand ein passende #ifdef herumstricken? * könnte da mal jemand ein passende #ifdef herumstricken?
*/ */
/* lt: folgendes funkt bei mir */
#ifndef __USE_MISC
extern const char *basename (const char *name); extern const char *basename (const char *name);
#endif
#else #else
#include "isdnlog.h" #include "isdnlog.h"
#include "tools.h" #include "tools.h"
@ -70,11 +76,14 @@ typedef unsigned short US; /* len 2 */
typedef unsigned long UL; /* len 4 */ typedef unsigned long UL; /* len 4 */
typedef enum {false,true} bool; typedef enum {false,true} bool;
#ifndef min
#define min(a,b) (a) < (b) ? (a) : (b) #define min(a,b) (a) < (b) ? (a) : (b)
#endif
static struct sth *sthp; static struct sth *sthp;
static int count; static int count;
static char version[] = "0.91"; static char version[] = "0.92";
#define LINK 127 #define LINK 127
#define INFO_LEN 80 #define INFO_LEN 80
#define LENGTH 120 #define LENGTH 120
@ -335,9 +344,16 @@ static int _getZ(struct sth *sthp, char *from, char *sto) {
} }
strncpy(newfrom, from, LENGTH-1); strncpy(newfrom, from, LENGTH-1);
while (strlen(newfrom)) { while (strlen(newfrom)) {
US ifrom = (US) atol(newfrom); UL lifrom = (UL) atol(newfrom); /* keys could be long */
US ifrom = (US) lifrom;
if (sthp->pack_key == 2) {
key.dptr = (char *) &ifrom; key.dptr = (char *) &ifrom;
key.dsize = sizeof(US); key.dsize = sizeof(US);
}
else {
key.dptr = (char *) &lifrom;
key.dsize = sizeof(UL);
}
value = gdbm_fetch(fh, key); value = gdbm_fetch(fh, key);
if (value.dptr) { if (value.dptr) {
char *p = value.dptr; char *p = value.dptr;
@ -397,7 +413,7 @@ int getZone(int provider, char *from, char *to)
} }
#ifdef STANDALONE #ifdef ZONETEST
static int checkZone(char *zf, char* df,int num1,int num2, bool verbose) static int checkZone(char *zf, char* df,int num1,int num2, bool verbose)
{ {

View File

@ -0,0 +1,13 @@
Angrenzende Bezirke in verschiedenen Bundeslaender werden
als Oesterreichtarif berechnet
# mkuta <code.bl
erzeugt zoneall.uta
# ../../redzone -z zoneall.uta -r zred.uta -n
generiert die reduzierte Verzonung
# ../../mkzonedb -r zred.uta -d ../../../../zone-at-uta.gdbm
die Datenbank.
leo

File diff suppressed because it is too large Load Diff

26
isdnlog/tools/zone/at/uta/mkuta Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/perl
# make uta zoneall from code.bl
# Z1 = bundesland (W,N) is same
# Z2 = oesterr
@a = <STDIN>;
open OUT, ">zoneall.uta.temp" || die "Can't write";
foreach $a (@a) {
foreach $b (@a) {
($na, $bla) = split(/\s+/,$a);
($nb, $blb) = split(/\s+/,$b);
$na = substr($na,1);
$nb = substr($nb,1);
if (($bla eq $blb) ||
($bla eq 'W' && $blb =~ /^N/) ||
($blb eq 'W' && $bla =~ /^N/)) {
print OUT "$na $nb 1\n";
}
else {
print OUT "$na $nb 2\n";
}
}
}
close(OUT);
system('sort <zoneall.uta.temp|uniq>zoneall.uta && rm zoneall.uta.temp');

View File

@ -118,6 +118,7 @@ sub read_compact {
print "$i:\n@nums\n" if($verbose>=3); print "$i:\n@nums\n" if($verbose>=3);
$n=0; $n=0;
while ( ($key, $value) = each(%db) ) { while ( ($key, $value) = each(%db) ) {
next if ($key eq "_tAbLe\x0" || $key eq "vErSiO\x0");
my($temp) = unpack($pack_key, $key); my($temp) = unpack($pack_key, $key);
next if( $temp !~ /\d/); next if( $temp !~ /\d/);
my($count) = unpack('S', $value); my($count) = unpack('S', $value);

View File

@ -20,7 +20,7 @@ use Getopt::Std;
my ($inf, $outf, $rc,$verbose, $normalize, $newinf, $oldinf, $keep_files, $LEN); my ($inf, $outf, $rc,$verbose, $normalize, $newinf, $oldinf, $keep_files, $LEN);
my ($opt_only); my ($opt_only);
# statistics # statistics
my (@red, $redt, $tot); my (@red, $redt, $tot, $rem);
my $LINK = 127; # maxzone my $LINK = 127; # maxzone
@ -189,7 +189,7 @@ sub reduce {
} }
sub reduce_2 { sub reduce_2 {
my ($pass) = $_[0]; my ($pass) = $_[0];
my($from, $to, $z, $i, $old, $olda, $red1, $j, $red, $k, $rem); my($from, $to, $z, $i, $old, $olda, $red1, $j, $red, $k);
my (@from, @to, @z, %zc, $redc, $eof, $line, $oldto); my (@from, @to, @z, %zc, $redc, $eof, $line, $oldto);
my ($which) = $LEN-$pass; my ($which) = $LEN-$pass;
print "Starting Pass b-$pass ...\n" if ($verbose); print "Starting Pass b-$pass ...\n" if ($verbose);
@ -317,11 +317,12 @@ sub sort_opt {
$newinf = "$inf.a-${pass}q"; $newinf = "$inf.a-${pass}q";
rename($outf, $newinf); rename($outf, $newinf);
system(qq(sort < $newinf |uniq | sed -e"s/X\\+//g" > $outf)); system(qq(sort < $newinf |uniq | sed -e"s/X\\+//g" > $outf));
my ($red, $rem, $wc); my ($red, $wc, $orem);
$wc = `wc --lines $outf`; $wc = `wc --lines $outf`;
$wc =~ /(\d+)\s/; $wc =~ /(\d+)\s/;
$orem = $rem;
$rem = $1; $rem = $1;
$red = $tot - $rem; $red = $orem - $rem;
$redt += $red; $redt += $red;
print "Pass o-$pass: $red data killed $rem remaining\n" if ($verbose); print "Pass o-$pass: $red data killed $rem remaining\n" if ($verbose);
$red[$pass + 10] = $red; $red[$pass + 10] = $red;
@ -540,4 +541,4 @@ sub optimize_2 {
last if($eof); last if($eof);
} # while } # while
$tot = $i if($pass == 1 && $opt_only); $tot = $i if($pass == 1 && $opt_only);
} # optimize } # optimize

Binary file not shown.

Binary file not shown.