1998-10-13 21:53:17 +00:00
|
|
|
/* $Id: isdnrep.c,v 1.47 1998/10/13 21:53:17 luethje Exp $
|
1997-03-16 20:58:07 +00:00
|
|
|
*
|
|
|
|
* ISDN accounting for isdn4linux. (Report-module)
|
|
|
|
*
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
* Copyright 1995, 1998 by Andreas Kool (akool@Kool.f.UUnet.de)
|
1997-03-24 22:51:59 +00:00
|
|
|
* and Stefan Luethje (luethje@sl-gw.lake.de)
|
1997-03-16 20:58:07 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
1998-03-29 19:54:04 +00:00
|
|
|
* functions htoi() and url_unescape():
|
|
|
|
* Copyright 1994, Steven Grimm <koreth@hyperion.com>.
|
|
|
|
*
|
|
|
|
*
|
1997-03-16 20:58:07 +00:00
|
|
|
* $Log: isdnrep.c,v $
|
1998-10-13 21:53:17 +00:00
|
|
|
* Revision 1.47 1998/10/13 21:53:17 luethje
|
|
|
|
* isdnrep and lib: bugfixes
|
|
|
|
*
|
1998-10-04 12:03:54 +00:00
|
|
|
* Revision 1.46 1998/10/04 12:04:21 akool
|
|
|
|
* - README
|
|
|
|
* New entries "CALLFILE" and "CALLFMT" documented
|
|
|
|
* Small Correction from Markus Werner <mw@empire.wolfsburg.de>
|
|
|
|
* cosmetics
|
|
|
|
*
|
|
|
|
* - isdnrep.c
|
|
|
|
* Bugfix (Thanks to Arnd Bergmann <arnd@uni.de>)
|
|
|
|
*
|
|
|
|
* - processor.c
|
|
|
|
* Patch from Oliver Lauer <Oliver.Lauer@coburg.baynet.de>
|
|
|
|
* Makes CHARGEMAX work without AOC-D
|
|
|
|
*
|
|
|
|
* Patch from Stefan Gruendel <sgruendel@adulo.de>
|
|
|
|
* gcc 2.7.2.1 Optimizer-Bug workaround
|
|
|
|
*
|
1998-10-03 18:05:48 +00:00
|
|
|
* Revision 1.45 1998/10/03 18:06:35 akool
|
|
|
|
* - processor.c, takt_at.c : Patch from Michael Reinelt <reinelt@eunet.at>
|
|
|
|
* try to guess the zone of the calling/called party
|
|
|
|
*
|
|
|
|
* - isdnrep.c : cosmetics (i hope, you like it, Stefan!)
|
|
|
|
*
|
1998-10-03 15:21:48 +00:00
|
|
|
* Revision 1.44 1998/10/03 15:21:48 luethje
|
|
|
|
* isdnrep: some bugfixes in output functions
|
|
|
|
*
|
1998-09-26 18:27:23 +00:00
|
|
|
* Revision 1.43 1998/09/26 18:29:55 akool
|
|
|
|
* - quick and dirty Call-History in "-m" Mode (press "h" for more info) added
|
|
|
|
* - eat's one more socket, Stefan: sockets[3] now is STDIN, FIRST_DESCR=4 !!
|
|
|
|
* - Support for tesion)) Baden-Wuerttemberg Tarif
|
|
|
|
* - more Providers
|
|
|
|
* - Patches from Wilfried Teiken <wteiken@terminus.cl-ki.uni-osnabrueck.de>
|
|
|
|
* - better zone-info support in "tools/isdnconf.c"
|
|
|
|
* - buffer-overrun in "isdntools.c" fixed
|
|
|
|
* - big Austrian Patch from Michael Reinelt <reinelt@eunet.at>
|
|
|
|
* - added $(DESTDIR) in any "Makefile.in"
|
|
|
|
* - new Configure-Switches "ISDN_AT" and "ISDN_DE"
|
|
|
|
* - splitted "takt.c" and "tools.c" into
|
|
|
|
* "takt_at.c" / "takt_de.c" ...
|
|
|
|
* "tools_at.c" / "takt_de.c" ...
|
|
|
|
* - new feature
|
|
|
|
* CALLFILE = /var/log/caller.log
|
|
|
|
* CALLFMT = %b %e %T %N7 %N3 %N4 %N5 %N6
|
|
|
|
* in "isdn.conf"
|
|
|
|
* - ATTENTION:
|
|
|
|
* 1. "isdnrep" dies with an seg-fault, if not HTML-Mode (Stefan?)
|
|
|
|
* 2. "isdnlog/Makefile.in" now has hardcoded "ISDN_DE" in "DEFS"
|
|
|
|
* should be fixed soon
|
|
|
|
*
|
1998-09-22 21:06:50 +00:00
|
|
|
* Revision 1.42 1998/09/22 21:06:50 luethje
|
|
|
|
* isdnrep: simple fix
|
|
|
|
*
|
1998-09-22 20:58:41 +00:00
|
|
|
* Revision 1.41 1998/09/22 20:59:53 luethje
|
|
|
|
* isdnrep: -fixed wrong provider report
|
|
|
|
* -fixed wrong html output for provider report
|
|
|
|
* -fixed strange html output
|
|
|
|
* kisdnlog: -fixed "1001 message window" bug ;-)
|
|
|
|
*
|
1998-06-14 15:33:42 +00:00
|
|
|
* Revision 1.40 1998/06/14 15:34:23 akool
|
|
|
|
* AVM B1 support (Layer 3)
|
|
|
|
* Telekom's new currency DEM 0,121 supported
|
|
|
|
* Disable holiday rates #ifdef ISDN_NL
|
|
|
|
* memory leak in "isdnrep" repaired
|
|
|
|
*
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
* Revision 1.39 1998/06/07 21:09:43 akool
|
|
|
|
* - Accounting for the following new providers implemented:
|
|
|
|
* o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
|
|
|
|
* TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
|
|
|
|
* tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
|
|
|
|
* WESTCom, WorldCom, Viag Interkom
|
|
|
|
*
|
|
|
|
* Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
|
|
|
|
* program http://www.insider.org/tarif/gebuehr.c
|
|
|
|
*
|
|
|
|
* - Telekom's 10plus implemented
|
|
|
|
*
|
|
|
|
* - Berechnung der Gebuehrenzone implementiert
|
|
|
|
* (CityCall, RegioCall, GermanCall, GlobalCall)
|
|
|
|
* The entry "ZONE" is not needed anymore in the config-files
|
|
|
|
*
|
|
|
|
* you need the file
|
|
|
|
* http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
|
|
|
|
* and the new entry
|
|
|
|
* [GLOBAL]
|
|
|
|
* AREADIFF = /usr/lib/isdn/vorwahl.dat
|
|
|
|
* for that feature.
|
|
|
|
*
|
|
|
|
* Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
|
|
|
|
* Data-File and Harald Milz for his first Perl-Implementation!
|
|
|
|
*
|
|
|
|
* - Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
|
|
|
|
*
|
|
|
|
* You must install the file
|
|
|
|
* "isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
|
|
|
|
* as "/usr/lib/isdn/sonderrufnummern.dat"
|
|
|
|
* for that feature.
|
|
|
|
*
|
|
|
|
* ATTENTION: This is *NO* production-code! Please test it carefully!
|
|
|
|
*
|
1998-05-20 12:23:57 +00:00
|
|
|
* Revision 1.38 1998/05/20 12:23:57 paul
|
|
|
|
* Duration divide by 100 replaced by divide by HZ (HZ is 1024 on Alpha).
|
|
|
|
* Y2K compliancy hopefully more robust.
|
|
|
|
*
|
1998-04-29 19:58:55 +00:00
|
|
|
* Revision 1.37 1998/04/29 19:58:55 luethje
|
|
|
|
* bugfix at HTML code
|
|
|
|
*
|
1998-04-27 22:35:31 +00:00
|
|
|
* Revision 1.36 1998/04/27 22:35:31 luethje
|
|
|
|
* bugfix on HTML code
|
|
|
|
*
|
1998-03-29 19:54:04 +00:00
|
|
|
* Revision 1.35 1998/03/29 19:54:11 luethje
|
|
|
|
* idnrep: added html feature (incoming/outgoing calls)
|
|
|
|
*
|
1998-03-25 20:58:34 +00:00
|
|
|
* Revision 1.34 1998/03/25 20:58:46 luethje
|
|
|
|
* isdnrep: added html feature (verbose on/off)
|
|
|
|
* processor.c: Patch of Oliver Lauer
|
|
|
|
*
|
1998-03-08 11:42:23 +00:00
|
|
|
* Revision 1.33 1998/03/08 11:43:04 luethje
|
|
|
|
* I4L-Meeting Wuerzburg final Edition, golden code - Service Pack number One
|
|
|
|
*
|
1998-02-13 07:01:49 +00:00
|
|
|
* Revision 1.32 1998/02/13 07:01:49 calle
|
|
|
|
* small fix inside ISDN_NL.
|
|
|
|
*
|
1997-09-07 00:43:06 +00:00
|
|
|
* Revision 1.31 1997/09/07 00:43:22 luethje
|
|
|
|
* create new error messages for isdnrep
|
|
|
|
*
|
1997-07-22 22:36:08 +00:00
|
|
|
* Revision 1.30 1997/07/22 22:36:17 luethje
|
|
|
|
* isdnrep: Use " " for blanks
|
|
|
|
* isdnctrl: Add the option "reset"
|
|
|
|
*
|
1997-06-15 23:49:28 +00:00
|
|
|
* Revision 1.29 1997/06/15 23:49:45 luethje
|
|
|
|
* Some new variables for the isdnlog
|
|
|
|
* isdnlog starts programs noe with the file system rights
|
|
|
|
* bugfixes
|
|
|
|
*
|
1997-05-28 21:22:39 +00:00
|
|
|
* Revision 1.28 1997/05/28 21:23:03 luethje
|
|
|
|
* isdnlog option -b is working again ;-)
|
|
|
|
* isdnlog has new \$x variables
|
|
|
|
* README completed
|
|
|
|
*
|
1997-05-25 19:40:43 +00:00
|
|
|
* Revision 1.27 1997/05/25 19:41:06 luethje
|
|
|
|
* isdnlog: close all files and open again after kill -HUP
|
|
|
|
* isdnrep: support vbox version 2.0
|
|
|
|
* isdnconf: changes by Roderich Schupp <roderich@syntec.m.EUnet.de>
|
|
|
|
* conffile: ignore spaces at the end of a line
|
|
|
|
*
|
1997-05-19 22:57:51 +00:00
|
|
|
* Revision 1.26 1997/05/19 22:58:18 luethje
|
|
|
|
* - bugfix: it is possible to install isdnlog now
|
|
|
|
* - improved performance for read files for vbox files and mgetty files.
|
|
|
|
* - it is possible to decide via config if you want to use avon or
|
|
|
|
* areacode.
|
|
|
|
*
|
1997-05-17 14:58:28 +00:00
|
|
|
* Revision 1.25 1997/05/17 14:58:28 luethje
|
|
|
|
* bug fix in HTML-Link
|
|
|
|
*
|
1997-05-17 01:08:11 +00:00
|
|
|
* Revision 1.24 1997/05/17 01:08:21 luethje
|
|
|
|
* some bugfixes
|
|
|
|
*
|
1997-05-15 23:24:54 +00:00
|
|
|
* Revision 1.23 1997/05/15 23:24:54 luethje
|
|
|
|
* added new links on HTML
|
|
|
|
*
|
1997-05-15 22:21:27 +00:00
|
|
|
* Revision 1.22 1997/05/15 22:21:35 luethje
|
1997-05-17 14:58:28 +00:00
|
|
|
* New feature: isdnrep can transmit via HTML fax files and vbox files.
|
1997-05-15 22:21:27 +00:00
|
|
|
*
|
1997-05-11 22:59:14 +00:00
|
|
|
* Revision 1.21 1997/05/11 22:59:19 luethje
|
|
|
|
* new version
|
|
|
|
*
|
1997-05-10 12:57:00 +00:00
|
|
|
* Revision 1.20 1997/05/10 12:57:00 luethje
|
|
|
|
* some changes
|
|
|
|
*
|
1997-05-10 01:20:52 +00:00
|
|
|
* Revision 1.19 1997/05/10 01:21:06 luethje
|
|
|
|
* some primitive changes
|
|
|
|
*
|
1997-05-09 23:30:37 +00:00
|
|
|
* Revision 1.18 1997/05/09 23:30:55 luethje
|
|
|
|
* isdnlog: new switch -O
|
|
|
|
* isdnrep: new format %S
|
|
|
|
* bugfix in handle_runfiles()
|
|
|
|
*
|
1997-05-06 22:13:21 +00:00
|
|
|
* Revision 1.17 1997/05/06 22:13:31 luethje
|
|
|
|
* bugfixes in HTML-Code of the isdnrep
|
|
|
|
*
|
1997-05-05 21:04:08 +00:00
|
|
|
* Revision 1.16 1997/05/05 21:04:21 luethje
|
|
|
|
* README completed
|
|
|
|
* some changes for the isdnmon
|
|
|
|
*
|
1997-05-04 22:23:09 +00:00
|
|
|
* Revision 1.15 1997/05/04 22:23:15 luethje
|
|
|
|
* README completed
|
|
|
|
* new features of the format string
|
|
|
|
*
|
1997-05-04 20:19:34 +00:00
|
|
|
* Revision 1.14 1997/05/04 20:19:54 luethje
|
|
|
|
* README completed
|
|
|
|
* isdnrep finished
|
|
|
|
* interval-bug fixed
|
|
|
|
*
|
1997-04-20 23:44:46 +00:00
|
|
|
* Revision 1.13 1997/04/20 23:44:49 luethje
|
|
|
|
* some primitve changes
|
|
|
|
*
|
1997-04-20 22:52:07 +00:00
|
|
|
* Revision 1.12 1997/04/20 22:52:25 luethje
|
|
|
|
* isdnrep has new features:
|
|
|
|
* -variable format string
|
|
|
|
* -can create html output (option -w1 or ln -s isdnrep isdnrep.cgi)
|
1997-04-20 23:44:46 +00:00
|
|
|
* idea and design by Dirk Staneker (dirk.staneker@student.uni-tuebingen.de)
|
1997-04-20 22:52:07 +00:00
|
|
|
* bugfix of processor.c from akool
|
|
|
|
*
|
1997-04-17 23:29:35 +00:00
|
|
|
* Revision 1.11 1997/04/17 23:29:45 luethje
|
|
|
|
* new structure of isdnrep completed.
|
1997-04-16 22:22:43 +00:00
|
|
|
*
|
1997-04-08 21:56:42 +00:00
|
|
|
* Revision 1.9 1997/04/08 21:56:53 luethje
|
|
|
|
* Create the file isdn.conf
|
|
|
|
* some bug fixes for pid and lock file
|
|
|
|
* make the prefix of the code in `isdn.conf' variable
|
|
|
|
*
|
1997-04-06 21:03:36 +00:00
|
|
|
* Revision 1.8 1997/04/06 21:03:37 luethje
|
|
|
|
* switch -f is working again
|
|
|
|
* currency_factor is float again ;-)
|
|
|
|
* renamed files isdnrep.c to rep_main.c and function.c isdnrep.c
|
|
|
|
*
|
|
|
|
* Revision 1.3 1997/04/03 22:30:00 luethje
|
1997-04-03 22:29:59 +00:00
|
|
|
* improved performance
|
|
|
|
*
|
1997-04-06 21:03:36 +00:00
|
|
|
* Revision 1.2 1997/03/31 22:43:11 luethje
|
1997-03-31 22:43:05 +00:00
|
|
|
* Improved performance of the isdnrep, made some changes of README
|
|
|
|
*
|
1997-04-06 21:03:36 +00:00
|
|
|
* Revision 1.1 1997/03/24 22:52:09 luethje
|
1997-03-24 22:51:59 +00:00
|
|
|
* isdnrep completed.
|
|
|
|
*
|
1997-03-23 23:11:48 +00:00
|
|
|
* Revision 1.4 1997/03/23 23:11:59 luethje
|
|
|
|
* improved performance
|
|
|
|
*
|
1997-03-23 20:25:23 +00:00
|
|
|
* Revision 1.3 1997/03/23 20:25:23 luethje
|
|
|
|
* tmporary (running) result of the new structure of isdnrep
|
|
|
|
*
|
1997-03-20 00:18:57 +00:00
|
|
|
* Revision 1.2 1997/03/20 00:19:13 luethje
|
|
|
|
* inserted the line #include <errno.h> in avmb1/avmcapictrl.c and imon/imon.c,
|
|
|
|
* some bugfixes, new structure in isdnlog/isdnrep/isdnrep.c.
|
|
|
|
*
|
1997-03-16 20:58:07 +00:00
|
|
|
* Revision 1.1 1997/03/16 20:59:05 luethje
|
|
|
|
* Added the source code isdnlog. isdnlog is not working yet.
|
|
|
|
* A workaround for that problem:
|
|
|
|
* copy lib/policy.h into the root directory of isdn4k-utils.
|
|
|
|
*
|
|
|
|
* Revision 2.6.19 1997/01/04 13:00:35 akool
|
|
|
|
* Korrektur bzgl. ISDN_CH
|
|
|
|
* Danke an Markus Maeder (mmaeder@cyberlink.ch)
|
|
|
|
*
|
|
|
|
* Revision 2.6.15 1997/01/02 11:32:35 akool
|
|
|
|
* -V Option added
|
|
|
|
*
|
|
|
|
* Revision 2.6.11 1996/12/30 10:17:35 akool
|
|
|
|
* Dutch accounting (Ad Aerts <ad@aasup.nl>)
|
|
|
|
*
|
|
|
|
* Revision 2.50 1996/08/25 11:48:35 akool
|
|
|
|
* Auswertung bei non-AOCE-Anschluessen verbessert
|
|
|
|
*
|
|
|
|
* Revision 2.13 1996/03/16 16:11:35 akool
|
|
|
|
* Andruck der "ibytes" implementiert
|
|
|
|
*
|
|
|
|
* Revision 2.10 1996/01/16 01:04:35 sl
|
|
|
|
* Ausgabe von bestimmten MSN's ergaenzt, Nur ankommende dor ausgehende
|
|
|
|
* Gespraeche anzeigen, Ueberarbeitung der kompletten Sourcen.
|
|
|
|
* Funktion fuer fremde Waehrungen ergaenzt
|
|
|
|
*
|
|
|
|
* Revision 2.03 1996/01/07 03:35:17 sl
|
|
|
|
* Optionen -c und -6 entfernt, Tab-Bug behoben, Bug in automatischer
|
|
|
|
* Gebuehrenberechnung beim alten Logformat behoben,
|
|
|
|
* Zeitangabe beim Summary,
|
|
|
|
*
|
|
|
|
* Revision 2.02 1996/01/07 03:35:17 sl
|
|
|
|
* Zeitraumausgabe angepasst, loeschen von isdn.log-Eintraegen
|
|
|
|
*
|
|
|
|
* Revision 2.01 1996/01/06 18:15:20 sl
|
|
|
|
* Zeitraumausgabe, nur Calls-Anzeige, optionales Logfile
|
|
|
|
*
|
|
|
|
* Revision 2.00 1996/01/01 17:50:19 akool
|
|
|
|
* Auswertung der neuen Eintraege (I/O, Cause) implementiert
|
|
|
|
* Vollstaendiges Redesign
|
|
|
|
*
|
|
|
|
* Revision 1.25 1995/11/19 09:56:19 akool
|
|
|
|
* Neue Option "-c" aktiviert die eigene Berechnung der Einheiten bei
|
|
|
|
* fehlender Gebuehreninfo
|
|
|
|
*
|
|
|
|
* Revision 1.24 1995/11/12 11:09:19 akool
|
|
|
|
* Formatfelder vergroessert
|
|
|
|
* Fremdverursachte Einheiten werden ge-()
|
|
|
|
* Alle Floating-Point-Zahlen werden deutsch (mit Komma) ausgegeben
|
|
|
|
*
|
|
|
|
* Revision 1.23 1995/11/06 18:04:19 akool
|
|
|
|
* Denkfehler in der "-6" Berechnung :-(
|
|
|
|
*
|
|
|
|
* Revision 1.22 1995/10/22 15:31:19 akool
|
|
|
|
* Aufschluesselung bach Tarifzonen implementiert
|
|
|
|
*
|
|
|
|
* Revision 1.21 1995/10/17 19:53:19 akool
|
|
|
|
* Auf echte Charging-Info umgestellt
|
|
|
|
*
|
|
|
|
* Revision 1.20 1995/10/15 17:58:19 akool
|
|
|
|
* Vergleich errechnete zu uebermittelten Einheiten implementiert
|
|
|
|
*
|
|
|
|
* Revision 1.16 1995/10/12 13:50:19 akool
|
|
|
|
* Neue Option "MYMSNS=x" in der "isdnlog.conf" zum definieren der Anzahl
|
|
|
|
* eigener MSN's
|
|
|
|
*
|
|
|
|
* Revision 1.15 1995/10/09 18:42:18 akool
|
|
|
|
* Offensichtlich sinnlose Daten i.d. "isdn.log" werden nun ignoriert
|
|
|
|
*
|
|
|
|
* Revision 1.14 1995/10/08 10:25:16 akool
|
|
|
|
* Ueberschreitung verschiedener Zeittakte bei einer Verbindung implementiert.
|
|
|
|
*
|
|
|
|
* Revision 1.6 1995/09/30 19:55:17 akool
|
|
|
|
* First public release
|
|
|
|
*
|
|
|
|
* Revision 1.1 1995/09/23 16:44:19 akool
|
|
|
|
* Initial revision
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
#define _REP_FUNC_C_
|
|
|
|
|
1998-05-20 12:23:57 +00:00
|
|
|
#include <sys/param.h>
|
1997-05-15 22:21:27 +00:00
|
|
|
#include <dirent.h>
|
|
|
|
#include <search.h>
|
|
|
|
#include <linux/limits.h>
|
|
|
|
|
1997-03-16 20:58:07 +00:00
|
|
|
#include "isdnrep.h"
|
1997-05-25 19:40:43 +00:00
|
|
|
#include "../../vbox/src/libvbox.h"
|
1997-03-16 20:58:07 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
#define END_TIME 1
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
#define SET_TIME 1
|
|
|
|
#define GET_TIME 2
|
|
|
|
#define GET_DATE 4
|
|
|
|
#define GET_DATE2 8
|
|
|
|
#define GET_YEAR 16
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-05-04 22:23:09 +00:00
|
|
|
#define GET_OUT 0
|
|
|
|
#define GET_IN 1
|
|
|
|
|
|
|
|
#define GET_BYTES 0
|
|
|
|
#define GET_BPS 2
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-16 22:22:43 +00:00
|
|
|
#define C_BEGIN_FMT '%'
|
|
|
|
|
|
|
|
#define FMT_FMT 1
|
|
|
|
#define FMT_STR 2
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-05-15 22:21:27 +00:00
|
|
|
#define C_VBOX 'v'
|
|
|
|
#define C_FAX 'f'
|
|
|
|
|
1997-05-19 22:57:51 +00:00
|
|
|
#define F_VBOX 1
|
|
|
|
#define F_FAX 2
|
|
|
|
|
1997-05-15 22:21:27 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
#define F_BEGIN 1
|
|
|
|
#define F_END 2
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
#define DEF_FMT " %X %D %15.15H %T %-15.15F %7u %U %I %O"
|
1997-05-10 01:20:52 +00:00
|
|
|
#define WWW_FMT "%X %D %17.17H %T %-17.17F %-20.20l SI: %S %9u %U %I %O"
|
1997-04-17 23:29:35 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-07-22 22:36:08 +00:00
|
|
|
#define STR_FAX "Fax: "
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1998-03-29 19:54:04 +00:00
|
|
|
#define H_ENV_VAR "QUERY_STRING"
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#define F_1ST_LINE 1
|
|
|
|
#define F_BODY_HEADER 2
|
|
|
|
#define F_BODY_HEADERL 4
|
|
|
|
#define F_BODY_LINE 8
|
|
|
|
#define F_BODY_BOTTOM1 16
|
|
|
|
#define F_BODY_BOTTOM2 32
|
|
|
|
#define F_COUNT_ONLY 64
|
|
|
|
#define F_TEXT_LINE 128
|
1997-04-20 22:52:07 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-05-04 20:19:34 +00:00
|
|
|
#define H_BG_COLOR "#FFFFFF"
|
1997-04-20 22:52:07 +00:00
|
|
|
#define H_TABLE_COLOR1 "#CCCCFF"
|
|
|
|
#define H_TABLE_COLOR2 "#FFCCCC"
|
|
|
|
#define H_TABLE_COLOR3 "#CCFFCC"
|
1998-09-22 20:58:41 +00:00
|
|
|
#define H_TABLE_COLOR4 "#FFFFCC"
|
|
|
|
#define H_TABLE_COLOR5 "#CCFFFF"
|
1997-04-20 22:52:07 +00:00
|
|
|
|
1998-03-29 19:54:04 +00:00
|
|
|
#define H_FORM_ON "<FORM METHOD=\"put\" ACTION=\"%s\">"
|
|
|
|
#define H_FORM_OFF "</FORM>"
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
#define H_1ST_LINE "<CENTER><FONT size=+1><B>%s</B></FONT><P>\n"
|
1998-03-29 19:54:04 +00:00
|
|
|
#define H_TEXT_LINE "<CENTER><B>%s</B><P>\n"
|
1997-04-20 22:52:07 +00:00
|
|
|
#define H_BODY_LINE "<TR>%s</TR>\n"
|
|
|
|
#define H_BODY_HEADER1 "<TABLE width=%g%% bgcolor=%s border=0 cellspacing=0 cellpadding=0>\n"
|
|
|
|
#define H_BODY_HEADER2 "<COL width=%d*>\n"
|
|
|
|
//#define H_BODY_HEADER2 "<COLGROUP span=1 width=%d*>\n"
|
|
|
|
#define H_BODY_HEADER3 "<TH colspan=%d>%s</TH>\n"
|
|
|
|
#define H_BODY_BOTTOM1 "<TD align=left colspan=%d>%s</TD>%s\n"
|
|
|
|
#define H_BODY_BOTTOM2 "</TABLE><P>\n"
|
|
|
|
|
1997-05-06 22:13:21 +00:00
|
|
|
#define H_LINE "<TR><TD colspan=%d><HR size=%d noshade width=100%%></TD></TR>\n"
|
|
|
|
|
1997-05-04 20:19:34 +00:00
|
|
|
#define H_LEFT "<TD align=left><TT>%s</TT></TD>"
|
|
|
|
#define H_CENTER "<TD align=center><TT>%s</TT></TD>"
|
|
|
|
#define H_RIGHT "<TD align=right><TT>%s</TT></TD>"
|
1997-05-15 22:21:27 +00:00
|
|
|
#define H_LINK "<A HREF=\"%s?-M+%c%d%s\">%s</A>"
|
1998-03-25 20:58:34 +00:00
|
|
|
#define H_LINK_DAY "<A HREF=\"%s?%s\">%s</A> "
|
1998-03-29 19:54:04 +00:00
|
|
|
#define H_FORM_DAY "%s<input name=\"%s\" maxlength=%d value=\"\" size=%d><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"go\">"
|
1997-04-20 22:52:07 +00:00
|
|
|
|
1997-05-04 20:19:34 +00:00
|
|
|
#define H_EMPTY " "
|
1997-04-17 23:29:35 +00:00
|
|
|
|
1997-05-28 21:22:39 +00:00
|
|
|
#define H_APP_ZYXEL2 "application/x-zyxel2"
|
|
|
|
#define H_APP_ZYXEL3 "application/x-zyxel3"
|
|
|
|
#define H_APP_ZYXEL4 "application/x-zyxel4"
|
|
|
|
#define H_APP_ULAW "application/x-ulaw"
|
|
|
|
#define H_APP_TEXT "text/plain"
|
|
|
|
#define H_APP_FAX3 "application/x-faxg3"
|
|
|
|
|
1997-04-17 23:29:35 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-16 22:22:43 +00:00
|
|
|
typedef struct {
|
|
|
|
int type;
|
|
|
|
char *string;
|
|
|
|
char s_type;
|
|
|
|
char *range;
|
|
|
|
} prt_fmt;
|
|
|
|
|
1997-05-15 22:21:27 +00:00
|
|
|
typedef struct {
|
|
|
|
int version;
|
1997-05-25 19:40:43 +00:00
|
|
|
int compression;
|
1997-05-15 22:21:27 +00:00
|
|
|
int used;
|
|
|
|
time_t time;
|
|
|
|
char type;
|
|
|
|
char *name;
|
|
|
|
} file_list;
|
|
|
|
|
1997-04-16 22:22:43 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
static time_t get_month(char *String, int TimeStatus);
|
|
|
|
static time_t get_time(char *String, int TimeStatus);
|
|
|
|
static int show_msn(one_call *cur_call);
|
|
|
|
static int add_sum_calls(sum_calls *s1, sum_calls *s2);
|
|
|
|
static int print_sum_calls(sum_calls *s, int computed);
|
|
|
|
static int add_one_call(sum_calls *s1, one_call *s2, double units);
|
|
|
|
static int clear_sum(sum_calls *s1);
|
1997-04-20 22:52:07 +00:00
|
|
|
static char *print_currency(double money, int computed);
|
1997-04-06 21:03:36 +00:00
|
|
|
static void strich(int type);
|
|
|
|
static int n_match(char *Pattern, char* Number, char* version);
|
|
|
|
static int set_caller_infos(one_call *cur_call, char *string, time_t from);
|
|
|
|
static int set_alias(one_call *cur_call, int *nx, char *myname);
|
|
|
|
static int print_header(int lday);
|
|
|
|
static int print_entries(one_call *cur_call, double unit, int *nx, char *myname);
|
|
|
|
static int print_bottom(double unit, char *start, char *stop);
|
|
|
|
static char *get_time_value(time_t t, int *day, int flag);
|
|
|
|
static char **string_to_array(char *string);
|
1997-04-20 22:52:07 +00:00
|
|
|
static prt_fmt** get_format(const char *format);
|
1997-05-04 22:23:09 +00:00
|
|
|
static char *set_byte_string(int flag, double Bytes);
|
1997-04-20 22:52:07 +00:00
|
|
|
static int print_line(int status, one_call *cur_call, int computed, char *overlap);
|
|
|
|
static int print_line2(int status, const char *, ...);
|
|
|
|
static int print_line3(const char *fmt, ...);
|
|
|
|
static int append_string(char **string, prt_fmt *fmt_ptr, char* value);
|
|
|
|
static char *html_conv(char *string);
|
|
|
|
static int get_format_size(void);
|
|
|
|
static int set_col_size(void);
|
|
|
|
static char *overlap_string(char *s1, char *s2);
|
|
|
|
static char* fill_spaces(char *string);
|
|
|
|
static void free_format(prt_fmt** ptr);
|
|
|
|
static int html_bottom(char *progname, char *start, char *stop);
|
|
|
|
static int html_header(void);
|
1997-05-10 12:57:00 +00:00
|
|
|
static char *print_diff_date(char *start, char *stop);
|
1997-05-15 22:21:27 +00:00
|
|
|
static int get_file_list(void);
|
|
|
|
static int set_dir_entries(char *directory, int (*set_fct)(const char *, const char *));
|
|
|
|
static int set_vbox_entry(const char *path, const char *file);
|
|
|
|
static int set_mgetty_entry(const char *path, const char *file);
|
|
|
|
static int set_element_list(file_list* elem);
|
|
|
|
static int Compare_files(const void *e1, const void *e2);
|
|
|
|
static file_list *get_file_to_call(time_t filetime, char type);
|
|
|
|
static char *get_links(time_t filetime, char type);
|
|
|
|
static char *append_fax(char **string, char *file, char type, int version);
|
|
|
|
static int time_in_interval(time_t t1, time_t t2, char type);
|
|
|
|
static char *nam2html(char *file);
|
1997-05-17 01:08:11 +00:00
|
|
|
static char *get_a_day(time_t t, int d_diff, int m_diff, int flag);
|
|
|
|
static char *get_time_string(time_t begin, time_t end, int d_diff, int m_diff);
|
1998-03-25 20:58:34 +00:00
|
|
|
static char *get_default_html_params(void);
|
1997-05-25 19:40:43 +00:00
|
|
|
static char *create_vbox_file(char *file, int *compression);
|
1998-03-29 19:54:04 +00:00
|
|
|
static int htoi(char *s);
|
|
|
|
static char **get_http_args(char *str, int *index);
|
|
|
|
static char *url_unescape(char *str);
|
1998-09-22 20:58:41 +00:00
|
|
|
static int app_fmt_string(char *target, int targetlen, char *fmt, int condition, char *value);
|
|
|
|
static int find_format_length(char *string);
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int invertnumbers = 0;
|
|
|
|
static int unknowns = 0;
|
|
|
|
static UNKNOWN unknown[MAXUNKNOWN];
|
|
|
|
static int zones[MAXZONES];
|
|
|
|
static int zones_usage[MAXZONES];
|
|
|
|
static double zones_dm[MAXZONES];
|
|
|
|
static double zones_dur[MAXZONES];
|
|
|
|
static char** ShowMSN = NULL;
|
1997-04-20 22:52:07 +00:00
|
|
|
static int* colsize = NULL;
|
|
|
|
static double h_percent = 100.0;
|
|
|
|
static char* h_table_color = H_TABLE_COLOR1;
|
1997-05-15 22:21:27 +00:00
|
|
|
static file_list **file_root = NULL;
|
|
|
|
static int file_root_size = 0;
|
|
|
|
static int file_root_member = 0;
|
|
|
|
static char *_myname;
|
1997-05-17 01:08:11 +00:00
|
|
|
static time_t _begintime;
|
1997-05-19 22:57:51 +00:00
|
|
|
static int read_path = 0;
|
1997-03-20 00:18:57 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
static char msg1[] = "%s: Can't open %s (%s)\n";
|
|
|
|
static char wrongdate2[] = "wrong date for delete: %s\n";
|
|
|
|
static char nomemory[] = "Out of memory!\n";
|
1997-03-23 20:25:23 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
static char htmlconv[][2][10] = {
|
|
|
|
{">", ">"},
|
|
|
|
{"<", "<"},
|
1997-07-22 22:36:08 +00:00
|
|
|
{" ", H_EMPTY},
|
1997-04-20 22:52:07 +00:00
|
|
|
{"" , ""},
|
|
|
|
};
|
1997-03-23 20:25:23 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
/*****************************************************************************/
|
1997-03-20 00:18:57 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
static int Tarif96 = 0;
|
|
|
|
static int Tarif962 = 0;
|
|
|
|
|
|
|
|
static sum_calls day_sum;
|
|
|
|
static sum_calls day_com_sum;
|
|
|
|
static sum_calls all_sum;
|
|
|
|
static sum_calls all_com_sum;
|
|
|
|
|
1997-03-20 00:18:57 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
1998-06-14 15:33:42 +00:00
|
|
|
static double *msn_sum;
|
|
|
|
static int *usage_sum;
|
|
|
|
static double *dur_sum;
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
|
|
|
|
static int usage_provider[100];
|
|
|
|
static double duration_provider[100];
|
|
|
|
static double pay_provider[100];
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
void set_print_fct_for_isdnrep(int (*new_print_msg)(int Level, const char *, ...))
|
1997-03-16 20:58:07 +00:00
|
|
|
{
|
1997-04-06 21:03:36 +00:00
|
|
|
print_msg = new_print_msg;
|
|
|
|
}
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
/*****************************************************************************/
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-05-15 22:21:27 +00:00
|
|
|
int send_html_request(char *myname, char *option)
|
|
|
|
{
|
|
|
|
char file[PATH_MAX];
|
|
|
|
char commandline[PATH_MAX];
|
|
|
|
char *filetype = NULL;
|
|
|
|
char *command = NULL;
|
1997-05-25 19:40:43 +00:00
|
|
|
char *vboxfile = NULL;
|
|
|
|
int compression;
|
1997-05-15 22:21:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (*option == C_VBOX)
|
|
|
|
{
|
|
|
|
sprintf(file,"%s%c%s",vboxpath,C_SLASH,option+2);
|
|
|
|
|
|
|
|
if (option[1] == '1')
|
1997-05-25 19:40:43 +00:00
|
|
|
{
|
|
|
|
if (vboxcommand1)
|
|
|
|
command = vboxcommand1;
|
|
|
|
else
|
1997-05-28 21:22:39 +00:00
|
|
|
filetype = H_APP_ZYXEL4;
|
1997-05-25 19:40:43 +00:00
|
|
|
}
|
1997-05-15 22:21:27 +00:00
|
|
|
else
|
|
|
|
if (option[1] == '2')
|
|
|
|
{
|
1997-05-25 19:40:43 +00:00
|
|
|
if (vboxcommand2)
|
|
|
|
command = vboxcommand2;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vboxfile = strcpy(file,create_vbox_file(file,&compression));
|
|
|
|
|
|
|
|
switch(compression)
|
|
|
|
{
|
1997-05-28 21:22:39 +00:00
|
|
|
case 2 : filetype = H_APP_ZYXEL2;
|
1997-05-25 19:40:43 +00:00
|
|
|
break;
|
1997-05-28 21:22:39 +00:00
|
|
|
case 3 : filetype = H_APP_ZYXEL3;
|
1997-05-25 19:40:43 +00:00
|
|
|
break;
|
1997-05-28 21:22:39 +00:00
|
|
|
case 4 : filetype = H_APP_ZYXEL4;
|
1997-05-25 19:40:43 +00:00
|
|
|
break;
|
1997-05-28 21:22:39 +00:00
|
|
|
case 6 : filetype = H_APP_ULAW;
|
1997-05-25 19:40:43 +00:00
|
|
|
break;
|
1997-05-28 21:22:39 +00:00
|
|
|
default: print_msg(PRT_NORMAL, "Content-Type: %s\n\n",H_APP_TEXT);
|
1997-05-25 19:40:43 +00:00
|
|
|
print_msg(PRT_NORMAL, "%s: unsupported compression type of vbox file :`%d'\n",myname,compression);
|
|
|
|
return -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1997-05-15 22:21:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1997-05-28 21:22:39 +00:00
|
|
|
print_msg(PRT_NORMAL, "Content-Type: %s\n\n",H_APP_TEXT);
|
1997-05-25 19:40:43 +00:00
|
|
|
print_msg(PRT_NORMAL, "%s: unsupported version of vbox `%c'\n",myname,option[0]);
|
1997-05-15 22:21:27 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (*option == C_FAX)
|
|
|
|
{
|
|
|
|
sprintf(file,"%s%c%s",mgettypath,C_SLASH,option+2);
|
|
|
|
|
|
|
|
if (option[1] == '3')
|
1997-05-25 19:40:43 +00:00
|
|
|
{
|
|
|
|
if (mgettycommand)
|
|
|
|
command = mgettycommand;
|
|
|
|
else
|
1997-05-28 21:22:39 +00:00
|
|
|
filetype = H_APP_FAX3;
|
1997-05-25 19:40:43 +00:00
|
|
|
}
|
1997-05-15 22:21:27 +00:00
|
|
|
else
|
|
|
|
{
|
1997-05-28 21:22:39 +00:00
|
|
|
print_msg(PRT_NORMAL, "Content-Type: %s\n\n",H_APP_TEXT);
|
1997-05-25 19:40:43 +00:00
|
|
|
print_msg(PRT_NORMAL, "%s:unsupported version of fax `%c%c'\n",myname,option[0]);
|
1997-05-15 22:21:27 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1997-05-28 21:22:39 +00:00
|
|
|
print_msg(PRT_NORMAL, "Content-Type: %s\n\n",H_APP_TEXT);
|
1997-05-15 22:21:27 +00:00
|
|
|
print_msg(PRT_NORMAL, "%s:invalid option string `%c%c'\n",myname,option[0],option[1]);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (command == NULL)
|
|
|
|
{
|
|
|
|
char precmd[SHORT_STRING_SIZE];
|
|
|
|
|
|
|
|
sprintf(precmd, "echo \"Content-Type: %s\"",filetype);
|
|
|
|
system(precmd);
|
|
|
|
sprintf(precmd, "echo");
|
|
|
|
system(precmd);
|
|
|
|
// print_msg(PRT_NORMAL, "Content-Type: %s\n\n",filetype);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(commandline,"%s %s",command?command:"cat",file);
|
|
|
|
system(commandline);
|
|
|
|
|
1997-05-25 19:40:43 +00:00
|
|
|
if (vboxfile)
|
|
|
|
{
|
|
|
|
if (unlink(vboxfile))
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"Can not delete file `%s': %s!\n",file, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-05-15 22:21:27 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
int read_logfile(char *myname)
|
|
|
|
{
|
|
|
|
auto double einheit = 0.23;
|
|
|
|
auto int nx[2];
|
|
|
|
auto time_t now, from = 0;
|
|
|
|
auto struct tm *tm;
|
|
|
|
auto int lday = -1;
|
|
|
|
auto char start[20] = "", stop[20];
|
|
|
|
auto char* tmpfile = NULL;
|
|
|
|
auto FILE *fi, *ftmp = NULL;
|
|
|
|
auto char string[BUFSIZ], s[BUFSIZ];
|
|
|
|
one_call cur_call;
|
1997-03-16 20:58:07 +00:00
|
|
|
|
|
|
|
|
1998-06-14 15:33:42 +00:00
|
|
|
msn_sum = calloc(mymsns + 1, sizeof(double));
|
|
|
|
usage_sum = calloc(mymsns + 1, sizeof(int));
|
|
|
|
dur_sum = calloc(mymsns + 1, sizeof(double));
|
|
|
|
|
1997-05-15 22:21:27 +00:00
|
|
|
_myname = myname;
|
1997-05-17 01:08:11 +00:00
|
|
|
_begintime = begintime;
|
1997-05-15 22:21:27 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if (html & H_PRINT_HEADER)
|
|
|
|
html_header();
|
1997-04-17 23:29:35 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if (lineformat == NULL)
|
|
|
|
{
|
|
|
|
if (html)
|
|
|
|
lineformat = WWW_FMT;
|
|
|
|
else
|
|
|
|
lineformat = DEF_FMT;
|
|
|
|
}
|
|
|
|
|
1997-04-17 23:29:35 +00:00
|
|
|
if (get_format(lineformat) == NULL)
|
|
|
|
return -1;
|
1997-04-16 22:22:43 +00:00
|
|
|
|
1997-05-19 22:57:51 +00:00
|
|
|
/* following two lines must be after get_format()! */
|
|
|
|
if (html)
|
|
|
|
get_file_list();
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
clear_sum(&day_sum);
|
|
|
|
clear_sum(&day_com_sum);
|
|
|
|
clear_sum(&all_sum);
|
|
|
|
clear_sum(&all_com_sum);
|
|
|
|
|
1997-05-04 20:19:34 +00:00
|
|
|
if (knowns == 0 || strcmp(known[knowns-1]->who,S_UNKNOWN))
|
1997-04-20 22:52:07 +00:00
|
|
|
{
|
|
|
|
if ((known = (KNOWN**) realloc(known, sizeof(KNOWN *) * (knowns+1))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((known[knowns] = (KNOWN*) calloc(1,sizeof(KNOWN))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
known[knowns]->who = S_UNKNOWN;
|
|
|
|
known[knowns++]->num = "0000";
|
|
|
|
}
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (delentries)
|
|
|
|
{
|
|
|
|
if(begintime)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, wrongdate2, timestring);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((tmpfile = tmpnam(NULL)) == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if ((ftmp = fopen(tmpfile, "w")) == (FILE *)NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, msg1, tmpfile, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!timearea) { /* from darf nicht gesetzt werden, wenn alle Telefonate angezeigt werden sollen */
|
|
|
|
time(&now);
|
|
|
|
/* aktuelle Zeit wird gesetzt */
|
|
|
|
tm = localtime(&now);
|
|
|
|
/* Zeit von 1970 nach Struktur */
|
|
|
|
tm->tm_sec = tm->tm_min = tm->tm_hour = 0;
|
|
|
|
from = mktime(tm);
|
|
|
|
/* Struktur nach Zeit von 1970 */
|
|
|
|
/* from hat den aktuellen Tag 0.00 Uhr */
|
|
|
|
} /* if */
|
|
|
|
|
|
|
|
if ((fi = fopen(logfile, "r")) == (FILE *)NULL){
|
|
|
|
print_msg(PRT_ERR,"Can not open file `%s': %s!\n",logfile,strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
memset(zones, 0, sizeof(zones));
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
while (fgets(s, BUFSIZ, fi)) {
|
|
|
|
strcpy(string,s);
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (*s == '#')
|
|
|
|
continue;
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (set_caller_infos(&cur_call,s,from) != 0)
|
|
|
|
continue;
|
1997-03-23 20:25:23 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (!begintime)
|
|
|
|
begintime = cur_call.t;
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (timearea)
|
|
|
|
{
|
|
|
|
if (delentries)
|
|
|
|
if (cur_call.t > endtime)
|
|
|
|
fputs(string,ftmp);
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (!verbose && cur_call.duration == 0)
|
|
|
|
continue;
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (phonenumberonly)
|
|
|
|
if (!show_msn(&cur_call))
|
|
|
|
continue;
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (incomingonly && cur_call.dir == DIALOUT)
|
|
|
|
continue;
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (outgoingonly && cur_call.dir == DIALIN)
|
|
|
|
continue;
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
get_time_value(cur_call.t,&day,SET_TIME);
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
/* Andreas, warum ist diese Abfrage hier drin, warum soll das nicht moeglich
|
|
|
|
sein? */
|
|
|
|
if (cur_call.duration > 172800.0) /* laenger als 2 Tage? Das KANN nicht sein! */
|
|
|
|
cur_call.duration = 0;
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
set_alias(&cur_call,nx,myname);
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (day != lday) {
|
|
|
|
if (header)
|
|
|
|
print_header(lday);
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
lday = day;
|
|
|
|
|
|
|
|
if (!*start)
|
|
|
|
{
|
|
|
|
sprintf(start, "%s %s", get_time_value(0,NULL,GET_DATE),
|
|
|
|
get_time_value(0,NULL,GET_YEAR));
|
|
|
|
sprintf(stop, "%s %s", get_time_value(0,NULL,GET_DATE),
|
|
|
|
get_time_value(0,NULL,GET_YEAR));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sprintf(stop, "%s %s", get_time_value(0,NULL,GET_DATE),
|
|
|
|
get_time_value(0,NULL,GET_YEAR));
|
|
|
|
} /* if */
|
|
|
|
|
1998-10-04 12:03:54 +00:00
|
|
|
if (!cur_call.currency_factor)
|
1997-04-06 21:03:36 +00:00
|
|
|
#ifdef ISDN_NL
|
|
|
|
einheit = 0.0011; /* cost of one second local tariff during office hours */
|
|
|
|
#elif defined(ISDN_CH)
|
|
|
|
einheit = 0.01;
|
1998-09-26 18:27:23 +00:00
|
|
|
#elif defined(ISDN_AT)
|
|
|
|
einheit = 1.056;
|
1997-04-06 21:03:36 +00:00
|
|
|
#else
|
1998-06-14 15:33:42 +00:00
|
|
|
einheit = Tarif96 ? 0.121 : 0.23;
|
1997-04-06 21:03:36 +00:00
|
|
|
#endif
|
|
|
|
else
|
1998-10-04 12:03:54 +00:00
|
|
|
einheit = cur_call.currency_factor;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
print_entries(&cur_call,einheit,nx,myname);
|
|
|
|
|
|
|
|
} /* while */
|
|
|
|
|
|
|
|
fclose(fi);
|
|
|
|
|
|
|
|
if (delentries) /* Erzeugt neue verkuerzte Datei */
|
|
|
|
lday = -1;
|
|
|
|
|
1998-03-29 19:54:04 +00:00
|
|
|
if (lday == -1 && html)
|
|
|
|
{
|
1998-04-27 22:35:31 +00:00
|
|
|
if (begintime == 0)
|
|
|
|
begintime = time(NULL);
|
|
|
|
|
|
|
|
if (endtime == 0)
|
|
|
|
endtime = time(NULL);
|
|
|
|
|
1998-03-29 19:54:04 +00:00
|
|
|
get_time_value(begintime,&lday,SET_TIME);
|
|
|
|
sprintf(start, "%s %s", get_time_value(0,NULL,GET_DATE),
|
|
|
|
get_time_value(0,NULL,GET_YEAR));
|
|
|
|
|
|
|
|
get_time_value(endtime,&lday,SET_TIME);
|
|
|
|
sprintf(stop, "%s %s", get_time_value(0,NULL,GET_DATE),
|
|
|
|
get_time_value(0,NULL,GET_YEAR));
|
|
|
|
|
|
|
|
print_line2(F_1ST_LINE,"I S D N Connection Report");
|
|
|
|
print_line2(F_TEXT_LINE,"");
|
|
|
|
print_line2(F_TEXT_LINE,"no calls from %s to %s", start, stop);
|
|
|
|
print_line2(F_TEXT_LINE,"");
|
|
|
|
lday = -1;
|
|
|
|
}
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (lday != -1 && header)
|
|
|
|
print_bottom(einheit, start, stop);
|
|
|
|
|
|
|
|
if (delentries) /* Erzeugt neue verkuerzte Datei */
|
|
|
|
{
|
|
|
|
fclose(ftmp);
|
|
|
|
|
|
|
|
if ((ftmp = fopen(tmpfile, "r")) == (FILE *)NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, msg1, tmpfile, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if ((fi = fopen(logfile, "w")) == (FILE *)NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, msg1, logfile, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (fgets(s, BUFSIZ, ftmp))
|
|
|
|
fputs(s,fi);
|
|
|
|
|
|
|
|
fclose(fi);
|
|
|
|
fclose(ftmp);
|
|
|
|
|
|
|
|
unlink(tmpfile);
|
|
|
|
}
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if (html & H_PRINT_HEADER)
|
|
|
|
html_bottom(myname,start,stop);
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
return 0;
|
|
|
|
} /* read_logfile */
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
int is_sondernummer(char *num)
|
|
|
|
{
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
|
|
if (*num)
|
|
|
|
for (i = 0; i < nSN; i++)
|
|
|
|
if (!strcmp(num, SN[i].msn))
|
|
|
|
return(i);
|
|
|
|
|
|
|
|
return(-1);
|
|
|
|
} /* sondernummer */
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
static int print_bottom(double unit, char *start, char *stop)
|
|
|
|
{
|
|
|
|
auto char string[BUFSIZ];
|
1998-09-22 20:58:41 +00:00
|
|
|
register int i, j, k;
|
1997-04-06 21:03:36 +00:00
|
|
|
register char *p = NULL;
|
|
|
|
sum_calls tmp_sum;
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
auto double s = 0.0, s2 = 0.0;
|
|
|
|
auto int s1 = 0;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (timearea) {
|
|
|
|
strich(1);
|
|
|
|
print_sum_calls(&day_sum,0);
|
|
|
|
|
|
|
|
if (day_com_sum.eh)
|
|
|
|
{
|
|
|
|
print_sum_calls(&day_com_sum,1);
|
|
|
|
|
|
|
|
clear_sum(&tmp_sum);
|
|
|
|
add_sum_calls(&tmp_sum,&day_sum);
|
|
|
|
add_sum_calls(&tmp_sum,&day_com_sum);
|
|
|
|
strich(1);
|
|
|
|
print_sum_calls(&tmp_sum,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
print_msg(PRT_NORMAL,"\n");
|
|
|
|
} /* if */
|
|
|
|
|
|
|
|
add_sum_calls(&all_sum,&day_sum);
|
|
|
|
add_sum_calls(&all_com_sum,&day_com_sum);
|
|
|
|
|
|
|
|
strich(2);
|
|
|
|
print_sum_calls(&all_sum,0);
|
|
|
|
|
|
|
|
if (all_com_sum.eh)
|
|
|
|
{
|
|
|
|
print_sum_calls(&all_com_sum,1);
|
|
|
|
|
|
|
|
clear_sum(&tmp_sum);
|
|
|
|
add_sum_calls(&tmp_sum,&all_sum);
|
|
|
|
add_sum_calls(&tmp_sum,&all_com_sum);
|
|
|
|
strich(2);
|
|
|
|
print_sum_calls(&tmp_sum,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
print_msg(PRT_NORMAL,"\n");
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
print_line2(F_BODY_BOTTOM2,"");
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
get_format("%-14.14s %4d call(s) %10.10s %12s %-12s %-12s");
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
for (j = 0; j < 2; j++)
|
1997-04-06 21:03:36 +00:00
|
|
|
{
|
1997-04-20 22:52:07 +00:00
|
|
|
if ((j == DIALOUT && !incomingonly) || (!outgoingonly && j == DIALIN))
|
|
|
|
{
|
1998-10-03 18:05:48 +00:00
|
|
|
sprintf(string, "%s Summary for %s", (j == DIALOUT) ? "Outgoing calls (calling:)" : "Incoming calls (called by:)",
|
1997-05-10 12:57:00 +00:00
|
|
|
print_diff_date(start,stop));
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
h_percent = 80.0;
|
|
|
|
h_table_color = H_TABLE_COLOR2;
|
|
|
|
print_line2(F_BODY_HEADER,"");
|
|
|
|
print_line2(F_BODY_HEADERL,"%s",string);
|
1998-09-22 20:58:41 +00:00
|
|
|
strich(1);
|
1997-04-06 21:03:36 +00:00
|
|
|
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
for (i = 0 /* mymsns */; i < knowns; i++) {
|
1997-04-20 22:52:07 +00:00
|
|
|
if (known[i]->usage[j]) {
|
|
|
|
print_line3(NULL,
|
1997-05-04 20:19:34 +00:00
|
|
|
/*!numbers?*/known[i]->who/*:known[i]->num*/,
|
1997-04-20 22:52:07 +00:00
|
|
|
known[i]->usage[j],
|
|
|
|
double2clock(known[i]->dur[j]),
|
|
|
|
j==DIALOUT?print_currency(known[i]->dm,0):
|
|
|
|
fill_spaces(print_currency(known[i]->dm,0)),
|
1997-05-04 22:23:09 +00:00
|
|
|
set_byte_string(GET_IN|GET_BYTES,known[i]->ibytes[j]),
|
|
|
|
set_byte_string(GET_OUT|GET_BYTES,known[i]->obytes[j]));
|
1997-04-20 22:52:07 +00:00
|
|
|
} /* if */
|
|
|
|
} /* for */
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
print_line2(F_BODY_BOTTOM2,"");
|
|
|
|
}
|
1997-04-06 21:03:36 +00:00
|
|
|
}
|
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
if (!incomingonly)
|
|
|
|
{
|
|
|
|
h_percent = 60.0;
|
|
|
|
h_table_color = H_TABLE_COLOR3;
|
|
|
|
get_format("%-4.4s %c : %-21.21s %4d call(s) %10.10s %12s");
|
|
|
|
print_line2(F_BODY_HEADER,"");
|
|
|
|
print_line2(F_BODY_HEADERL,"Outgoing calls ordered by Zone");
|
|
|
|
strich(1);
|
1997-04-20 22:52:07 +00:00
|
|
|
|
1998-10-03 15:21:48 +00:00
|
|
|
/* Andreas: zones[i] ist manchmal immer NULL, warum ? */
|
1998-09-22 20:58:41 +00:00
|
|
|
for (i = 1; i < MAXZONES; i++)
|
|
|
|
if (zones[i]) {
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
p = "";
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
switch (i) {
|
|
|
|
case 1 : p = "CityCall"; break;
|
|
|
|
case 2 : p = "RegioCall"; break;
|
|
|
|
case 3 :
|
|
|
|
case 4 : p = "GermanCall"; break;
|
|
|
|
default: p = "GlobalCall"; break;
|
|
|
|
} /* switch */
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
print_line3(NULL,
|
|
|
|
"Zone", (char) i+48, p, zones_usage[i],
|
|
|
|
double2clock(zones_dur[i]), print_currency(zones_dm[i],0));
|
1998-10-03 15:21:48 +00:00
|
|
|
} /* if */
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1998-10-03 15:21:48 +00:00
|
|
|
/* Was soll das werden, Andreas ? */
|
1998-09-22 20:58:41 +00:00
|
|
|
if (known[knowns-1]->eh > 0)
|
|
|
|
{
|
|
|
|
print_line3(NULL,
|
1998-10-03 15:21:48 +00:00
|
|
|
"Zone", 'x', S_UNKNOWN,
|
1998-09-22 20:58:41 +00:00
|
|
|
known[knowns-1]->usage[DIALOUT], double2clock(known[knowns-1]->dur[DIALOUT]),
|
1997-04-06 21:03:36 +00:00
|
|
|
#ifdef ISDN_NL
|
1998-09-22 20:58:41 +00:00
|
|
|
print_currency(known[knowns-1]->eh * unit + known[knowns-1]->usage[DIALOUT] * 0.0825,0));
|
1997-04-06 21:03:36 +00:00
|
|
|
#else
|
1998-09-22 20:58:41 +00:00
|
|
|
print_currency(known[knowns-1]->eh * unit, 0));
|
1997-04-06 21:03:36 +00:00
|
|
|
#endif
|
1998-09-22 20:58:41 +00:00
|
|
|
}
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
print_line2(F_BODY_BOTTOM2,"");
|
1997-04-20 22:52:07 +00:00
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
h_percent = 60.0;
|
|
|
|
h_table_color = H_TABLE_COLOR4;
|
|
|
|
get_format("%-8.8s %05s %-15.15s %4d call(s) %10.10s %12s");
|
|
|
|
print_line2(F_BODY_HEADER,"");
|
|
|
|
print_line2(F_BODY_HEADERL,"Outgoing calls ordered by Provider");
|
|
|
|
strich(1);
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
for (i = 1; i < 100; i++) {
|
|
|
|
sprintf(string,"010%02d",i);
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
if (usage_provider[i]) {
|
|
|
|
print_line3(NULL, "Provider", string, Providername(i),
|
|
|
|
usage_provider[i],
|
|
|
|
double2clock(duration_provider[i]),
|
|
|
|
print_currency(pay_provider[i], 0));
|
|
|
|
} /* if */
|
|
|
|
} /* for */
|
|
|
|
|
|
|
|
print_line2(F_BODY_BOTTOM2,"");
|
|
|
|
|
|
|
|
h_percent = 60.0;
|
|
|
|
h_table_color = H_TABLE_COLOR5;
|
|
|
|
get_format("%-30.30s %4d call(s) %10.10s %12s");
|
|
|
|
print_line2(F_BODY_HEADER,"");
|
|
|
|
print_line2(F_BODY_HEADERL,"Outgoing calls ordered by MSN");
|
|
|
|
strich(1);
|
|
|
|
|
|
|
|
for (k = 0; k <= mymsns; k++) {
|
|
|
|
if (msn_sum[k]) {
|
|
|
|
|
1998-10-03 15:21:48 +00:00
|
|
|
print_line3(NULL, ((k == mymsns) ? S_UNKNOWN : known[k]->who),
|
1998-09-22 20:58:41 +00:00
|
|
|
usage_sum[k],
|
|
|
|
double2clock(dur_sum[k]),
|
|
|
|
print_currency(msn_sum[k], 0));
|
|
|
|
|
|
|
|
s += msn_sum[k];
|
|
|
|
s1 += usage_sum[k];
|
|
|
|
s2 += dur_sum[k];
|
|
|
|
} /* if */
|
|
|
|
} /* for */
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
if (s) {
|
|
|
|
strich(2);
|
|
|
|
print_line3(NULL, "TOTAL", s1, double2clock(s2), print_currency(s, 0));
|
|
|
|
} /* if */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
print_line2(F_BODY_BOTTOM2,"");
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if (seeunknowns && unknowns) {
|
|
|
|
print_msg(PRT_NORMAL,"\n\nUnknown caller(s)\n");
|
|
|
|
strich(3);
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
for (i = 0; i < unknowns; i++) {
|
1998-03-08 11:42:23 +00:00
|
|
|
#if 0
|
1997-04-20 22:52:07 +00:00
|
|
|
print_msg(PRT_NORMAL,"%s %-14s ", unknown[i].called ? "called by" : " calling", unknown[i].num);
|
1998-03-08 11:42:23 +00:00
|
|
|
#else
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
if ((unknown[i].cause != 1) && /* Unallocated (unassigned) number */
|
|
|
|
(unknown[i].cause != 3) && /* No route to destination */
|
|
|
|
(unknown[i].cause != 28)) { /* Invalid number format (address incomplete) */
|
1998-03-08 11:42:23 +00:00
|
|
|
auto char *p;
|
|
|
|
auto int l;
|
|
|
|
register int flag = C_NO_WARN | C_NO_EXPAND;
|
|
|
|
auto int prefix = strlen(countryprefix);
|
|
|
|
auto char areacode[64], vorwahl[64], rufnummer[64], iam[64];
|
|
|
|
|
|
|
|
|
|
|
|
print_msg(PRT_NORMAL,"%s ", unknown[i].called ? "Called by" : " Calling");
|
|
|
|
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
if (is_sondernummer(unknown[i].num) > 0)
|
|
|
|
;
|
|
|
|
else
|
1998-03-08 11:42:23 +00:00
|
|
|
if ((p = get_areacode(unknown[i].num, &l, flag)) != 0) {
|
|
|
|
if (l > 1) {
|
1998-10-13 21:53:17 +00:00
|
|
|
/* Sehr gefaehrlich, was ist mit Laendern, die einen dreistelligen Code haben??? */
|
|
|
|
Strncpy(areacode, unknown[i].num, 3 + prefix);
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
if ((l - (2 + prefix)) > 0) {
|
1998-10-13 21:53:17 +00:00
|
|
|
Strncpy(vorwahl, unknown[i].num + 2 + prefix, l - (2 + prefix) + 1);
|
1998-03-08 11:42:23 +00:00
|
|
|
vorwahl[l - (2 + prefix)] = 0;
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
*vorwahl = 0;
|
1998-03-08 11:42:23 +00:00
|
|
|
strcpy(rufnummer, unknown[i].num + l);
|
|
|
|
|
|
|
|
strcpy(iam, num2nam(unknown[i].mynum, unknown[i].si1));
|
|
|
|
|
|
|
|
print_msg(PRT_NORMAL,"%s %s/%s, %s %s %s (%s %s %s,%d):%s\n\t\t\t ",
|
|
|
|
areacode, vorwahl, rufnummer, p, (unknown[i].called ? "on" : "with"),
|
|
|
|
iam, unknown[i].num, (unknown[i].called ? "->" : "<-"),
|
|
|
|
unknown[i].mynum, unknown[i].si1, qmsg(TYPE_CAUSE, VERSION_EDSS1, unknown[i].cause));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
print_msg(PRT_NORMAL,"??? %s\n\t\t\t ", unknown[i].num);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print_msg(PRT_NORMAL,"??? %s\n\t\t\t ", unknown[i].num);
|
|
|
|
}
|
|
|
|
} /* if */
|
|
|
|
#endif
|
1997-04-20 22:52:07 +00:00
|
|
|
for (k = 0; k < unknown[i].connects; k++) {
|
|
|
|
strcpy(string, ctime(&unknown[i].connect[k]));
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if ((p = strchr(string, '\n')))
|
|
|
|
*p = 0;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
*(string + 19) = 0;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if (k && (k + 1) % 2) {
|
|
|
|
print_msg(PRT_NORMAL,"\n\t\t\t ");
|
1997-04-06 21:03:36 +00:00
|
|
|
} /* if */
|
|
|
|
|
|
|
|
print_msg(PRT_NORMAL,"%s%s", k & 1 ? ", " : "", string + 4);
|
|
|
|
} /* for */
|
|
|
|
|
|
|
|
print_msg(PRT_NORMAL,"\n");
|
|
|
|
} /* for */
|
|
|
|
} /* if */
|
|
|
|
|
|
|
|
return 0;
|
1997-03-23 20:25:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
static int print_line3(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
char *string = NULL;
|
1997-05-15 22:21:27 +00:00
|
|
|
char tmpstr[BUFSIZ*3];
|
1997-04-20 22:52:07 +00:00
|
|
|
auto va_list ap;
|
|
|
|
prt_fmt** fmtstring;
|
|
|
|
|
|
|
|
|
|
|
|
if (fmt == NULL)
|
|
|
|
fmtstring = get_format(NULL);
|
|
|
|
else
|
|
|
|
fmtstring = get_format(fmt);
|
|
|
|
|
|
|
|
if (fmtstring == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
|
|
|
|
while(*fmtstring != NULL)
|
|
|
|
{
|
|
|
|
if ((*fmtstring)->type == FMT_FMT)
|
|
|
|
{
|
|
|
|
switch((*fmtstring)->s_type)
|
|
|
|
{
|
|
|
|
case 's' : append_string(&string,*fmtstring,va_arg(ap,char*));
|
|
|
|
break;
|
|
|
|
case 'c' : sprintf(tmpstr,"%c",va_arg(ap,char));
|
|
|
|
append_string(&string,*fmtstring,tmpstr);
|
|
|
|
break;
|
|
|
|
case 'd' : sprintf(tmpstr,"%d",va_arg(ap,int));
|
|
|
|
append_string(&string,*fmtstring,tmpstr);
|
|
|
|
break;
|
|
|
|
case 'f' : sprintf(tmpstr,"%f",va_arg(ap,double));
|
|
|
|
append_string(&string,*fmtstring,tmpstr);
|
|
|
|
break;
|
|
|
|
default : print_msg(PRT_ERR, "Internal Error: unknown format `%c'!\n",(*fmtstring)->s_type);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((*fmtstring)->type == FMT_STR)
|
|
|
|
{
|
|
|
|
append_string(&string,NULL,(*fmtstring)->string);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
print_msg(PRT_ERR, "Internal Error: unknown format type `%d'!\n",(*fmtstring)->type);
|
|
|
|
|
|
|
|
fmtstring++;
|
|
|
|
}
|
|
|
|
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
print_line2(F_BODY_LINE,"%s",string);
|
|
|
|
free(string);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int print_line2(int status, const char *fmt, ...)
|
|
|
|
{
|
1997-05-15 22:21:27 +00:00
|
|
|
char string[BUFSIZ*3];
|
1997-04-20 22:52:07 +00:00
|
|
|
auto va_list ap;
|
|
|
|
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
1997-05-15 22:21:27 +00:00
|
|
|
vsnprintf(string, BUFSIZ*3, fmt, ap);
|
1997-04-20 22:52:07 +00:00
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
if (!html)
|
|
|
|
status = 0;
|
|
|
|
|
|
|
|
switch (status)
|
|
|
|
{
|
|
|
|
case F_COUNT_ONLY : break;
|
|
|
|
case F_1ST_LINE : print_msg(PRT_NORMAL,H_1ST_LINE,string);
|
|
|
|
break;
|
1998-03-29 19:54:04 +00:00
|
|
|
case F_TEXT_LINE : print_msg(PRT_NORMAL,H_TEXT_LINE,string);
|
|
|
|
break;
|
1997-04-20 22:52:07 +00:00
|
|
|
case F_BODY_BOTTOM1:
|
|
|
|
case F_BODY_LINE : print_msg(PRT_NORMAL,H_BODY_LINE,string);
|
|
|
|
break;
|
|
|
|
case F_BODY_HEADER : print_msg(PRT_NORMAL,H_BODY_HEADER1,h_percent,h_table_color,get_format_size());
|
|
|
|
set_col_size();
|
|
|
|
break;
|
|
|
|
case F_BODY_HEADERL: print_msg(PRT_NORMAL,H_BODY_HEADER3,get_format_size(),string);
|
|
|
|
break;
|
|
|
|
case F_BODY_BOTTOM2: print_msg(PRT_NORMAL,H_BODY_BOTTOM2,string);
|
|
|
|
break;
|
|
|
|
default : print_msg(PRT_NORMAL,"%s\n",string);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int print_line(int status, one_call *cur_call, int computed, char *overlap)
|
1997-04-16 22:22:43 +00:00
|
|
|
{
|
1997-04-17 23:29:35 +00:00
|
|
|
char *string = NULL;
|
1997-04-20 22:52:07 +00:00
|
|
|
char *Ptr;
|
|
|
|
char help[32];
|
1997-04-17 23:29:35 +00:00
|
|
|
prt_fmt **fmtstring = get_format(NULL);
|
|
|
|
int dir;
|
1997-04-20 22:52:07 +00:00
|
|
|
int i = 0;
|
|
|
|
int free_col;
|
|
|
|
int last_free_col = -1;
|
|
|
|
|
1998-03-29 19:54:04 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if (colsize == NULL || status == F_COUNT_ONLY)
|
|
|
|
{
|
|
|
|
free(colsize);
|
|
|
|
|
|
|
|
if ((colsize = (int*) calloc(get_format_size()+1,sizeof(int))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
1997-04-17 23:29:35 +00:00
|
|
|
|
|
|
|
while (*fmtstring != NULL)
|
|
|
|
{
|
1997-04-20 22:52:07 +00:00
|
|
|
free_col = 0;
|
|
|
|
|
1997-04-17 23:29:35 +00:00
|
|
|
if ((*fmtstring)->type == FMT_FMT)
|
|
|
|
{
|
|
|
|
switch((*fmtstring)->s_type)
|
|
|
|
{
|
|
|
|
/* time: */
|
1997-04-20 22:52:07 +00:00
|
|
|
case 'X': if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, get_time_value(0,NULL,GET_TIME));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, fill_spaces(get_time_value(0,NULL,GET_TIME)));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* date (normal format with year): */
|
|
|
|
case 'x': if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, get_time_value(0,NULL,GET_DATE2));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, fill_spaces(get_time_value(0,NULL,GET_DATE2)));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* date (without year): */
|
1997-05-04 20:19:34 +00:00
|
|
|
case 'y': if (status == F_BODY_LINE)
|
1997-04-20 22:52:07 +00:00
|
|
|
colsize[i] = append_string(&string,*fmtstring, get_time_value(0,NULL,GET_DATE));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, fill_spaces(get_time_value(0,NULL,GET_DATE)));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* year: */
|
|
|
|
case 'Y': if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, get_time_value(0,NULL,GET_YEAR));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, fill_spaces(get_time_value(0,NULL,GET_YEAR)));
|
|
|
|
}
|
1997-04-17 23:29:35 +00:00
|
|
|
break;
|
|
|
|
/* duration: */
|
1997-04-20 22:52:07 +00:00
|
|
|
case 'D': if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, double2clock(cur_call->duration));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, fill_spaces(double2clock(cur_call->duration)));
|
|
|
|
}
|
1997-04-17 23:29:35 +00:00
|
|
|
break;
|
1997-04-20 22:52:07 +00:00
|
|
|
/* Home (if possible the name): */
|
|
|
|
/* Benoetigt Range! */
|
|
|
|
case 'H': if (status == F_BODY_LINE)
|
1997-04-17 23:29:35 +00:00
|
|
|
{
|
1997-04-20 22:52:07 +00:00
|
|
|
dir = cur_call->dir?CALLED:CALLING;
|
|
|
|
if (!numbers)
|
|
|
|
{
|
|
|
|
colsize[i] = append_string(&string,*fmtstring,
|
|
|
|
cur_call->who[dir][0]?cur_call->who[dir]:cur_call->num[dir]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Home (number): */
|
|
|
|
/* Benoetigt Range! */
|
|
|
|
case 'h': if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring,
|
1997-04-17 23:29:35 +00:00
|
|
|
cur_call->num[cur_call->dir?CALLED:CALLING]);
|
1997-04-20 22:52:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, "");
|
1997-04-17 23:29:35 +00:00
|
|
|
}
|
|
|
|
break;
|
1997-04-20 22:52:07 +00:00
|
|
|
/* The other (if possible the name): */
|
|
|
|
/* Benoetigt Range! */
|
1998-03-08 11:42:23 +00:00
|
|
|
case 'F': if (status == F_BODY_LINE)
|
1997-04-20 22:52:07 +00:00
|
|
|
{
|
|
|
|
dir = cur_call->dir?CALLING:CALLED;
|
|
|
|
if (!numbers)
|
|
|
|
{
|
|
|
|
colsize[i] = append_string(&string,*fmtstring,
|
|
|
|
cur_call->who[dir][0]?cur_call->who[dir]:cur_call->num[dir]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1997-04-17 23:29:35 +00:00
|
|
|
/* The other (number): */
|
1997-04-20 22:52:07 +00:00
|
|
|
/* Benoetigt Range! */
|
|
|
|
case 'f': if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring,
|
|
|
|
cur_call->num[cur_call->dir?CALLING:CALLED]);
|
|
|
|
else
|
1997-04-17 23:29:35 +00:00
|
|
|
{
|
1997-04-20 22:52:07 +00:00
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, "");
|
1997-04-17 23:29:35 +00:00
|
|
|
}
|
|
|
|
break;
|
1997-04-20 22:52:07 +00:00
|
|
|
/* The home location: */
|
|
|
|
/* Benoetigt Range! */
|
|
|
|
case 'L': if (status == F_BODY_LINE)
|
|
|
|
{
|
|
|
|
dir = cur_call->dir?CALLED:CALLING;
|
|
|
|
if (cur_call->num[dir][0] != C_UNKNOWN &&
|
|
|
|
cur_call->num[dir][0] != '\0' &&
|
|
|
|
(Ptr = get_areacode(cur_call->num[dir],NULL,C_NO_ERROR)) != NULL)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, Ptr);
|
|
|
|
else
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, "");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* The home location: */
|
|
|
|
/* Benoetigt Range! */
|
|
|
|
case 'l': if (status == F_BODY_LINE)
|
|
|
|
{
|
|
|
|
dir = cur_call->dir?CALLING:CALLED;
|
|
|
|
if (cur_call->num[dir][0] != C_UNKNOWN &&
|
|
|
|
cur_call->num[dir][0] != '\0' &&
|
|
|
|
(Ptr = get_areacode(cur_call->num[dir],NULL,C_NO_ERROR)) != NULL)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, Ptr);
|
|
|
|
else
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, "");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* The "To"-sign (from home to other) (-> or <-): */
|
|
|
|
case 'T': if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, cur_call->dir?"<-":"->");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, " ");
|
|
|
|
}
|
1997-04-17 23:29:35 +00:00
|
|
|
break;
|
1997-04-20 22:52:07 +00:00
|
|
|
/* The "To"-sign (from other to home) (-> or <-): */
|
|
|
|
case 't': if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, cur_call->dir?"->":"<-");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free_col = 1;
|
|
|
|
if (!html || status == F_COUNT_ONLY)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, " ");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* The units (if exists): */
|
|
|
|
/* Benoetigt Range! */
|
|
|
|
case 'u': if (cur_call->eh > 0)
|
|
|
|
{
|
|
|
|
sprintf(help,"%d EH",cur_call->eh);
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, help);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, "");
|
|
|
|
break;
|
|
|
|
/* The money or/and a message: */
|
|
|
|
case 'U': if (cur_call->duration || cur_call->eh > 0)
|
1997-04-17 23:29:35 +00:00
|
|
|
{
|
|
|
|
if (cur_call->dir)
|
1997-04-20 22:52:07 +00:00
|
|
|
colsize[i] = append_string(&string,NULL," ");
|
1997-04-17 23:29:35 +00:00
|
|
|
else
|
1997-04-20 22:52:07 +00:00
|
|
|
colsize[i] = append_string(&string,*fmtstring,print_currency(cur_call->dm,computed));
|
1997-04-17 23:29:35 +00:00
|
|
|
}
|
|
|
|
else
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
if ((status == F_BODY_LINE) &&
|
|
|
|
(cur_call->cause != -1) &&
|
|
|
|
(cur_call->cause != 0x10) && /* Normal call clearing */
|
|
|
|
(cur_call->cause != 0x1f)) /* Normal, unspecified */
|
1997-04-20 22:52:07 +00:00
|
|
|
colsize[i] = append_string(&string,*fmtstring,qmsg(TYPE_CAUSE, VERSION_EDSS1, cur_call->cause));
|
|
|
|
else
|
|
|
|
colsize[i] = append_string(&string,NULL," ");
|
1997-04-17 23:29:35 +00:00
|
|
|
break;
|
|
|
|
/* In-Bytes: */
|
1997-04-20 22:52:07 +00:00
|
|
|
/* Benoetigt Range! */
|
1997-05-04 22:23:09 +00:00
|
|
|
case 'I': colsize[i] = append_string(&string,*fmtstring,set_byte_string(GET_IN|GET_BYTES,(double)cur_call->ibytes));
|
1997-04-17 23:29:35 +00:00
|
|
|
break;
|
|
|
|
/* Out-Bytes: */
|
1997-04-20 22:52:07 +00:00
|
|
|
/* Benoetigt Range! */
|
1997-05-04 22:23:09 +00:00
|
|
|
case 'O': colsize[i] = append_string(&string,*fmtstring,set_byte_string(GET_OUT|GET_BYTES,(double)cur_call->obytes));
|
|
|
|
break;
|
|
|
|
/* In-Bytes per second: */
|
|
|
|
/* Benoetigt Range! */
|
|
|
|
case 'P': colsize[i] = append_string(&string,*fmtstring,set_byte_string(GET_IN|GET_BPS,cur_call->duration?cur_call->ibytes/(double)cur_call->duration:0.0));
|
|
|
|
break;
|
|
|
|
/* Out-Bytes per second: */
|
|
|
|
/* Benoetigt Range! */
|
|
|
|
case 'p': colsize[i] = append_string(&string,*fmtstring,set_byte_string(GET_OUT|GET_BPS,cur_call->duration?cur_call->obytes/(double)cur_call->duration:0.0));
|
1997-04-20 22:52:07 +00:00
|
|
|
break;
|
1997-05-09 23:30:37 +00:00
|
|
|
/* SI: */
|
1997-05-10 01:20:52 +00:00
|
|
|
case 'S': if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring,int2str(cur_call->si,2));
|
|
|
|
else
|
|
|
|
colsize[i] = append_string(&string,*fmtstring," ");
|
1997-05-09 23:30:37 +00:00
|
|
|
break;
|
1998-03-08 11:42:23 +00:00
|
|
|
|
|
|
|
case 'j': if (status == F_BODY_LINE)
|
|
|
|
{
|
|
|
|
if (!numbers)
|
|
|
|
{
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
colsize[i] = append_string(&string,*fmtstring, (cur_call->provider > 0 ? Providername(cur_call->provider) : ""));
|
1998-03-08 11:42:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
1997-05-15 22:21:27 +00:00
|
|
|
/* Link for answering machine! */
|
|
|
|
case 'C': if (html)
|
|
|
|
{
|
|
|
|
if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring,get_links(cur_call->t,C_VBOX));
|
|
|
|
else
|
|
|
|
colsize[i] = append_string(&string,*fmtstring," ");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
print_msg(PRT_ERR, "Unknown format %%C!\n");
|
|
|
|
break;
|
|
|
|
/* Link for fax! */
|
|
|
|
case 'G': if (html)
|
|
|
|
{
|
|
|
|
if (status == F_BODY_LINE)
|
|
|
|
colsize[i] = append_string(&string,*fmtstring,get_links(cur_call->t,C_FAX));
|
|
|
|
else
|
|
|
|
colsize[i] = append_string(&string,*fmtstring," ");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
print_msg(PRT_ERR, "Unknown format %%G!\n");
|
|
|
|
break;
|
1997-04-20 22:52:07 +00:00
|
|
|
/* there are dummy entries */
|
|
|
|
case 'c':
|
1997-05-04 20:19:34 +00:00
|
|
|
case 'd':
|
1997-04-20 22:52:07 +00:00
|
|
|
case 's': if (status != F_BODY_LINE)
|
|
|
|
free_col = 1;
|
|
|
|
|
|
|
|
colsize[i] = append_string(&string,*fmtstring, " ");
|
1997-04-17 23:29:35 +00:00
|
|
|
break;
|
1997-04-20 22:52:07 +00:00
|
|
|
default : print_msg(PRT_ERR, "Internal Error: unknown format `%c'!\n",(*fmtstring)->s_type);
|
1997-04-17 23:29:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((*fmtstring)->type == FMT_STR)
|
|
|
|
{
|
1997-04-20 22:52:07 +00:00
|
|
|
if (!html || status == F_COUNT_ONLY || status == F_BODY_LINE || last_free_col != i-1)
|
|
|
|
colsize[i] = append_string(&string,NULL,(*fmtstring)->string);
|
|
|
|
else
|
|
|
|
free_col = 1;
|
1997-04-17 23:29:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
print_msg(PRT_ERR, "Internal Error: unknown format type `%d'!\n",(*fmtstring)->type);
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if (html && status == F_BODY_BOTTOM1 && free_col && last_free_col == i-1)
|
|
|
|
last_free_col = i;
|
|
|
|
|
1997-04-17 23:29:35 +00:00
|
|
|
fmtstring++;
|
1997-04-20 22:52:07 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (last_free_col != -1)
|
|
|
|
{
|
|
|
|
char *help2 = NULL;
|
|
|
|
|
|
|
|
|
1997-05-04 20:19:34 +00:00
|
|
|
if ((help2 = (char*) calloc(strlen(H_BODY_BOTTOM1)+(string?strlen(string):0)+strlen(overlap)+1,sizeof(char))) == NULL)
|
1997-04-20 22:52:07 +00:00
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
1997-05-04 20:19:34 +00:00
|
|
|
sprintf(help2,H_BODY_BOTTOM1,last_free_col+1,overlap,string?string:"");
|
1997-04-20 22:52:07 +00:00
|
|
|
|
|
|
|
free(string);
|
|
|
|
string = help2;
|
|
|
|
overlap = NULL;
|
1997-04-17 23:29:35 +00:00
|
|
|
}
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
colsize[i] = -1;
|
|
|
|
|
|
|
|
if (status == F_COUNT_ONLY)
|
|
|
|
return strlen(string);
|
|
|
|
else
|
|
|
|
print_line2(status,"%s",overlap_string(string,overlap));
|
|
|
|
|
1997-04-17 23:29:35 +00:00
|
|
|
free(string);
|
|
|
|
|
1997-04-16 22:22:43 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
static int append_string(char **string, prt_fmt *fmt_ptr, char* value)
|
1997-04-17 23:29:35 +00:00
|
|
|
{
|
1997-05-15 22:21:27 +00:00
|
|
|
char tmpstr[BUFSIZ*3];
|
1997-04-20 22:52:07 +00:00
|
|
|
char tmpfmt2[20];
|
|
|
|
char *tmpfmt;
|
|
|
|
char *htmlfmt;
|
1997-05-15 22:21:27 +00:00
|
|
|
int condition = html && (*value == ' ' || fmt_ptr == NULL || (fmt_ptr->s_type!='C' && fmt_ptr->s_type!='G'));
|
1997-04-20 22:52:07 +00:00
|
|
|
|
1997-04-17 23:29:35 +00:00
|
|
|
|
|
|
|
if (fmt_ptr != NULL)
|
1997-04-20 22:52:07 +00:00
|
|
|
sprintf(tmpfmt2,"%%%ss",fmt_ptr->range);
|
1997-04-17 23:29:35 +00:00
|
|
|
else
|
1997-04-20 22:52:07 +00:00
|
|
|
strcpy(tmpfmt2,"%s");
|
1997-04-17 23:29:35 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if (html)
|
|
|
|
{
|
|
|
|
switch (fmt_ptr==NULL?'\0':fmt_ptr->range[0])
|
|
|
|
{
|
|
|
|
case '-' : htmlfmt = H_LEFT;
|
|
|
|
break;
|
|
|
|
case '\0': htmlfmt = H_CENTER;
|
|
|
|
break;
|
|
|
|
default : htmlfmt = H_RIGHT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1997-07-22 22:36:08 +00:00
|
|
|
if (!strncmp(STR_FAX,value,strlen(STR_FAX)))
|
|
|
|
htmlfmt = H_LEFT;
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if ((tmpfmt = (char*) alloca(sizeof(char)*(strlen(htmlfmt)+strlen(tmpfmt2)+1))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(tmpfmt,htmlfmt,tmpfmt2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
tmpfmt = tmpfmt2;
|
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
app_fmt_string(tmpstr,BUFSIZ*3-1,tmpfmt,condition,value);
|
1997-04-17 23:29:35 +00:00
|
|
|
|
|
|
|
if (*string == NULL)
|
|
|
|
*string = (char*) calloc(strlen(tmpstr)+1,sizeof(char));
|
|
|
|
else
|
|
|
|
*string = (char*) realloc(*string,sizeof(char)*(strlen(*string)+strlen(tmpstr)+1));
|
|
|
|
|
|
|
|
if (*string == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
1997-04-20 22:52:07 +00:00
|
|
|
return -1;
|
1997-04-17 23:29:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
strcat(*string,tmpstr);
|
1997-04-20 22:52:07 +00:00
|
|
|
|
|
|
|
return strlen(tmpstr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char *html_conv(char *string)
|
|
|
|
{
|
|
|
|
static char RetCode[BUFSIZ];
|
|
|
|
char *ptr = RetCode;
|
|
|
|
int i;
|
|
|
|
int empty = 1;
|
|
|
|
|
|
|
|
if (string == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
for(i = 0; htmlconv[i][0][0] != '\0'; i++)
|
|
|
|
{
|
|
|
|
if (htmlconv[i][0][0] == *string)
|
|
|
|
{
|
|
|
|
strcpy(ptr,htmlconv[i][1]);
|
|
|
|
while (*ptr != '\0') ptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (htmlconv[i][0][0] == '\0')
|
|
|
|
*ptr++ = *string;
|
|
|
|
|
|
|
|
if (*string != '\0' && !isspace(*string))
|
|
|
|
empty = 0;
|
|
|
|
}
|
|
|
|
while(*string++ != '\0');
|
|
|
|
|
|
|
|
if (empty)
|
|
|
|
return H_EMPTY;
|
|
|
|
|
|
|
|
return RetCode;
|
1997-04-17 23:29:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-05-04 22:23:09 +00:00
|
|
|
static char *set_byte_string(int flag, double Bytes)
|
1997-04-17 23:29:35 +00:00
|
|
|
{
|
1997-04-20 22:52:07 +00:00
|
|
|
static char string[4][20];
|
|
|
|
static int num = 0;
|
1997-05-11 22:59:14 +00:00
|
|
|
int factor = 1;
|
|
|
|
char prefix = ' ';
|
1997-04-20 22:52:07 +00:00
|
|
|
|
1997-04-17 23:29:35 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
num = (num+1)%4;
|
1997-04-17 23:29:35 +00:00
|
|
|
|
|
|
|
if (!Bytes)
|
1997-05-04 22:23:09 +00:00
|
|
|
{
|
|
|
|
if (flag & GET_BPS)
|
|
|
|
strcpy(string[num]," ");
|
|
|
|
else
|
|
|
|
strcpy(string[num]," ");
|
|
|
|
}
|
1997-04-17 23:29:35 +00:00
|
|
|
else
|
1997-05-11 22:59:14 +00:00
|
|
|
{
|
|
|
|
if (Bytes >= 9999999999.0)
|
|
|
|
{
|
|
|
|
factor = 1073741824;
|
|
|
|
prefix = 'G';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Bytes >= 9999999)
|
|
|
|
{
|
|
|
|
factor = 1048576;
|
|
|
|
prefix = 'M';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Bytes >= 9999)
|
|
|
|
{
|
|
|
|
factor = 1024;
|
|
|
|
prefix = 'k';
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(string[num],"%c=%s %cB%s",flag&GET_IN?'I':'O',double2str(Bytes/factor,7,2,0),prefix,flag&GET_BPS?"/s":"");
|
|
|
|
}
|
1997-04-17 23:29:35 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
return string[num];
|
1997-04-17 23:29:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
static int set_col_size(void)
|
|
|
|
{
|
|
|
|
one_call *tmp_call;
|
1997-05-04 20:19:34 +00:00
|
|
|
int size = 0;
|
1997-04-20 22:52:07 +00:00
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
if ((tmp_call = (one_call*) calloc(1,sizeof(one_call))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
1997-05-04 20:19:34 +00:00
|
|
|
print_line(F_COUNT_ONLY,tmp_call,0,NULL);
|
1997-04-20 22:52:07 +00:00
|
|
|
|
|
|
|
while(colsize[i] != -1)
|
1997-05-04 20:19:34 +00:00
|
|
|
if (html)
|
|
|
|
print_msg(PRT_NORMAL,H_BODY_HEADER2,colsize[i++]);
|
|
|
|
else
|
|
|
|
size += colsize[i++];
|
1997-04-20 22:52:07 +00:00
|
|
|
|
|
|
|
free(tmp_call);
|
1997-05-04 20:19:34 +00:00
|
|
|
return size;
|
1997-04-20 22:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int get_format_size(void)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
prt_fmt** fmt = get_format(NULL);
|
|
|
|
|
|
|
|
if (fmt == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
while(*fmt++ != NULL) i++;
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char *overlap_string(char *s1, char *s2)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
if (s1 == NULL || s2 == NULL)
|
|
|
|
return s1;
|
|
|
|
|
|
|
|
while(s1[i] != '\0' && s2[i] != '\0')
|
|
|
|
{
|
|
|
|
if (isspace(s1[i]))
|
|
|
|
s1[i] = s2[i];
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return s1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char* fill_spaces(char *string)
|
|
|
|
{
|
|
|
|
static char RetCode[256];
|
|
|
|
char *Ptr = RetCode;
|
|
|
|
|
|
|
|
while (*string != '\0')
|
|
|
|
{
|
|
|
|
*Ptr++ = ' ';
|
|
|
|
string++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*Ptr = '\0';
|
|
|
|
|
|
|
|
return RetCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static void free_format(prt_fmt** ptr)
|
|
|
|
{
|
|
|
|
prt_fmt** ptr2 = ptr;
|
|
|
|
|
|
|
|
|
|
|
|
if (ptr == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while(*ptr != NULL)
|
|
|
|
{
|
|
|
|
free((*ptr)->string);
|
|
|
|
free((*ptr)->range);
|
|
|
|
free((*ptr++));
|
|
|
|
}
|
|
|
|
|
|
|
|
free(ptr2);
|
|
|
|
free(colsize);
|
|
|
|
colsize = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static prt_fmt** get_format(const char *format)
|
1997-04-16 22:22:43 +00:00
|
|
|
{
|
|
|
|
static prt_fmt **RetCode = NULL;
|
|
|
|
prt_fmt *fmt = NULL;
|
|
|
|
char *Ptr = NULL;
|
|
|
|
char *string = NULL;
|
|
|
|
char *start = NULL;
|
|
|
|
char *End = NULL;
|
|
|
|
char Range[20] = "";
|
|
|
|
int num;
|
|
|
|
char Type;
|
|
|
|
|
|
|
|
|
|
|
|
if (format == NULL)
|
|
|
|
return RetCode;
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
free_format(RetCode);
|
|
|
|
RetCode = NULL;
|
|
|
|
|
1997-04-16 22:22:43 +00:00
|
|
|
if ((End = (char*) alloca(sizeof(char)*(strlen(format)+1))) == NULL ||
|
|
|
|
(string = (char*) alloca(sizeof(char)*(strlen(format)+1))) == NULL )
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ptr = start = strcpy(string,format);
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (*Ptr == C_BEGIN_FMT)
|
|
|
|
{
|
|
|
|
if (Ptr[1] != C_BEGIN_FMT)
|
|
|
|
{
|
|
|
|
if (Ptr != start)
|
|
|
|
{
|
|
|
|
if ((fmt = (prt_fmt*) calloc(1,sizeof(prt_fmt))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
delete_element(&RetCode,0);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*Ptr = '\0';
|
|
|
|
fmt->string= strdup(start);
|
|
|
|
fmt->type = FMT_STR;
|
|
|
|
append_element(&RetCode,fmt);
|
|
|
|
}
|
|
|
|
|
1997-04-17 23:29:35 +00:00
|
|
|
*Range = *End = '\0';
|
1997-04-16 22:22:43 +00:00
|
|
|
if ((num = sscanf(Ptr+1,"%[^a-zA-Z]%c%[^\n]",Range,&Type,End)) > 1 ||
|
|
|
|
(num = sscanf(Ptr+1,"%c%[^\n]",&Type,End)) > 0 )
|
|
|
|
{
|
1997-05-04 20:19:34 +00:00
|
|
|
if (!isalpha(Type))
|
|
|
|
print_msg(PRT_ERR, "Warning: Invalid token in format type `%c'!\n",Type);
|
|
|
|
|
1997-04-16 22:22:43 +00:00
|
|
|
if ((fmt = (prt_fmt*) calloc(1,sizeof(prt_fmt))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
delete_element(&RetCode,0);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-05-19 22:57:51 +00:00
|
|
|
switch (Type)
|
|
|
|
{
|
|
|
|
case 'C': read_path |= F_VBOX;
|
|
|
|
break;
|
|
|
|
case 'G': read_path |= F_FAX;
|
|
|
|
break;
|
|
|
|
default : break;
|
|
|
|
}
|
|
|
|
|
1997-04-16 22:22:43 +00:00
|
|
|
fmt->s_type= Type;
|
|
|
|
fmt->range = strdup(Range);
|
|
|
|
fmt->type = FMT_FMT;
|
|
|
|
|
|
|
|
append_element(&RetCode,fmt);
|
|
|
|
*Range = '\0';
|
|
|
|
|
|
|
|
if (*End != '\0')
|
|
|
|
Ptr = start = strcpy(string,End);
|
|
|
|
else
|
|
|
|
Ptr = start = "";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, "Error: Invalid token in format string `%s'!\n",format);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memmove(Ptr,Ptr+1,strlen(Ptr));
|
|
|
|
Ptr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Ptr++;
|
|
|
|
}
|
|
|
|
while(*Ptr != '\0');
|
|
|
|
|
|
|
|
if (Ptr != start)
|
|
|
|
{
|
|
|
|
if ((fmt = (prt_fmt*) calloc(1,sizeof(prt_fmt))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
delete_element(&RetCode,0);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt->string= strdup(start);
|
|
|
|
fmt->type = FMT_STR;
|
|
|
|
append_element(&RetCode,fmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
return RetCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
static void how_expensive(one_call *cur_call)
|
|
|
|
{
|
|
|
|
register int zone = -1, zone2 = -1, pro = -1, dur = (int)cur_call->duration;
|
|
|
|
auto double pay2, onesec;
|
|
|
|
extern double pay(time_t ts, int dauer, int tarifz, int pro);
|
|
|
|
|
|
|
|
|
|
|
|
if (!cur_call->dir && (dur > 0) && !cur_call->dm) {
|
|
|
|
|
|
|
|
if (*cur_call->num[1] && memcmp(cur_call->num[1] + 3, "19", 2))
|
|
|
|
zone2 = area_diff(NULL, cur_call->num[1]);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
if ((c = call[chan].confentry[OTHER]) > -1)
|
|
|
|
zone = known[c]->zone;
|
|
|
|
|
|
|
|
if ((zone == -1) && (zone2 > 0)) {
|
|
|
|
sprintf(sx, "WARNING: Assuming ZONE %d", zone2);
|
|
|
|
zone = zone2;
|
|
|
|
info(chan, PRT_SHOWHANGUP, STATE_HANGUP, sx);
|
|
|
|
} /* if */
|
|
|
|
|
|
|
|
if ((zone != -1) && (zone2 != -1) && (zone != zone2)) {
|
|
|
|
sprintf(sx, "WARNING: Wrong ZONE (%d), assuming %d", zone, zone2);
|
|
|
|
zone = zone2;
|
|
|
|
|
|
|
|
info(chan, PRT_SHOWHANGUP, STATE_HANGUP, sx);
|
|
|
|
} /* if */
|
|
|
|
#else
|
|
|
|
zone = zone2;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (cur_call->eh > 0) /* Gebuehrentakt AOC-E kam (Komfortanschluss, via Telekom */
|
|
|
|
cur_call->dm = cur_call->eh * currency_factor;
|
|
|
|
else {
|
|
|
|
if (zone > 0) {
|
|
|
|
switch (zone) { /* map "isdnlog" to "gebuehr.c" Zones */
|
|
|
|
case 2 : zone = 3;
|
|
|
|
break;
|
|
|
|
case 3 : zone = 4;
|
|
|
|
break;
|
|
|
|
} /* switch */
|
|
|
|
|
|
|
|
pro = cur_call->provider;
|
|
|
|
|
|
|
|
if (pro == -1)
|
|
|
|
pro = 33; /* Telekom */
|
|
|
|
|
|
|
|
if (pro) {
|
|
|
|
cur_call->dm = pay(cur_call->t, (int)cur_call->duration, zone, pro);
|
|
|
|
|
|
|
|
if (!cur_call->dm) { /* ooops - not supported by that provider ... retry with Telekom */
|
|
|
|
cur_call->dm = pay(cur_call->t, (int)cur_call->duration, zone, pro = 33);
|
|
|
|
cur_call->provider = 0;
|
|
|
|
} /* if */
|
|
|
|
} /* if */
|
|
|
|
} /* if */
|
|
|
|
} /* else */
|
|
|
|
|
|
|
|
if ((dur > 600) && (zone > 1) && ((cur_call->eh > 0) || (pro == 33))) {
|
|
|
|
onesec = cur_call->dm / dur;
|
|
|
|
pay2 = (dur - 600) * onesec * 0.30;
|
|
|
|
cur_call->dm -= pay2;
|
|
|
|
} /* if */
|
|
|
|
|
|
|
|
} /* if */
|
|
|
|
|
|
|
|
} /* how_expensive */
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
static int print_entries(one_call *cur_call, double unit, int *nx, char *myname)
|
1997-03-23 20:25:23 +00:00
|
|
|
{
|
1998-09-22 20:58:41 +00:00
|
|
|
register int i, pro;
|
|
|
|
auto int computed = 0;
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
extern double pay(time_t ts, int dauer, int tarifz, int pro);
|
1998-09-22 20:58:41 +00:00
|
|
|
#if 0
|
|
|
|
register int tarifz;
|
|
|
|
auto double takt;
|
|
|
|
auto int go, zone = 1, zeit = -1;
|
|
|
|
auto time_t t1, t2;
|
|
|
|
#endif
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
#if 0
|
|
|
|
if (cur_call->dm && !(cur_call->eh > 0))
|
1997-04-06 21:03:36 +00:00
|
|
|
/* Falls Betrag vorhanden und Einheiten nicht, Einheiten berechnen */
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
cur_call->eh = cur_call->dm/unit;
|
1997-04-16 22:22:43 +00:00
|
|
|
else if (cur_call->currency_factor &&
|
|
|
|
cur_call->currency_factor != unit && cur_call->eh>0 )
|
1997-04-06 21:03:36 +00:00
|
|
|
/* Falls Einheiten sich auf anderen Einheiten-Faktor beziehen, Einheiten korrigieren */
|
|
|
|
cur_call->eh /= unit / cur_call->currency_factor;
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
#endif
|
1997-04-06 21:03:36 +00:00
|
|
|
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
how_expensive(cur_call);
|
1997-04-06 21:03:36 +00:00
|
|
|
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
#if 0
|
1998-09-22 20:58:41 +00:00
|
|
|
# if 0
|
1997-04-06 21:03:36 +00:00
|
|
|
if (compute && !currency_factor &&
|
|
|
|
!cur_call->dir && ((cur_call->eh == -1) ||
|
|
|
|
(!cur_call->eh && cur_call->duration && cur_call->cause == -1))) { /* DIALOUT, keine AOCE Meldung */
|
1998-09-22 20:58:41 +00:00
|
|
|
# else
|
1997-04-06 21:03:36 +00:00
|
|
|
go = 0;
|
|
|
|
|
|
|
|
if ((cur_call->eh == -1) && !cur_call->dir) { /* Rauswahl, Gebuehr unbekannt */
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
|
|
|
|
pro = cur_call->provider;
|
|
|
|
if (pro == -1)
|
|
|
|
pro = 33; /* Telekom */
|
|
|
|
|
|
|
|
if (pro && (nx[1] != -1)) {
|
|
|
|
if (!cur_call->dm) {
|
|
|
|
|
|
|
|
tarifz = known[nx[CALLED]]->zone;
|
|
|
|
|
|
|
|
switch (tarifz) { /* map "isdnlog" to "gebuehr.c" Zones */
|
|
|
|
case 2 : tarifz = 3;
|
|
|
|
break;
|
|
|
|
case 3 : tarifz = 4;
|
|
|
|
break;
|
|
|
|
} /* switch */
|
|
|
|
|
|
|
|
unit = cur_call->dm = cur_call->dm =
|
|
|
|
pay(cur_call->t, (int)cur_call->duration, tarifz, pro);
|
|
|
|
|
|
|
|
cur_call->eh = 0;
|
|
|
|
} /* if */
|
|
|
|
usage_provider[pro]++;
|
|
|
|
duration_provider[pro] += cur_call->duration;
|
|
|
|
pay_provider[pro] += cur_call->dm;
|
|
|
|
computed = 1;
|
|
|
|
go = 0;
|
|
|
|
}
|
|
|
|
else if (nx[1] == -1) { /* Gegner unbekannt! */
|
1997-04-06 21:03:36 +00:00
|
|
|
if (compute) {
|
|
|
|
zone = compute; /* in "-c x" Zone vermuten */
|
|
|
|
go = 1;
|
|
|
|
}
|
|
|
|
else { /* mit 0 DM berechnen */
|
|
|
|
cur_call->eh = 0;
|
|
|
|
go = 0;
|
|
|
|
} /* else */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
go = 1;
|
|
|
|
if (!(zone = known[nx[1]]->zone))
|
|
|
|
go = cur_call->eh = 0;
|
|
|
|
} /* else */
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
}
|
|
|
|
else if (!cur_call->dir) { /* Rauswahl, evtl. != Telebums */
|
|
|
|
pro = cur_call->provider;
|
|
|
|
|
|
|
|
if (pro == -1)
|
|
|
|
pro = 33; /* Telekom */
|
|
|
|
|
|
|
|
computed = 1;
|
|
|
|
go = 0;
|
|
|
|
|
|
|
|
usage_provider[pro]++;
|
1998-09-22 20:58:41 +00:00
|
|
|
duration_provider[pro] += cur_call->duration;
|
|
|
|
pay_provider[pro] += cur_call->dm;
|
1997-04-06 21:03:36 +00:00
|
|
|
} /* if */
|
|
|
|
|
|
|
|
if (go) {
|
1998-09-22 20:58:41 +00:00
|
|
|
# endif
|
1997-04-06 21:03:36 +00:00
|
|
|
t1 = cur_call->t;
|
|
|
|
t2 = cur_call->t + cur_call->duration;
|
|
|
|
|
|
|
|
cur_call->eh = takt = 0;
|
|
|
|
computed = 1;
|
|
|
|
|
|
|
|
while (t1 < t2) {
|
|
|
|
if (Tarif96)
|
|
|
|
takt = cheap96(t1, zone, &zeit);
|
|
|
|
else
|
|
|
|
takt = cheap(t1, zone);
|
|
|
|
|
|
|
|
if (!takt) {
|
|
|
|
print_msg(PRT_ERR, "%s: OOPS! Abbruch: Zeittakt==0 ???\n", myname);
|
|
|
|
break;
|
|
|
|
} /* if */
|
|
|
|
|
|
|
|
cur_call->eh++;
|
|
|
|
t1 += takt;
|
|
|
|
|
|
|
|
} /* while */
|
|
|
|
} /* if */
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
#endif
|
1998-09-22 20:58:41 +00:00
|
|
|
pro = cur_call->provider;
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
|
|
|
|
if (pro == -1)
|
1998-09-22 20:58:41 +00:00
|
|
|
pro = 33; /* Telekom */
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
if (cur_call->duration || (cur_call->eh > 0))
|
|
|
|
{
|
|
|
|
add_one_call(computed?&day_com_sum:&day_sum,cur_call,unit);
|
|
|
|
|
|
|
|
if (cur_call->dir) {
|
|
|
|
if (nx[CALLING] == -1) {
|
1997-04-20 22:52:07 +00:00
|
|
|
known[knowns-1]->usage[DIALIN]++;
|
|
|
|
known[knowns-1]->ibytes[DIALIN] += cur_call->ibytes;
|
|
|
|
known[knowns-1]->obytes[DIALIN] += cur_call->obytes;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
if (cur_call->duration > 0)
|
1997-04-20 22:52:07 +00:00
|
|
|
known[knowns-1]->dur[DIALIN] += cur_call->duration;
|
1997-04-06 21:03:36 +00:00
|
|
|
} /* if */
|
1997-04-20 22:52:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
known[nx[CALLING]]->usage[cur_call->dir]++;
|
|
|
|
known[nx[CALLING]]->dur[cur_call->dir] += cur_call->duration;
|
|
|
|
known[nx[CALLING]]->ibytes[DIALIN] += cur_call->ibytes;
|
|
|
|
known[nx[CALLING]]->obytes[DIALIN] += cur_call->obytes;
|
|
|
|
}
|
1997-04-06 21:03:36 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
usage_provider[pro]++;
|
|
|
|
duration_provider[pro] += cur_call->duration;
|
|
|
|
pay_provider[pro] += cur_call->dm;
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
if (nx[CALLED] == -1) {
|
1997-04-20 22:52:07 +00:00
|
|
|
known[knowns-1]->eh += cur_call->eh;
|
|
|
|
known[knowns-1]->dm += cur_call->dm;
|
|
|
|
known[knowns-1]->ibytes[DIALOUT] += cur_call->ibytes;
|
|
|
|
known[knowns-1]->obytes[DIALOUT] += cur_call->obytes;
|
|
|
|
known[knowns-1]->usage[DIALOUT]++;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
if (cur_call->duration > 0)
|
1997-04-20 22:52:07 +00:00
|
|
|
known[knowns-1]->dur[DIALOUT] += cur_call->duration;
|
1997-04-06 21:03:36 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
known[nx[CALLED]]->eh += cur_call->eh;
|
|
|
|
known[nx[CALLED]]->dm += cur_call->dm;
|
1997-04-20 22:52:07 +00:00
|
|
|
known[nx[CALLED]]->usage[cur_call->dir]++;
|
|
|
|
known[nx[CALLED]]->dur[cur_call->dir] += cur_call->duration;
|
|
|
|
known[nx[CALLED]]->ibytes[DIALOUT] += cur_call->ibytes;
|
|
|
|
known[nx[CALLED]]->obytes[DIALOUT] += cur_call->obytes;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
zones[known[nx[CALLED]]->zone] += cur_call->eh;
|
|
|
|
zones_dm[known[nx[CALLED]]->zone] += cur_call->dm;
|
|
|
|
|
|
|
|
if (cur_call->duration > 0)
|
|
|
|
zones_dur[known[nx[CALLED]]->zone] += cur_call->duration;
|
|
|
|
|
|
|
|
zones_usage[known[nx[CALLED]]->zone]++;
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
|
|
|
|
#if 1 /* AK:05-May-98 */
|
|
|
|
if (cur_call->dir == DIALOUT) {
|
|
|
|
for (i = 0; i < mymsns; i++) {
|
|
|
|
if (!n_match(known[i]->num, cur_call->num[0], cur_call->version) && (known[i]->si == cur_call->si)) {
|
|
|
|
msn_sum[i] += cur_call->dm;
|
|
|
|
usage_sum[i]++;
|
|
|
|
dur_sum[i] += cur_call->duration;
|
|
|
|
break;
|
|
|
|
} /* if */
|
|
|
|
} /* for */
|
|
|
|
|
|
|
|
if (i == mymsns) {
|
1998-06-14 15:33:42 +00:00
|
|
|
msn_sum[i] += cur_call->dm;
|
|
|
|
usage_sum[i]++;
|
|
|
|
dur_sum[i] += cur_call->duration;
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
} /* if */
|
|
|
|
|
|
|
|
} /* if */
|
|
|
|
#endif
|
1997-04-06 21:03:36 +00:00
|
|
|
} /* if */
|
|
|
|
} /* else */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (cur_call->cause != -1)
|
|
|
|
day_sum.err++;
|
|
|
|
} /* else */
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
print_line(F_BODY_LINE,cur_call,computed,NULL);
|
1997-04-06 21:03:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int print_header(int lday)
|
|
|
|
{
|
|
|
|
sum_calls tmp_sum;
|
|
|
|
time_t now;
|
|
|
|
|
|
|
|
|
|
|
|
if (lday == -1) {
|
|
|
|
time(&now);
|
1997-04-20 22:52:07 +00:00
|
|
|
print_line2(F_1ST_LINE,"I S D N Connection Report - %s", ctime(&now));
|
1997-04-06 21:03:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strich(1);
|
|
|
|
print_sum_calls(&day_sum,0);
|
|
|
|
|
|
|
|
if (day_com_sum.eh)
|
|
|
|
{
|
|
|
|
print_sum_calls(&day_com_sum,1);
|
|
|
|
|
|
|
|
clear_sum(&tmp_sum);
|
|
|
|
add_sum_calls(&tmp_sum,&day_sum);
|
|
|
|
add_sum_calls(&tmp_sum,&day_com_sum);
|
|
|
|
strich(1);
|
|
|
|
print_sum_calls(&tmp_sum,0);
|
|
|
|
}
|
|
|
|
else
|
1997-04-20 22:52:07 +00:00
|
|
|
print_msg(PRT_NORMAL,"\n\n");
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
add_sum_calls(&all_sum,&day_sum);
|
|
|
|
clear_sum(&day_sum);
|
|
|
|
|
|
|
|
add_sum_calls(&all_com_sum,&day_com_sum);
|
|
|
|
clear_sum(&day_com_sum);
|
1997-04-20 22:52:07 +00:00
|
|
|
|
|
|
|
print_line2(F_BODY_BOTTOM2,"");
|
1997-04-06 21:03:36 +00:00
|
|
|
} /* if */
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
h_percent = 100.0;
|
|
|
|
h_table_color = H_TABLE_COLOR1;
|
|
|
|
print_line2(F_BODY_HEADER,"");
|
1997-04-20 23:44:46 +00:00
|
|
|
print_line2(F_BODY_HEADERL,"%s %s", get_time_value(0,NULL,GET_DATE),
|
1997-04-20 22:52:07 +00:00
|
|
|
get_time_value(0,NULL,GET_YEAR));
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char *get_time_value(time_t t, int *day, int flag)
|
|
|
|
{
|
1997-04-20 22:52:07 +00:00
|
|
|
static char time_string[4][18] = {"","",""};
|
1997-04-06 21:03:36 +00:00
|
|
|
static int oldday = -1;
|
|
|
|
static int oldyear = -1;
|
|
|
|
struct tm *tm;
|
|
|
|
|
|
|
|
|
|
|
|
if (flag & SET_TIME)
|
|
|
|
{
|
|
|
|
tm = localtime(&t);
|
|
|
|
|
|
|
|
/*sprintf(time_string[0],"%d:%d:%d",tm->tm_hour,tm->tm_min,tm->tm_sec);*/
|
|
|
|
strftime(time_string[0],17,"%X",tm);
|
|
|
|
|
|
|
|
if (oldday != tm->tm_yday || oldyear != tm->tm_year)
|
|
|
|
{
|
|
|
|
*day = tm->tm_mday;
|
|
|
|
|
|
|
|
Tarif96 = tm->tm_year > 95;
|
|
|
|
|
|
|
|
/* Ab Juli '96 gibt's noch mal eine Senkung in den Zonen 3 und 4
|
|
|
|
genaue Preise sind jedoch noch nicht bekannt. FIX-ME */
|
|
|
|
|
|
|
|
Tarif962 = (Tarif96 && (tm->tm_mon > 5)) || (tm->tm_year > 96);
|
|
|
|
|
|
|
|
strftime(time_string[1],17,"%a %b %d",tm);
|
1997-04-20 22:52:07 +00:00
|
|
|
strftime(time_string[2],17,"%x",tm);
|
1997-04-06 21:03:36 +00:00
|
|
|
oldday = tm->tm_yday;
|
|
|
|
|
|
|
|
if (oldyear != tm->tm_year)
|
|
|
|
{
|
1997-04-20 22:52:07 +00:00
|
|
|
sprintf(time_string[3],"%d",1900+tm->tm_year);
|
1997-04-06 21:03:36 +00:00
|
|
|
oldyear = tm->tm_year;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag & GET_TIME)
|
|
|
|
return time_string[0];
|
|
|
|
else
|
|
|
|
if (flag & GET_DATE)
|
|
|
|
return time_string[1];
|
|
|
|
else
|
1997-04-20 22:52:07 +00:00
|
|
|
if (flag & GET_DATE2)
|
1997-04-06 21:03:36 +00:00
|
|
|
return time_string[2];
|
1997-04-20 22:52:07 +00:00
|
|
|
else
|
|
|
|
if (flag & GET_YEAR)
|
|
|
|
return time_string[3];
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int set_alias(one_call *cur_call, int *nx, char *myname)
|
|
|
|
{
|
|
|
|
auto int n, cc, i, j;
|
|
|
|
auto int hit;
|
|
|
|
|
|
|
|
|
|
|
|
for (n = CALLING; n <= CALLED; n++) {
|
|
|
|
nx[n] = -1;
|
|
|
|
hit = 0;
|
|
|
|
|
|
|
|
if (!*(cur_call->num[n])) {
|
1997-05-04 20:19:34 +00:00
|
|
|
// if (!numbers)
|
1997-04-06 21:03:36 +00:00
|
|
|
{
|
|
|
|
cur_call->num[n][0] = C_UNKNOWN;
|
|
|
|
cur_call->num[n][1] = '\0';
|
|
|
|
}
|
|
|
|
/* Wenn keine Nummer, dann Name "UNKNOWN" */
|
|
|
|
|
|
|
|
hit++;
|
|
|
|
} else {
|
|
|
|
/* In der folg. Schleife werden Nummern durch Namen ersetzt */
|
|
|
|
cc = 0;
|
|
|
|
|
|
|
|
for (j = 0; ((j < 2) && !cc); j++) {
|
|
|
|
for (i = 0; i < knowns; i++) {
|
|
|
|
|
|
|
|
if (cur_call->version[0] != '\0')
|
|
|
|
{
|
|
|
|
if (!strcmp(cur_call->version,LOG_VERSION_2) ||
|
1998-03-08 11:42:23 +00:00
|
|
|
!strcmp(cur_call->version,LOG_VERSION_3) ||
|
|
|
|
!strcmp(cur_call->version,LOG_VERSION) )
|
1997-04-06 21:03:36 +00:00
|
|
|
cc = ((known[i]->si == cur_call->si) || j) &&
|
|
|
|
!n_match(known[i]->num, cur_call->num[n], cur_call->version);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (*cur_call->num[n] != '0') {
|
|
|
|
|
|
|
|
/* Alte Syntax der "isdn.log" : Ohne vorlaufene "0" */
|
|
|
|
cc = ((known[i]->si == cur_call->si) || j) &&
|
|
|
|
!match(known[i]->num+1, cur_call->num[n], 0);
|
|
|
|
|
|
|
|
if (!cc) {
|
|
|
|
/* Ganz alte Syntax der "isdn.log" : Ohne Vorwahl */
|
|
|
|
cc = ((known[i]->si == cur_call->si) || j) &&
|
|
|
|
!n_match(known[i]->num, cur_call->num[n], LOG_VERSION_1);
|
|
|
|
} /* if */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cc) {
|
|
|
|
|
1997-05-04 20:19:34 +00:00
|
|
|
strncpy(cur_call->who[n], known[i]->who,NUMSIZE);
|
1997-03-23 20:25:23 +00:00
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
nx[n] = i;
|
|
|
|
hit++;
|
|
|
|
break;
|
|
|
|
} /* if */
|
|
|
|
} /* for */
|
|
|
|
} /* for */
|
|
|
|
|
|
|
|
/* In der naechsten Schleife werden die unbekannten Nummern
|
|
|
|
registriert */
|
|
|
|
if (!hit) {
|
|
|
|
for (i = 0; i < unknowns; i++)
|
|
|
|
if (!strcmp(unknown[i].num, cur_call->num[n])) {
|
|
|
|
hit++;
|
|
|
|
break;
|
|
|
|
} /* if */
|
|
|
|
|
|
|
|
strcpy(unknown[i].num, cur_call->num[n]);
|
1998-03-08 11:42:23 +00:00
|
|
|
strcpy(unknown[i].mynum, cur_call->num[1 - n]);
|
|
|
|
unknown[i].si1 = cur_call->si1;
|
1997-04-06 21:03:36 +00:00
|
|
|
unknown[i].called = !n;
|
|
|
|
unknown[i].connect[unknown[i].connects] = cur_call->t;
|
1998-03-08 11:42:23 +00:00
|
|
|
unknown[i].cause = cur_call->cause;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
/* ACHTUNG: MAXCONNECTS und MAXUNKNOWN sollten unbedingt groesser sein ! */
|
|
|
|
if (unknown[i].connects + 1 < MAXCONNECTS)
|
|
|
|
unknown[i].connects++;
|
|
|
|
else
|
|
|
|
print_msg(PRT_ERR, "%s: WARNING: Too many unknown connection's from %s\n", myname, unknown[i].num);
|
|
|
|
|
|
|
|
if (!hit) {
|
|
|
|
if (unknowns < MAXUNKNOWN)
|
|
|
|
unknowns++;
|
|
|
|
else
|
|
|
|
print_msg(PRT_ERR, "%s: WARNING: Too many unknown number's\n", myname);
|
|
|
|
} /* if */
|
|
|
|
} /* if */
|
|
|
|
} /* else */
|
|
|
|
} /* for */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int set_caller_infos(one_call *cur_call, char *string, time_t from)
|
|
|
|
{
|
1998-03-08 11:42:23 +00:00
|
|
|
register int i = 0, adapt = 0;
|
1997-04-06 21:03:36 +00:00
|
|
|
auto char **array;
|
|
|
|
|
|
|
|
|
|
|
|
array = string_to_array(string);
|
|
|
|
|
|
|
|
if (array[5] == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
cur_call->t = atol(array[5]);
|
|
|
|
|
|
|
|
if (timearea && (cur_call->t < begintime || cur_call->t > endtime))
|
|
|
|
return -1;
|
|
|
|
else
|
|
|
|
if (cur_call->t < from)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
cur_call->eh = 0;
|
|
|
|
cur_call->dir = -1;
|
|
|
|
cur_call->cause = -1;
|
|
|
|
cur_call->ibytes = cur_call->obytes = 0L;
|
|
|
|
cur_call->dm = 0.0;
|
|
|
|
cur_call->version[0] = '\0';
|
|
|
|
cur_call->si = cur_call->si1 = 0;
|
|
|
|
cur_call->dir = DIALOUT;
|
1997-04-16 22:22:43 +00:00
|
|
|
cur_call->who[0][0] = '\0';
|
|
|
|
cur_call->who[1][0] = '\0';
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
cur_call->provider = 0;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
for (i = 1; array[i] != NULL; i++)
|
|
|
|
{
|
|
|
|
switch (i)
|
|
|
|
{
|
|
|
|
case 0 : cur_call->t = atom(array[i]);
|
|
|
|
break;
|
|
|
|
case 1 : strcpy(cur_call->num[0], Kill_Blanks(array[i]));
|
|
|
|
break;
|
|
|
|
case 2 : strcpy(cur_call->num[1], Kill_Blanks(array[i]));
|
1998-03-08 11:42:23 +00:00
|
|
|
|
|
|
|
/* Korrektur der falschen Eintraege aus den ersten Januar-Tagen 1998 */
|
|
|
|
if (!memcmp(cur_call->num[1], "+491019", 7)) {
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
cur_call->provider = 19;
|
1998-03-08 11:42:23 +00:00
|
|
|
memmove(cur_call->num[1] + 3, cur_call->num[1] + 8, strlen(cur_call->num[1]) - 7);
|
|
|
|
adapt++;
|
|
|
|
}
|
|
|
|
else if (!memcmp(cur_call->num[1], "+491033", 7)) {
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
cur_call->provider = 33;
|
1998-03-08 11:42:23 +00:00
|
|
|
memmove(cur_call->num[1] + 3, cur_call->num[1] + 8, strlen(cur_call->num[1]) - 7);
|
|
|
|
adapt++;
|
|
|
|
}
|
|
|
|
else if (!memcmp(cur_call->num[1], "+491070", 7)) {
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
cur_call->provider = 70;
|
1998-03-08 11:42:23 +00:00
|
|
|
memmove(cur_call->num[1] + 3, cur_call->num[1] + 8, strlen(cur_call->num[1]) - 7);
|
|
|
|
adapt++;
|
|
|
|
} /* else */
|
|
|
|
|
|
|
|
if (adapt)
|
|
|
|
strcpy(cur_call->version, LOG_VERSION);
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
break;
|
1998-05-20 12:23:57 +00:00
|
|
|
case 3 : cur_call->duration = strtod(array[i],NULL);
|
1997-04-06 21:03:36 +00:00
|
|
|
break;
|
1998-05-20 12:23:57 +00:00
|
|
|
case 4 : cur_call->duration = strtod(array[i],NULL)/HZ;
|
1997-04-06 21:03:36 +00:00
|
|
|
break;
|
|
|
|
case 5 : /*cur_call->t = atol(array[i]);*/
|
|
|
|
break;
|
|
|
|
case 6 : cur_call->eh = atoi(array[i]);
|
|
|
|
break;
|
|
|
|
case 7 : cur_call->dir = (*array[i] == 'I') ? DIALIN : DIALOUT;
|
|
|
|
break;
|
|
|
|
case 8 : cur_call->cause = atoi(array[i]);
|
|
|
|
break;
|
|
|
|
case 9 : cur_call->ibytes = atol(array[i]);
|
|
|
|
break;
|
|
|
|
case 10: cur_call->obytes = atol(array[i]);
|
|
|
|
break;
|
1998-03-08 11:42:23 +00:00
|
|
|
case 11: if (!adapt)
|
|
|
|
strcpy(cur_call->version,array[i]);
|
1997-04-06 21:03:36 +00:00
|
|
|
break;
|
|
|
|
case 12: cur_call->si = atoi(array[i]);
|
|
|
|
break;
|
|
|
|
case 13: cur_call->si1 = atoi(array[i]);
|
|
|
|
break;
|
|
|
|
case 14: cur_call->currency_factor = atof(array[i]);
|
|
|
|
break;
|
|
|
|
case 15: strncpy(cur_call->currency, array[i], 3);
|
|
|
|
break;
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
case 16: cur_call->dm = atof(array[i]);
|
1997-04-06 21:03:36 +00:00
|
|
|
break;
|
1998-03-08 11:42:23 +00:00
|
|
|
|
|
|
|
case 17: if (!adapt)
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
cur_call->provider = atoi(array[i]);
|
1998-03-08 11:42:23 +00:00
|
|
|
break;
|
|
|
|
|
1997-04-06 21:03:36 +00:00
|
|
|
default : print_msg(PRT_ERR,"Unknown element found `%s'!\n",array[i]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i < 3)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char **string_to_array(char *string)
|
|
|
|
{
|
|
|
|
static char *array[30];
|
|
|
|
auto char *ptr;
|
|
|
|
auto int i = 0;
|
|
|
|
|
|
|
|
if ((ptr = strrchr(string,C_DELIM)) != NULL)
|
|
|
|
*ptr = '\0';
|
|
|
|
|
|
|
|
array[5] = NULL;
|
|
|
|
array[0] = string;
|
|
|
|
|
|
|
|
while((string = strchr(string,C_DELIM)) != NULL)
|
|
|
|
{
|
|
|
|
*string++ = '\0';
|
|
|
|
array[++i] = string;
|
|
|
|
}
|
|
|
|
|
|
|
|
array[++i] = NULL;
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
int get_term (char *String, time_t *Begin, time_t *End,int delentries)
|
|
|
|
{
|
|
|
|
time_t now;
|
|
|
|
time_t Date[2];
|
|
|
|
int Cnt;
|
|
|
|
char DateStr[2][256] = {"",""};
|
|
|
|
|
|
|
|
|
|
|
|
time(&now);
|
|
|
|
|
|
|
|
if (String[0] == '-')
|
|
|
|
strcpy(DateStr[1],String+1);
|
|
|
|
else
|
|
|
|
if (String[strlen(String)-1] == '-')
|
|
|
|
{
|
|
|
|
strcpy(DateStr[0],String);
|
|
|
|
DateStr[0][strlen(String)-1] ='\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (strchr(String,'-'))
|
|
|
|
{
|
|
|
|
if (sscanf(String,"%[/.0-9]-%[/.0-9]",DateStr[0],DateStr[1]) != 2)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy(DateStr[0],String);
|
|
|
|
strcpy(DateStr[1],String);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Cnt = 0; Cnt < 2; Cnt++)
|
|
|
|
{
|
|
|
|
if (strchr(DateStr[Cnt],'/'))
|
|
|
|
Date[Cnt] = get_month(DateStr[Cnt],delentries?0:Cnt);
|
|
|
|
else
|
|
|
|
Date[Cnt] = get_time(DateStr[Cnt],delentries?0:Cnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
*Begin = DateStr[0][0] == '\0' ? 0 : Date[0];
|
|
|
|
*End = DateStr[1][0] == '\0' ? now : Date[1];
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static time_t get_month(char *String, int TimeStatus)
|
|
|
|
{
|
|
|
|
time_t now;
|
|
|
|
int Cnt = 0;
|
|
|
|
struct tm *TimeStruct;
|
|
|
|
int Args[3];
|
|
|
|
int ArgCnt;
|
|
|
|
|
|
|
|
|
|
|
|
time(&now);
|
|
|
|
TimeStruct = localtime(&now);
|
|
|
|
TimeStruct->tm_sec = 0;
|
|
|
|
TimeStruct->tm_min = 0;
|
|
|
|
TimeStruct->tm_hour= 0;
|
|
|
|
TimeStruct->tm_mday= 1;
|
|
|
|
TimeStruct->tm_isdst= -1;
|
|
|
|
|
|
|
|
ArgCnt = sscanf(String,"%d/%d/%d",&(Args[0]),&(Args[1]),&(Args[2]));
|
|
|
|
|
|
|
|
switch (ArgCnt)
|
|
|
|
{
|
|
|
|
case 3:
|
|
|
|
TimeStruct->tm_mday = Args[0];
|
|
|
|
Cnt++;
|
|
|
|
case 2:
|
1998-05-20 12:23:57 +00:00
|
|
|
/* if (Args[Cnt+1] > 99) */
|
|
|
|
if (Args[Cnt+1] >= 1900)
|
1997-04-06 21:03:36 +00:00
|
|
|
TimeStruct->tm_year = ((Args[Cnt+1] / 100) - 19) * 100 + (Args[Cnt+1]%100);
|
|
|
|
else
|
1998-05-20 12:23:57 +00:00
|
|
|
if (Args[Cnt+1] < 70)
|
|
|
|
TimeStruct->tm_year = Args[Cnt+1] + 100;
|
|
|
|
else
|
|
|
|
TimeStruct->tm_year = Args[Cnt+1];
|
1997-04-06 21:03:36 +00:00
|
|
|
case 1:
|
|
|
|
TimeStruct->tm_mon = Args[Cnt];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TimeStatus == END_TIME)
|
|
|
|
{
|
|
|
|
if (ArgCnt == 3) /* Wenn Tag angegeben ist */
|
|
|
|
{
|
|
|
|
TimeStruct->tm_mday++;
|
|
|
|
TimeStruct->tm_mon--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
TimeStruct->tm_mon--;
|
|
|
|
|
|
|
|
return mktime(TimeStruct);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static time_t get_time(char *String, int TimeStatus)
|
|
|
|
{
|
|
|
|
time_t now;
|
|
|
|
int Len = 0;
|
|
|
|
int Year;
|
|
|
|
char *Ptr;
|
|
|
|
struct tm *TimeStruct;
|
|
|
|
|
|
|
|
|
|
|
|
time(&now);
|
|
|
|
TimeStruct = localtime(&now);
|
|
|
|
TimeStruct->tm_sec = 0;
|
|
|
|
TimeStruct->tm_min = 0;
|
|
|
|
TimeStruct->tm_hour= 0;
|
|
|
|
TimeStruct->tm_isdst= -1;
|
|
|
|
|
|
|
|
switch (strlen(String))
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return 0;
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
TimeStruct->tm_mday = atoi(String);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Len = strlen(String);
|
|
|
|
|
|
|
|
if ((Ptr = strchr(String,'.')) != NULL)
|
|
|
|
{
|
|
|
|
TimeStruct->tm_sec = atoi(Ptr+1);
|
|
|
|
Len -= strlen(Ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Len % 2)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (sscanf(String,"%2d%2d%2d%2d%d",
|
|
|
|
&(TimeStruct->tm_mon),
|
|
|
|
&(TimeStruct->tm_mday),
|
|
|
|
&(TimeStruct->tm_hour),
|
|
|
|
&(TimeStruct->tm_min),
|
|
|
|
&Year ) > 4)
|
1998-05-20 12:23:57 +00:00
|
|
|
/* if (Year > 99) */
|
|
|
|
if (Year >= 1900)
|
1997-04-06 21:03:36 +00:00
|
|
|
TimeStruct->tm_year = ((Year / 100) - 19) * 100 + (Year%100);
|
|
|
|
else
|
1998-05-20 12:23:57 +00:00
|
|
|
if (Year < 70)
|
|
|
|
TimeStruct->tm_year = Year + 100;
|
|
|
|
else
|
|
|
|
TimeStruct->tm_year = Year;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
TimeStruct->tm_mon--;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TimeStatus == END_TIME)
|
|
|
|
if (TimeStruct->tm_sec == 0 &&
|
|
|
|
TimeStruct->tm_min == 0 &&
|
|
|
|
TimeStruct->tm_hour== 0 )
|
|
|
|
TimeStruct->tm_mday++;
|
|
|
|
else
|
|
|
|
if (TimeStruct->tm_sec == 0 &&
|
|
|
|
TimeStruct->tm_min == 0 )
|
|
|
|
TimeStruct->tm_hour++;
|
|
|
|
else
|
|
|
|
if (TimeStruct->tm_sec == 0 )
|
|
|
|
TimeStruct->tm_min++;
|
|
|
|
else
|
|
|
|
TimeStruct->tm_sec++;
|
|
|
|
|
|
|
|
return mktime(TimeStruct);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
int set_msnlist(char *String)
|
|
|
|
{
|
|
|
|
int Cnt;
|
|
|
|
int Value = 1;
|
|
|
|
char *Ptr = String;
|
|
|
|
|
|
|
|
|
|
|
|
if (ShowMSN)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
while((Ptr = strchr(Ptr,',')) != NULL)
|
|
|
|
{
|
|
|
|
Ptr++;
|
|
|
|
Value++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ShowMSN = (char**) calloc(Value+1,sizeof(char*));
|
|
|
|
for(Cnt = 0; Cnt < Value; Cnt++)
|
|
|
|
ShowMSN[Cnt] = (char*) calloc(NUMSIZE,sizeof(char));
|
|
|
|
|
|
|
|
if (!ShowMSN)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*String == 'n')
|
|
|
|
{
|
|
|
|
++String;
|
|
|
|
invertnumbers++;
|
|
|
|
}
|
|
|
|
|
|
|
|
Cnt = 0;
|
|
|
|
|
|
|
|
while(String)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (*String == 'm')
|
|
|
|
{
|
|
|
|
Value = atoi(++String);
|
|
|
|
|
|
|
|
if (Value > 0 && Value <= mymsns)
|
|
|
|
{
|
|
|
|
strcpy(ShowMSN[Cnt],known[Value-1]->num);
|
|
|
|
Cnt++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"Invalid MSN %d!\n",Cnt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sscanf(String,"%[^,],",ShowMSN[Cnt++]);
|
|
|
|
|
|
|
|
String = strchr(String,',');
|
|
|
|
if (String) String++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int show_msn(one_call *cur_call)
|
|
|
|
{
|
|
|
|
int Cnt;
|
|
|
|
|
|
|
|
for(Cnt = 0; ShowMSN[Cnt] != NULL; Cnt++)
|
|
|
|
if (!num_match(ShowMSN[Cnt], cur_call->num[0]) ||
|
|
|
|
!num_match(ShowMSN[Cnt] , cur_call->num[1]))
|
|
|
|
return !invertnumbers;
|
|
|
|
else
|
|
|
|
if (!strcmp(ShowMSN[Cnt],"0"))
|
|
|
|
return !invertnumbers;
|
|
|
|
|
|
|
|
return invertnumbers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
static char *print_currency(double money, int computed)
|
1997-04-06 21:03:36 +00:00
|
|
|
{
|
|
|
|
static char RetCode[256];
|
|
|
|
|
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
sprintf(RetCode,"%s %s%c", double2str(money,8,2,0),currency,computed?'*':' ');
|
1997-04-06 21:03:36 +00:00
|
|
|
return RetCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int print_sum_calls(sum_calls *s, int computed)
|
|
|
|
{
|
|
|
|
static char String[256];
|
1997-04-20 22:52:07 +00:00
|
|
|
one_call *tmp_call;
|
|
|
|
int RetCode;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
if ((tmp_call = (one_call*) calloc(1,sizeof(one_call))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp_call->eh = s->eh;
|
|
|
|
tmp_call->dm = s->dm;
|
|
|
|
tmp_call->obytes = s->obytes;
|
|
|
|
tmp_call->ibytes = s->ibytes;
|
1997-04-06 21:03:36 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
sprintf(String,"%3d IN=%s, %3d OUT=%s, %3d failed",
|
|
|
|
s->in,
|
|
|
|
double2clock(s->din),
|
|
|
|
s->out,
|
|
|
|
double2clock(s->dout),
|
|
|
|
s->err);
|
|
|
|
|
|
|
|
RetCode = print_line(F_BODY_BOTTOM1,tmp_call,computed,String);
|
|
|
|
free(tmp_call);
|
|
|
|
return RetCode;
|
1997-04-06 21:03:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int add_one_call(sum_calls *s1, one_call *s2, double units)
|
|
|
|
{
|
|
|
|
if (s2->dir == DIALIN)
|
|
|
|
{
|
|
|
|
s1->in++;
|
|
|
|
s1->din += s2->duration > 0?s2->duration:0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
- Accounting for the following new providers implemented:
o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
WESTCom, WorldCom, Viag Interkom
Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
program http://www.insider.org/tarif/gebuehr.c
- Telekom's 10plus implemented
- Berechnung der Gebuehrenzone implementiert
(CityCall, RegioCall, GermanCall, GlobalCall)
The entry "ZONE" is not needed anymore in the config-files
you need the file
http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
and the new entry
[GLOBAL]
AREADIFF = /usr/lib/isdn/vorwahl.dat
for that feature.
Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
Data-File and Harald Milz for his first Perl-Implementation!
- Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
You must install the file
"isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
as "/usr/lib/isdn/sonderrufnummern.dat"
for that feature.
ATTENTION: This is *NO* production-code! Please test it carefully!
1998-06-07 21:07:50 +00:00
|
|
|
/* s2->dm = s2->eh * units; AK:15-May-98 */
|
1997-04-06 21:03:36 +00:00
|
|
|
|
|
|
|
s1->out++;
|
|
|
|
s1->dout += s2->duration > 0?s2->duration:0;
|
|
|
|
s1->eh += s2->eh;
|
|
|
|
s1->dm += s2->dm;
|
|
|
|
}
|
|
|
|
|
|
|
|
s1->ibytes += s2->ibytes;
|
|
|
|
s1->obytes += s2->obytes;
|
|
|
|
#ifdef ISDN_NL
|
|
|
|
s1->dm += 0.0825; /* add call setup charge */
|
|
|
|
s2->dm += 0.0825;
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int clear_sum(sum_calls *s1)
|
|
|
|
{
|
|
|
|
s1->in = 0;
|
|
|
|
s1->out = 0;
|
|
|
|
s1->eh = 0;
|
|
|
|
s1->err = 0;
|
|
|
|
s1->din = 0;
|
|
|
|
s1->dout = 0;
|
|
|
|
s1->dm = 0;
|
|
|
|
s1->ibytes = 0L;
|
|
|
|
s1->obytes = 0L;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int add_sum_calls(sum_calls *s1, sum_calls *s2)
|
|
|
|
{
|
|
|
|
s1->in += s2->in;
|
|
|
|
s1->out += s2->out;
|
|
|
|
s1->eh += s2->eh;
|
|
|
|
s1->err += s2->err;
|
|
|
|
s1->din += s2->din;
|
|
|
|
s1->dout += s2->dout;
|
|
|
|
s1->dm += s2->dm;
|
|
|
|
s1->ibytes += s2->ibytes;
|
|
|
|
s1->obytes += s2->obytes;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static void strich(int type)
|
|
|
|
{
|
1997-04-20 22:52:07 +00:00
|
|
|
if (html)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case 3 :
|
1997-05-06 22:13:21 +00:00
|
|
|
case 1 : print_msg(PRT_NORMAL,H_LINE,get_format_size(),1);
|
|
|
|
break;
|
|
|
|
case 2 : print_msg(PRT_NORMAL,H_LINE,get_format_size(),3);
|
1997-04-20 22:52:07 +00:00
|
|
|
break;
|
1997-05-06 22:13:21 +00:00
|
|
|
default: print_msg(PRT_ERR,"Internal error: Invalid line flag!\n");
|
1997-04-20 22:52:07 +00:00
|
|
|
break;
|
|
|
|
} /* switch */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1997-05-04 20:19:34 +00:00
|
|
|
char *string;
|
|
|
|
int size = set_col_size();
|
|
|
|
|
|
|
|
if ((string = (char*) calloc(size+1,sizeof(char))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (size>0)
|
|
|
|
string[--size] = type==2?'=':'-';
|
|
|
|
|
|
|
|
print_msg(PRT_NORMAL,"%s\n",string);
|
|
|
|
|
|
|
|
free(string);
|
1997-04-20 22:52:07 +00:00
|
|
|
}
|
1997-04-06 21:03:36 +00:00
|
|
|
} /* strich */
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int n_match(char *Pattern, char* Number, char* version)
|
|
|
|
{
|
|
|
|
int RetCode = -1;
|
|
|
|
char s[SHORT_STRING_SIZE];
|
|
|
|
|
1998-03-08 11:42:23 +00:00
|
|
|
if (!strcmp(version,LOG_VERSION_3) || !strcmp(version,LOG_VERSION))
|
1997-04-06 21:03:36 +00:00
|
|
|
{
|
|
|
|
RetCode = num_match(Pattern,Number);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (!strcmp(version,LOG_VERSION_2))
|
|
|
|
{
|
|
|
|
strcpy(s,expand_number(Number));
|
|
|
|
RetCode = num_match(Pattern,s);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (!strcmp(version,LOG_VERSION_1))
|
|
|
|
{
|
|
|
|
if ((RetCode = match(Pattern, Number,0)) != 0 &&
|
1997-04-08 21:56:42 +00:00
|
|
|
!strncmp(Pattern,areaprefix,strlen(areaprefix)) )
|
1997-04-06 21:03:36 +00:00
|
|
|
{
|
1997-04-08 21:56:42 +00:00
|
|
|
sprintf(s,"*%s%s",myarea/*+strlen(areaprefix)*/,Pattern);
|
1997-04-06 21:03:36 +00:00
|
|
|
RetCode = match(s,Number,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
print_msg(PRT_ERR,"Unknown Version of logfile entries!\n");
|
|
|
|
|
|
|
|
return RetCode;
|
|
|
|
}
|
1997-03-23 20:25:23 +00:00
|
|
|
|
1997-03-31 22:43:05 +00:00
|
|
|
/*****************************************************************************/
|
1997-03-16 20:58:07 +00:00
|
|
|
|
1997-04-20 22:52:07 +00:00
|
|
|
static int html_header(void)
|
|
|
|
{
|
|
|
|
print_msg(PRT_NORMAL,"Content-Type: text/html\n\n");
|
|
|
|
print_msg(PRT_NORMAL,"<HTML>\n");
|
1997-05-04 20:19:34 +00:00
|
|
|
print_msg(PRT_NORMAL,"<BODY bgcolor=%s>\n",H_BG_COLOR);
|
1997-04-20 22:52:07 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int html_bottom(char *_progname, char *start, char *stop)
|
|
|
|
{
|
1998-03-29 19:54:04 +00:00
|
|
|
int value;
|
|
|
|
int value2;
|
1997-04-20 22:52:07 +00:00
|
|
|
char *progname = strdup(_progname);
|
|
|
|
char *ptr = strrchr(progname,'.');
|
|
|
|
|
|
|
|
|
|
|
|
if (ptr)
|
|
|
|
*ptr = '\0';
|
|
|
|
|
1998-03-29 19:54:04 +00:00
|
|
|
/*
|
|
|
|
print_msg(PRT_NORMAL,H_FORM_ON,_myname);
|
|
|
|
print_msg(PRT_NORMAL,H_FORM_DAY,"Date:","-t",40,10);
|
|
|
|
print_msg(PRT_NORMAL,H_FORM_OFF);
|
1998-03-25 20:58:34 +00:00
|
|
|
*/
|
|
|
|
|
1998-03-29 19:54:04 +00:00
|
|
|
if (!incomingonly)
|
|
|
|
{
|
|
|
|
value = incomingonly;
|
|
|
|
value2 = outgoingonly;
|
|
|
|
incomingonly++;
|
|
|
|
outgoingonly = 0;
|
|
|
|
if ((ptr = get_time_string(_begintime,endtime,0,0)) != NULL)
|
|
|
|
print_msg(PRT_NORMAL,H_LINK_DAY,_myname,ptr,"incoming only");
|
|
|
|
incomingonly = value;
|
|
|
|
outgoingonly = value2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!outgoingonly)
|
|
|
|
{
|
|
|
|
value = incomingonly;
|
|
|
|
value2 = outgoingonly;
|
|
|
|
incomingonly = 0;
|
|
|
|
outgoingonly++;
|
|
|
|
if ((ptr = get_time_string(_begintime,endtime,0,0)) != NULL)
|
|
|
|
print_msg(PRT_NORMAL,H_LINK_DAY,_myname,ptr,"outgoing only");
|
|
|
|
incomingonly = value;
|
|
|
|
outgoingonly = value2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (outgoingonly || incomingonly)
|
|
|
|
{
|
|
|
|
value = incomingonly;
|
|
|
|
value2 = outgoingonly;
|
|
|
|
incomingonly = outgoingonly = 0;
|
|
|
|
if ((ptr = get_time_string(_begintime,endtime,0,0)) != NULL)
|
|
|
|
print_msg(PRT_NORMAL,H_LINK_DAY,_myname,ptr,"all calls");
|
|
|
|
incomingonly = value;
|
|
|
|
outgoingonly = value2;
|
|
|
|
}
|
|
|
|
|
|
|
|
value = verbose;
|
1998-03-25 20:58:34 +00:00
|
|
|
verbose = !verbose;
|
|
|
|
if ((ptr = get_time_string(_begintime,endtime,0,0)) != NULL)
|
1998-03-29 19:54:04 +00:00
|
|
|
print_msg(PRT_NORMAL,H_LINK_DAY,_myname,ptr,value?"verbose off":"verbose on");
|
|
|
|
verbose = value;
|
1998-03-25 20:58:34 +00:00
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
if ((ptr = get_time_string(_begintime,endtime,0,-1)) != NULL)
|
1997-05-15 23:24:54 +00:00
|
|
|
print_msg(PRT_NORMAL,H_LINK_DAY,_myname,ptr,"previous month");
|
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
if ((ptr = get_time_string(_begintime,endtime,-1,0)) != NULL)
|
1997-05-15 23:24:54 +00:00
|
|
|
print_msg(PRT_NORMAL,H_LINK_DAY,_myname,ptr,"previous day");
|
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
if ((ptr = get_time_string(_begintime,endtime,1,0)) != NULL)
|
1997-05-15 23:24:54 +00:00
|
|
|
print_msg(PRT_NORMAL,H_LINK_DAY,_myname,ptr,"next day");
|
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
if ((ptr = get_time_string(_begintime,endtime,0,1)) != NULL)
|
1997-05-15 23:24:54 +00:00
|
|
|
print_msg(PRT_NORMAL,H_LINK_DAY,_myname,ptr,"next month");
|
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
print_msg(PRT_NORMAL,"\n<BR><H6>%s %s %s</H6>\n",progname,VERSION,__DATE__);
|
1997-05-15 23:24:54 +00:00
|
|
|
print_msg(PRT_NORMAL,"\n</BODY>\n");
|
1997-05-10 12:57:00 +00:00
|
|
|
print_msg(PRT_NORMAL,"<HEAD><TITLE>%s %s\n",progname,print_diff_date(start,stop));
|
1997-04-20 22:52:07 +00:00
|
|
|
print_msg(PRT_NORMAL,"</TITLE>\n");
|
|
|
|
print_msg(PRT_NORMAL,"</HTML>\n");
|
|
|
|
|
|
|
|
free(progname);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-05-10 12:57:00 +00:00
|
|
|
static char *print_diff_date(char *start, char *stop)
|
|
|
|
{
|
|
|
|
static char RetCode[64];
|
|
|
|
|
|
|
|
if (strcmp(start,stop))
|
|
|
|
sprintf(RetCode,"%s .. %s",start,stop);
|
|
|
|
else
|
|
|
|
sprintf(RetCode,"%s",start);
|
|
|
|
|
|
|
|
return RetCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-05-15 22:21:27 +00:00
|
|
|
static int get_file_list(void)
|
|
|
|
{
|
1997-05-19 22:57:51 +00:00
|
|
|
if (read_path & F_VBOX)
|
|
|
|
set_dir_entries(vboxpath,set_vbox_entry);
|
|
|
|
|
|
|
|
if (read_path & F_FAX)
|
|
|
|
set_dir_entries(mgettypath,set_mgetty_entry);
|
1997-05-15 22:21:27 +00:00
|
|
|
|
|
|
|
qsort(file_root,file_root_member,sizeof(file_list*),Compare_files);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int set_dir_entries(char *directory, int (*set_fct)(const char *, const char *))
|
|
|
|
{
|
|
|
|
struct dirent *eptr;
|
|
|
|
DIR *dptr;
|
|
|
|
|
|
|
|
if (directory != NULL)
|
|
|
|
{
|
|
|
|
if ((dptr = opendir(directory)) != NULL)
|
|
|
|
{
|
|
|
|
while ((eptr = readdir(dptr)) != NULL)
|
|
|
|
{
|
|
|
|
if (eptr->d_name[0] != '.')
|
|
|
|
{
|
|
|
|
if (set_fct(directory,eptr->d_name))
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(dptr);
|
|
|
|
}
|
1997-09-07 00:43:06 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"Can not open directory `%s': %s!\n", directory, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
1997-05-15 22:21:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int set_vbox_entry(const char *path, const char *file)
|
|
|
|
{
|
|
|
|
struct tm tm;
|
|
|
|
file_list *lptr = NULL;
|
|
|
|
char string[PATH_MAX];
|
|
|
|
int cnt;
|
1997-05-25 19:40:43 +00:00
|
|
|
FILE *fp;
|
|
|
|
vaheader_t ptr;
|
1997-05-15 22:21:27 +00:00
|
|
|
|
|
|
|
|
1997-05-25 19:40:43 +00:00
|
|
|
|
|
|
|
sprintf(string,"%s%c%s",path,C_SLASH,file);
|
|
|
|
|
|
|
|
if ((fp = fopen(string,"r")) == NULL)
|
1997-09-07 00:43:06 +00:00
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"Can not open file `%s': %s!\n", string, strerror(errno));
|
1997-05-25 19:40:43 +00:00
|
|
|
return -1;
|
1997-09-07 00:43:06 +00:00
|
|
|
}
|
1997-05-25 19:40:43 +00:00
|
|
|
|
|
|
|
fread(&ptr,sizeof(vaheader_t),1,fp);
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
if (strncmp(ptr.magic,"VBOX",4))
|
|
|
|
{
|
|
|
|
/* Version 0.x and 1.x of vbox! */
|
1997-05-15 22:21:27 +00:00
|
|
|
|
|
|
|
if ((cnt = sscanf(file,"%2d%2d%2d%2d%2d%2d",
|
1997-05-25 19:40:43 +00:00
|
|
|
&(tm.tm_year),
|
|
|
|
&(tm.tm_mon),
|
|
|
|
&(tm.tm_mday),
|
|
|
|
&(tm.tm_hour),
|
|
|
|
&(tm.tm_min),
|
|
|
|
&(tm.tm_sec))) != 6)
|
1997-05-15 22:21:27 +00:00
|
|
|
{
|
1997-05-25 19:40:43 +00:00
|
|
|
print_msg(PRT_ERR,"invalid file name `%s'!\n",file);
|
|
|
|
return -1;
|
1997-05-15 22:21:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((lptr = (file_list*) calloc(1,sizeof(file_list))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tm.tm_mday > 31)
|
|
|
|
{
|
|
|
|
int help = tm.tm_mday;
|
|
|
|
tm.tm_mday = tm.tm_year;
|
|
|
|
tm.tm_year = help;
|
|
|
|
}
|
|
|
|
|
|
|
|
tm.tm_mon--;
|
|
|
|
tm.tm_isdst = -1;
|
|
|
|
|
|
|
|
lptr->name = strdup(file);
|
|
|
|
lptr->time = mktime(&tm);
|
|
|
|
lptr->type = C_VBOX;
|
|
|
|
lptr->used = 0;
|
|
|
|
lptr->version = 1;
|
1997-05-25 19:40:43 +00:00
|
|
|
lptr->compression = 0;
|
1997-05-15 22:21:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1997-05-25 19:40:43 +00:00
|
|
|
/* Version 2.x of vbox! */
|
|
|
|
|
|
|
|
if ((lptr = (file_list*) calloc(1,sizeof(file_list))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
lptr->name = strdup(file);
|
|
|
|
lptr->time = ntohl(ptr.time);
|
|
|
|
lptr->type = C_VBOX;
|
|
|
|
lptr->used = 0;
|
|
|
|
lptr->version = 2;
|
|
|
|
lptr->compression = ntohl(ptr.compression);
|
1997-05-15 22:21:27 +00:00
|
|
|
}
|
1997-05-25 19:40:43 +00:00
|
|
|
/*
|
1997-05-15 22:21:27 +00:00
|
|
|
else
|
|
|
|
{
|
1997-05-25 19:40:43 +00:00
|
|
|
print_msg(PRT_ERR, "Version %d of vbox is not implemented yet!\n",vboxversion);
|
1997-05-15 22:21:27 +00:00
|
|
|
print_msg(PRT_ERR, "Invalid version %d of vbox!\n",vboxversion);
|
|
|
|
return -1;
|
|
|
|
}
|
1997-05-25 19:40:43 +00:00
|
|
|
*/
|
1997-05-15 22:21:27 +00:00
|
|
|
|
|
|
|
return set_element_list(lptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int set_mgetty_entry(const char *path, const char *file)
|
|
|
|
{
|
|
|
|
file_list *lptr = NULL;
|
|
|
|
char string[PATH_MAX];
|
|
|
|
|
|
|
|
sprintf(string,"%s%c%s",path,C_SLASH,file);
|
|
|
|
|
|
|
|
if (access(string,R_OK))
|
1997-09-07 00:43:06 +00:00
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"Can not open file `%s': %s!\n", string, strerror(errno));
|
1997-05-15 22:21:27 +00:00
|
|
|
return -1;
|
1997-09-07 00:43:06 +00:00
|
|
|
}
|
1997-05-15 22:21:27 +00:00
|
|
|
|
|
|
|
if ((lptr = (file_list*) calloc(1,sizeof(file_list))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
lptr->name = strdup(file);
|
|
|
|
|
|
|
|
strcpy(string,"0x3");
|
|
|
|
strncpy(string+3,file+2,7);
|
|
|
|
lptr->time = strtol(string,NIL,0);
|
|
|
|
|
|
|
|
lptr->type = C_FAX;
|
|
|
|
lptr->used = 0;
|
|
|
|
lptr->version = 3;
|
1997-05-25 19:40:43 +00:00
|
|
|
lptr->compression = 0;
|
1997-05-15 22:21:27 +00:00
|
|
|
|
|
|
|
return set_element_list(lptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int set_element_list(file_list* elem)
|
|
|
|
{
|
|
|
|
if (file_root_size == file_root_member)
|
|
|
|
{
|
|
|
|
file_root_size += 10;
|
|
|
|
if ((file_root = (file_list**) realloc(file_root,sizeof(file_list*)*file_root_size)) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
file_root[file_root_member++] = elem;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int Compare_files(const void *e1, const void *e2)
|
|
|
|
{
|
|
|
|
if ((*(file_list**) e1)->time > (*(file_list**) e2)->time)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
if ((*(file_list**) e1)->time < (*(file_list**) e2)->time)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static file_list *get_file_to_call(time_t filetime, char type)
|
|
|
|
{
|
|
|
|
static file_list **ptr = NULL;
|
|
|
|
static int cnt;
|
|
|
|
static time_t _filetime;
|
|
|
|
int interval;
|
|
|
|
|
|
|
|
if (filetime == 0)
|
|
|
|
{
|
|
|
|
if (ptr != NULL)
|
|
|
|
{
|
|
|
|
ptr++;
|
|
|
|
cnt--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ptr = file_root;
|
|
|
|
cnt = file_root_member;
|
|
|
|
_filetime = filetime;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (cnt > 0 && (interval = time_in_interval((*ptr)->time,_filetime,type)) < 1)
|
|
|
|
{
|
|
|
|
if (interval == 0 && (*ptr)->used == 0 && (*ptr)->type == type)
|
|
|
|
{
|
|
|
|
(*ptr)->used = 1;
|
|
|
|
return (*ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr++;
|
|
|
|
cnt--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int time_in_interval(time_t t1, time_t t2, char type)
|
|
|
|
{
|
|
|
|
int begin;
|
|
|
|
int end;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case C_VBOX : begin = 0;
|
|
|
|
end = 10;
|
|
|
|
break;
|
|
|
|
case C_FAX : begin = -2;
|
|
|
|
end = 1;
|
|
|
|
break;
|
|
|
|
default : begin = 0;
|
|
|
|
end = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((int) t1 < ((int) t2) + begin)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if ((int) t1 > ((int) t2) + end)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char *get_links(time_t filetime, char type)
|
|
|
|
{
|
|
|
|
static char *string[5] = {NULL,NULL,NULL,NULL,NULL};
|
|
|
|
static int cnt = -1;
|
|
|
|
file_list *ptr;
|
|
|
|
|
|
|
|
|
|
|
|
cnt = (cnt+1) % 5;
|
|
|
|
free(string[cnt]);
|
|
|
|
string[cnt] = NULL;
|
|
|
|
|
|
|
|
if (type == C_VBOX)
|
|
|
|
{
|
|
|
|
if ((ptr = get_file_to_call(filetime,type)) != NULL)
|
|
|
|
{
|
|
|
|
if ((string[cnt] = (char*) calloc(SHORT_STRING_SIZE,sizeof(char))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(string[cnt],H_LINK,_myname,type,ptr->version,nam2html(ptr->name),"phone");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (type == C_FAX)
|
|
|
|
{
|
|
|
|
while((ptr = get_file_to_call(filetime,type)) != NULL)
|
|
|
|
{
|
|
|
|
append_fax(&(string[cnt]),ptr->name,type,ptr->version);
|
|
|
|
filetime = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, "Internal error: Invalid type %d of file!\n",(int)type);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return string[cnt]?string[cnt]:" ";
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char *append_fax(char **string, char *file, char type, int version)
|
|
|
|
{
|
|
|
|
static int cnt = 0;
|
|
|
|
char help[BUFSIZ];
|
|
|
|
char help2[20];
|
|
|
|
|
|
|
|
if (*string == NULL)
|
|
|
|
cnt = 1;
|
|
|
|
else
|
|
|
|
cnt++;
|
|
|
|
|
|
|
|
sprintf(help2,"<%d>",cnt);
|
|
|
|
sprintf(help,H_LINK,_myname,type,version,nam2html(file),help2);
|
|
|
|
|
|
|
|
if (*string == NULL)
|
1997-07-22 22:36:08 +00:00
|
|
|
*string = strdup(STR_FAX);
|
1997-05-15 22:21:27 +00:00
|
|
|
|
|
|
|
if ((*string = (char*) realloc(*string,sizeof(char)*(strlen(*string)+strlen(help)+2))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR, nomemory);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcat(*string,help);
|
|
|
|
strcat(*string," ");
|
|
|
|
|
|
|
|
return *string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char *nam2html(char *file)
|
|
|
|
{
|
|
|
|
static char RetCode[SHORT_STRING_SIZE];
|
|
|
|
char *ptr = RetCode;
|
|
|
|
|
|
|
|
while (*file != '\0')
|
|
|
|
{
|
|
|
|
switch (*file)
|
|
|
|
{
|
|
|
|
case '+': strcpy(ptr,"%2b");
|
|
|
|
ptr += 3;
|
|
|
|
file++;
|
|
|
|
break;
|
|
|
|
default : *ptr++ = *file++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*ptr = '\0';
|
|
|
|
|
|
|
|
return RetCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
static char *get_a_day(time_t t, int d_diff, int m_diff, int flag)
|
1997-05-15 23:24:54 +00:00
|
|
|
{
|
|
|
|
static char string[16];
|
|
|
|
struct tm *tm;
|
|
|
|
time_t cur_time;
|
1997-05-17 01:08:11 +00:00
|
|
|
char flag2 = 0;
|
|
|
|
|
1997-05-15 23:24:54 +00:00
|
|
|
|
|
|
|
if (t == 0)
|
1997-05-17 01:08:11 +00:00
|
|
|
{
|
|
|
|
if (flag & F_END)
|
|
|
|
return NULL;
|
|
|
|
|
1997-05-15 23:24:54 +00:00
|
|
|
time(&t);
|
1997-05-17 01:08:11 +00:00
|
|
|
flag2 = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag & F_END)
|
|
|
|
t++;
|
1997-05-15 23:24:54 +00:00
|
|
|
|
|
|
|
tm = localtime(&t);
|
|
|
|
|
|
|
|
tm->tm_mday += d_diff;
|
|
|
|
tm->tm_mon += m_diff;
|
|
|
|
tm->tm_isdst = -1;
|
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
if (flag2 == 1)
|
|
|
|
{
|
|
|
|
tm->tm_hour = 0;
|
|
|
|
tm->tm_min = 0;
|
|
|
|
tm->tm_sec = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
t = mktime(tm);
|
|
|
|
|
|
|
|
if (flag & F_END)
|
|
|
|
t-=2;
|
|
|
|
|
1997-05-15 23:24:54 +00:00
|
|
|
time(&cur_time);
|
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
if (cur_time < t)
|
|
|
|
{
|
1997-05-17 14:58:28 +00:00
|
|
|
if (!(flag & F_END))
|
|
|
|
return NULL;
|
|
|
|
/*
|
1997-05-17 01:08:11 +00:00
|
|
|
if (flag & F_END)
|
|
|
|
t = cur_time;
|
|
|
|
else
|
|
|
|
return NULL;
|
1997-05-17 14:58:28 +00:00
|
|
|
*/
|
1997-05-17 01:08:11 +00:00
|
|
|
}
|
1997-05-15 23:24:54 +00:00
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
tm = localtime(&t);
|
|
|
|
sprintf(string,"%02d%02d%02d%02d%04d.%02d",tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_year+1900,tm->tm_sec);
|
1997-05-15 23:24:54 +00:00
|
|
|
|
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
1997-05-17 01:08:11 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char *get_time_string(time_t begin, time_t end, int d_diff, int m_diff)
|
|
|
|
{
|
1998-03-25 20:58:34 +00:00
|
|
|
static char string[256];
|
1997-05-17 01:08:11 +00:00
|
|
|
char *ptr = NULL;
|
|
|
|
|
|
|
|
|
1998-03-25 20:58:34 +00:00
|
|
|
strcpy(string,get_default_html_params());
|
1997-05-17 01:08:11 +00:00
|
|
|
|
|
|
|
if ((ptr = get_a_day(begin,d_diff,m_diff,F_BEGIN)) != NULL)
|
|
|
|
{
|
1998-03-25 20:58:34 +00:00
|
|
|
strcat(string,"+-t");
|
1997-05-17 01:08:11 +00:00
|
|
|
strcat(string,ptr);
|
|
|
|
|
|
|
|
if ((ptr = get_a_day(end,d_diff,m_diff,F_END)) != NULL)
|
|
|
|
{
|
|
|
|
strcat(string,"-");
|
|
|
|
strcat(string,ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
1997-05-15 23:24:54 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1998-03-25 20:58:34 +00:00
|
|
|
static char *get_default_html_params(void)
|
|
|
|
{
|
|
|
|
static char string[50];
|
|
|
|
|
1998-03-29 19:54:04 +00:00
|
|
|
sprintf(string,"-w%d%s%s%s",
|
|
|
|
html-1,
|
1998-03-25 20:58:34 +00:00
|
|
|
/* ^^---sehr gefaehrlich, da eine UND-Verknuepfung!!! */
|
1998-03-29 19:54:04 +00:00
|
|
|
verbose?"+-v":"",
|
|
|
|
outgoingonly?"+-o":"",
|
|
|
|
incomingonly?"+-i":"");
|
1998-03-25 20:58:34 +00:00
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1997-05-25 19:40:43 +00:00
|
|
|
static char *create_vbox_file(char *file, int *compression)
|
|
|
|
{
|
|
|
|
int fdin, fdout, len;
|
|
|
|
char string[BUFSIZ];
|
|
|
|
char *fileout = NULL;
|
|
|
|
vaheader_t header;
|
|
|
|
|
|
|
|
if ((fdin = open(file,O_RDONLY)) == -1)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"Can not open file `%s': %s!\n",file, strerror(errno));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read(fdin,&header,sizeof(vaheader_t)) == sizeof(vaheader_t))
|
|
|
|
{
|
|
|
|
if (compression != NULL)
|
|
|
|
*compression = ntohl(header.compression);
|
|
|
|
|
|
|
|
if ((fileout = tmpnam(NULL)) == NULL || (fdout = open(fileout,O_WRONLY | O_CREAT,0444)) == -1)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"Can not open file `%s': %s!\n",fileout, strerror(errno));
|
|
|
|
close(fdin);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
while((len = read(fdin,string,BUFSIZ)) > 0)
|
|
|
|
{
|
|
|
|
if (write(fdout,string,len) != len)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"Can not write to file `%s': %s!\n",fileout, strerror(errno));
|
|
|
|
close(fdout);
|
|
|
|
close(fdin);
|
|
|
|
unlink(fileout);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close(fdout);
|
1997-06-15 23:49:28 +00:00
|
|
|
|
|
|
|
if (len < 0)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"Can not read from file `%s': %s!\n",file, strerror(errno));
|
|
|
|
close(fdin);
|
|
|
|
unlink(fileout);
|
|
|
|
return NULL;
|
|
|
|
}
|
1997-05-25 19:40:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
close(fdin);
|
|
|
|
return fileout;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1998-03-29 19:54:04 +00:00
|
|
|
static int htoi(char *s)
|
|
|
|
{
|
|
|
|
int value;
|
|
|
|
char c;
|
|
|
|
|
|
|
|
c = s[0];
|
|
|
|
if (isupper(c))
|
|
|
|
c = tolower(c);
|
|
|
|
value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16;
|
|
|
|
|
|
|
|
c = s[1];
|
|
|
|
if (isupper(c))
|
|
|
|
c = tolower(c);
|
|
|
|
value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10;
|
|
|
|
|
|
|
|
return (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char *url_unescape(char *str)
|
|
|
|
{
|
|
|
|
char *RetCode = str;
|
|
|
|
char *dest = str;
|
|
|
|
|
|
|
|
while (str[0])
|
|
|
|
{
|
|
|
|
if (str[0] == '+')
|
|
|
|
dest[0] = ' ';
|
|
|
|
else if (str[0] == '%' && isxdigit(str[1]) && isxdigit(str[2]))
|
|
|
|
{
|
|
|
|
dest[0] = (unsigned char) htoi(str + 1);
|
|
|
|
str += 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
dest[0] = str[0];
|
|
|
|
|
|
|
|
str++;
|
|
|
|
dest++;
|
|
|
|
}
|
|
|
|
|
|
|
|
dest[0] = '\0';
|
|
|
|
|
|
|
|
return RetCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
int new_args(int *nargc, char ***nargv)
|
|
|
|
{
|
|
|
|
int index = *nargc;
|
|
|
|
int index2 = 1;
|
|
|
|
char **h_args;
|
|
|
|
char *h_env;
|
|
|
|
|
|
|
|
if ((h_env = getenv(H_ENV_VAR)) == NULL)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if ((h_args = get_http_args(h_env,&index)) == NULL)
|
|
|
|
return 2;
|
|
|
|
|
|
|
|
while (index2 < *nargc)
|
|
|
|
h_args[index++] = (*nargv)[index2++];
|
|
|
|
|
|
|
|
h_args[0] = (*nargv)[0];
|
|
|
|
h_args[index] = NULL;
|
|
|
|
|
|
|
|
*nargc = index;
|
|
|
|
*nargv = h_args;
|
|
|
|
|
|
|
|
unlink("/tmp/iii");
|
|
|
|
{
|
|
|
|
FILE *fp = fopen("/tmp/iii","w");
|
|
|
|
for(index2=0;index2 < index;index2++)
|
|
|
|
{
|
|
|
|
fputs(h_args[index2],fp);
|
|
|
|
fputs("*\n",fp);
|
|
|
|
}
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static char **get_http_args(char *str, int *index)
|
|
|
|
{
|
|
|
|
char **RetCode = NULL;
|
|
|
|
|
|
|
|
if (index == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (*index < 0)
|
|
|
|
*index = 0;
|
|
|
|
|
|
|
|
str = url_unescape(strdup(str));
|
|
|
|
|
|
|
|
if (str == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (str == '\0')
|
|
|
|
{
|
|
|
|
free(str);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((RetCode = (char**) calloc(20+(*index),sizeof(char*))) == NULL)
|
|
|
|
{
|
|
|
|
print_msg(PRT_ERR,"%s\n", strerror(errno));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*index = 1;
|
|
|
|
RetCode[0] = NULL;
|
|
|
|
|
|
|
|
RetCode[(*index)++] = str;
|
|
|
|
|
|
|
|
while(*str != '\0')
|
|
|
|
{
|
|
|
|
if (*str == ' ' || *str == '=')
|
|
|
|
{
|
|
|
|
*str++ = '\0';
|
|
|
|
|
|
|
|
if (*str != ' ' && *str != '=' && *str != '\0')
|
|
|
|
RetCode[(*index)++] = str;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
str++;
|
|
|
|
}
|
|
|
|
|
|
|
|
RetCode[*index] = NULL;
|
|
|
|
|
|
|
|
return RetCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
static int find_format_length(char *string)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
char type;
|
|
|
|
char* dest;
|
|
|
|
|
|
|
|
if (string == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
while (*string != '\0')
|
|
|
|
{
|
|
|
|
if (*string++ == '%')
|
|
|
|
{
|
1998-09-22 21:06:50 +00:00
|
|
|
if (*string == '%')
|
|
|
|
{
|
|
|
|
string++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
1998-09-22 20:58:41 +00:00
|
|
|
while(index("0123456789-",*string)) string++;
|
|
|
|
|
|
|
|
if (*string == '\0')
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (*string == '.')
|
|
|
|
{
|
|
|
|
if (sscanf(++string,"%d%c",&len,&type) == 2 && type == 's' && len >= 0)
|
|
|
|
{
|
|
|
|
if ((dest = index(--string,'s')) == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
memmove(string,dest,strlen(dest)+1);
|
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*string == 's')
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else if (*string == 's')
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static int app_fmt_string(char *target, int targetlen, char *fmt, int condition, char *value)
|
|
|
|
{
|
|
|
|
char tmpfmt[BUFSIZ];
|
1998-10-03 15:21:48 +00:00
|
|
|
char tmpvalue[BUFSIZ];
|
1998-09-22 20:58:41 +00:00
|
|
|
int len;
|
|
|
|
|
|
|
|
strcpy(tmpfmt,fmt);
|
1998-10-03 15:21:48 +00:00
|
|
|
strcpy(tmpvalue,value);
|
1998-09-22 20:58:41 +00:00
|
|
|
len = find_format_length(tmpfmt);
|
|
|
|
|
1998-10-03 15:21:48 +00:00
|
|
|
if (len != -1 && len > 0 && strlen(tmpvalue) > len)
|
|
|
|
tmpvalue[len] = '\0';
|
1998-09-22 20:58:41 +00:00
|
|
|
|
1998-10-03 15:21:48 +00:00
|
|
|
value = condition?html_conv(tmpvalue):tmpvalue;
|
1998-09-22 20:58:41 +00:00
|
|
|
|
|
|
|
return snprintf(target,targetlen,tmpfmt,value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|