diff --git a/isdnlog/country-de.dat b/isdnlog/country-de.dat index 1ed5963c..7703932c 100644 --- a/isdnlog/country-de.dat +++ b/isdnlog/country-de.dat @@ -1,6 +1,6 @@ V:1.02-Germany [02-Jul-1999 19:13:54] -# $Id: country-de.dat,v 1.4 1999/07/02 19:17:01 akool Exp $ +# $Id: country-de.dat,v 1.5 1999/07/04 20:46:39 akool Exp $ # N:Usbekistan diff --git a/isdnlog/rate-de.dat b/isdnlog/rate-de.dat index cabe6031..e4c00d8b 100644 --- a/isdnlog/rate-de.dat +++ b/isdnlog/rate-de.dat @@ -1,4 +1,4 @@ -V:1.02-Germany [02-Jul-1999 21:27:20] +V:1.02-Germany [04-Jul-1999 22:56:37] # Währungsformat U:%.3f DM @@ -8,7 +8,7 @@ U:%.3f DM # # (C) Copyright 1999 by Andreas Kool (akool@isdn4linux.de) # -# $Id: rate-de.dat,v 1.27 1999/07/02 19:17:10 akool Exp $ +# $Id: rate-de.dat,v 1.28 1999/07/04 20:46:44 akool Exp $ # # Zonenzuordnung für Deutschland # @@ -337,6 +337,7 @@ T:W/18-08=0.049996/60 T:E,H/*=0.049996/60 Wochenende Z:102 o.tel.o online 01011 A:0191501 # Proxy: proxy.otelo-online.de:8080; DNS: 195.50.149.33 und 195.50.140.6; Mail: mail.otelo-online.de; User: otelo; Passwort: online +S:Internet by call T:W/09-21=0.059044/60 Geschaeftszeit T:W/21-09=0.059044/60 T:E,H/*=0.059044/60 @@ -587,6 +588,7 @@ T:W/18-08=0.05/0,0.049996(60)/1 T:E,H/*=0.05/0,0.049996(60)/1 Wochenende Z:102 o.tel.o online 01011 A:0191501 # (Benutzername: otelo; Passwort: online) +S:Internet by call T:W/09-21=0.05/0,0.059044(60)/1 Geschaeftszeit T:W/21-09=0.05/0,0.059044(60)/1 T:E,H/*=0.05/0,0.059044(60)/1 @@ -3833,6 +3835,7 @@ A:+49176,+49179 # E2 T:*/*=0.49/60 Z:102 01019freenet A:01929 # DNS: 62.104.197.193 und 212.81.191.16; POP3: pop3.01019freenet.de; SMTP: mx.01019freenet.de; User: mobilcom; Passwort: mobilcom +S:Internet by call # eXpress Net: http://www.express-net.de A:01928120 # eXpress Net # Zugang wie bei Mobilcom T:*/*=0.05/60 FreeNet @@ -3870,6 +3873,7 @@ A:+49176,+49179 # E2 T:*/*=0.49(60)/1 Z:102 01019freenet A:01929 # (Benutzername und Passwort: egal, min. 1 Buchstabe) +S:Internet by call T:*/*=0.05(60)/1 FreeNet Z:200 Gruppe A A:Andorra, Belgien, Dänemark, Finnland, Frankreich, Gibraltar @@ -3923,6 +3927,7 @@ A:+49176,+49179 # E2 T:*/*=0.49(60)/1 Z:102 01019freenet A:01929 # (Benutzername und Passwort: egal, min. 1 Buchstabe) +S:Internet by call T:*/*=0.05(60)/1 FreeNet Z:200 Gruppe A A:Andorra, Belgien, Dänemark, Finnland, Frankreich, Gibraltar @@ -4788,6 +4793,7 @@ T:W/18-08=0.46/60 Freizeit T:E,H/*=0.46/60 Wochenende Z:102 TelePassport-Online A:01924924 # Proxy: proxy.telepassport.de; DNS: 212.41.64.33 und 212.41.68.33; User: tele; Passwort: tele +S:Internet by call T:*/*=0.06/60 Z:200 Euro 1 A:Andorra, Belgien, Dänemark, Färöer, Finnland, Frankreich, Griechenland @@ -4841,6 +4847,7 @@ A:+49176,+49179 # E2 T:*/*=0.56/60 Z:102 TelePassport-Online A:01924924 # (Benutzername: beliebig; Passwort: beliebig) +S:Internet by call T:W/08-18=0.08/60 Geschäftszeit T:W/18-08=0.06/60 Freizeit T:E,H/*=0.08/60 Wochenende @@ -4895,6 +4902,7 @@ A:+49176,+49179 # E2 T:*/*=0.56/60 Z:102 TelePassport-Online A:01924924 # (Benutzername: beliebig; Passwort: beliebig) +S:Internet by call T:W/08-18=0.08/60 Geschäftszeit T:W/18-08=0.06/60 Freizeit T:E,H/*=0.08/60 Wochenende @@ -4953,6 +4961,7 @@ A:+49176,+49179 # E2 T:*/*=0.56/60 Z:102 TelePassport-Online A:01924924 # (Benutzername: beliebig; Passwort: beliebig) +S:Internet by call T:*/*=0.06/60 Z:200 International 1 A:Andorra, Belgien, Dänemark, Färöer, Finnland, Frankreich, Griechenland @@ -5009,6 +5018,7 @@ T:W/18-08=0.48/60 Freizeit T:E,H/*=0.48/60 Wochenende Z:102 TelePassport-Online A:01924924 # (Benutzername: beliebig; Passwort: beliebig) +S:Internet by call T:W/08-18=0.08/60 Geschäftszeit T:W/18-08=0.06/60 Freizeit T:E,H/*=0.08/60 Wochenende @@ -5058,6 +5068,7 @@ A:+49176,+49179 # E2 T:*/*=0.56/60 Z:102 TelePassport-Online A:01924924 # (Benutzername: beliebig; Passwort: beliebig) +S:Internet by call T:*/*=0.08/60 Z:200 Global 1 A:Belgien, Dänemark, Finnland, Frankreich, Griechenland, Großbritannien @@ -5113,6 +5124,7 @@ T:W/18-08=0.48/60 Freizeit T:E,H/*=0.48/60 Wochenende Z:102 TelePassport-Online A:01924924 # (Benutzername: beliebig; Passwort: beliebig) +S:Internet by call T:W/08-18=0.08/60 Geschäftszeit T:W/18-08=0.06/60 Freizeit T:E,H/*=0.06/60 Wochenende @@ -9918,6 +9930,7 @@ A:+49176,+49179 # E2 T:*/*=0.48/60 Z:102 net@home A:0192340 # DNS: 195.222.195.222 und 195.222.195.223; User: esprit; Passwort: telecom +S:Internet by call T:*/*=0.058/60 Internet Z:103 CALL POP # Verfügbarkeit nach Vorwahlbereichen: @@ -9925,6 +9938,7 @@ Z:103 CALL POP # 01.05.99: 06/07/08/09 # 01.06.99: 02/052/054/056/057/059 A:0192343 # (Benutzername: Call, Passwort: POP) +S:Internet by call T:*/*=0.058/60 Z:200 Euro 1/Welt 1 A:Belgien, Dänemark, Finnland, Frankreich @@ -11523,6 +11537,7 @@ A:+49176,+49179 # E2 T:*/*=0.69/60 Z:100 Talknet by call A:019251 # Proxy: proxy.tli.de:8080; DNS: 195.252.128.53 und 195.252.128.54; User: talknet; Passwort: talknet +S:Internet by call T:W/07-19=0.09(60)/180 T:W/19-22=0.07(60)/180 T:W/22-07=0.05(60)/180 @@ -11586,50 +11601,37 @@ A:+4366211811 T:*/*=0.25/60 Z:41 Telefonauskunft Ausland (Austria, dial 01051004366211812) A:+4366211812 -T:*/*=0.25/60 -Z:200 -A:Großbritannien -A:USA T:*/*=0.16/60 -Z:201 -A:Niederlande -A:Schweden -T:*/*=0.21/60 -Z:202 -A:Kanada -A:Frankreich -A:Alaska -A:Hawaii -T:*/*=0.22/60 -Z:203 -A:Dänemark -A:Norwegen -A:Finnland -A:Belgien -A:Schweiz -T:*/*=0.23/60 -Z:204 -A:Österreich -A:Australien -T:*/*=0.25/60 -Z:207 -A:Neuseeland -A:Hongkong -A:Japan -T:*/*=0.29/60 -Z:208 -A:Liechtenstein -T:*/*=0.31/60 -Z:209 -A:Spanien -A:Italien -T:*/*=0.32/60 -Z:210 -A:Luxemburg -T:*/*=0.34/60 -Z:212 -A:Monaco T:*/*=0.36/60 +Z:200 +T:*/*=0.25/60 +A:Australien, Österreich +Z:201 +T:*/*=0.23/60 +A:Belgien, Dänemark, Finnland, Norwegen, Schweiz +Z:202 +T:*/*=0.22/60 +A:Frankreich, Kanada, Alaska, Hawaii +Z:203 +T:*/*=0.21/60 +A:Niederlande, Schweden +Z:204 +T:*/*=0.16/60 +A:Großbritannien, USA +Z:205 +T:*/*=0.29/60 +A:Neuseeland, Hongkong, Japan +Z:206 +T:*/*=.32/60 +A:Italien, Sapnien +Z:207 +T:*/*=0.34/60 +A:Luxembourg +Z:208 +T:*/*=0.36/60 +A:Monaco +Z:209 +T:*/*=0.39/60 Z:213 A:Österreich Mobilfunk T:*/*=0.75/60 @@ -11637,19 +11639,23 @@ Z:214 impossible # Mobilfunk in den folgenden Ländern ist über 01051 nicht möglich! # Daher wird hier erst mal ein viel zu hoher Preis dafür # definiert. -A:Großbritannien Mobilfunk +A:Australien Mobilfunk A:Belgien Mobilfunk -A:Niederlande Mobilfunk -A:Schweiz Mobilfunk -A:Italien Mobilfunk A:Dänemark Mobilfunk -A:Schweden Mobilfunk -A:Norwegen Mobilfunk A:Finnland Mobilfunk -A:Spanien Mobilfunk +A:Großbritannien Mobilfunk +A:Italien Mobilfunk +A:Japan Mobilfunk A:Liechtenstein Mobilfunk A:Luxemburg Mobilfunk A:Monaco Mobilfunk +A:Neuseeland Mobilfunk +A:Niederlande Mobilfunk +A:Norwegen Mobilfunk +A:Österreich Mobilfunk +A:Schweden Mobilfunk +A:Schweiz Mobilfunk +A:Spanien Mobilfunk A:+491618 # T-C-Tel Voice Mail A:+491610,+491611,+491612,+491613,+491614,+491615,+491616,+491617,+491619 # C A:+49170,+49171 # D1 @@ -12363,6 +12369,7 @@ C:Arcor Online A:0192070 # Proxy: proxy.arcor-ip.de:80; DNS: 145.253.2.11 und 145.253.2.75; Mail: mail.arcor-ip.de; User: arcor; Passwort: internet C:Yahoo! Online A:0192020 # Proxy: proxy.arcor-ip.de:80; DNS: 145.253.2.11 und 145.253.2.75; Mail: mail.arcor-ip.de; User: arcor; Passwort: internet +S:Internet by call T:*/*=0.06/60 Z:40 Telefonauskunft A:11870 @@ -13893,8 +13900,8 @@ C:Tarif: Westcom privat D:dtag Z:2-4 National T:W/08-18=0.16(60)/1 Standard -T:W/18-08=0.09(60)/1 Spar -T:E/*=0.09(60)/1 Spar +T:W/18-08=0.08(60)/1 Spar +T:E,H/*=0.08(60)/1 Spar A:+49 Z:10-15 Mobil A:+491618 # T-C-Tel Voice Mail @@ -13981,9 +13988,9 @@ T:W/06-08=0.10/60 Sparzeit T:W/08-18=0.15/60 Hauptzeit T:W/18-21=0.10/60 Freizeit T:W/21-06=0.05/60 Traumzeit -A:+49 T:E,H/06-21=0.10/60 Freizeit T:E,H/21-06=0.05/60 Nacht +A:+49 Z:10-15 Mobil A:+491618 # T-C-Tel Voice Mail A:+491610,+491611,+491612,+491613,+491614,+491615,+491616,+491617,+491619 # C @@ -14612,12 +14619,13 @@ T:*/*=0.847/0,0.121/6.7 # 39:First Telecom 28.05.1999 as # 40:Esprit 01.05.1999 ak # 50:Talkline 01.05.1999 ak -# 51:01051 Telecom 04.06.1999 je +# 51:01051 Telecom 02.07.1999 je +# 66:Interroute 02.07.1999 je # 70:Arcor 01.05.1999 ak # 78:3U 01.05.1999 ak # 79:Viatel 20.06.1999 je -# 85:GTS-WESTCom 01.05.1999 ak -# 90:Viag Interkom 29.05.1999 je +# 85:GTS-WESTCom 02.07.1999 je +# 90:Viag Interkom 02.07.1999 je # # 2. Angemeldet: # 13:Tele 2 27.05.1999 as diff --git a/isdnlog/tools/isdnrate.c b/isdnlog/tools/isdnrate.c index 654a70de..2f8bfeae 100644 --- a/isdnlog/tools/isdnrate.c +++ b/isdnlog/tools/isdnrate.c @@ -1,4 +1,4 @@ -/* $Id: isdnrate.c,v 1.8 1999/07/03 10:24:14 akool Exp $ +/* $Id: isdnrate.c,v 1.9 1999/07/04 20:47:05 akool Exp $ * * ISDN accounting for isdn4linux. (rate evaluation) * @@ -19,6 +19,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdnrate.c,v $ + * Revision 1.9 1999/07/04 20:47:05 akool + * rate-de.dat V:1.02-Germany [04-Jul-1999 22:56:37] + * * Revision 1.8 1999/07/03 10:24:14 akool * fixed Makefile * @@ -60,11 +63,12 @@ static char options[] = "Vvd:hb:s:txu"; static char usage[] = "%s: usage: %s [ -%s ] Destination ...\n"; static int verbose = 0, header = 0, best = MAXPROVIDER, table = 0, explain = 0; -static int usestat = 0; +static int usestat = 0, provider = UNKNOWN; static int duration = LCR_DURATION; static time_t start; static int day, month, year, hour, min; static char country[BUFSIZ], area[BUFSIZ], msn[BUFSIZ]; +static char ignore[MAXPROVIDER]; typedef struct { @@ -73,6 +77,11 @@ typedef struct { char *explain; } SORT; +typedef struct { + int weight; + int index; +} SORT2; + static SORT sort[MAXPROVIDER]; int print_msg(int Level, const char *fmt, ...) @@ -211,6 +220,12 @@ static int compare(const void *s1, const void *s2) } /* compare */ +static int compare2(const void *s1, const void *s2) +{ + return(((SORT2 *)s1)->weight < ((SORT2 *)s2)->weight); +} /* compare2 */ + + static char *printrate(RATE Rate) { static char message[BUFSIZ]; @@ -267,7 +282,30 @@ static void splittime() } /* splittime */ -static void numsplit(char *num, char *country, char *area, char *msn) +static char *Provider(int prefix) +{ + register char *p; + register int l; + static char s[BUFSIZ]; + + + if (prefix == UNKNOWN) + return("?"); + + p = getProvider(prefix); + + l = max(WIDTH, strlen(p)) - strlen(p); + + if (prefix < 100) + sprintf(s, "%s%02d:%s%*s", vbn, prefix, p, l, ""); + else + sprintf(s, "%s%03d:%s%*s", vbn, prefix - 100, p, l - 1, ""); + + return(s); +} /* Provider */ + + +static void numsplit(char *num) { register int l1, l3; auto int l2; @@ -277,6 +315,9 @@ static void numsplit(char *num, char *country, char *area, char *msn) *country = *area = *msn = 0; + if (verbose && (provider != UNKNOWN)) + print_msg(PRT_NORMAL, " Provider %s\n", Provider(provider)); + if ((l1 = getCountrycode(num, &s)) != UNKNOWN) { Strncpy(country, num, l1 + 1); @@ -313,8 +354,10 @@ static void numsplit(char *num, char *country, char *area, char *msn) static int normalizeNumber(char *target) { - auto COUNTRY *Country; - auto char num[BUFSIZ]; + register int l1, l2; + register char c; + auto COUNTRY *Country; + auto char num[BUFSIZ]; if (isalpha(*target)) { @@ -326,17 +369,44 @@ static int normalizeNumber(char *target) } /* else */ } else { + l1 = strlen(vbn); + + if (!memcmp(target, vbn, l1)) { + if (target[l1] == '0') /* dreistellige Verbindungsnetzbetreiberkennzahl? */ + l2 = l1 + 3; + else + l2 = l1 + 2; + + c = target[l2]; + target[l2] = 0; + provider = atoi(target + l1); + + if (l2 == 6) + provider += 100; + + target[l2] = c; + memmove(target, target + l2, strlen(target) - l2); + } /* if */ + if (*target == '+') strcpy(num, target); else if (!memcmp(target, "00", 2)) sprintf(num, "+%s", target + 2); - else if (*target == '0') - sprintf(num, "%s%s", mycountry, target + 1); + else if (*target == '0') { +#if 0 + if (!strchr("18", target[1])) /* FIXME: "18" ist Deutsche-Sonderrufnummernerkennung! */ +#endif + sprintf(num, "%s%s", mycountry, target + 1); +#if 0 + else + sprintf(num, "%s%s", mycountry, target); +#endif + } else sprintf(num, "%s%s%s", mycountry, myarea, target); } /* else */ - numsplit(num, country, area, msn); + numsplit(num); return(1); } /* normalizeNumber */ @@ -344,11 +414,20 @@ static int normalizeNumber(char *target) static int compute() { register int i, n = 0; + register int low = 0, high = MAXPROVIDER - 1; auto RATE Rate; auto char s[BUFSIZ]; - for (i = 0; i < MAXPROVIDER; i++) { + if (provider != UNKNOWN) { + low = high = provider; + } /* if */ + + for (i = low; i <= high; i++) { + + if (ignore[i]) + continue; + clearRate(&Rate); Rate.src[0] = mycountry; Rate.src[1] = myarea; @@ -358,6 +437,8 @@ static int compute() Rate.dst[1] = area; Rate.dst[2] = msn; + /* Rate.Service = "Internet by call"; */ + Rate.prefix = i; buildtime(); @@ -365,6 +446,8 @@ static int compute() Rate.start = start; Rate.now = start + duration - ZAUNPFAHL; + /* kludge to suppress "impossible" Rates */ + if (!getRate(&Rate, NULL) && (Rate.Price != 99.99)) { sort[n].prefix = Rate.prefix; sort[n].rate = Rate.Charge; @@ -386,29 +469,6 @@ static int compute() } /* compute */ -static char *Provider(int prefix) -{ - register char *p; - register int l; - static char s[BUFSIZ]; - - - if (prefix == UNKNOWN) - return("?"); - - p = getProvider(prefix); - - l = max(WIDTH, strlen(p)) - strlen(p); - - if (prefix < 100) - sprintf(s, "%s%02d:%s%*s", vbn, prefix, p, l, ""); - else - sprintf(s, "%s%03d:%s%*s", vbn, prefix - 100, p, l - 1, ""); - - return(s); -} /* Provider */ - - static void result(char *target, int n) { @@ -455,15 +515,20 @@ static void purge(int n) static void printTable() { - register int n, d, i, lasthour; + register int n, d, i, h, lasthour; auto struct tm *tm; auto SORT last[MAXLAST]; auto int used[MAXPROVIDER]; auto int hours[MAXPROVIDER]; + auto int weight[MAXPROVIDER]; auto int useds = 0, maxhour; + auto SORT2 wsort[MAXPROVIDER]; + static int firsttime = 1; memset(used, 0, sizeof(used)); + memset(hours, 0, sizeof(hours)); + memset(weight, 0, sizeof(weight)); if (header) print_msg(PRT_NORMAL, "Eine %d Sekunden lange Verbindung von %s %s nach %s %s %s kostet\n", @@ -528,12 +593,19 @@ static void printTable() last[i].explain); } /* for */ - used[last[0].prefix] = 1; + used[last[0].prefix]++; if (lasthour >= hour) - hours[last[0].prefix] += ((24 - lasthour) + hour); + h = ((24 - lasthour) + hour); else - hours[last[0].prefix] += hour - lasthour; + h = hour - lasthour; + + hours[last[0].prefix] += h; + + if ((lasthour > 8) && (lasthour < 21)) + h *= 2; + + weight[last[0].prefix] += h * (d ? 5 : 2); for (i = 0; i < MAXLAST; i++) { last[i].prefix = sort[i].prefix; @@ -578,12 +650,20 @@ static void printTable() last[i].explain); } /* for */ - used[last[0].prefix] = 1; + used[last[0].prefix]++; if (lasthour >= hour) - hours[last[0].prefix] += ((24 - lasthour) + hour); + h = ((24 - lasthour) + hour); else - hours[last[0].prefix] += hour - lasthour; + h = hour - lasthour; + + hours[last[0].prefix] += h; + + if ((lasthour > 8) && (lasthour < 21)) + h *= 2; + + weight[last[0].prefix] += h * (d ? 5 : 2); + } /* for */ if (usestat) { @@ -594,12 +674,40 @@ static void printTable() for (i = 0; i < MAXPROVIDER; i++) if (used[i]) { - print_msg(PRT_NORMAL, "%s (%d hours)\n", Provider(i), hours[i]); + print_msg(PRT_NORMAL, "%s %d times, %d hours, weight = %d\n", + Provider(i), used[i], hours[i], weight[i]); + + wsort[useds].weight = weight[i]; + wsort[useds].index = i; + useds++; if (hours[i] < maxhour) maxhour = hours[i]; } /* if */ + + if ((best < MAXPROVIDER) && (best < useds)) { + print_msg(PRT_NORMAL, "Retrying with only %d provider(s), eliminating %d provider(s)\n", best, useds - best); + + qsort((void *)wsort, useds, sizeof(SORT2), compare2); + + for (i = 0; i < useds; i++) { + print_msg(PRT_NORMAL, "%s %d times, %d hours, weight = %d\n", + Provider(wsort[i].index), used[wsort[i].index], hours[wsort[i].index], weight[wsort[i].index]); + + if (i == best - 1) + print_msg(PRT_NORMAL, "\n"); + + if (i >= best - 1) + ignore[wsort[i].index]++; + } /* for */ + + if (firsttime) + printTable(); + + firsttime = 0; + + } /* if */ } /* if */ } /* printTable */ @@ -620,6 +728,7 @@ int main(int argc, char *argv[], char *envp[]) init(); post_init(); + memset(ignore, 0, sizeof(ignore)); while (i < argc) { if (normalizeNumber(argv[i])) {