/isdn4k-utils-CVS-2010-05-01-patched/isdnlog/tools/tools.h

# · C Header · 1313 lines · 534 code · 114 blank · 665 comment · 0 complexity · a9c2deac5a772305e002a3ade9c0aa30 MD5 · raw file

  1. /* $Id: tools.h,v 1.65 2007/01/05 04:23:58 tobiasb Exp $
  2. *
  3. * ISDN accounting for isdn4linux.
  4. *
  5. * Copyright 1995 .. 2000 by Andreas Kool (akool@isdn4linux.de)
  6. * and Stefan Luethje (luethje@sl-gw.lake.de)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2, or (at your option)
  11. * any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. *
  22. * $Log: tools.h,v $
  23. * Revision 1.65 2007/01/05 04:23:58 tobiasb
  24. * Made isdnrep and isdnrate buildable under cygwin. See ChangeLog for details.
  25. *
  26. * Revision 1.64 2005/02/23 14:33:40 tobiasb
  27. * New feature: provider skipping.
  28. * Certain providers can be completely ignored (skipped) when loading the
  29. * rate-file. The selection is done by Q: tags in rate.conf or by skipProv=
  30. * in the parameter file. The syntax is explained in the new manual page
  31. * rate.conf(5). Absurd settings for provider skipping may cause trouble.
  32. * The version number will change to 4.70 in a few days after an update
  33. * of the rate-de.dat.
  34. *
  35. * Revision 1.63 2004/09/29 21:02:02 tobiasb
  36. * Changed handling of multiple "calling party number" information elements.
  37. * The network provided number is now preferred in any case. The other
  38. * number (typical set by originating user) can be ignored using the
  39. * ignoreCOLP or -U setting, which allows different values for COLP and CLIP
  40. * now. (The old behaviour was to use the first number if ignoreCOLP was set
  41. * and the network provided number regardless of order otherwise.)
  42. *
  43. * Revision 1.62 2004/09/05 22:04:57 tobiasb
  44. * New parameter file entry "ignoreUPD" for suppressing "Unexpected
  45. * discrimator (...)" messages, demanded by Günther J. Niederwimmer
  46. * on the suse-isdn mailing list.
  47. *
  48. * Revision 1.61 2004/07/24 16:16:56 tobiasb
  49. * New entry `REPOPTIONS' in section [ISDNLOG] of the isdn configuration
  50. * file. This will be used for commandline options defaults of isdnrep.
  51. *
  52. * Revision 1.60 2004/01/28 14:27:47 tobiasb
  53. * Second step in restricting fds at isdnlog restart and script starting.
  54. * The fd limit is now taken from getrlimit() instead of NR_OPEN.
  55. * Close_Fds(first) which tries to close all possible fds is generally
  56. * built in but the execution must be requested with "closefds=yes" in
  57. * the parameterfile otherwise the isdnlog behaviour remains unchanged.
  58. *
  59. * Revision 1.59 2003/08/26 19:46:13 tobiasb
  60. * isdnlog-4.66:
  61. * - Added support for AVM B1 (with layer 2 d-channel trace) in point-to-
  62. * point mode, where only TEI 0 is used ("Anlagenanschluss" in German).
  63. * Many thanks to Klaus Heske for his testing efforts.
  64. * - The source number "0" in outgoing calls is now expanded to
  65. * +<country><area>0. This may be useful for point-to-point setups,
  66. * when <area> contains area code and local number without extension.
  67. * - Basic support for different codesets in (E)DSS1 messages. Except
  68. * for codeset 0, unknown information elements are now silently
  69. * ignored (controlled by ignore_unknown_IE in isdnlog/isdnlog.h).
  70. * - Added some information elements to isdnlog/messages.c.
  71. * - Increased the length of msn (local number) in struct telnum.
  72. * - Fixed seperation of country and area code for long numbers
  73. * in getDest, tools/dest.c.
  74. * - Changed broken (with gcc 2.95.2) generation of .depend. The old
  75. * output did not consider the location of objectfiles in subdirs.
  76. * Remove this file before compiling this upgraded isdnlog.
  77. * - Moved DUALFIX... defines from tools/tools.h to isdnlog/isdnlog.h.
  78. * - Added missing R:-Links for cellphone entries in country-de.dat.
  79. * - Different entry for each city "Neustadt" in tools/zone/de/code.
  80. * - Earlier changes since isdnlog-4.65:
  81. * - Allow dualmode workaround 0x100 (DUALFIX_DESTNUM) to work also with
  82. * CALL_PROCEEDING messages for cleaning up unanswered incoming calls.
  83. *
  84. * Revision 1.58 2003/07/25 22:18:04 tobiasb
  85. * isdnlog-4.65:
  86. * - New values for isdnlog option -2x / dual=x with enable certain
  87. * workarounds for correct logging in dualmode in case of prior
  88. * errors. See `man isdnlog' and isdnlog/processor.c for details.
  89. * - New isdnlog option -U2 / ignoreCOLP=2 for displaying ignored
  90. * COLP information.
  91. * - Improved handling of incomplete D-channel frames.
  92. * - Increased length of number aliases shown immediately by isdnlog.
  93. * Now 127 instead of 32 chars are possible. (Patch by Jochen Erwied.)
  94. * - The zone number for an outgoing call as defined in the rate-file
  95. * is written to the logfile again and used by isdnrep
  96. * - Improved zone summary of isdnrep. Now the real zone numbers as
  97. * defined in the rate-file are shown. The zone number is taken
  98. * from the logfile as mentioned before or computed from the current
  99. * rate-file. Missmatches are indicated with the chars ~,+ and *,
  100. * isdnrep -v ... explains the meanings.
  101. * - Fixed provider summary of isdnrep. Calls should no longer be
  102. * treated wrongly as done via the default (preselected) provider.
  103. * - Fixed the -pmx command line option of isdnrep, where x is the xth
  104. * defined [MSN].
  105. * - `make install' restarts isdnlog after installing the data files.
  106. * - A new version number generates new binaries.
  107. * - `make clean' removes isdnlog/isdnlog/ilp.o when called with ILP=1.
  108. *
  109. * Revision 1.57 2000/09/05 08:05:03 paul
  110. * Now isdnlog doesn't use any more ISDN_XX defines to determine the way it works.
  111. * It now uses the value of "COUNTRYCODE = 999" to determine the country, and sets
  112. * a variable mycountrynum to that value. That is then used in the code to set the
  113. * way isdnlog works.
  114. * It works for me, please check it! No configure.in / doc changes yet until
  115. * it has been checked to work.
  116. * So finally a version of isdnlog that can be compiled and distributed
  117. * internationally.
  118. *
  119. * Revision 1.56 2000/08/06 13:06:53 akool
  120. * isdnlog-4.38
  121. * - isdnlog now uses ioctl(IIOCNETGPN) to associate phone numbers, interfaces
  122. * and slots in "/dev/isdninfo".
  123. * This requires a Linux-Kernel 2.2.12 or better.
  124. * Support for older Kernel's are implemented.
  125. * If IIOCNETGPN is available, the entries "INTERFACE = xxx" in
  126. * "/etc/isdn/isdn.conf" are obsolete.
  127. * - added 01013:Tele2 totally Freecall on 12. and 13. August 2000
  128. * - resolved *any* warning's from "rate-de.dat" (once more ...)
  129. * - Patch from oliver@escape.de (Oliver Wellnitz) against
  130. * "Ziffernwahl verschluckt Nummern"
  131. *
  132. * **Please "make clean" before using this version of isdnlog!!**
  133. *
  134. * Revision 1.55 2000/06/29 17:38:28 akool
  135. * - Ported "imontty", "isdnctrl", "isdnlog", "xmonisdn" and "hisaxctrl" to
  136. * Linux-2.4 "devfs" ("/dev/isdnctrl" -> "/dev/isdn/isdnctrl")
  137. *
  138. * Revision 1.54 2000/03/09 18:50:03 akool
  139. * isdnlog-4.16
  140. * - isdnlog/samples/isdn.conf.no ... changed VBN
  141. * - isdnlog/isdnlog/isdnlog.c .. ciInterval
  142. * - isdnlog/isdnlog/processor.c .. ciInterval
  143. * - isdnlog/tools/tools.h .. ciInterval, abclcr conf option
  144. * - isdnlog/tools/isdnconf.c .. ciInterval, abclcr conf option
  145. * - isdnlog/tools/isdnrate.c .. removed a warning
  146. * - isdnlog/NEWS ... updated
  147. * - isdnlog/README ... updated
  148. * - isdnlog/isdnlog/isdnlog.8.in ... updated
  149. * - isdnlog/isdnlog/isdnlog.5.in ... updated
  150. * - isdnlog/samples/provider ... NEW
  151. *
  152. * ==> Please run a make clean, and be sure to read isdnlog/NEWS for changes
  153. * ==> and new features.
  154. *
  155. * Revision 1.53 2000/03/06 07:03:21 akool
  156. * isdnlog-4.15
  157. * - isdnlog/tools/tools.h ... moved one_call, sum_calls to isdnrep.h
  158. * ==> DO A 'make clean' PLEASE
  159. * - isdnlog/tools/telnum.c ... fixed a small typo
  160. * - isdnlog/isdnrep/rep_main.c ... incl. dest.h
  161. * - isdnlog/isdnrep/isdnrep.c ... fixed %l, %L
  162. * - isdnlog/isdnrep/isdnrep.h ... struct one_call, sum_calls are now here
  163. *
  164. * Support for Norway added. Many thanks to Tore Ferner <torfer@pvv.org>
  165. * - isdnlog/rate-no.dat ... NEW
  166. * - isdnlog/holiday-no.dat ... NEW
  167. * - isdnlog/samples/isdn.conf.no ... NEW
  168. * - isdnlog/samples/rate.conf.no ... NEW
  169. *
  170. * Revision 1.52 2000/02/11 10:41:53 akool
  171. * isdnlog-4.10
  172. * - Set CHARGEINT to 11 if < 11
  173. * - new Option "-dx" controls ABC_LCR feature (see README for infos)
  174. * - new rates
  175. *
  176. * Revision 1.51 1999/12/31 13:57:20 akool
  177. * isdnlog-4.00 (Millenium-Edition)
  178. * - Oracle support added by Jan Bolt (Jan.Bolt@t-online.de)
  179. * - resolved *any* warnings against rate-de.dat
  180. * - Many new rates
  181. * - CREDITS file added
  182. *
  183. * Revision 1.50 1999/11/02 21:01:58 akool
  184. * isdnlog-3.62
  185. * - many new rates
  186. * - next try to fix "Sonderrufnummern"
  187. *
  188. * Revision 1.49 1999/10/29 19:46:01 akool
  189. * isdnlog-3.60
  190. * - sucessfully ported/tested to/with:
  191. * - Linux-2.3.24 SMP
  192. * - egcs-2.91.66
  193. * using -DBIG_PHONE_NUMBERS
  194. *
  195. * - finally added working support for HFC-card in "echo mode"
  196. * try this:
  197. * hisaxctrl bri 10 1
  198. * hisaxctrl bri 12 1
  199. * isdnlog -21 -1
  200. * -----------------^^ new option
  201. *
  202. * Revision 1.48 1999/10/25 18:30:04 akool
  203. * isdnlog-3.57
  204. * WARNING: Experimental version!
  205. * Please use isdnlog-3.56 for production systems!
  206. *
  207. * Revision 1.47 1999/06/28 19:16:54 akool
  208. * isdnlog Version 3.38
  209. * - new utility "isdnrate" started
  210. *
  211. * Revision 1.46 1999/06/16 23:38:09 akool
  212. * fixed zone-processing
  213. *
  214. * Revision 1.45 1999/06/15 20:05:22 akool
  215. * isdnlog Version 3.33
  216. * - big step in using the new zone files
  217. * - *This*is*not*a*production*ready*isdnlog*!!
  218. * - Maybe the last release before the I4L meeting in Nuernberg
  219. *
  220. * Revision 1.44 1999/06/13 14:08:28 akool
  221. * isdnlog Version 3.32
  222. *
  223. * - new option "-U1" (or "ignoreCOLP=1") to ignore CLIP/COLP Frames
  224. * - TEI management decoded
  225. *
  226. * Revision 1.43 1999/06/03 18:51:25 akool
  227. * isdnlog Version 3.30
  228. * - rate-de.dat V:1.02-Germany [03-Jun-1999 19:49:22]
  229. * - small fixes
  230. *
  231. * Revision 1.42 1999/05/22 10:19:36 akool
  232. * isdnlog Version 3.29
  233. *
  234. * - processing of "sonderrufnummern" much more faster
  235. * - detection for sonderrufnummern of other provider's implemented
  236. * (like 01929:FreeNet)
  237. * - Patch from Oliver Lauer <Oliver.Lauer@coburg.baynet.de>
  238. * - Patch from Markus Schoepflin <schoepflin@ginit.de>
  239. * - easter computing corrected
  240. * - rate-de.dat 1.02-Germany [22-May-1999 11:37:33] (from rate-CVS)
  241. * - countries-de.dat 1.02-Germany [22-May-1999 11:37:47] (from rate-CVS)
  242. * - new option "-B" added (see README)
  243. * (using "isdnlog -B16 ..." isdnlog now works in the Netherlands!)
  244. *
  245. * Revision 1.41 1999/05/13 11:40:11 akool
  246. * isdnlog Version 3.28
  247. *
  248. * - "-u" Option corrected
  249. * - "ausland.dat" removed
  250. * - "countries-de.dat" fully integrated
  251. * you should add the entry
  252. * "COUNTRYFILE = /usr/lib/isdn/countries-de.dat"
  253. * into section "[ISDNLOG]" of your config file!
  254. * - rate-de.dat V:1.02-Germany [13-May-1999 12:26:24]
  255. * - countries-de.dat V:1.02-Germany [13-May-1999 12:26:26]
  256. *
  257. * Revision 1.40 1999/05/09 18:24:31 akool
  258. * isdnlog Version 3.25
  259. *
  260. * - README: isdnconf: new features explained
  261. * - rate-de.dat: many new rates from the I4L-Tarifdatenbank-Crew
  262. * - added the ability to directly enter a country-name into "rate-xx.dat"
  263. *
  264. * Revision 1.39 1999/05/04 19:33:50 akool
  265. * isdnlog Version 3.24
  266. *
  267. * - fully removed "sondernummern.c"
  268. * - removed "gcc -Wall" warnings in ASN.1 Parser
  269. * - many new entries for "rate-de.dat"
  270. * - better "isdnconf" utility
  271. *
  272. * Revision 1.38 1999/04/30 19:08:27 akool
  273. * isdnlog Version 3.23
  274. *
  275. * - changed LCR probing duration from 181 seconds to 153 seconds
  276. * - "rate-de.dat" filled with May, 1. rates
  277. *
  278. * Revision 1.37 1999/04/16 14:40:07 akool
  279. * isdnlog Version 3.16
  280. *
  281. * - more syntax checks for "rate-xx.dat"
  282. * - isdnrep fixed
  283. *
  284. * Revision 1.36 1999/04/14 13:17:30 akool
  285. * isdnlog Version 3.14
  286. *
  287. * - "make install" now install's "rate-xx.dat", "rate.conf" and "ausland.dat"
  288. * - "holiday-xx.dat" Version 1.1
  289. * - many rate fixes (Thanks again to Michael Reinelt <reinelt@eunet.at>)
  290. *
  291. * Revision 1.35 1999/04/10 16:36:48 akool
  292. * isdnlog Version 3.13
  293. *
  294. * WARNING: This is pre-ALPHA-dont-ever-use-Code!
  295. * "tarif.dat" (aka "rate-xx.dat"): the next generation!
  296. *
  297. * You have to do the following to test this version:
  298. * cp /usr/src/isdn4k-utils/isdnlog/holiday-de.dat /etc/isdn
  299. * cp /usr/src/isdn4k-utils/isdnlog/rate-de.dat /usr/lib/isdn
  300. * cp /usr/src/isdn4k-utils/isdnlog/samples/rate.conf.de /etc/isdn/rate.conf
  301. *
  302. * After that, add the following entries to your "/etc/isdn/isdn.conf" or
  303. * "/etc/isdn/callerid.conf" file:
  304. *
  305. * [ISDNLOG]
  306. * SPECIALNUMBERS = /usr/lib/isdn/sonderrufnummern.dat
  307. * HOLIDAYS = /usr/lib/isdn/holiday-de.dat
  308. * RATEFILE = /usr/lib/isdn/rate-de.dat
  309. * RATECONF = /etc/isdn/rate.conf
  310. *
  311. * Please replace any "de" with your country code ("at", "ch", "nl")
  312. *
  313. * Good luck (Andreas Kool and Michael Reinelt)
  314. *
  315. * Revision 1.34 1999/04/03 12:47:50 akool
  316. * - isdnlog Version 3.12
  317. * - "%B" tag in ILABEL/OLABEL corrected
  318. * - isdnlog now register's incoming calls when there are no free B-channels
  319. * (idea from sergio@webmedia.es)
  320. * - better "samples/rate.conf.de" (suppress provider without true call-by-call)
  321. * - "tarif.dat" V:1.17 [03-Apr-99]
  322. * - Added EWE-Tel rates from Reiner Klaproth <rk1@msjohan.dd.sn.schule.de>
  323. * - isdnconf can now be used to generate a Least-cost-router table
  324. * (try "isdnconf -c .")
  325. * - isdnlog now simulate a RELEASE COMPLETE if nothing happpens after a SETUP
  326. * - CHARGEMAX Patches from Oliver Lauer <Oliver.Lauer@coburg.baynet.de>
  327. *
  328. * Revision 1.33 1999/03/24 19:39:06 akool
  329. * - isdnlog Version 3.10
  330. * - moved "sondernnummern.c" from isdnlog/ to tools/
  331. * - "holiday.c" and "rate.c" integrated
  332. * - NetCologne rates from Oliver Flimm <flimm@ph-cip.uni-koeln.de>
  333. * - corrected UUnet and T-Online rates
  334. *
  335. * Revision 1.32 1999/03/20 16:55:27 akool
  336. * isdnlog 3.09 : support for all Internet-by-call numbers
  337. *
  338. * Revision 1.31 1999/03/20 14:34:17 akool
  339. * - isdnlog Version 3.08
  340. * - more tesion)) Tarife from Michael Graw <Michael.Graw@bartlmae.de>
  341. * - use "bunzip -f" from Franz Elsner <Elsner@zrz.TU-Berlin.DE>
  342. * - show another "cheapest" hint if provider is overloaded ("OVERLOAD")
  343. * - "make install" now makes the required entry
  344. * [GLOBAL]
  345. * AREADIFF = /usr/lib/isdn/vorwahl.dat
  346. * - README: Syntax description of the new "rate-at.dat"
  347. * - better integration of "sondernummern.c" from mario.joussen@post.rwth-aachen.de
  348. * - server.c: buffer overrun fix from Michael.Weber@Post.RWTH-Aachen.DE (Michael Weber)
  349. *
  350. * Revision 1.30 1999/03/15 21:28:54 akool
  351. * - isdnlog Version 3.06
  352. * - README: explain some terms about LCR, corrected "-c" Option of "isdnconf"
  353. * - isdnconf: added a small LCR-feature - simply try "isdnconf -c 069"
  354. * - isdnlog: dont change CHARGEINT, if rate is't known!
  355. * - sonderrufnummern 1.02 [15-Mar-99] :: added WorldCom
  356. * - tarif.dat 1.09 [15-Mar-99] :: added WorldCom
  357. * - isdnlog now correctly handles the new "Ortstarif-Zugang" of UUnet
  358. *
  359. * Revision 1.29 1999/03/14 14:27:37 akool
  360. * - isdnlog Version 3.05
  361. * - new Option "-u1" (or "ignoreRR=1")
  362. * - added version information to "sonderrufnummern.dat"
  363. * - added debug messages if sonderrufnummern.dat or tarif.dat could not be opened
  364. * - sonderrufnummern.dat V 1.01 - new 01805 rates
  365. *
  366. * Revision 1.28 1999/03/07 18:20:11 akool
  367. * - new 01805 tarif of DTAG
  368. * - new March 1999 tarife
  369. * - added new provider "01051 Telecom"
  370. * - fixed a buffer overrun from Michael Weber <Michael.Weber@Post.RWTH-Aachen.DE>
  371. * - fixed a bug using "sondernnummern.c"
  372. * - fixed chargeint change over the time
  373. * - "make install" now install's "sonderrufnummern.dat", "tarif.dat",
  374. * "vorwahl.dat" and "tarif.conf"! Many thanks to
  375. * Mario Joussen <mario.joussen@post.rwth-aachen.de>
  376. * - Euracom Frames would now be ignored
  377. * - fixed warnings in "sondernnummern.c"
  378. * - "10plus" messages no longer send to syslog
  379. *
  380. * Revision 1.27 1999/02/28 19:33:52 akool
  381. * Fixed a typo in isdnconf.c from Andreas Jaeger <aj@arthur.rhein-neckar.de>
  382. * CHARGEMAX fix from Oliver Lauer <Oliver.Lauer@coburg.baynet.de>
  383. * isdnrep fix from reinhard.karcher@dpk.berlin.fido.de (Reinhard Karcher)
  384. * "takt_at.c" fixes from Ulrich Leodolter <u.leodolter@xpoint.at>
  385. * sondernummern.c from Mario Joussen <mario.joussen@post.rwth-aachen.de>
  386. * Reenable usage of the ZONE entry from Schlottmann-Goedde@t-online.de
  387. * Fixed a typo in callerid.conf.5
  388. *
  389. * Revision 1.26 1999/01/24 19:02:51 akool
  390. * - second version of the new chargeint database
  391. * - isdnrep reanimated
  392. *
  393. * Revision 1.25 1999/01/10 15:24:36 akool
  394. * - "message = 0" bug fixed (many thanks to
  395. * Sebastian Kanthak <sebastian.kanthak@muehlheim.de>)
  396. * - CITYWEEKEND via config-file possible
  397. * - fixes from Michael Reinelt <reinelt@eunet.at>
  398. * - fix a typo in the README from Sascha Ziemann <szi@aibon.ping.de>
  399. * - Charge for .at optimized by Michael Reinelt <reinelt@eunet.at>
  400. * - first alpha-Version of the new chargeinfo-Database
  401. * ATTENTION: This version requires the following manual steps:
  402. * cp /usr/src/isdn4k-utils/isdnlog/tarif.dat /usr/lib/isdn
  403. * cp /usr/src/isdn4k-utils/isdnlog/samples/tarif.conf /etc/isdn
  404. *
  405. * Revision 1.24 1998/12/09 20:40:27 akool
  406. * - new option "-0x:y" for leading zero stripping on internal S0-Bus
  407. * - new option "-o" to suppress causes of other ISDN-Equipment
  408. * - more support for the internal S0-bus
  409. * - Patches from Jochen Erwied <mack@Joker.E.Ruhr.DE>, fixes TelDaFax Tarif
  410. * - workaround from Sebastian Kanthak <sebastian.kanthak@muehlheim.de>
  411. * - new CHARGEINT chapter in the README from
  412. * "Georg v.Zezschwitz" <gvz@popocate.hamburg.pop.de>
  413. *
  414. * Revision 1.23 1998/11/24 20:53:10 akool
  415. * - changed my email-adress
  416. * - new Option "-R" to supply the preselected provider (-R24 -> Telepassport)
  417. * - made Provider-Prefix 6 digits long
  418. * - full support for internal S0-bus implemented (-A, -i Options)
  419. * - isdnlog now ignores unknown frames
  420. * - added 36 allocated, but up to now unused "Auskunft" Numbers
  421. * - added _all_ 122 Providers
  422. * - Patch from Jochen Erwied <mack@Joker.E.Ruhr.DE> for Quante-TK-Anlagen
  423. * (first dialed digit comes with SETUP-Frame)
  424. *
  425. * Revision 1.22 1998/11/01 08:50:35 akool
  426. * - fixed "configure.in" problem with NATION_*
  427. * - DESTDIR fixes (many thanks to Michael Reinelt <reinelt@eunet.at>)
  428. * - isdnrep: Outgoing calls ordered by Zone/Provider/MSN corrected
  429. * - new Switch "-i" -> running on internal S0-Bus
  430. * - more providers
  431. * - "sonderrufnummern.dat" extended (Frag Fred, Telegate ...)
  432. * - added AVM-B1 to the documentation
  433. * - removed the word "Teles" from the whole documentation ;-)
  434. *
  435. * Revision 1.21 1998/10/18 20:13:44 luethje
  436. * isdnlog: Added the switch -K
  437. *
  438. * Revision 1.20 1998/09/26 18:30:18 akool
  439. * - quick and dirty Call-History in "-m" Mode (press "h" for more info) added
  440. * - eat's one more socket, Stefan: sockets[3] now is STDIN, FIRST_DESCR=4 !!
  441. * - Support for tesion)) Baden-Wuerttemberg Tarif
  442. * - more Providers
  443. * - Patches from Wilfried Teiken <wteiken@terminus.cl-ki.uni-osnabrueck.de>
  444. * - better zone-info support in "tools/isdnconf.c"
  445. * - buffer-overrun in "isdntools.c" fixed
  446. * - big Austrian Patch from Michael Reinelt <reinelt@eunet.at>
  447. * - added $(DESTDIR) in any "Makefile.in"
  448. * - new Configure-Switches "ISDN_AT" and "ISDN_DE"
  449. * - splitted "takt.c" and "tools.c" into
  450. * "takt_at.c" / "takt_de.c" ...
  451. * "tools_at.c" / "takt_de.c" ...
  452. * - new feature
  453. * CALLFILE = /var/log/caller.log
  454. * CALLFMT = %b %e %T %N7 %N3 %N4 %N5 %N6
  455. * in "isdn.conf"
  456. * - ATTENTION:
  457. * 1. "isdnrep" dies with an seg-fault, if not HTML-Mode (Stefan?)
  458. * 2. "isdnlog/Makefile.in" now has hardcoded "ISDN_DE" in "DEFS"
  459. * should be fixed soon
  460. *
  461. * Revision 1.19 1998/06/21 11:53:27 akool
  462. * First step to let isdnlog generate his own AOCD messages
  463. *
  464. * Revision 1.18 1998/06/07 21:10:02 akool
  465. * - Accounting for the following new providers implemented:
  466. * o.tel.o, Tele2, EWE TEL, Debitel, Mobilcom, Isis, NetCologne,
  467. * TelePassport, Citykom Muenster, TelDaFax, Telekom, Hutchison Telekom,
  468. * tesion)), HanseNet, KomTel, ACC, Talkline, Esprit, Interoute, Arcor,
  469. * WESTCom, WorldCom, Viag Interkom
  470. *
  471. * Code shamelessly stolen from G.Glendown's (garry@insider.regio.net)
  472. * program http://www.insider.org/tarif/gebuehr.c
  473. *
  474. * - Telekom's 10plus implemented
  475. *
  476. * - Berechnung der Gebuehrenzone implementiert
  477. * (CityCall, RegioCall, GermanCall, GlobalCall)
  478. * The entry "ZONE" is not needed anymore in the config-files
  479. *
  480. * you need the file
  481. * http://swt.wi-inf.uni-essen.de/~omatthes/tgeb/vorwahl2.exe
  482. * and the new entry
  483. * [GLOBAL]
  484. * AREADIFF = /usr/lib/isdn/vorwahl.dat
  485. * for that feature.
  486. *
  487. * Many thanks to Olaf Matthes (olaf.matthes@uni-essen.de) for the
  488. * Data-File and Harald Milz for his first Perl-Implementation!
  489. *
  490. * - Accounting for all "Sonderrufnummern" (0010 .. 11834) implemented
  491. *
  492. * You must install the file
  493. * "isdn4k-utils/isdnlog/sonderrufnummern.dat.bz2"
  494. * as "/usr/lib/isdn/sonderrufnummern.dat"
  495. * for that feature.
  496. *
  497. * ATTENTION: This is *NO* production-code! Please test it carefully!
  498. *
  499. * Revision 1.17 1998/03/08 11:43:18 luethje
  500. * I4L-Meeting Wuerzburg final Edition, golden code - Service Pack number One
  501. *
  502. * Revision 1.16 1997/05/29 17:07:30 akool
  503. * 1TR6 fix
  504. * suppress some noisy messages (Bearer, Channel, Progress) - can be reenabled with log-level 0x1000
  505. * fix from Bodo Bellut (bodo@garfield.ping.de)
  506. * fix from Ingo Schneider (schneidi@informatik.tu-muenchen.de)
  507. * limited support for Info-Element 0x76 (Redirection number)
  508. *
  509. * Revision 1.15 1997/05/25 19:41:16 luethje
  510. * isdnlog: close all files and open again after kill -HUP
  511. * isdnrep: support vbox version 2.0
  512. * isdnconf: changes by Roderich Schupp <roderich@syntec.m.EUnet.de>
  513. * conffile: ignore spaces at the end of a line
  514. *
  515. * Revision 1.14 1997/05/15 22:21:49 luethje
  516. * New feature: isdnrep can transmit via HTTP fax files and vbox files.
  517. *
  518. * Revision 1.13 1997/05/09 23:31:00 luethje
  519. * isdnlog: new switch -O
  520. * isdnrep: new format %S
  521. * bugfix in handle_runfiles()
  522. *
  523. * Revision 1.12 1997/05/04 20:20:05 luethje
  524. * README completed
  525. * isdnrep finished
  526. * interval-bug fixed
  527. *
  528. * Revision 1.11 1997/04/20 22:52:36 luethje
  529. * isdnrep has new features:
  530. * -variable format string
  531. * -can create html output (option -w1 or ln -s isdnrep isdnrep.cgi)
  532. * idea and design from Dirk Staneker (dirk.staneker@student.uni-tuebingen.de)
  533. * bugfix of processor.c from akool
  534. *
  535. * Revision 1.10 1997/04/15 22:37:13 luethje
  536. * allows the character `"' in the program argument like the shell.
  537. * some bugfixes.
  538. *
  539. * Revision 1.9 1997/04/03 22:40:21 luethje
  540. * some bugfixes.
  541. *
  542. * Revision 1.8 1997/03/31 22:43:18 luethje
  543. * Improved performance of the isdnrep, made some changes of README
  544. *
  545. * Revision 1.7 1997/03/29 09:24:34 akool
  546. * CLIP presentation enhanced, new ILABEL/OLABEL operators
  547. *
  548. * Revision 1.6 1997/03/23 23:12:05 luethje
  549. * improved performance
  550. *
  551. * Revision 1.5 1997/03/23 21:04:10 luethje
  552. * some bugfixes
  553. *
  554. * Revision 1.4 1997/03/20 22:42:41 akool
  555. * Some minor enhancements.
  556. *
  557. * Revision 1.3 1997/03/20 00:19:18 luethje
  558. * inserted the line #include <errno.h> in avmb1/avmcapictrl.c and imon/imon.c,
  559. * some bugfixes, new structure in isdnlog/isdnrep/isdnrep.c.
  560. *
  561. * Revision 1.2 1997/03/17 23:21:08 luethje
  562. * README completed, new funktion Compare_Sections() written, "GNU_SOURCE 1"
  563. * added to tools.h and a sample file added.
  564. *
  565. * Revision 1.1 1997/03/16 20:59:25 luethje
  566. * Added the source code isdnlog. isdnlog is not working yet.
  567. * A workaround for that problem:
  568. * copy lib/policy.h into the root directory of isdn4k-utils.
  569. *
  570. * Revision 2.6.36 1997/02/10 09:30:43 akool
  571. * MAXCARDS implemented
  572. *
  573. * Revision 2.6.25 1997/01/17 23:30:43 akool
  574. * City Weekend Tarif implemented (Thanks to Oliver Schoett <schoett@muc.de>)
  575. *
  576. * Revision 2.6.20 1997/01/05 20:05:43 akool
  577. * neue "AreaCode" Release implemented
  578. *
  579. * Revision 2.6.15 1997/01/02 19:51:43 akool
  580. * CHARGEMAX erweitert
  581. * CONNECTMAX implementiert
  582. *
  583. * Revision 2.40 1996/06/19 17:45:43 akool
  584. * double2byte(), time2str() added
  585. *
  586. * Revision 2.3.26 1996/05/05 12:07:43 akool
  587. * known.interface added
  588. *
  589. * Revision 2.3.23 1996/04/28 12:16:43 akool
  590. * confdir()
  591. *
  592. * Revision 2.2.5 1996/03/25 19:17:43 akool
  593. * 1TR6 causes implemented
  594. *
  595. * Revision 2.23 1996/03/24 12:11:43 akool
  596. * Explicit decl. of basename() - new "unistd.h" dont have one
  597. *
  598. * Revision 2.15 1996/02/21 20:14:43 akool
  599. *
  600. * Revision 2.12 1996/02/13 20:08:43 root
  601. * Nu geht's (oder?)
  602. *
  603. * Revision 2.12 1996/02/13 20:08:43 root
  604. * Nu geht's (oder?)
  605. *
  606. * Revision 1.2 1996/02/13 20:05:28 root
  607. * so nun gehts
  608. *
  609. * Revision 1.1 1996/02/13 14:28:14 root
  610. * Initial revision
  611. *
  612. * Revision 2.05 1995/02/11 17:10:16 akool
  613. *
  614. */
  615. /****************************************************************************/
  616. #ifndef _TOOLS_H_
  617. #define _TOOLS_H_
  618. /****************************************************************************/
  619. #define _GNU_SOURCE 1
  620. #include <stdio.h>
  621. #include <string.h>
  622. #include <errno.h>
  623. #include <malloc.h>
  624. #include <time.h>
  625. #include <stdlib.h>
  626. #include <stdarg.h>
  627. #include <unistd.h>
  628. #include <sys/time.h>
  629. #include <sys/times.h>
  630. #include <sys/types.h>
  631. #include <sys/stat.h>
  632. #include <sys/wait.h>
  633. #include <sys/socket.h>
  634. #include <netdb.h>
  635. #include <netinet/in.h>
  636. #include <arpa/inet.h>
  637. #include <sys/un.h>
  638. #include <fcntl.h>
  639. #include <ctype.h>
  640. #include <limits.h>
  641. #include <signal.h>
  642. #include <math.h>
  643. #include <syslog.h>
  644. #include <sys/ioctl.h>
  645. #ifdef __linux__
  646. #include <sys/kd.h>
  647. #include <linux/isdn.h>
  648. #else
  649. #include <libgen.h>
  650. #endif
  651. #ifdef DBMALLOC
  652. #include "dbmalloc.h"
  653. #endif
  654. /****************************************************************************/
  655. #include "policy.h"
  656. #include "libisdn.h"
  657. #include "holiday.h"
  658. #include "country.h"
  659. #include "rate.h"
  660. /****************************************************************************/
  661. #ifndef OLDCONFFILE
  662. # define OLDCONFFILE "isdnlog.conf"
  663. #endif
  664. #ifndef RELOADCMD
  665. # define RELOADCMD "reload"
  666. #endif
  667. #ifndef STOPCMD
  668. # define STOPCMD "stop"
  669. #endif
  670. #ifndef REBOOTCMD
  671. # define REBOOTCMD "/sbin/reboot"
  672. #endif
  673. #ifndef LOGFILE
  674. # define LOGFILE "/sbin/reboot"
  675. #endif
  676. /****************************************************************************/
  677. #define LOG_VERSION "3.2"
  678. /****************************************************************************/
  679. #undef min
  680. #undef max
  681. #define max(a,b) (((a) > (b)) ? (a) : (b))
  682. #define min(a,b) (((a) < (b)) ? (a) : (b))
  683. #define abs(x) (((x) < 0) ? -(x) : (x))
  684. #define UNKNOWN -1
  685. #define UNDEFINED -2
  686. /****************************************************************************/
  687. #define MAXDIG 128
  688. #define GETARG(typ) va_arg(ap, typ)
  689. /****************************************************************************/
  690. #define NIL (char **)NULL
  691. /****************************************************************************/
  692. #ifndef ISDN_MSNLEN /* if linux undefined and <linux/isdn.h> not included */
  693. #define ISDN_MSNLEN 32
  694. #endif
  695. #define NUMSIZE (ISDN_MSNLEN + 1)
  696. #define FNSIZE 64
  697. #define RETSIZE 128
  698. #define MAXRET 5
  699. #define MAXPROVIDER 1000
  700. #define MAXZONES 500
  701. #define MAXCHAN 7
  702. #define MAXCARDS 2
  703. #define DIGITS 17
  704. #define DEB 1
  705. #define MAXUNKNOWN 50
  706. #define MAXCONNECTS 50
  707. /****************************************************************************/
  708. #if 0 /* Fixme: remove */
  709. #define SONDERNUMMER -2 /* FIXME: set by readconfig(), but unused by now */
  710. #endif
  711. #define INTERN 0
  712. #define FREECALL 0
  713. #if 0 /* Fixme: remove */
  714. #define LOCALCALL 1
  715. #define CITYCALL 2
  716. #define REGIOCALL 3
  717. #define GERMANCALL 4
  718. #define C_MOBILBOX 10
  719. #define C_NETZ 10
  720. #define D1_NETZ 10
  721. #define D2_NETZ 10
  722. #define E_PLUS_NETZ 10
  723. #define E2_NETZ 10
  724. #define INTERNET 100
  725. #define AUKUNFT_IN 40
  726. #define AUSKUNFT_AUS 41
  727. #endif
  728. /* this is specific to Germany */
  729. #define DTAG 33
  730. #define LCR_DURATION 153
  731. /****************************************************************************/
  732. #define CALLING 0
  733. #define CALLED 1
  734. #define DATETIME 2
  735. /****************************************************************************/
  736. #define DIALOUT 0
  737. #define DIALIN 1
  738. /****************************************************************************/
  739. #define ALERTING 0x01
  740. #define CALL_PROCEEDING 0x02
  741. #define SETUP 0x05
  742. #define SETUP_ACKNOWLEDGE 0x0d
  743. #define SUSPEND 0x25
  744. #define SUSPEND_ACKNOWLEDGE 0x2d
  745. #define RESUME 0x26
  746. #define RESUME_ACKNOWLEDGE 0x2e
  747. #define CONNECT 0x07
  748. #define CONNECT_ACKNOWLEDGE 0x0f
  749. #define FACILITY 0x62
  750. #define NOTIFY 0x6e
  751. #define STATUS 0x7d
  752. #define MAKEL_ACKNOWLEDGE 0x28
  753. #define MAKEL_RESUME_ACK 0x33
  754. #define DISCONNECT 0x45
  755. #define RELEASE 0x4d
  756. #define RELEASE_COMPLETE 0x5a
  757. #define INFORMATION 0x7b
  758. #define AOCD_1TR6 0x6d
  759. /****************************************************************************/
  760. #define AOC_UNITS 0
  761. #define AOC_AMOUNT 1
  762. /****************************************************************************/
  763. #define RING_INCOMING 1
  764. #define RING_OUTGOING 2
  765. #define RING_RING 4
  766. #define RING_CONNECT 8
  767. #define RING_BUSY 16
  768. #define RING_AOCD 32
  769. #define RING_ERROR 64
  770. #define RING_HANGUP 128
  771. #define RING_KILL 256
  772. #define RING_SPEAK 512
  773. #define RING_PROVIDER 1024
  774. #define RING_LOOP 2048
  775. #define RING_UNIQUE 4096
  776. #define RING_INTERVAL 8192
  777. /****************************************************************************/
  778. #define STATE_RING 1 /* "Telefonklingeln" ... jemand ruft an, oder man selbst ruft raus */
  779. #define STATE_CONNECT 2 /* Verbindung */
  780. #define STATE_HANGUP 3 /* Verbindung beendet */
  781. #define STATE_AOCD 100 /* Gebuehrenimpuls _waehrend_ der Verbindung */
  782. #define STATE_CAUSE 101 /* Aussergewoehnliche Cause-Meldungen von der VSt */
  783. #define STATE_TIME 102 /* Uhrzeit-Meldung von der VSt */
  784. #define STATE_BYTE 103 /* Durchsatz-Meldung von Frank (Byte/s/B-Kanal) */
  785. #define STATE_HUPTIMEOUT 104 /* Wechsel des hangup-Timer's */
  786. /****************************************************************************/
  787. #define AOC_OTHER -999999L
  788. /****************************************************************************/
  789. #define QCMASK 0377
  790. #define QUOTE 0200
  791. #define QMASK (QCMASK &~QUOTE)
  792. #define NOT '!'
  793. #if 0 /* Fixme: remove */
  794. #define AVON "avon"
  795. #endif
  796. #define BIGBUFSIZ 2048
  797. /****************************************************************************/
  798. #define VAR_START "START"
  799. #define VAR_MYMSNS "MYMSNS"
  800. #define VAR_MYCOUNTRY "MYAREA"
  801. #define VAR_MYAREA "MYPREFIX"
  802. #define VAR_CURRENCY "CURRENCY"
  803. #define VAR_ILABEL "ILABEL"
  804. #define VAR_OLABEL "OLABEL"
  805. #define VAR_CHARGEMAX "CHARGEMAX"
  806. #define VAR_CONNECTMAX "CONNECTMAX"
  807. #define VAR_BYTEMAX "BYTEMAX"
  808. /****************************************************************************/
  809. #define VERSION_UNKNOWN 0
  810. #define VERSION_EDSS1 1
  811. #define VERSION_1TR6 2
  812. #define DEF_NUM_MSN 3
  813. /****************************************************************************/
  814. #define OTHER (call[chan].dialin ? CALLING : CALLED)
  815. #define ME (call[chan].dialin ? CALLED : CALLING)
  816. #define CLIP 2
  817. #define REDIR 3
  818. #define _OTHER(call) (call->dialin ? CALLING : CALLED)
  819. #define _ME(call) (call->dialin ? CALLED : CALLING)
  820. #define MAXMSNS (REDIR + 1)
  821. /****************************************************************************/
  822. #define SHORT_STRING_SIZE 256
  823. #define LONG_STRING_SIZE 1024
  824. #define BUF_SIZE 4096
  825. /****************************************************************************/
  826. /* Keywords for parameter file */
  827. #define CONF_SEC_OPT "OPTIONS"
  828. #define CONF_ENT_DEV "DEVICE"
  829. #define CONF_ENT_LOG "LOG"
  830. #define CONF_ENT_FLUSH "FLUSH"
  831. #define CONF_ENT_PORT "PORT"
  832. #define CONF_ENT_STDOUT "STDOUT"
  833. #define CONF_ENT_SYSLOG "SYSLOG"
  834. #define CONF_ENT_XISDN "XISDN"
  835. #define CONF_ENT_TIME "TIME"
  836. #define CONF_ENT_CON "CONSOLE"
  837. #define CONF_ENT_START "START"
  838. #define CONF_ENT_THRU "THRUPUT"
  839. #define CONF_ENT_DAEMON "DAEMON"
  840. #define CONF_ENT_PIPE "PIPE"
  841. #define CONF_ENT_BI "BILINGUAL"
  842. #define CONF_ENT_MON "MONITOR"
  843. #define CONF_ENT_HANGUP "HANGUP"
  844. #define CONF_ENT_CALLS "CALLS"
  845. #define CONF_ENT_XLOG "XLOG"
  846. #define CONF_ENT_NL "NEWLINE"
  847. #define CONF_ENT_WIDTH "WIDTH"
  848. #define CONF_ENT_WD "WATCHDOG"
  849. #define CONF_ENT_AMT "AMT"
  850. #define CONF_ENT_DUAL "DUAL"
  851. #define CONF_ENT_Q931 "Q931DUMP"
  852. #define CONF_ENT_OUTFILE "OUTFILE"
  853. #define CONF_ENT_KEYBOARD "KEYBOARD"
  854. #define CONF_ENT_INTERNS0 "INTERNS0"
  855. #define CONF_ENT_PRESELECT "PRESELECTED"
  856. #define CONF_ENT_TRIM "TRIM"
  857. #define CONF_ENT_OTHER "OTHER"
  858. #define CONF_ENT_IGNORERR "IGNORERR"
  859. #define CONF_ENT_IGNORECOLP "IGNORECOLP"
  860. #define CONF_ENT_VBN "VBN"
  861. #define CONF_ENT_VBNLEN "VBNLEN"
  862. #define CONF_ENT_CIINTERVAL "CIINTERVAL"
  863. #define CONF_ENT_ABCLCR "ABCLCR"
  864. #define CONF_ENT_PROVIDERCHANGE "PROVIDERCHANGE"
  865. #define CONF_ENT_CLOSEFDS "CLOSEFDS"
  866. #define CONF_ENT_IGNOREUPD "IGNOREUPD"
  867. #define CONF_ENT_SKIPPROV "SKIPPROV"
  868. /****************************************************************************/
  869. /* Keywords for isdn.conf */
  870. #define CONF_SEC_ISDNLOG "ISDNLOG"
  871. #define CONF_ENT_CHARGE "CHARGEMAX"
  872. #define CONF_ENT_CONNECT "CONNECTMAX"
  873. #define CONF_ENT_BYTE "BYTEMAX"
  874. #define CONF_ENT_CURR "CURRENCY"
  875. #define CONF_ENT_ILABEL "ILABEL"
  876. #define CONF_ENT_OLABEL "OLABEL"
  877. #define CONF_ENT_RELOAD "RELOADCMD"
  878. #define CONF_ENT_STOP "STOPCMD"
  879. #define CONF_ENT_REBOOT "REBOOTCMD"
  880. #define CONF_ENT_LOGFILE "LOGFILE"
  881. #define CONF_SEC_START "START"
  882. #define CONF_SEC_FLAG "FLAG"
  883. #define CONF_ENT_FLAGS "FLAGS"
  884. #define CONF_ENT_PROG "PROGRAM"
  885. #define CONF_ENT_USER "USER"
  886. #define CONF_ENT_GROUP "GROUP"
  887. #define CONF_ENT_INTVAL "INTERVAL"
  888. #define CONF_ENT_TIME "TIME"
  889. #define CONF_ENT_REPFMT "REPFMT"
  890. #define CONF_ENT_REPOPTS "REPOPTIONS"
  891. #define CONF_ENT_CALLFILE "CALLFILE"
  892. #define CONF_ENT_CALLFMT "CALLFMT"
  893. #define CONF_ENT_HOLIFILE "HOLIDAYS"
  894. #define CONF_ENT_DESTFILE "DESTFILE"
  895. #define CONF_ENT_COUNTRYFILE "COUNTRYFILE"
  896. #define CONF_ENT_ZONEFILE "ZONEFILE"
  897. #define CONF_ENT_RATECONF "RATECONF"
  898. #define CONF_ENT_RATEFILE "RATEFILE"
  899. #define CONF_ENT_LCDFILE "LCDFILE"
  900. #define CONF_ENT_VBOXVER "VBOXVERSION"
  901. #define CONF_ENT_VBOXPATH "VBOXPATH"
  902. #define CONF_ENT_VBOXCMD1 "VBOXCMD1"
  903. #define CONF_ENT_VBOXCMD2 "VBOXCMD2"
  904. #define CONF_ENT_MGTYVER "MGETTYVERSION"
  905. #define CONF_ENT_MGTYPATH "MGETTYPATH"
  906. #define CONF_ENT_MGTYCMD "MGETTYCMD"
  907. /****************************************************************************/
  908. #define PRT_ERR 1
  909. #define PRT_WARN 2
  910. #define PRT_INFO 4
  911. #define PRT_PROG_OUT 4
  912. #define PRT_NORMAL 4
  913. #define PRT_LOG 8
  914. /****************************************************************************/
  915. #define NO_MSN -1
  916. #define C_FLAG_DELIM '|'
  917. /****************************************************************************/
  918. #define C_UNKNOWN '?'
  919. #define S_UNKNOWN "UNKNOWN"
  920. /****************************************************************************/
  921. #define S_QUOTES "\\$@;,#"
  922. /****************************************************************************/
  923. #define TYPE_STRING 0
  924. #define TYPE_MESSAGE 1
  925. #define TYPE_ELEMENT 2
  926. #define TYPE_CAUSE 3
  927. #define TYPE_SERVICE 4
  928. /****************************************************************************/
  929. typedef struct {
  930. int state;
  931. int cref;
  932. int tei;
  933. int dialin;
  934. int cause;
  935. int loc;
  936. int aoce;
  937. int traffic;
  938. int channel;
  939. int dialog;
  940. int bearer;
  941. int si1; /* Service Indicator entsprechend i4l convention */
  942. int si11; /* if (si1 == 1) :: 0 = Telefon analog / 1 = Telefon digital */
  943. int logcount; /* number of writen logfile entries (for DUALFIX_MULTLOG) */
  944. char onum[MAXMSNS][NUMSIZE];
  945. int screening;
  946. char num[MAXMSNS][NUMSIZE];
  947. char vnum[MAXMSNS][256];
  948. int provider;
  949. int sondernummer[MAXMSNS];
  950. int local[MAXMSNS];
  951. int intern[MAXMSNS];
  952. char id[32];
  953. char usage[16];
  954. int confentry[MAXMSNS];
  955. time_t time;
  956. time_t connect;
  957. time_t t_duration;
  958. time_t disconnect;
  959. clock_t duration;
  960. int cur_event;
  961. long ibytes;
  962. long obytes;
  963. long libytes;
  964. long lobytes;
  965. double ibps;
  966. double obps;
  967. char areacode[MAXMSNS][NUMSIZE];
  968. char vorwahl[MAXMSNS][NUMSIZE];
  969. char rufnummer[MAXMSNS][NUMSIZE];
  970. char alias[MAXMSNS][RETSIZE];
  971. char area[MAXMSNS][128];
  972. char money[64];
  973. char currency[32];
  974. char msg[BUFSIZ];
  975. int stat;
  976. int version;
  977. int bchan;
  978. double tick;
  979. int chargeint;
  980. int huptimeout;
  981. char service[32];
  982. double pay;
  983. double aocpay;
  984. char digits[NUMSIZE];
  985. int oc3;
  986. int takteChargeInt;
  987. int card;
  988. int knock;
  989. time_t lastcint;
  990. time_t lasteh;
  991. float cint;
  992. int cinth;
  993. int ctakt;
  994. int zone; /* Fixme: zone is in Rate : _zone */
  995. int uid;
  996. int hint;
  997. int tz;
  998. int tarifknown;
  999. RATE Rate;
  1000. char interface[10];
  1001. char fnum[NUMSIZE];
  1002. } CALL;
  1003. /****************************************************************************/
  1004. typedef struct {
  1005. int flag;
  1006. char *time;
  1007. char *infoarg;
  1008. int interval;
  1009. char *user;
  1010. char *group;
  1011. /* char *service; */
  1012. } info_args;
  1013. /****************************************************************************/
  1014. typedef struct {
  1015. char *num;
  1016. char *who;
  1017. int zone;
  1018. int flags;
  1019. int si;
  1020. char *interface;
  1021. info_args **infoargs;
  1022. /* above from "isdnlog.conf" */
  1023. int usage[2];
  1024. double dur[2];
  1025. int eh;
  1026. double pay;
  1027. double charge;
  1028. double rcharge;
  1029. double scharge;
  1030. int day;
  1031. int month;
  1032. double online;
  1033. double sonline;
  1034. double bytes;
  1035. double sbytes;
  1036. double ibytes[2];
  1037. double obytes[2];
  1038. } KNOWN;
  1039. /****************************************************************************/
  1040. typedef struct {
  1041. unsigned long i;
  1042. unsigned long o;
  1043. } IO;
  1044. /****************************************************************************/
  1045. typedef struct {
  1046. char id[20];
  1047. int ch;
  1048. int dr;
  1049. int u;
  1050. int f;
  1051. char n[20];
  1052. } IFO;
  1053. /****************************************************************************/
  1054. #ifdef _TOOLS_C_
  1055. #define _EXTERN
  1056. #else
  1057. #define _EXTERN extern
  1058. _EXTERN char Months[][4];
  1059. #endif /* _TOOLS_C_ */
  1060. _EXTERN KNOWN start_procs;
  1061. _EXTERN KNOWN **known;
  1062. _EXTERN int mymsns;
  1063. _EXTERN int knowns;
  1064. _EXTERN int currency_mode;
  1065. _EXTERN double currency_factor;
  1066. _EXTERN double chargemax;
  1067. _EXTERN double connectmax;
  1068. _EXTERN double bytemax;
  1069. _EXTERN int connectmaxmode;
  1070. _EXTERN int bytemaxmode;
  1071. _EXTERN char *currency;
  1072. _EXTERN int hour;
  1073. _EXTERN int day;
  1074. _EXTERN int month;
  1075. _EXTERN int retnum;
  1076. _EXTERN int ln;
  1077. _EXTERN char retstr[MAXRET + 1][RETSIZE];
  1078. _EXTERN time_t cur_time;
  1079. _EXTERN section *conf_dat;
  1080. _EXTERN char ilabel[256];
  1081. _EXTERN char olabel[256];
  1082. _EXTERN char idate[256];
  1083. _EXTERN CALL call[MAXCHAN];
  1084. #ifdef Q931
  1085. _EXTERN int q931dmp;
  1086. #else
  1087. #define q931dmp 0
  1088. #endif
  1089. #if 0 /* Fixme: remove */
  1090. _EXTERN int CityWeekend;
  1091. #endif
  1092. _EXTERN int preselect;
  1093. /* global variables specific to isdnlog (e.g. for parameterfile/commandline
  1094. * settings) should be moved to isdnlog/isdnlog.h. |TB| 2003-08-22 */
  1095. _EXTERN int dual;
  1096. /* Bitvalues 0x100 and greater in dual are used for activation of workarounds
  1097. * in isdnlog/processor.c. The input value for -2 (commandline) or dual
  1098. * (parameterfile) is splitted between dual and dualfix. Bitvalues less than
  1099. * 0x100 remain unchanged in dual, greater values are copied to dualfix and
  1100. * removed from dual to maintain backward compatibility. |TB| */
  1101. _EXTERN int dualfix;
  1102. _EXTERN int hfcdual;
  1103. _EXTERN int abclcr;
  1104. _EXTERN char * providerchange;
  1105. _EXTERN int ciInterval;
  1106. _EXTERN int ehInterval;
  1107. _EXTERN char mlabel[BUFSIZ];
  1108. _EXTERN char *amtsholung;
  1109. _EXTERN int ignoreRR;
  1110. _EXTERN int ignoreCOLP;
  1111. _EXTERN int ignoreCLIP;
  1112. _EXTERN int interns0;
  1113. _EXTERN char *vbn;
  1114. _EXTERN char *vbnlen;
  1115. _EXTERN char *mynum;
  1116. _EXTERN int myicountry;
  1117. _EXTERN int conf_country; /* replaces the ISDN_xx defines */
  1118. #undef _EXTERN
  1119. /****************************************************************************/
  1120. extern int optind, errno;
  1121. extern char *optarg;
  1122. /****************************************************************************/
  1123. #ifdef _TOOLS_C_
  1124. #define _EXTERN
  1125. _EXTERN char* reloadcmd = RELOADCMD;
  1126. _EXTERN char* stopcmd = STOPCMD;
  1127. _EXTERN char* rebootcmd = REBOOTCMD;
  1128. _EXTERN char* logfile = LOGFILE;
  1129. _EXTERN char* callfile = NULL;
  1130. _EXTERN char* callfmt = NULL;
  1131. _EXTERN char* holifile = NULL;
  1132. _EXTERN char* destfile = NULL;
  1133. _EXTERN char* countryfile = NULL;
  1134. _EXTERN char* zonefile = NULL;
  1135. _EXTERN char* rateconf = NULL;
  1136. _EXTERN char* ratefile = NULL;
  1137. _EXTERN char* lcdfile = NULL;
  1138. _EXTERN int (*_print_msg)(const char *, ...) = printf;
  1139. _EXTERN int use_new_config = 1;
  1140. _EXTERN char ***lineformats = NULL;
  1141. _EXTERN char *vboxpath = NULL;
  1142. _EXTERN char *vboxcommand1 = NULL;
  1143. _EXTERN char *vboxcommand2 = NULL;
  1144. _EXTERN char *mgettypath = NULL;
  1145. _EXTERN char *mgettycommand = NULL;
  1146. _EXTERN char *isdnrep_defopts = NULL;
  1147. #else
  1148. #define _EXTERN extern
  1149. _EXTERN char* reloadcmd;
  1150. _EXTERN char* stopcmd;
  1151. _EXTERN char* rebootcmd;
  1152. _EXTERN char* logfile;
  1153. _EXTERN char* callfile;
  1154. _EXTERN char* callfmt;
  1155. _EXTERN char* holifile;
  1156. _EXTERN char* destfile;
  1157. _EXTERN char* countryfile;
  1158. _EXTERN char* zonefile;
  1159. _EXTERN char* rateconf;
  1160. _EXTERN char* ratefile;
  1161. _EXTERN char* lcdfile;
  1162. _EXTERN int (*_print_msg)(const char *, ...);
  1163. _EXTERN int use_new_config;
  1164. _EXTERN char ***lineformats;
  1165. _EXTERN char *vboxpath;
  1166. _EXTERN char *vboxcommand1;
  1167. _EXTERN char *vboxcommand2;
  1168. _EXTERN char *mgettypath;
  1169. _EXTERN char *mgettycommand;
  1170. _EXTERN char *isdnrep_defopts;
  1171. #endif
  1172. _EXTERN void set_print_fct_for_tools(int (*new_print_msg)(const char *, ...));
  1173. _EXTERN int print_version(char *myname);
  1174. _EXTERN time_t atom(register char *p);
  1175. _EXTERN char *num2nam(char *num, int si);
  1176. _EXTERN char *double2str(double n, int l, int d, int flags);
  1177. _EXTERN char *double2byte(double bytes);
  1178. _EXTERN char *time2str(time_t sec);
  1179. _EXTERN char *double2clock(double n);
  1180. _EXTERN char *vnum(int chan, int who);
  1181. _EXTERN char *i2a(int n, int l, int base);
  1182. _EXTERN int il_printf(char *obuf, int chan, register char *fmt, ...);
  1183. _EXTERN char *qmsg(int type, int version, int val);
  1184. _EXTERN char *Myname;
  1185. _EXTERN char *zonen[MAXZONES];
  1186. #undef _EXTERN
  1187. /****************************************************************************/
  1188. #ifdef _ISDNCONF_C_
  1189. #define _EXTERN
  1190. #else
  1191. #define _EXTERN extern
  1192. #endif
  1193. _EXTERN int readconfig(char *myname);
  1194. _EXTERN void setDefaults(void);
  1195. _EXTERN void discardconfig(void);
  1196. _EXTERN section *read_isdnconf(section **_conf_dat);
  1197. #undef _EXTERN
  1198. /****************************************************************************/
  1199. #endif /* _TOOLS_H_ */