diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2008-05-26 10:40:09 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2008-05-26 10:40:09 +0000 |
commit | 2e598474fa6a089cf784ae7a0dfd29f0af0b1a50 (patch) | |
tree | ce6d26c22aa5ab44c23fab794efd22c6b5bc9c39 /usr.sbin/i4b | |
parent | 50715949692e09308fab9ba413a424e9aeb8d4f5 (diff) | |
download | src-2e598474fa6a089cf784ae7a0dfd29f0af0b1a50.tar.gz src-2e598474fa6a089cf784ae7a0dfd29f0af0b1a50.zip |
Remove ISDN4BSD (I4B) from HEAD as it is not MPSAFE and
parts relied on the now removed NET_NEEDS_GIANT.
Most of I4B has been disconnected from the build
since July 2007 in HEAD/RELENG_7.
This is what was removed:
- configuration in /etc/isdn
- examples
- man pages
- kernel configuration
- sys/i4b (drivers, layers, include files)
- user space tools
- i4b support from ppp
- further documentation
Discussed with: rwatson, re
Notes
Notes:
svn path=/head/; revision=179315
Diffstat (limited to 'usr.sbin/i4b')
114 files changed, 0 insertions, 37457 deletions
diff --git a/usr.sbin/i4b/Makefile b/usr.sbin/i4b/Makefile deleted file mode 100644 index 01f76421a1fa..000000000000 --- a/usr.sbin/i4b/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ - -SUBDIR= dtmfdecode g711conv isdnd isdndebug isdndecode isdnmonitor isdnphone \ - isdntel isdntelctl isdntest isdntrace man - -.include <bsd.subdir.mk> - diff --git a/usr.sbin/i4b/Makefile.inc b/usr.sbin/i4b/Makefile.inc deleted file mode 100644 index 11954191e2ea..000000000000 --- a/usr.sbin/i4b/Makefile.inc +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD$ - -# if you don't like curses stuff in the daemon (i.e. don't intend -# to ever run it in the foreground but are using the monitoring -# utilities instead) define this to compile it without. -#I4B_WITHOUT_CURSES = 1 - -# if you would like monitoring support, define this -I4B_EXTERNAL_MONITOR = 1 - -# for the security conscious type: restrict monitoring to the -# local machine by not compiling any tcp/ip support for monitoring -# at all -#I4B_NOTCPIP_MONITOR = 1 - -.include "${.CURDIR}/../../Makefile.inc" diff --git a/usr.sbin/i4b/dtmfdecode/Makefile b/usr.sbin/i4b/dtmfdecode/Makefile deleted file mode 100644 index 74a9df7cde9d..000000000000 --- a/usr.sbin/i4b/dtmfdecode/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -#--------------------------------------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Tue Dec 14 21:17:46 1999] -# -#--------------------------------------------------------------------------- - -PROG= dtmfdecode - -CFLAGS+= -DDEBUG - -# libm is only necessary if USE_COS is defined in the source -#LDADD= -lm - -test: ${PROG} - uudecode -p < dtmfsounds.al.uu | ./${PROG} - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/dtmfdecode/dtmfdecode.1 b/usr.sbin/i4b/dtmfdecode/dtmfdecode.1 deleted file mode 100644 index 53f673af6e9c..000000000000 --- a/usr.sbin/i4b/dtmfdecode/dtmfdecode.1 +++ /dev/null @@ -1,70 +0,0 @@ -.\" -.\" Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: dtmfdecode.1,v 1.6 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 22:53:13 1999] -.\" -.\" -.Dd February 15, 1999 -.Dt DTMFDECODE 1 -.Os -.Sh NAME -.Nm dtmfdecode -.Nd decodes DTMF tones from A-law audio data -.Sh SYNOPSIS -.Nm -.Sh DESCRIPTION -The -.Nm -utility -is part of the isdn4bsd package and is used to detect DTMF tones in the -audio stream. -.Pp -It reads audio G.711 A-Law coded data from stdin and outputs the detected -numbers values as ASCII characters to stdout. -.Pp -The detector is implemented as 8 narrow band-pass filters realized with -an integer double-cross recursive algorithm. -Various ad-hoc methods are -employed to provide hysteresis and anti-bounce for the detected signals. -.Sh EXAMPLES -The command: -.Bd -literal -offset indent -dtmfdecode < beep.al -.Ed -.Pp -will print a "1" to stdout. -.Sh STANDARDS -ITU Recommendations G.711 -.Sh AUTHORS -.An -nosplit -The -.Nm -utility was written by -.An Poul-Henning Kamp Aq phk@FreeBSD.org . -This man page was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/dtmfdecode/dtmfdecode.c b/usr.sbin/i4b/dtmfdecode/dtmfdecode.c deleted file mode 100644 index 16c68e62e022..000000000000 --- a/usr.sbin/i4b/dtmfdecode/dtmfdecode.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - * - * $Id: dtmfdecode.c,v 1.6 1999/12/13 21:25:24 hm Exp $ - * - * $FreeBSD$ - * - * Extract DTMF signalling from ISDN4BSD A-law coded audio data - * - * A-Law to linear conversion from the sox package. - * - */ - -#include <stdio.h> -#include <math.h> - -/* Integer math scaling factor */ -#define FSC (1<<12) - -/* Alaw parameters */ -#define SIGN_BIT (0x80) /* Sign bit for an A-law byte. */ -#define QUANT_MASK (0xf) /* Quantization field mask. */ -#define SEG_SHIFT (4) /* Left shift for segment number. */ -#define SEG_MASK (0x70) /* Segment field mask. */ - -static int -alaw2linear(a_val) - unsigned char a_val; -{ - int t; - int seg; - - a_val ^= 0x55; - - t = (a_val & QUANT_MASK) << 4; - seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT; - switch (seg) { - case 0: - t += 8; - break; - case 1: - t += 0x108; - break; - default: - t += 0x108; - t <<= seg - 1; - } - return ((a_val & SIGN_BIT) ? t : -t); -} - -#ifdef USE_COS -/* The frequencies we're trying to detect */ -static int dtmf[8] = {697, 770, 852, 941, 1209, 1336, 1477, 1633}; -#else -/* precalculated: p1[kk] = (-cos(2 * 3.141592 * dtmf[kk] / 8000.0) * FSC) */ -static int p1[8] = {-3497, -3369, -3212, -3027, -2384, -2040, -1635, -1164}; -#endif - -/* This is the Q of the filter (pole radius) */ -#define POLRAD .99 - -#define P2 ((int)(POLRAD*POLRAD*FSC)) - -int -main(int argc, char **argv) -{ - int i, kk, t, nn, s, so, ia; - int x, c, d, f, h[8], k[8], n, y[8]; -#ifdef USE_COS - int p1[8]; -#endif - int alaw[256]; - char key[256]; - - for (kk = 0; kk < 8; kk++) { - y[kk] = h[kk] = k[kk] = 0; -#ifdef USE_COS - p1[kk] = (-cos(2 * 3.141592 * dtmf[kk] / 8000.0) * FSC); -#endif - } - - for (i = 0; i < 256; i++) { - key[i] = '?'; - alaw[i] = alaw2linear(i) / (32768/FSC); - } - - /* We encode the tones in 8 bits, translate those to symbol */ - key[0x00] = '\0'; - - key[0x11] = '1'; key[0x12] = '4'; key[0x14] = '7'; key[0x18] = '*'; - key[0x21] = '2'; key[0x22] = '5'; key[0x24] = '8'; key[0x28] = '0'; - key[0x41] = '3'; key[0x42] = '6'; key[0x44] = '9'; key[0x48] = '#'; - key[0x81] = 'A'; key[0x82] = 'B'; key[0x84] = 'C'; key[0x88] = 'D'; - - nn = 0; - ia = 0; - so = 0; - t = 0; - while ((i = getchar()) != EOF) - { - t++; - - /* Convert to our format */ - x = alaw[i]; - - /* Input amplitude */ - if (x > 0) - ia += (x - ia) / 128; - else - ia += (-x - ia) / 128; - - /* For each tone */ - s = 0; - for(kk = 0; kk < 8; kk++) { - - /* Turn the crank */ - c = (P2 * (x - k[kk])) / FSC; - d = x + c; - f = (p1[kk] * (d - h[kk])) / FSC; - n = x - k[kk] - c; - k[kk] = h[kk] + f; - h[kk] = f + d; - - /* Detect and Average */ - if (n > 0) - y[kk] += (n - y[kk]) / 64; - else - y[kk] += (-n - y[kk]) / 64; - - /* Threshold */ - if (y[kk] > FSC/10 && y[kk] > ia) - s |= 1 << kk; - } - - /* Hysteresis and noise supressor */ - if (s != so) { -/* printf("x %d %x -> %x\n",t,so, s); */ - nn = 0; - so = s; - } else if (nn++ == 520 && key[s]) { - putchar(key[s]); -/* printf(" %d %x\n",t,s); */ - } - } - putchar('\n'); - return (0); -} diff --git a/usr.sbin/i4b/dtmfdecode/dtmfsounds.al.uu b/usr.sbin/i4b/dtmfdecode/dtmfsounds.al.uu deleted file mode 100644 index f4e0c07c5763..000000000000 --- a/usr.sbin/i4b/dtmfdecode/dtmfsounds.al.uu +++ /dev/null @@ -1,2098 +0,0 @@ -$FreeBSD$ -begin 666 dtmfsounds.al -M5555U=74U-564-34UU%5U-?1UM'7UM37U=5555145%545%155%555%555=75 -M5575U=75U-15U5555575U575U=75U=75U=34U-35U-35U=75U=55U=5555%0 -MU-374535U-;7T=?6U]?4U-75U555551555555555555555555%5555145=75 -MU-34U-34U-35U=75U=75U=55U=75U=55555555755=5545/4U-=15-37T=;1 -MU];7U]34U=5555555%145%145%555555U555U=55U=34U=75U=75U-75U=35 -MU-74U=74U-75U=75U=75U=55U=75U=564-34UU!4U-36U]'6UM?7U-35U555 -M55555555555455155555555555545%55U-74U-34U-34U=74U-35U=35U=75 -MU=75U=75U=75U=75U590U-374534U-'6T=;6U]?5U-555%145%155%545555 -M5555U555U=75U=74U-5555755=75U=74U=75U=75U=35U=34U=74U-35U=75 -M555545/4U-=15-34T=;1U];7U]34U=55555555555%555%545%555=555575 -M5535U=34U-34U-34U-34U-75U=555555555555555555U=75U=514]34UU%4 -MU-?1UM'6UM?6U-15U51555155514551455555=75U=75U=75U=35U=75U=75 -MU=75U-34U-34U-75U=75U=75U=74U=75U=5555%0U-374535U-'6T=;1UM;4 -MU-75555555145%555555555555555575U5555=75U-34U-34U-74U=75U-74 -MU=75U=5555555=55U=75U=755E#4U-=15-34T=;1UM;7U]34U=5555555514 -M5%555%5555155575U=74U=74U55555555=75U-35U-34U-75U=75U-75U=75 -M5555555555104]74UU%5U-;0UM#6UM?7U=35U-755554551455155%155575 -MU=75U=155U755=75U-34U-34U-34U-75U575U555U=55U5555575U=75U5%3 -MU-375E74U]'6T=?6U]?4U-755=5555145%5555555555U=55U555U575U-55 -MU=75U=75U=34U=35U=75U=75U-75U=74U-75U=75U=7545/4U-=15-74UM36 -MU];7U]34U=75U5555%5455555555555555555%5555=4U=74U-34U]34U-35 -MU=75U=75U555555555555555U555U5564]34UU94U-?1U]'7UM37U-35U=75 -M555555145%5455155575U=75U=75U=?4U=75U=75U=75U=75U=75U-35U-75 -MU=75U=35U=75U=7555%3U-?74534U-;7UM?6U]?7U-35U555555555545%14 -M55555575U=75U5545%55U=74U]?7U-34U-35U=75U=75U=75U=75U=75U=75 -MU=5545/5U-965=?7T=;1U];4U]75U5555555555555155%5555555=75U=35 -MU=74U-75U=75U-74U=75U=75U=35U=35U-74U=75U=75555555514]37UE95 -MU-31UM'7UM?7U-35U-5555555%545%145%155575U575U=345%75U=34U-34 -MU-34U=75U=75U=75U=75555555555=55U575U5%3U-374534U]'6T=;1U]?4 -MU-755554551555555555555555555=75U575U-35U=75U=35U-75U-75U-34 -MU=75U=75U=75U=75U=75U55545/5U-=15-74UM;6U];4U]34U=5555555555 -M55555%1555555=55U=75U5145575U=77U-?7U]34U-35U=75U=75U=55U=55 -MU=75U=75U=564]34UU%4U=36U];7U]37U=35U=75555555555%555%555%55 -M5=75U=75U=34U=55U=75U=75U-75U=74U=74U-35U=75U-34U-75U57555%3 -MU=774534U-'6T=;6U];4U-74U555551555545514555555555=75U=155-75 -MU-34U-34U-35U=75U=75U=755=5555555=75U=755=5545#5U-=15=37T=;1 -MU];7U]74U=5555155%555%155%145575U=75U=75U=74U-35U=75U=35U=75 -MU=74U=75U=75U=74U=75U=55U555U5514]75UU%4U=31U]'7UM?7U-35U555 -M5%1455155%55555555555=75U=355515U=75U-34U-37U-35U=75U=35U-75 -M555555555575U=75U590U-375E77U]'6T=;1U]?4U-755555555555555514 -M555455155555U=55U-35U=75U-74U-74U-74U=75U=75U=35U=75U=75U=55 -MU55545+5U=115-37T=;0UM;7UM37U-15U5555%5455555%555%555=75U575 -MU%54U=75U-75U-34U-35U=75U=74U=74U=75U575U=75U=75U=514-34UU%4 -MU-?1UM'6UM?7U-35U5755555551555145515555555755=75U=34U=75U575 -MU555U=55U=75U=75U=75U=34U-75U=75U=75U590U-?65E37U-'6T=?6U];4 -MU]3555545%145U145%1455555575U=55U=555-75U-34U-37U-34U-34U=35 -MU=75U=75U555555555555=755E#4U]965=37T-;1UM;4U]745=55U5555514 -M5%1455155=755=75U=75U=74U]75U=75U=75U=75U=75U=75U=74U-35U-35 -MU=75U555U5514]75UU%4U-31UM'7UM?7U-?4U-7555555%145%=455555575 -MU=755=755%15U=74U-34U-34U-34U-75U=75U=55U=55U=55U=75U=75U590 -MU]365E77U];6T=?7U=35U5755555555555555%5555555=55U555U=75U-?5 -MU=75U-75U-35U-34U=75U=75U=75U=75U=555=55U=7545/5U-=65=37T=;1 -MU]'7UM34U=7555555%1455555%555555U=755=75U5545=75U-34U-34U-75 -MU=75U=75U=755=75U=55U=75U=75U=564-37UE95U-31UM'6UM?7U-35U=75 -M55555%155%14551555555555U=75U=37U]35U=35U=755=75U=74U-35U-75 -MU=75U=75U=75U=75U5%3U=374534U-;7UM?6U-?4U]345=5555545%545555 -M55555555U555U=555%55U=74U-34U]34U-35U=75U=75U=75U=75U=75U=75 -MU=7545/5U-=15-37T='0UM'7U]34U=35U5555%145%14555455555555U=74 -MU-74U]35U5755555U575U=74U-34U-75U=75U=74U=74U=74U-164]34UU%4 -MU-31U]'6T=?7U-35U=755=75555555545%15551555555575U515U-34U-34 -MU-35U-34U-34U-75U55555555555U=75U=75U590U-364534U-;6T=;1U];7 -MU-7555555555555555555%5555755555U555U=34U=75U-74U-35U=35U-74 -MU-74U-35U=75U=75U=75U=755E#4U-=15-34UM?1U]'7UM?7U-3555555%55 -M55555%155%1555555575U=545=34U-?7U-34U-35U=755=75U=75U=35U=75 -MU=75U=74U=564-37UE94U-31UM'7UM37U-35U%5555545%145%555%555575 -MU=75U=75U=74U]75U=75U-74U=74U=75U=75U=75U=75U=35U=75U=75U5%3 -MU=374534U-'6T=?6U-?4U-7555555%145%145%145%55U575U-75U=355%75 -MU=75U=35U=34U-35U-35U=75U-75U=75U=75U=75U=755E/4U-965=37T=;1 -MUM;7U]74U=75555555545%=45%145%155575U=75U=75U-?5U=75U=34U=75 -MU-?5U-15U]=5U=55U-?4U=355=555%534-54UM57U]'4UM#4U]37U577UE+4 -MU432V5?%4U]40-!5U]I4U%-0U=77UE;3UU/64-'24M'45]W55]'1UU574%'5 -MUM34TU14UU!75E'7UM%5U=!77E=4T=+3W];65%]15U70T=S15%105U16UE!6 -MT]7655Q55%?1U-957UU7V<?;TE]#6=39S=A564-15MS:5]944-95U-=65E%4 -MT=#3UU)45U97U];1UM34U=;0T-564577T-;75%%04577U]?555=75U35U-34 -M55175%555]375=?6T]/755155=75U]15U-37U]545%145=74U=174]75U5%4 -MU-?6U-?4UM#0UM?5U5545=545%975555U=545%75U=755575U=36UM75U555 -M5=7455555=74U]?4U-75U]74U-74U-75U57555%0U=774%15U=;7UM;6U];4 -MU-355=35U=5555175%54557555145=755=355U75U=34U=34U-35U-75U-34 -MU]35U=75U=7555755=75U=555E/5U-=15-37T]'3T=;7U-74U=75U5545%54 -M5555U=755%=45%555%55U575U-?555555=75U=74U-74U-?7U=755=755=55 -MU=75U-34U5514]37UE%4U-?1UM#7UM?7U]?5U=7555555%14555555555%55 -M5=75U=75U515U=74U-37U]34U=755=75U=35U=35U=75U=75U=75U=74U%90 -MU=374577U]'1T-;1UM?4U-755=75U5545%545=55555555555%555=55U=34 -MU=555=75U-35U=75U-74U=74U=35U=74U=74U=75U=755E/5U-=15-34T='1 -MUM'7UM37U=75U555555555145U=45%555=7555555=545-75U-37U]34U-34 -MU-74U=75U-355575U=555=75U=35U=114-34UE%5U]31U]'7T=;4U-15U-55 -MU55555=75555U51555555=75U=35U=74U]355=555=755575U=34U-34U-75 -MU-75U=75U=75U=55U5%3U-375E34U]'6T=?1U]?4U]34U555U5555%145%15 -M55555555U=75U=755535U=37U-34U-35U-35U-75U=55U=75U=75U=75U=34 -MU-755E#4U-=15-37T=;1UM;7U]34U=555555555455155555555455555=75 -MU=75U-;7U-545=36U%35U];65U345U355=35T-?4UE-4U5#0T=154]35U5!7 -MU]71UM37UM745%545=37UM9555=75U35U=34U%575U975577U]355575U=?7 -MUM;7U]34U%555574U=555-75U=35U=74U575U%=1U-774577UM/1T-;7U=55 -MU5755575U5555U145%555=555=55U=75U-35U=74U-75U=75U-74U=74U-74 -MU=74U=75U=34U-?4U=55555545/4U-=15-37T=;1UM;4UM34U=35U5545%14 -M5%15555555555=55U=75U=755%75U=34U-37U-?4U-34U=755=7555555=55 -M5=55U=75U5514M74UU95U-?1UM#6UM?7U=75U-7555545%15555555555555 -MU=75U=74U575U-75U=755=75U=75U=75U=75U=34U-74U=34U=35U=7555!3 -M5=774%?5U]#0T=?6U-?7U]745=7555155554U554U5155555U=75U=3455=5 -MU=34U=34U-34U-74U575U=75U=75U575U=555=75U=5545/5U-915=37T-;0 -MUM'4U]74U554U555555555145%1455555575U555U=74U]?55-?6U=;75=17 -M5];4UM94T=14UU!4U%'7U%?3U%31U==17=57U%=5UM31T-76T]70U=745M75 -M5M945]=75=17U%17U595UU37U%7555545-37U-37U]?4U=34U-34U]545%35 -MU575UM1555155=75U%=3U=?65E35U-?7UM31U];7U-755=555%15U5145514 -M5%35U=75U5555-74U=37U]155=75U=77U]34U-75U=75U=75U=345575U-35 -MU]?55E/5U-105-74UM?1UM'7UM?7U-35U5555%175%555%555555U=75U=75 -MU=355=75U=35U-34U-34U-35U-75U5555=55U5755575U=75U5514M74UE95 -MU-31UM'7T=?7U-35U575555555555%545%145=75U=35U=74U=75U-35U575 -M5575U=74U-34U-35U=75U575U=75U=75U=7555%0U=374574U]'6T-?1U-?4 -MU=755=555555555555555%55555555555=75U515U=74U-34U-34U=34U-35 -MU-75U=75U55555155=75U=755E/4U-965-?4T=;1UM'7UM34U=5555155%14 -M555555555=5555555555U=75U=?7U-35U-75U-35U=35U-75U=35U=75U=75 -MU=75557555514E74UU%4U-?1UM'6T=?6U]?4U=7555155%15555555555554 -M5575U=75U=545-75U=34U-?4U-34U-34U=75U=75U=75U=75U=75U=7555%2 -MU=774537U]'6T-;1U]?4U-755=5555555%545%145%555575U=75U=75U=74 -MU]35U=35U-75U=75U=75U=75U=74U-74U=34U=75U55545/5U]965=34UM;1 -MU];4U]34U=75U5555554555555555555U575U=75U=755%35U=34U]?7U-34 -MU=75U=75U=75U=75U=555=75U=35U=514]34UE95U]?1UM'6T=?7U-?4U-75 -M555555145%145%155555U=75U=74U575U-?4U=75U=75U=55U=75U=75U=34 -MU-74U=34U-35U=75U5%3U=?65E74U]'6T=?7U-?5U-75U555U55555555555 -M555555755=75U=75U5545=75U-34U]?7U]34U=75U=75U=755=555=75U=75 -MU=7545/4U]975=?4T=;1U];4U]34U=75U555555555155555555555555=75 -MU=35U=37U-75U=75U=75U=75U=74U=34U-75U=34U-35U=35U5504E74UU%4 -MU-31UM'6T=?7U=34U=75555555555%54555555555575U=75U=155=75U=35 -MU-34U-34U-35U-75U=75U=75U=75U=75U=75U5%3U=365U77U]'6T=;6U-?4 -MU=75555555555%555%555555U=75U=75U=34U=74U]355=755=75U=75U=75 -MU=75U=75U=74U-34U-35U=7545+5U-965=37T=?1U]?7U]745=75U5555554 -M5%14551455155=75U-34U-34U575U=74U-34U-34U-34U=75U=7555555=55 -MU=75U=55U5104E74UU95U]?1UM#1UM?4U=35U5555555555555145%155575 -MU=75U=35U-55U-35U=75U=75U=75U-75U=75U=75U=34U-34U-34U=7555%2 -MU=375E74U]'6T=?6U-?5U-75U=55U5555554555455555575U=75U=74U554 -M5=75U-34U-34U-34U-75U=75U=75U=75U=75U575U=5545+5U-975=?7T=;1 -MUM;4U]74U=75U5555%1455145555555555555555U=75U=37U-75U=75U=75 -MU=34U=34U-35U-75U=75U=74U=5555504E75UE95U-31UM'6T=?7U-34U-75 -M555555155555555555555555U555U=555%75U=34U-37U-34U=74U-75U=75 -MU=55U=75U=75U=75U593U=?65E74U]'6T=?6U-?4U-755555551555145555 -M5555U=75U=75U=75U575U]35U=75U=75U=75U=75U-34U=75U=75U=74U-35 -MU=355E/5U-965=?7T=;1UM;7U]74U=5555545%145%1455155%555575U=75 -MU=35U555U-34U-34U-34U-74U=35U=75U=75U=75U=75U=75U5514E74UE95 -MU-?1UM'6T=?6U-35U555555555155%5455145%155=75U=75U=75U=?4U=75 -MU=75U=75U=75U=34U=75U=34U-75U-34U=75U%93U-?15U77U]#1T-;6U]?4 -MU-35U55555555%145%155%145%555575U=75U5545=74U-34U]?4U]34U]34 -MU-34U=75U=75U575U575U57545+5U-965=37T=;1U];4U]34U55555545%55 -M55555555U55555755=74U=35U=77U]75U=75U=74U=74U=74U=75U=75U=75 -MU-34U-34U=564]77UE95U-?1UM'7UM37U-35U=755=555%55555555555575 -M55555=55U5755574U-?7U]34U-34U=75U=75U=75U=7555555%155=75U5%3 -MU=365E77U]#6T=;6U]?4U-55555555145%1455555555U5755=755=755575 -MU-34U-74U=34U-35U-35U-75U=75U=35U=74U-75U=755E/5U-965=37T=;1 -MUM;7U-34U555U555551455145%145%545555U=75U=74U%75U-74U-34U=34 -MU=35U-74U=75U=75U=74U=74U=74U-564]37UE95U-?1UM'7UM;7U-35U555 -M5%145%155%55551555555=75U=34U-35U=?7U-35U-75U=75U=75U-74U=75 -MU=75U=74U-35U=74U593U=?15U77U]'7T=?6U-35U-755555555555545%54 -M555555555=75U=75U=555=75U-34U]?7U]?7U]34U=755=55U575U=55U555 -MU57545+5U-965=?7T-;0UM;4U]755555551555555=5555155555U=75U=75 -MU-755574U]75U=75U=75U=74U-74U=75U=75U=74U-34U-35U=564]74UU95 -MU-36UM'7T=?7U-35U575U=5455155%145%155%555=55U=75U=755574U-34 -MU=34U-34U-34U=35U=75U=55U575U575U=755514U=745=75U=35U=34U-34 -MU-75U=75U=74U-75U5755=55U=75U=75U=755555U=35U=755=5555555575 -MU=75U-75U-34U-34U-35U=755%15U-15U=74U-34U-75U=755555U=555=75 -MU5755=75U=75U=74U=35U-75U5545575U=75U=55U=75U=75U-74U=75U575 -MU=74U-74U-555-74U%75U=34U-34U-34U-7555555555U=75U=55U=75U=75 -MU=555=75U=75U=37U=555555U5555=75U-74U-34U-74U=74U=74U=75U554 -MU=355575U=34U-34U-34U-35U=5555555=75U555U=75U=75U=55U5555554 -M5-75U=34U-34U=35U-34U-74U=55U=55U555555555755%35U-15U=75U-74 -MU-34U-35U-75U=7555555=555555U=75U=55U=75U5555574U]35U=555=55 -M5575U=75U=75U575U=755=75555555545-75U%75U-74U=35U=34U=75U-34 -MU-35U=35U=75U=75U5555575U=7555755515U=74U=75U-74U=75U=75U=75 -MU=75U=35U=75U=75U555U=745=74U-35U-74U=75U=55U5555575U=75U=75 -MU=75U=75U=74U=35U555U=34U=75U-35U-75U=75U=75U=75U=74U-74U-35 -MU=755535U=15U=75U-34U=75U=74U=34U=34U=75U=755575U575U=75U=34 -MU55555175555U=75U-35U-34U-35U-75U=75U=74U=75U=75U=555-74U%75 -MU-34U]35U=75U=55U5555555U=75U5555555U=75U=34U-75U=75U=37U]75 -MU=75U=755=75U=75U=75U=74U-34U-34U=5555175=745=74U-34U-34U=75 -MU=555=555575U555U575U=75U=74U-34U-34U5555%35U=37U-?4U]?4U-35 -MU=5555145%155575U=74U-34U574U-15U=74U]37U-35U5555575U=75U=75 -MU-75U55555145575U=75U-75U=74U]?5U-755=55U=75U=75U-34U-34U-15 -MU=75U=75U=355=35U%15U=74U=34U]34U-34U-75U=75U575U=75U=74U=34 -MU=555%145%145%=4U=34U]34U]35U-55U575U=74U=35U=55U555U=75U%55 -MU-375=75U=35U-74U-?4U-35U=75555555555575U=75U=75U=35U-35U=35 -MU=34U=75U=75U=75U=75U=75U=74U=75U=75U-34U5755534U-35U=35U-34 -MU=75U=75U=35U-75U=75U5755=5555555=55U=74U=75U5545=55U-34U-35 -MU-35U=75U555U=75U=75U=74U-35U=545]75U%75U-34U-34U-35U=75U575 -MU=75U=5555555575U=75U=74U-75U575U=74U-555575U=75U575U=75U-34 -MU-35U=74U=74U=75U5545=745=74U-?4U]34U-75U=755=55U=75U5555=75 -MU=75U=75U555U=5555555%35U=34U=74U-74U-75U-75U=75U=75U=755=75 -MU=355%35U=15U=74U-74U-34U-35U=75U5555=75U=75U=75U=75U=55U575 -M5575U=75U-?5U=75U=75U-35U-74U=75U=75U=75U=34U=75U=545-75U%75 -MU=74U=34U-75U=75U=75U=75U=75U=75U-75U=75U=755=55551555=5U=74 -MU-34U-35U=35U=75U=75U=35U=75U=755555U514U-345=74U-34U=34U=75 -MU=75U=5555555575U=75U=75U-75U=75U=75U=35U-?7U-75U=755=755=75 -MU=35U=75U=75U555U=74U-755574U-=55=75U-74U=35U-34U=75U5555555 -M5575U575U=75U5555-74U=55U=555=74U-75U-35U=35U=34U-75U=755575 -MU=755575U=555=75U%75U-74U-?4U]34U=75U=75555555555555U575U=75 -MU=75U=75U=75U=74U]5555555=75U=75U=35U-75U-35U=75U=74U-75U555 -MU=755%55U=75U-35U-35U-34U-74U-74U=75U=75U=75U=75U=75U=755=75 -M5535U=75U=75U=75U=75U=74U-34U=755575U=75U=755575U=155=75U=74 -MU-35U]34U-75U-74U574U=74U=34U=35U=75U=75U=55U575U=?5U=755555 -M5555U5555=75U-75U=34U-34U-74U=555-75U515U=74U=75U-75U=75U=75 -MU5555=555575U=75U=555=755=75U=75U%55U=75U-75U-74U=74U=75U=75 -MU=75U-55U555U575U5545=745-74U-37U]?7U-35U=75U=75U=555555U555 -M5575U=74U=74U-35U=755=77U=75U=34U-75U=75U575U=75U=35U-75U=75 -MU=755574U-?5U=34U-34U=75U=75U=75U=75U=55U5555575U=75U575U=74 -MU-75U=155-75U=34U-34U-74U=75U=5555555=55U=555=55U=555-75U515 -MU=74U-37U-75U=75U=75U=75U=75U=55U=75U=75U=75U=75U=75U574U]75 -M55555%555=75U=74U=35U=75U=75U=74U-75U=54U=345575U=34U-34U=75 -MU-75U575U55555555555U=75U=75U=75U=755=755535U=34U-34U-74U=75 -MU=555555U=75U=75U575U=74U574U-155=74U=34U-35U=34U-75U=75U=75 -M55755=75U=75U=75U=75U=75U=55U=35U55555555555U=75U-74U-35U-75 -MU=75U-34U=355=74U515U=74U=34U-35U=75U=75U-75U=555575U=75U=55 -M55555=75U=75U=545=75U-35U-35U-35U=74U=74U=755=5555555=55U555 -MU-345575U=35U-34U=34U-75U=75U=75U=75U=74U=75U=55U55555555=55 -M5=77U-75U555557555755=75U=75U=75U=75U=35U=755574U-55U=75U-74 -MU=35U=75U=75U-75U-35U=75U57555555=75U=75U55555555U75U=35U-35 -MU-74U=35U=35U=74U=74U-75U-75U%555=74U%74U-?4U-34U=755=75U=55 -M5=55U575U57555555575U=34U-35U=75U=75U]?5U=35U=75U555U=75U=75 -MU=35U=34U=74U=75U555U-345574U=34U-74U=35U=75U=75U=75U=75U=75 -MU=755=555575U=755=7555=45=74U-74U-75U=75U575U=75U=75U=55U575 -MU=755575U=545=74U-34U-?4U-75U=55U55555555=75U-34U-34U-34U=75 -MU=555575U=34U555551555555575U=75U=34U=34U-34U-74U=555=35U575 -MU=34U-34U-34U=35U=75U=755=7555555=55U57555555=755555U=545=75 -MU=75U-34U-35U=3555555=555=75U=75U574U555U=755%75U=35U-34U-35 -MU=75U=35U=75U=75U=75U=55U=55U555U-555555U574U%55555555755=75 -M5555U575U=74U-74U=34U=74U577U-15U=75U-34U-?4U-75U=75U=74U=75 -MU=75U=75U=75U=555575U5555=755%15U=74U-34U-35U-75U=755=75U=35 -MU=75U=75U=555=3555=5U=74U-36U-34U-75U5755=75U=7555555575U=75 -MU=35U=755=75U=55U-?555555=75U-74U-75U5555=75U=34U-34U-74U575 -MU-355%55U=74U-74U=35U=74U=74U-75U=75U=755=75U=75U=75U=755575 -M55145=75U=35U=35U=755=75U575U=74U-75U=5555555%75U555U=74U]34 -MU=34U-35U=75U=55U5755=75U555U=75U=55U575U-755=555=3755555555 -M5=755555U555U=34U]34U-34U-75U=555=55U514U=34U-34U%75U=75U=74 -MU-35U=55557555755=55U=55U=34U=75U=545=75U-?4U-34U-35U=75U=75 -MU555U=75U=75U=75U555U=755%75U=34U-35U-34U=75U=555555U575U=75 -MU=75U575U=75U=555555U=74U]355=55U=55U=74U-34U=75U=75U=75U=34 -MU=355=77U-545=75U=35U=35U-35U-75U575U=75U=75U555U5755575U-75 -MU555U=74U535U=74U-34U=74U=74U-34U=75U=755=75U=75U=555=35U515 -MU=74U-34U]75U=75U=755=75U575U=34U=75U575U555U=75U=75U=75U-35 -MU555555555555=75U=74U-74U-74U-34U-35U=55U-355=55U=55U=755=74 -MU=34U-34U-75U575U=75U=55U555U5555=755575U515U-34U-34U=75U-75 -MU=75U=34U=35U=75U=75U5555574U-54U555U-75U-34U-34U-34U-75U=75 -MU5555%555575U=74U-34U=75U=55U=36U]34U575U5755555U=75U=34U-74 -MU-34U-35U=555=34U%35U=75U=75U=35U-35U-35U=75U575U5555575U575 -MU%75U=755=55U=55U=35U-34U-74U=74U-74U-75U-55U575U5755515U575 -MU-345=55U=34U-37U-35U-55U=75U=75U=7555555=75U=75U=7555555575 -MU=75U]1555755575U575U=75U575U=74U=74U=75U=155=75U=545575U-34 -MU-35U-35U=75U=35U=355=55555555555=55U=75U535U=75U575U=74U-34 -MU-74U-74U=75U=755=55U=35U-55U-555=35U555U=74U=34U-34U-75U=55 -M5=555=555=55U=55U555U555U=75U=75U=75U-35U=755%755=55U=155555 -M5=75U=755=55U=755575U-755%155=75U-37U-?4U=74U=75U=5555555=75 -MU=75U=75U=75U-74U-75U-545=35U=35U=75U=75U-75U=75U=75U=555554 -M5=355574U%545575U-74U-34U-34U-?4U-34U=55557555555575U=74U=75 -MU=75U=355=77U-55U555U575U-75U575U-77U=745575U=555=155-35U515 -MU-75U]34U-75U=75U=75U=74U=75U=55U=35U555U=55U=75U=55U=145=75 -MU-75U-34U-35U%75U-74U=74U=74U=75U=35U=55U=545%35U=34U-34U=34 -MU=155575U=55U=55U=355=755=75U=75U=?5U=35U=55U]?5U575U=74U=74 -M5=345=75U=75U-75U-74U-34U574U-545%75U-75U-75U=74U=74U-35U=35 -MU=75U=75U=75U575U=75U=355=745554U=35U-74U]35U-75U=75U=755=74 -MU=755555U=155=35U575U=74U]34U-35U=75U=75U=55U-75U=7555555555 -MU=55U=75U=75U=75U=34U55555555=75U=55U=75U=75U]34U-75U-34U575 -MU-555%75U-35U-34U-75U=34U=75U555U515U=55U5555=755=75U-74U574 -M5=555=55U-75U-35U-55U5755=755=555=555=15U=55U535U-575575U=77 -MU-74U-35U=755=745575U=55U=75U=555=555=75U=7555555=37U]?5U555 -MU515U=755=74U575U-75U=35U=15U=55U=34U%75U-74U=34U-35U-35U=75 -M5575U5155=75U=35U-5555155574U=77U-?45=75U=75U=75U=34U-37U-74 -MU=75U=5555555575U555U-345-755=74U=75U-35U=745=74U-745=75U=75 -MU=75U=74U=755=755=755575U]?5U=5555555575U-55U=755-775-76U=74 -M5=155=34U==55%755=77U=75U-355=75U=74U-34U=75U555U=74U5755=74 -MU-35U=75U5545=75U-355=?5U=35U-75U575U=75U=34U=755=555=75U535 -MU-34U-34U=75U=355=75U555U-35U-75U=55U555U555U=35U-55U-75U-37 -MU5555555U555U=75U-75U-35U=755555U=755=555=75U=55U-34U]74U575 -MU=75U-75U5555=555=155=55U=55U-55U-155=?6U=54U==5U-15U=75UM?4 -MU537U5755=545-=7U-94U-55U=555=145%74U-35U=?4U-745=555=74U-74 -MU=34U-545517U575U%74U]37U=34U=74U%555%75U=35U=555=34U=15U-35 -MU]75U%75U%755=755535U-76U-34U=355575U555U515U577U=745-745=74 -M5%755=35U=355=755%34U-35U=35U-74U=74U=75U-74U-35U=75U555U514 -MU=755=75U=35U-34U-35U-75U=75U55555555575U=75U=55U=75U5755%15 -M5=75U-?4U=35U=7555555575U5555575U575U575U=755%75U=545=75U-75 -MU-75U-35U-34U-35U=755=55U575U=75U=75U=755=755%1555=45575U=75 -MU-34U-34U=34U=34U-3555755575U=755=75U5755=755=75U=75U=755=75 -M5=75U=555=55U=355=35U=35U-34U%55U=75U=37U-35U=5555555=55U575 -MU575U=74U=34U=15U554U=74U=75U=?4U-355=155=75U=74U-755555U555 -M5575U=555=75U-75U555U=555%75U-74U-34U=75557555755=75U=75U=75 -MU-35U=75U=15U=34U-75U=35U575U57555755=75U=75U=34U=55U=75U=75 -MU=55U=75U=74UM35U=555=75U=75U-75U=75U=74U-35U=75U=555=74U-75 -MU=34U-?4U=155=155-555=75U=75U=55U=55U=75U=75U57555555575U515 -M5=34U-?4U-?4U=555=755=35U=75U=55U=7555755-765-77U=74U577U534 -MU%34U%75U%74U57555555575U=55U=75U=355=555=55U-?5U-75U555U=55 -MU=75U=75U=35U=75U=74U=355555U=15U=34U-?4U=35U=74U=74U=745575 -MU5545=55U=75U=75U=74U-555%75U=55U-35U=75U=35U-35U-75U-55U-74 -MU-75U5555%555-75U575U575U=35U-75U=35U=75U=7555755555U=35U=75 -MU575U=75U5545555U=74U]55U=55U5555=75U=75U=75U=35U=75U-75U%55 -MU=345=74U=75U-75U=75U-74U-75U-75U=555=555=75U=75U555U=555515 -M5=555=74U-?7U]34U-34U-75U=75U=755=5555555=555515U=75U=74U-34 -MU=34U=75U=74U=75U=55U5555=75U=75U=75U=74U=555%15U=75U]34U575 -M55755575U=74U-35U-35U-55U=55U=555=75U-75U-34U=35U=75U=74U=34 -MU=75U=555555U=555575U=75U=34U%545=75U535U-37U-34U=35U=75U=74 -MU=75U575U=555555U555U-74U=74U-34U-34U-35U=75U=74U=75U=74U=75 -M5=75U=755555U-355575U=75U=345=755=75U=75U=75U=55U=75U=75U=35 -MU=345%75U=155=75U=34U-35U-75U=75U=755555U555U=75U=75U=55U=74 -MU-555U15U=555=75U-35U-34U-35U=74U=74U=75U=75U=75U=555=75U-74 -MU-37U]?4U-35U=75U=555555555555355555U=75U=75U=?7U=545=75U=77 -MU]74U=75U575U=755=75U=75U=75U=75U=35U5555=74U=75U-34U-355575 -MU-755=75U-75U555U=555=555=755=75U-?45%355=555=74U-?7U-34U=75 -MU=75U=75U55455555=75U=755535U=555=74U]?7U-34U]34U-75U555U=75 -MU%75555555555=75U=34U]755%15U=75U]?4U=35U=75U=75U=75U=35U-75 -MU=75U=75U-555-74U-75U=75U=34U-74U-75U575U=75U=75U575U575U=55 -M5=75U=37U5175%75U555U-34U-37U-34U-755=555=35U=75U575U555U554 -MU5755=75U=75U=75U=74U=75U=755555U5755=75U=75U=75U=75U-?45U=5 -M5=755=?4U=55U555U=75U=75U-75U=35U=75U=75U-355574U-155=74U-77 -MU-35U=35U=75U=34U=75U=75U=75U=755=555=74U]545U555=155=35U=35 -MU-35U-75U-34U-74U=75U=75U=75U5555%75U575U-74U-34U-34U-74U555 -M555555755575U575U=75U=75U=?7U5575575U=74U-75U=75U=75U=75U=55 -MU=75U=75U=74U-75U=55U=74U574U=34U-34U=35U=75U=35U=74U=75U=75 -MU-75U=55U575U-355%145=555575U=34U-34U-74U-74U-35U=75U-74U-34 -MU=755535U=35U=34U]?7U-35U=5555555555U=555=75U=75U=75U=75U=74 -MU]545U15U=75U];4U-75U=755=75U=75U=35U=75U=75U=75U=555%75U%55 -MU=37U-34U-?55=75U=75U=5555555555U=75U=75U=74U-?7U5175%15U555 -MU-34U]?4U-35U=75U=75U=75U=75U575U=75U555U=755=74U=35U=75U=34 -MU-75U-74U=75U=7555155575U=75U=74U]?45%=455555=77U-75U=75U=75 -MU=75U-75U=35U=75U=75U=755575U-35U=34U]34U=75U=755575U=555=75 -M55555=75U=75U=55U=77U]575U15U=755-77U]355=37U-145-75U-75U=37 -MU-355%!6T]'4UE95T]75U5%4U]?5U5=5U]155515U-155%15U=555=74U-35 -M5=74U-;6U%145%755=77UM?4U=35U=555=74U=35U=34U-75U=75U-35U=55 -MU=74U=74U-55U=74U-75U-74U=74U=755-74U=555=34U=555=75U-145%17 -M5%55U-75U]34U]74U]75U-34U-75U=55U=755575U=555%?5U-155=37UM34 -MU=75U-75U=77U-755575U=755=75U=755%75U=34U-545U545=75U]?4U]?4 -MU%75U-355555U-55U=75U-55U-75U]55U=75UU75U-75U-74U%74U=74U=74 -MU-34U=75U=555515U575U575U-?7U5165%55U557U=74U-34U]34U-355555 -M5=555575U5555515U514U=74U=74U=75U-34U=35U-75U-75U=75U555U=75 -M5575U=75U=75U]?55%=45=75U=?7U-155=55U=155=75U%55U=75U=75U=75 -MU=755555U=35U=34U-75U-355=74U=755-74U5555=75U=555=75U=755=77 -MU]575U145=555=75U]35U-75U-35U-75U-75U=74U-75U=55U=555-75U-75 -MU-34U=35U-35U-34U=7555555%555=75U=55U-55U555U-?7U%175%55U=74 -MUM?4U-75U=75U515U=75U%54U=75U=55U=7555175=345575U-?5U=34U=15 -M5=55U-35U-75U-74U574U57555555=74U]?55%=75%75U575U-77U=34U=75 -MU-35U-55U-55U554U%55U575U535U-35U=75U-74U-34U-75U=74U-75U=74 -MU%54U575U515U-74U%77UM545E=55575U=34U=75U575U555U555U=55U=74 -MU-75U-74U-555575U]74U=76U-77U-775=755%755%755=755=755=155=15 -MU=54U=?7UU565%15U5565-35U-15U-?4U]15U-?5U-14U=55U=54U=75U554 -M5=74U=34U-35U-74U-74U-74U57455755=755%55U=555=15U-35U];455=6 -M5%555=34U]34U=35U=355=75U=75U=34U=355=75U-355515U-75U=74U]?4 -MU=55U-35U=75U-34U=75U575U575U5555=555-77U]545U1455755%77U-?7 -MU=74U-75U=55U=75U575U=75U=75U5555%74U-75U=34U-35U=75U-35U-75 -MU-55U=755555U=755=755=75U=3455175%55U=74UM;4U-745=74U=75U=35 -MU=34U=55U=75U=34U%54U=745575U=74U=34U-35U-35U=75U=75U=75U=75 -MU=755=75U=35U-?55%=45-75U514U=75U]34U-34U-74U575U57555755=75 -M5=755515U=555=75U-34U-35U-75U=55U5755555U=75U=75U5755=75U=74 -MU]545E145555U=34U-75U575U-75U%75U-74U%75U=74U574U=745=74U-74 -MU=74U=34U-75U=75U=755575U=74U=35U=35U=35U=35U-?7U5165%=55=55 -M5=75U-?4U-?4U-34U-75U=75U-75U575U55555145=745=74U-34U-34U=34 -MU-35U=75U=75U=75U=75U=55U=555=75U-?55%=55-75U=74U]75U=55U555 -M5575U=75U-74U-34U-35U=745575U=35U-35U-34U=35U=75U=755555U=75 -MU=5555555575U=75U=74U]545U55U=355574U=34U-34U-34U=75U=75U=55 -MU555555555555575U%75U=74U=35U=75U=35U=75U=75U=555=75U=755=75 -MU=75U-?7U5175%35U=75U-?4U=75U=75U-75U=35U-74U-35U=75U=75U=55 -MU=345=75U=35U=75U=75U=75U-34U=74U-75U=75U=75U=75U=75U-?55U=4 -M5%75U555U=74U-34U-75U-75U=35U=34U=75U=75U=755575U=15U=75U-34 -MU=35U-75U=75U=75U-555=755=555=75U=75U=77U]545E145=555=37U=75 -MU=55U=555=75U=75U=75U=75U=75U=555-75U575U-34U-34U-75U=75U=74 -MU=75U=75U=75U=55U=75U=75U=?7U5175%55U=555-75U-34U-34U-34U-34 -MU=75U-75U=74U-34U=75U=355575U=75U-34U-75U=34U=75U=755=555555 -M55755575U=75U-?55%=45-75U=74U]35U=55U=75U575U=75U=75U555U=75 -MU-34U574U-15U-34U-74U=75U=75U=75U=75U=75U=35U-34U=75U5555=77 -MU]545E145575U575U-34U-34U-34U-35U=75U575U=55U5555=555-75U575 -MU-34U=34U-34U=35U-75U55555555575U=75U=55U555U=?7U5175%155575 -MU=34U=75U=75U=75U=75U-75U=75U=75U=74U-55U-755575U=34U-34U-75 -MU=75U=75U=75U=75U=75U=35U=755=75U-?55%=45%75U554U=34U-35U-34 -MU-34U=74U=75U=55U55555555%35U=555=75U-34U=35U=75U=35U=75U=55 -M5555U555U=75U=75U=74U]545U145=75U=77U]75U=75U=34U=34U=75U=35 -MU=35U=75U=555=75U-75U-34U-35U-35U-35U-7555755=755=75U=555=75 -MU=75U=?7U%175555U=555-75U=34U-34U-34U-74U-75U=75U=75U=34U555 -MU=34U=75U=35U=75U=75U=75U-75U=55U575U=75U=755=75U=75U-?55%=4 -M5%74U=74U]34U=555=75U=75U=75U575U5755=75U=74U575U=55U=74U-34 -MU-35U-75U=75U=75U=75U575U=75U=75U=75U=74U]575U145=74U575U-37 -MU-34U-75U-75U=55U5555555U=7555555-75U5555=74U=35U-34U=75U=35 -MU=75U=55U5555=7555555=75U=34U5175575U=75U=?4U=755=75U=555=75 -MU=75U=75U=75U=75U-55U=345=75U=35U-34U-34U-75U=75U-74U-75U-34 -MU-75U=75U575U-?55%=45-75U=545=75U-35U-35U-35U-75U-75U-74U-75 -MU=755575U=35U=75U-35U-35U=75U555U=75U=75U=74U=75U=755575U=77 -MU]545U145=75U=77U-34U-75U=74U=74U=34U=75U=75U-75U=555%55U555 -MU=74U=35U=75U=75U=74U=34U=75U=75U=75U=75U=75U=?7U5175515U=75 -M5=74U-34U-34U=75U=75U=75U=75U=755=755555U=755=75U=35U-75U=75 -MU=74U=75U5555=755555U5555=75U=75U-355%=45%755=75U-?5U=75U=75 -MU=75U=75U=75U=75U=55U=755575U=55U=74U-34U-34U-34U=35U=75U=55 -MU=5555555=55U=75U=77U]545U55U=74U555U=74U-37U-34U=34U=75U=75 -MU=55U575U5555-75U515U=74U=35U-34U=35U=755575U=35U=7555555554 -M5575U=37U%145575U=75U=37U=75U=75U=75U=75U=75U-35U-74U=75U=55 -MU=755=75U=34U-34U=75U=75U=34U-35U-35U-75U575U575U=74U]?55%=4 -M5%75U=155=35U-35U=75U=75U=75U555U=75U=55U=755575U=555=75U-34 -MU-34U-35U=75U=75U=55U5555=55U=75U=75U=74U]545U145=75U=37U]75 -MU=35U=75U=75U=35U=75U=75U=75U=75U=75U-75U-34U-34U-75U=74U-75 -MU574U=75U=75U=75U-75U=75U=?7U5575555U=7555755=74U=34U-74U=75 -MU=75U-75U=35U=74U555U=34U=34U=35U-35U=35U=55U555U555U=75U=75 -M5555U=55U=75U-?455=45555U=75U]?4U-34U=75U=75U=75U=75U=55U=74 -MU=74U=75U=55U=74U]74U-35U=34U=75U=35U=35U=75U=35U-75U=35U-37 -MUM155%555575U514U=75U-35U-34U-74U=35U=555=75U=75U=555=75U515 -MU=75U=75U=34U=75U=75U=75U=75U=75U575557555555=34U5175%555=75 -MU=37U=75U555U555U=75U=75U=75U-75U=34U-55U=755-75U=35U=74U=55 -MU=75U-35U-74U-35U-75U=75U=75U=75U]?55%=45555U=545-75U-34U-34 -MU-35U=75U=55U=75U=75U5755535U=555=74U-34U-34U=75U=75U=75U=75 -MU575U=75U555U=75U=77U]155%55U=74U=74U]34U-755=755575U=35U=75 -MU=74U=35U-755=75U575U=75U=34U-34U-75U=7555555575U5755575U=55 -MU=75U=34U5=75U155=34U-74U]37U-34U-75U=75U=75U=75U57555555514 -M55755%75U=34U-34U=75U=75U=75U=75U5555=75U=75U=555575U-355%94 -M5575U-75U];4U=755=75U=75U=755=55555555555=75U535U=55U=34U-74 -MU=75U=75U=55U5555=555555U=75U=75U-75U=74U]575D!F9'!Q1EK4T-IC -M)"`_,0T4^)B-L[.UBK>VNJ6]CXFTM)(6$H6RLUP^)C]FB)D/.SLW!`$*"Q&2 -MZ@PX.P6VN[4&/#;DM[:%4N:'AW0`&X"XNX0W.0F/N++D#@]ME_X1%)RTCQX\ -M/QVQNXH#/C!XCXSD$7V1Z!HT#I*\OY`P.C6!O['.#@UFE=,=:H6VB!T\/Q"S -MNK4&/#9TC(+_%<69E`0V")*_OI$P.C6'O+;9#`-Y[WX:%(>QBAP_/A.PNK4& -M/3=*@H;`;N:$E@8Q"YV^OI,P.C6'LK?=`@=/X&X&%H&SM1P_/A*PNK4',C1) -M@85<8I6`D0`S-9V^N9,P.S6%L[37`1O?Y!$#$8.RM!P^/AVPN[4$,S5-AYQQ -M9Y.-DP(R-)VYN9(Q.PJ:L(I1!Q+S^1\,$X*]MQP^.1RQNXH%,0M$FI1F>)B. -MG0T]-)VYN9TQ.`N8L8E>!6KA\`4)'8R_MQPY.1RVN(L:-@Y2GN!I<(2+GP\\ -M-YVYN9PV.0B>MXQ`'F7KRP8*'(^^MATY.1^VN8@8-PW5D\P72H"TF0X_-I*Y -MN9PV/@F<M(-+$U*1Q@,U'HZYMATY.1^WOHD9-0#9EW421H*WFPD^-I*YN9PW -M/PZ2BH9Q%_^<WPPW&(FYL1(Y.1ZWOX\?"P?"[F(>7(^VA0@Y,9.YN9\W/`^0 -MB85_;^F;UPXV!8BXL!,Y/AZTO(P=#AKWYQ<%5XBPA`LX,9"YN9\T/0V1C)]E -M9)"$5@LQ!8N[L!,^/AZUO8(2#1S_]AP'T+6SAPHX,9&^N9\U,@*7@)%F=)B! -M7C4P!(J[L!`^/AZ*LX`0`!?DTP4!W+2RA@H[,):^OI\U,`"4A^]B58>"7C0R -M!XJZLQ$^/QZ(L(81!V+@308"V+>\@34[,)2_OIP+,0;JFO)I]8.,63<]!HJZ -MLQ8_/!Z.MH06&W?O?@(,V[:_@34[,)6_OYT)-@3HG5!J^HR)6#8\`8JZLQ<\ -M/!^/MYH4'<&58`\.V+&^@#4Z,.J\O)T.-!KNEG@7XHF+63$_`(JZLQ0\/1R- -MM9\5%.:7:0@+WK"^@S4Z,.F]O9,,"A_L[&D1Z[6U7C`_`XJZLVH],AV#B)!K -M8Y20%#4UW;"Y@C4Z,.RRLI`""1#M_Q`2E[2T73`^`HJZLV@R,Q*!CY5H<9V= -M$30TT+.XC0H[,.*SLY$`#!7BT1D<D+:W5C,Y#8NZLVDS,!.&@N)NW9J9$C<W -MU;*XC0H[,."PL)8&`&/C<`09DK&VU3,X#8NZL&\P,1&$AO]L^8::'#$V4+*[ -MC`L[,.>QL94'!WW@8P$:G["QTC(X#(B[L&TQ-A>:FMQM[X*$&3`Q1;*[C`@X -M,>6VM^@%&%'@%0T$F;*PV#(X#(FXL6,V-!6>G71BEX^'&S,P0+VZCP@X,?ZW -MM.P8$_#@$PX'F[VSPS([#XFXL6$W-6F=E&9BG8B!!3(P3KVZCPDY-OVTBN$< -M:N/@'@L!A;RRR#T[#XZYMF8T"&*0X6IBF+6#!3TS=KVZCPX^-_&*B?L3993C -M!34`A;^]]ST[#XR^MV<*#V>7PA!MA+>-!#PR<KVZCP\_-_>(C?867)+B!S<" -MA+^]\CT[#XV_MV4(`GSK2AYMAK:,!#\]>+VZCPP\-/6/@-IJ_9OM`38-A+Z\ -M_C([#X*\M&4/`4[M8`5M@[".!SX]9;*[CPT]-<B"A%]L[X?O`C$/A[F\Y3(X -M#X.]M7H-!=?G%`9OC;.)!SX\9K*[CP(R"LB`F7=FD8#I#3,.A[F_Y#(X#X"X -MKJ&YMX;G:P0,"C<R/#X^.3\\,S$U"0$8:4[AEIJ&@H^)BXJ*M8J+B(Z,@H&' -MFI^1ZN'SW4)^86]J%!80$!,3$Q,0$187%&II;&-G>GQV2$!?U=_$P\[*]/?W -M]_?W]/3UR,[-P,?:V=S3T=155U%04U)=7%Q?7U]?7%Q=4E-345%65U=45575 -MU-37UM;6UM;6UM;6UM;6UM;6UM?7U]355U34UM;7UM?7U-35U=75U=75U=75 -MU=75U=75U=74U=34U-34U-34U-74U-34U-34U-34U=34U-35U-34U-34U-35 -MU-34U-34U-34U-34U5565-76UM?7U]?4U-75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U-34U=35U=75U=75U=75U-75U-75U=75U=75U-34U=75 -MU=755594U=;6U]?4U-35U=75U=75U=75U=75U=75U=75U=74U=75U=75U=75 -MU=74U-75U=75U575U=55U=75U=75U5555=75U=75U=75U=75U=545E?5UM?7 -MU]34U=75U=755=75U5755=5555555575U=75U=75U=75U=75U=34U-35U-75 -MU=75U=75U=75U=755575U=75U=75U=75U=55U5165]76U]?7U-35U=75U=75 -MU=75U575555555555=75U=75U=755=75U=75U=75U=75U555U=75U=75U=75 -MU=75U575U=75U=755=755=555%%75=;7U]?4U-75U=75U=75U=75U5755=55 -MU=75U=75U=75U575U=75U=74U=35U=55U575U=75U=75U=75U=755=75U=75 -MU=75U=555=545E?5UM?7U]34U=35U=75U=55U555555555555=3ED.GF^<71 -M271^>65E9V1D97A_<G9*3$1>5]?2WMK&P\W.R<C(R\C)SL_"P\;'VMC>W-/6 -MU]555E914%-34U)24E)24U)34U!045%65E=75%555=75U-74U-37UM?4U535 -MU=35U-34U575U=74U=75U5555555555555555%145%155%15U=155=75U-74 -MU=75U=755=75U=74U-55U55555545555U=75U=37U]545E155=75U=75U-?7 -MU-75U=7555545555U=75U=75U=75U=555=75U575U-34U-34U]35U=555555 -M5=75U-34U-74U=7555555=55U=37U5575%755=75U=545=75U=75U=74U=75 -MU=75U575U=75U=75U554U=745=75U=34U-34U-34U-75U=75U555U5555555 -MU575U=75U=75U]?55%=55=75U-34U-36U]755555U5755=75U=75U=755=75 -M55755535U-35U=55U=75U-35U=755555U=75U=75U=7555555555U=75U=37 -MU]155%155=75U=755=34U-?4U-35U5555555U=74U-34U=755=555%75U575 -M5=75U=75U=755555U575U=75U=75U=75U=55U5555555U=36U%54U=555=55 -M5555U-34U=34U=755555U=75U=75U=75U=75U515U=745=74U=75U=755=75 -MU=74U=75U5555555U=75U=35U-555555U=555%?5U=34U-37U%35U-74U-34 -MU-34U-755=75U=34U=75U5555U945=55U=74U]34U-34U=75U=74U-34U=34 -MU5555%555575U-34U]37U]545E155=34U-35U-?4U=55U=75U=74U=555%15 -M5=75U-34U-355=75U515U=74U-?7U]?7U-75U555U=55U=34U-5555555515 -M5=74U=37U%145%15U=75U-15U=35U=55U=34U=34U]?4U-75U5545%55U555 -MU-3455555=55U=75U=34U-34U=75U=75U=75U=75U=7555555=75U]?55515 -M55555=75U=77U]34U=7555155-75U=34U-34U=5555555%35U=35U=34U]34 -MU=55U=74U=75U=75555555755=75U=75U5555%75U-545%55U=55U=555%15 -MU=74U]?7U]34U55555555=75U=75U=555=75U5755=74U=34U=34U=75U555 -MU5555=5555555575U=555575U=75551755155=74U-75U-?5U=555555U=75 -MU-75U-75U=75U=75U555U-745575U=75U=74U=75U=755=755=755=755=75 -MU555U555U555U-?4U5155=75U=75U555U=75U-34U-75U57555555575U=55 -M55555%=45=555=75U=74U-35U=755=755=75U55555155%555575U=755574 -MU]155U555=75U=75U=?4U555U55555555=7555555%555574U-755=75U555 -M5=75U=55U=75U=555=75U=75U=74U-55U555U=75U=75U=37U%545%155=55 -MU=555-75U=75U=74U=75U=34U=35U=555575U554U=755=74U-75U-34U-74 -MU-34U=75U555U=75U=755=75U=75U=75U]?555145555U=75U=74UM34U-75 -MU=555=755555U=75U=75U5555575U=15U=35U-34U-34U-74U-75U=75U=75 -MU=75U=5555555=555=74U]155%55U=5555755%35U-37U]34U-75U=34U=75 -MU=34U-7555555%55U575U=74U-34U-75U=35U=75U=35U=55555555555=75 -MU=75U-?7U%545=75U-34U]35U-34U=7555755=75U=75U=75U=555=75U=55 -MU-345575U-34U-34U-75U-75U-75U=75U=75U=34U=75U=74U=75U]?45514 -M5=75U=75U-55U-74U-35U-55U=35U575U=75U55555555515U=55U=75U-34 -MU-34U=34U=74U=75U5555575U5555=75U=75U=74U-545U55U555U=34U=37 -MU-74U=55U=75U=75U=75U=34U-34U=755=74U-75U=74U-75U=75U-35U=75 -MU=555=75U=7555555575U=75U=34U5175575U=75U=155%75U-34U=75U=34 -MU-75U=75U=75U575U554U=345=75U-?4U-74U=75U-75U-75U=75U555U=75 -MU=34U=35U=75U-355%=55575U=75U=75U]35U-75U=75U5755=555555U=75 -MU=755574U-155=75U-35U=74U=75U=75U=75U=74U=75U=75U-75U=75U=37 -MU]155%555=75U=74U555U=74U-34U-34U-34U-74U=74U=75U=555-75U555 -MU=74U-34U-75U=75U-75U=55U=75U575U=755=75U=75U=34U554U575U=74 -MU-35U-?4U=5555755555U=75U=75U=75U-35U555U-355575U=34U-34U=75 -MU=75U=75U=75U=75U=75U=75U-75U=75U-355%=45575U=74U%55U=34U]35 -MU-34U-34U=755=755=755=555%1555545=74U-34U-?4U-35U-75U=755=55 -M5-555=75U575U=74U=77U]545%55U574U-77U=76U=755=15U%75U535U574 -M5%745%75U==4U=17UU55U-75U-?5U-75UU75UU75U-755=74U=355=555=35 -M5=755=3455175515U575U-34U=77U=34U=75U-75UU75U575U%755=755514 -MU=755555U=34U-35U=35U-35U=75U=74U=75U575U=75U5555=75U-755515 -M5=75U=74U-34U]?5U=75U=55U575U=75U-34U=75U=755574U-35U=75U-34 -MU-75U%75U=55U555U555U575U=75U5755=755=74U-545U555=75U=75U515 -MU-74U=75U-75U=755=75U=75U575U5555575U53555755=74U-34U=34U=35 -MU575U=75U=55U5555=555555U=34U5545%75U=75U-35U-?7U=75U575U=74 -MU575U=35U=75U=755=75U-35=V!^<W5$7]?2Q`4C)S(T&F>5A8V+MKNGOH^! -M@[>SM)Z5AKRDO/8R)#D-_U8$-0D4XFDP)B,Y;(NUE`8,$N'E!#8Q;K&DI8T% -M-0'AAI!B%)RSI;+T,#DTYHJ*DF??AK6%`#X["(:\O809`A/D]@<Q-F^WNKR4 -M-3T*99+Z$AGIMKZT$#\[-.NTM9U@1X2)G0(^/@&)N+R%!0P<^?,%-S74L*6R -M\38\-768Z143E+>]C@0Y.@J?MK>=;GJ?@ND//SP?M+N\G0`+&O7S&S4/XK.Z -ML60S/PK#AY-F%):TLX$".#L/AK.VDA=NEH?]"3PS;[&ZO>@.-`3`^1P.`)"R -MN[<3/#X(XX.;=6Z6M;&9"#LY`8^]L9$2$>.95`@]-M*SI;/.-38&S>$1`@68 -MO;B(!SX^#Y&.AM5BEXNTE34[/QZUO['J&QG(D'<),S7IO:6Q9#8Q`?/H;@82 -MA+V^@@PX/@.:M8/#8NN.B_$W.SUOMKFQY`8'295Y#C$/G[^EM!`P,`'AD7\: -M%8:RO84*.S\$@+>,]6_@@HUT-C@PT;.XMM0-`V;M>@\W`8>^NX@$/3,&E9[= -M'6&!LK.6-SH\'8ZQCLP4\8:&;#$^-^B]N[1G"`QHX7X"-1N"N;B"#3\R!)*$ -MY1=R@+"V\C$Z/6RULXG1$UB:FQ8Q/PJ9OKN*%C0(%.%U`0D6CKF^A`LY,AF% -M@.IN2(&QM7XS.C#5MKV)2AEDDY,2-CT-@;B[CAHV-1;M500-88NYO)`W.#,1 -M@8^08$R'MXX7/3LV[K._CF$$%>N5'S8S!X^[N(,`,#06ZO`>!D2UOK/^,#LP -M8(^+GV1TA;6`&3TX-9Z\OXP4`!+DXAXW-AV*NKF%#C(T%9'B%AKUM;^V>#(Z -M,=6*M)MG>)Z.A0<\.0Z!OKZ#'P\:R><?-31BM[J_D30\-VR>EVT=Y+6]M1$\ -M.C?BM[::8V*1@Y,`/#\!C[B^AP<+!]7E$@L(4+:ZLOXQ/C1^A)]P%N*ULH\% -M/CLUG;"QFFL4[X?N`CTR'K6ZOYX"-`!%YQ8/#>>PN[!^,CDTTH"$T&OLB[&! -M`SDX#H>RL)L1'?*9^`TR,&ZVI;V4"#8"1>UI`P:4L[BW$3PY"N&/@/!OXHZW -MF0\X.0&,O[.<'AI%D,<-,S=0LZ6R\S0P#52590<8G;.YBP0^.0F1BHWD;>>- -MBI0+.#\9M;FSE@0&9^I3#3$*XKVEL7XQ,PW(DUP8$YBSOX(".#D-A;>)X6GD -MI:*DLHF23QP`"34P,C\^.3\_,C`W"@T$$&3(Z)R$@(V.B(JUM;6*BXF/C8.& -MA)F2E^_ESE)V9&)H%1<1$!,3$Q,3$!$6%Q5K;F)A9'ES=$)84=;>Q,+.RO3T -M]_?W]_3URLG/PL'$V][=T];45U)24U%04E)=75Q<7%Q<75U34U!15E=75%55 -MU=74U]?6UM;6T='1UM;6UM;6UM;6U]?7U-34U=75U=74U-75U=55U555U=75 -MU=74U=34U-155U34T=;6UM?7U-?4U-74U=74U-34U=35U=75U=74U=34U-34 -MU-35U=75U-74U-34U-34U=74U-34U-34U-34U-75U-75U=34U-35U-74U556 -M5]76UM?6U]?4U-75U=755=75U=75U=755575U=75U=35U-74U=75U=75U-34 -MU-35U=75U=75U=75U=75U=5555555575U=75U=75U=755597U=;6U]?4U-35 -MU=75U575U=75U=755555U=75U=75U=75U=75U=75U=75U=75U=75U575U=75 -MU=75U=75U=555575U575U=75U=75U55445?5UM;6UM?7U-35U-75U=75U=75 -MU=5555555555U=75U57555555575U=75U=75U=55U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U5115U76UM?7U-35U575U555U=55U555555555555=75 -MU=75U=75U=75U=75U=35U=75U575U=55U=75U=75U=555575U=75U=75U=75 -MU=755%97U='6U]?4U]34U=75U=75U=555555555555555=75U=75U<B7E^'F -MS]M!=7UY961D9&5E>'ES<4I)1D535M'=V\3#S<G)R,O+R,C.S\W#QL?$VM_< -MTM#1U]155U%14U)27%U<7%U=4E)34U!045%65U145=75U-?7U-55U=74U-34 -MU-34U%75U-34U-75U=75U57555755555555555145=555U555=75U=75U=75 -MU=75U=74U=75U=755=755=55U5555=75U-355%145575U575U=75U=34U=55 -M55555=55U=75U5755575U=755535U=155=75U=34U=75U-75U=75U=555=55 -MU=75U=75U=75U=75U=74U-545U14U=75U=75U5545=75U=75U=75U=75U-35 -MU=75U=75U=555%555515U=74U=34U-35U=75U=75U-74U=755=7555755=55 -M5575U=34U5145575U=75U-35U=74U]7555555=7555755=755=755=75U554 -MU=355%75U=34U]?7U-3555145%145%75U=74U-34U-35U=75U=55U-355%14 -M5=75U=75U=755%75U=34U=74U=75U=75U=755555U5755575U=55U=75U=34 -MU-34U-74U-35U=75U555555555555=555=75U=74U-555%15U=75U-34U-34 -MU]?4U=755575U=55U575U=555555U5545-74U555U=74U=75U-75U=75U555 -M55555=75U=75U-75U=75U=75U=34U5145%755=75U=74U515U=74U-34U-74 -MU-74U=34U=34U=75U554U=755-75U=35U-34U=75U=75U=35U=75U=755555 -MU=75U=75U=75U-3555145=75U=75U=75U=?7U=75U555U555U555U5555=55 -MU=755575U-15U=74U-34U=35U=74U=75U=75U=75U=75U-74U-35U=75U=75 -MU-555%55U=75U-75U=155=34U-34U-34U-34U55555555555U=555-75U515 -MU=74U=34U-34U-75U=75U=55U5555555U=75U=75U=75U=34U5175%75U=35 -MU-34U=74U]75U=75U=75U575U=75U=74U=75U-55U=345%75U=35U-75U-75 -MU=75U=55U55555555575U=755=75U=75U-?455155=55U=75U=355535U=74 -MU-34U-74U=75U=75555555555%155=545555U=75U=75U-75U=75U=75U=35 -M5=75U=75U=75U=75U=74U-155%55U=75U=74U]35U-?4U555555555555575 -M5=555555U5555=75U555U=75U=75U=74U=75U575U=755=74U=75U=75U=75 -MU=55U=34U5175555U=75U=75U%55U=75U=74U-35U=75U=75555555555514 -M55555U55U=75U-74U=75U=75U=75U=755555U=555%5555555555U-355%=4 -M5=75U=75U=75U=37U=755=7555555=75U=75U-35U=755575U=545=75U-74 -MU=35U=75555555555555U=75U=75U=75U=75U=74U-555%555575U=75U=55 -M5=75U=35U=75U=35U=34U575557555555%75U514U=74U-35U-75U=34U-34 -MU-35U=755=55U=75U=555555U=37U5545555U=75U=75U=74U-35U=755=75 -MU=75U5555=75U=75U=55U=345=75U=75U=75U=75U-75U=75U=75U=75U=75 -MU=74U-34U=35U-?555155=75U-34U-34U575U-37U-34U-35U=755=75U575 -MU=755574U-145=75U-34U-35U=74U=75U=75U-755575U575U=755=75U=74 -MU]145%55U=75U575U575U=?4U575U555U=75U=75U=55U=75U=555-74U%55 -MU=74U-34U-74U-34U-34U=75U=74U=35U-75U=755=75U=?7U%545575U-74 -MU-35U-54U=74U=34U-34U-34U-35U-75U=75U=55U-355=74U-?4U-34U=35 -MU-74U-75U-75555555555575U=555=75U-355%155-75U=34U=35U=77U%75 -M5555U=75U=75U=75U=75U=35U574U-15U=74U-34U-34U=75U=75U=555=55 -MU575U=75U575U555U=74U-545%155=74U-34U-345=74U-?4U-35U=75U555 -MU555U=55U=545=75U515U=75U=34U-34U-75U-75U=75U=75U=75U5555555 -M5575U=34U5545574U-74U-34U-74U]?5U-555=7555755575U5555575U555 -MU-345=75U-34U-35U=75U=75U=75U=75U575U575U=75U=75U=75U-355515 -M5555U=75U=74U555U=74U-75U-34U-75U=75U=74U=755574U=555=74U-34 -MU-35U=75U=75U=75U=555=75U=755=75U=55U=74U]555555U-34U-75U-35 -MU-?4U=75557555755=75U=75U=55U=555=75U575U=74U-34U-35U-75U=75 -MU=75U=75U=75U=75U=55U=55U=34U5545%55U=75U=75U5545575U-34U-34 -MU=75U=75U=75U=35U=55U-755=75U=34U-34U=35U=75U=75U=75U=555555 -M5=75U=75U=55U-3555155=75U=555=755=74U-755=75U575U=75U=55U575 -MU=75U574U=555=74U-34U-34U-74U=7555555=555=555=55U555U555U=74 -MU]155%75U575U-75U=755575U=34U-34U-34U=75U=75U=75U=755=75U515 -M5555U=35U-34U-34U-35U=75U=74U5755555U=75U=75U=?4U5545=75U-34 -MU-34U-74U]?5U=75U=75U-75U=75U=75U=74U555U-345=75U=34U-35U=75 -MU=75U=755575U=75U=75U=75U575U=74U-3455155555U=555=75U554U=74 -MU-34U-34U-75U=34U-35U=75U575U-55U=34U]34U-34U-75U-74U=75U=75 -MU5555=55U=75U=75U575U-545U15U=75U=34U-34U-37U=75U=75U=75U=35 -MU=34U=35U=35U=34U%55U=74U-35U-75U=55U=75U=75U=74U=755=755=55 -M5=75U=74U5175555U=75U-34U-155=75U-34U-34U-34U-74U=5555755555 -MU=7555755=75U=75U=34U=35U=74U=75U=555555U=55U=75U=75U-355%=5 -M5=75U=75U=74U=37U]35U=75U=75U=75U=74U=35U=75U574U-15U=75U-74 -MU-34U-75U=755=755=75U=75U=75U=55U=55U=75U-545%555=75U=74U=74 -M5574U=74U-34U-34U-35U-75U=7555555-755515U=37U]?4U-34U=75U=75 -MU=75U575U555555555555575U=37U5145575U=34U-34U-75U-?5U=75U=75 -M5555U575U=75U57555145=755575U=35U-34U-35U-34U=34U=75U-34U-75 -MU-35U=75U=74U-355%=45%75U=75U574U%55U=74U-34U-35U-74U=35U=55 -M55555535U=545=75U-34U-34U-75U=75U=75U=75U=75U=75U575U575U574 -MU-545%55U=75U=35U-75U=74U555555555555=75U=75U=75U=555=75U%75 -MU-74U-35U-75U-34U-75U555555555555555U=75U=75U=37U5145%55U=75 -MU-35U-355=75U-34U-75U=75U=75U55555555514U=555%75U=34U-34U=75 -MU=555=55U575U=75U=755=75U=75U=55U-3555155555U=75U=34U-37U]35 -MU=555=55U=75U=55U=75U%75U575U=555=75U=75U=55U575U=74U-754WEA -M<G-,1%#6W]8W(B0R"1/1F(:+B[:POK.*B[6YHZ:W]7^2FQ<S/@J8L8,!/SXT -M#38Z)36$L8T&/#(!=A8)"?*RI;-E-PI\A)UN%(>YI+8=,S=AAIAE%)BROH`( -M.#(4AH1W%I&VL)0Q)3)RCH_E:96UM-\S)3'HMK>6;.:/CV(R.S6$O;"0$7:% -MA!(R.0V.N;.5!1/HD1DS/1NTN[/R#0%>XAXV,6&PI;%E-0EMYQ$U"_B]I;0< -M,#07[&0"`)"\NXD#/#$4D/T;&9B]OH8*.3!CA))N%(6RLI0Q.C'<CX#68YBV -MME\R.C:5M(CG8Y&*B1<\.@J$L[?O%/F#AAL\.0*.O['A&6>>D@<]/!^WN+'; -M`![A[`<S,'ZSNK9C"P-`Y1HW->.\NK4>-@AAX1$(`I^_NX\",C1BE'D!&X>_ -MOH0U/C=XF.8=%(&\O>@Q.#?-@YYA88:SMG8].C27BH/6986WBQ,_.PF'L8CS -M;):)@0<^.0&.O+3V$_6&G0,_/!*WN;=:!V^0[`(],$ZSN[1N#QK^_``P->N_ -MNHL8-`)!_04T#9JYNX(",PA][18/&H"YN9LU/#5/DW4$%(V^O>,P.37QA^X6 -M9(V\L6<].`N6CIIZ<8"PBAX^.`^'MX)<>X6T@`$Y.0>.LHE4:I2,G`PY/!:W -MOXIQ&=":X@X_,%2RN(MJ`Q25RP\R-):_NXX;"@7VV@,V#(>XN(`",0)1_`4+ -M!8V[OI\U,@[7ZA0#%(FXO?LP/PCYF%89?XB^L6T\.0Z6@Y1J7XZRBAH^.0*$ -MM85Y6X.V@`(X/@6/L8-W99J+G`@X/&JWO8]Z$>B!X0HY,,ZROH\5!$^=W0H\ -M-)._N((;#Q'M0@DP#(&XN8<"-`3W5P,T!8Z[OI,U,`/(^QL/%;6[O?4Q/0WD -MD6D'=;2YL6H]/P*6A,\3PK6\B@0Y/@&$CI%L](FP@`P[/AF,MX5E4(.TG34[ -M/&VTLX%F8)F,Y#0X,/RSO(,4'>"%03<^-)^_OH$8`7F7934R#(.XOIH#"!/G -M>`DV!8NZOY0*-@3\5@`+:+2ZLM8Q,P'FX1X`7[:[L18]/0&7G6$9^+:^B@8^ -M/P2:@/\4X+2R@`D[/!*-BY!C^XFVDC0Z/62TMIIC4H"(_#8[,.:PLH05;IV& -M?S$Y-)B_O(4>&/^=;S8\#(*XOYP``F'N:#0P&K6ZO.P(-1/D9@DU;[:ELTPV -M-AOFU`$-VK"ZMA`R,P64[A(%[;"YBP$^/1F8FWT0E+&\@0L[/1:#C>=NE;2P -MD#<Z,G"*M9%BYXZUR3`Z,>VQL9]J0X:"83,X-9J\LI\=%Y:8%C`_#8RXO98& -M!,:4$S8S&+2ZLN0.#V+A%S4W8[&EL'PW-!#F9@\.\+.ZMQTS,1SKQP<&E+*X -MB`,_,Q*<EQ<=DK._A@HX,VN!AT)JG;&SEC8Z,$2(CN9BEK2TT#,Z-NBVM)1N -MY(R,:#([-86]L9<0<X6%'#(^`H^YL^@%$^N1&#,R'K2[L_0-`5#B&38V9+"E -ML68U"6+G$34+Y+VEM!\P-!3L9P(`D[R[C@,\-A20\!L>F[V^AS4Y,6.$DVD5 -MA;*RE3$[,=V/@5%CF+&W1S(Z-Y6TB>5BD;6)%CP["X2SM.(4^8.'&SPY`(Z_ -MMN<99YZ3!ST]'+>DKJ&XMH'@:00,"C<R/#X^.3\\,S$T"``::G?DE)B'@HR) -MBXJUM8J*B(Z,@H"'FI^0E>/\V$9\9FQJ%!80$Q,3$Q,0$!$7%!5I;&-F97]Q -M24=<5=+;P<S(]?3W]_;W]_3UR\[-P\;%V-_=T-16459745!375U<7%Q<7%Q< -M75U24U!15E=45575U=34U]?6UM;1T='1T='6UM;6UM?7U]?7U]34U-75U=75 -MU=75U=75U=75U=75U=75U-345594U=;6U];7U]?7U]?4U-35U=75U=75U-35 -MU=75U=75U=75U-34U-34U-35U=74U-34U-34U-34U=75U=34U=34U=34U=75 -MU=75U=74U=555E?5UM;7U]34U-?4U-35U=75U=75U=75U=75U=75U=75U=74 -MU-34U-75U=75U=75U=35U=75U=75U=75U=75U=75U=55U575U575U=75U511 -M5E77U]37U-34U-75U=75U55555555=75U57555555=75U=74U=75U=75U=75 -MU=75U=75U=75U575U=75U=75U=75U5555=75U=75U=755%%75=;6U]?4U]34 -MU-34U=55U5555=75U575555555555555U=755555555555755=75U=75U=55 -MU=75U=75U=75U=75U=55U=75U=75U=544595U]?4U]37U-35U=7555555555 -MU57555755555U555U=75U=75U=75U=75U=75U=75U=75555555555=75U=55 -MU5555=555=75U=75U5115U76U]?7U-?4U-35U=75U5555575555555555555 -M5555U=75U^20Z>'YQ==)='YY9&5G965Z>7QR=DM"1UE1U=#>VL;#S,[)R,C( -MR,G.S,+#P<?8V-[<W=#6U-545E%04U)24EU=75U24E)34%!145965U155=74 -MU-155-74U-?7U]?7U-34U-545=75U=75U5555=555555U5545%175U5555=4 -M5575U=34U-75U=75U5555=555=5555555%555555U575U=37U5545%75U=34 -MU=34U=755=74U%55555555555555U555U575U555U-355=75U=34U-75U=74 -MU=75U=75U=55U=75U=75U=555=555=75U-?55%=45575U=74U-34U-355%75 -MU=75U=75U=34U=75U=555=555575U=545=75U-34U=75U-75U=35U=75U=75 -MU=5555555575U=75U-34U]155U145=55U=75U=75U-74U]35U=755=755555 -MU555U555U=555=75U575U=74U-34U-34U=35U=555=555=75U-75U=75U=75 -MU574U-?7U%145555U=75U=755=75U555U=74U=34U-35U=35U=75U=755514 -MU5555U15U=34U-34U-34U-75U575U575U=75U=75U=555=75U=75U]?55%14 -M5575U=34U-74U-34U-?7U-75U575555555555=75U=755575U5545=75U-74 -MU=75U=75U=75U=755=75U=75U=75U=75U=75U=74U-545U145=75U=75U=74 -MU-55U=34U-34U-34U-34U-74U-35U=555=75U5145=75U=34U=74U-34U-34 -MU-35U-75U=75U=5555555555U=34U5545=75U-75U-75U-35U=77U-755555 -M5=755=55U=75U=75U=75U-355=75U-34U-74U=75U=74U=35U=75U=75U=75 -MU=74U-34U-74U-?555155=75U=35U-75U=755575U=34U-34U-34U-75U=75 -MU=555575U5545=74U-34U-35U-74U=55U=5555555=555=75U=75U=75U=74 -MU%555U155575U=75U=34U=75U-35U5555=75U575U=75U575U5555=35U535 -MU=34U=35U=74U=35U=755=5555555555U=75U=5555555=3455175%75U=75 -MU=75U=75U555U=75U-34U-34U=75U=555575U575U=755%75U=35U-75U-35 -MU-75U=5555555575555555555=755=75U]?55%155=75U=75U=75U=75U=34 -MU=7555555=755575U=75U=755=74U=545=75U-34U=75U=755=75U=755=55 -MU555U55555555575U=74U-545U155575U=75U-75U-555=75U-75U=75U=75 -M5=75555555145-7555145=75U=75U=74U=35U=35U5755555555555145555 -MU555U=35U5175%755=75U=75U=34U=77U]7555555%5555555=5555555555 -MU=755%75U=75U=75U=75U=75U=55555555555=75U=75U=75U=75U-355%=4 -M5%555=75U=35U=755575U-34U-34U-75555555555=755575U=545575U-34 -MU-35U-34U=74U=75U=75U=55U5555575U575U=37U]555U145=75U=75U=75 -MU=75U-?5U=75U=55U5555=75U=75U=555=75U535U-34U-34U-35U=755=75 -M5=755=755=55U=75U=75U=55U=34U5545%55U=75U=74U=34U-55U=34U-34 -MU-35U=75U555U=55U555U-555%555=75U=75U=74U=75U=75U=75U=755=75 -M5=75U=755=75U];455145=75U=34U-35U=75U=37U-75U-75U=74U-34U=34 -MU=75U=74U-55U=75U-75U=35U=75U=75U=75U=55U555U=755=75U=75U=77 -MU-555U75U=75U-34U=75U=755-75U=34U=34U-35U-35U=75U=55U=35U555 -MU=37U-34U-74U=75U=75U=75U=75U=55U555U5755=75U=37U-545575U=74 -MU-34U-34U=74U]155%55555555755=75U575U555U-755=75U=35U-74U=35 -MU=75U=74U=75U=55U=55U=75U=74U=34U]?455155=75U=74U=35U=755515 -MU=74U-34U-75U-75U=75U=755574U=545=74U-34U-34U-34U-35U=75U=75 -MU575U=75U=75U=75U-77U%545U15U=74U-34U-34U=35U-?4U=75U=75U=75 -MU=75U575U=55U=34U515U=74U=75U=74U=35U=75U=35U=75U=75U=34U-75 -MU=75U=37U5175%55U=75U=74U=74U-54U=75U-35U-34U=35U=35U=75U=55 -MU-755%75U=34U-34U-34U-34U=75U=7555555=75U57555555575U-3555=5 -M5=55U=75U=75U-34U-37U-75U=75U=75U=34U=75U=755=74U=155=34U-35 -MU=75U=75U=75U=75U=75U=75U=55U=75U=755=74U-545U55U=74U=34U=75 -MU=355=75U=34U-35U=755575U=75U5555=75U5145=75U=35U-34U=34U-74 -MU=35U-74U=75U=75U=555=55U=34U5145575U=34U-34U-74U-75U]35U=75 -MU=75U=75U=75U=75U=55U-355=74U-74U-75U=75U-75U=75U=75U=74U=75 -MU=74U=75U=34U-?455155=74U=75U=75U=75U535U-34U-74U-75U=75U=75 -MU=755575U5545%55U=74U-34U-34U-75U=75U=75U-75U575555555555=74 -MU]155%55U=75U=74U=75U-75U=?4U=75U=75U=55U=75U575U=75U575U=75 -MU-74U=75U=75U=75U=75U=75U=75U=75U=35U=75U=75U=?7U%545575U=74 -MU-34U-35U=545=75U-34U-35U-55U=75U=75U=75U=75U=755575U=75U=75 -MU=55U=75U=75U=55U=75U=555=755555U=55U=74U=34U=35U-75U=55U=74 -MU-75U=755575U=75U=75U=75U=75U=75U=75U=74U=75U=75U=75U=75U=75 -MU=75U-75U-34U-75U=74U575U=75U=7555555=55U=755%355=75U=74U-74 -MU=74U=74U=75U=75U=755=755=55U5555=55U=75U=75U57555555=75U=74 -MU-34U-35U=75U555U=75U5555575U575U]?4U=755=755=75U=75U=75U=75 -MU=75U=34U-35U=75U=75U=55U=75U575U=75U=74U=75U=75U=74U-75U=75 -MU=34U=35U-34U=75U554U=74U-74U=35U=75U=75U=75U=75U=755555U555 -MU=75U=75U=75U=75U575U=75U=75U555U555U574U575U=75U=75U=35U=35 -MU=75U=?7U=75U575U=555=55U=75U=75U=75U=75U-34U-75U=74U=75U=75 -MU=75U=75U=75U=74U-35U-35U=355=75U=74U-75U=75U=75U=155=75U-34 -MU-34U=75U=75U=75U=75U=55U5545575U=75U=75U575U=75U=74U=75U575 -M55755=75U=75U-75U=74U-34U=35U=35U=34U=74U]75U555U=55U=75U=75 -MU=75U=75U=75U=74U=5555555575U=75U=35U=75U=75U=34U=75U=75U=74 -MU575U=75U-75U=75U-75U=755575U=34U-74U-74U-75U-75U=75U=755=75 -MU=55U=75U=75U=75U555U=755575U=75U=75U=555=55U=3555555555U=75 -MU-74U-74U-75U-3555555575U=75U=74U=75U=75U=75U=34U-35U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=74U]75U-34U=74U-55U=74U=74U-55 -MU-74U-34U-34U-75U=555=755575U55555555575U=75U=75U=75U=755=75 -MU=35U=5555555555U=74U575U=74U=74U-74U-34U-75U=37U-5555555=75 -MU=75U=75U575U=75U=74U=35U-75U=75U=55U=74U=75U=75U=75U=75U=75 -MU-74U-35U=75U57555555%75U555U=555=75U=75U-35U-35U-74U=755=75 -M557555555555U=35U=75U=75U=75U=75U-34U-75U=7555755575U5555555 -M5=75U=75U=75U-75U=74U]355575U=75U5555=55U=75U=74U=75U=74U-75 -M5555U=55U=55U=75U555U=75U=75U=55=&!Y<W1$7M?3Q!HC)C(T!6;KA8VT -MO;*UL+ZEMY^2B;NGM.F5B(<,)"0*EI$'-03C93TC(37AY04&E+2##SH\;X*% -M2OZVNK`1,S7AC99H[;.DL!TP",V3%P)/L*6T!#`.048/-VRPNHL$-`3V:#<P -M;[.[B!X-9903,S)ML[F/$1V7F!L\/&RPO($538"&!CD_:;>QG&R4M8(#.S]N -MBHCE9X>PC@([/&V-A&1]B;R+`C@S9H3F'W6TN8H#/S9_D6H#3K&ZM0$R"%CR -M!@MUL[J*!S8&]GH*-W"RNH@%"13L$3$P>;*XC!\$_)`:/3UEL[^!$&^;F@8^ -M/&>QLYAJYXZ!`C@_9[2TZ&&;MH(,.SQDB8-;<HRRC@PX,GB`D1=!M;Z(##DQ -M<YYQ!%&QNXL"/#5'[1L,U+.ZB``P`L-`#S54O;J)!C4?YQ4W-ER]NXP%`TN5 -M&#(S1K*^@!\2D9P&/SU+L[V%%E6#A0(X/'>VMI9LD[6!#SL]=K6.]7Z`L((. -M.S)WC)IB1(J\CPXX,4B$\![?MKF.#S\T6)<6`,FSNXX-,@_8SP`(]+VZCP`V -M!/]B-33*O+N-!PYO[!PP,<*\N(`:!>&6!SPSV[*\A!)FA9X".3+1L+"3%>Z) -MA`X[/52WM>=GA+:!"#LR4(B!<$.)LH(+.S!3@)41Q[>^C0@Y-U>?9P3RL+B, -M#CP(V^8%#/J]NXP,,`'Q?`D*Y+R[@@,U$.80-C?EO[B`!P#5ZP0R,?F\OH09 -M%I*0`CXS\K*RG!'*@ID..#+WL;?N;9ZUA`L[,\BTC-1TC;"&-3LPP(R?:<2T -MO(`U.#;$A-P9^;"Y@PL_-<V4$@#@O;N""3(-]]4"#NR\NX,,-QCZ%30U[[^[ -M@0`/9^(:,S;MO[F$!!OOE`,\,..\O9\<?823#CDSYK.QE164B9D*.S/EMHOQ -M>8&VA34Z,/Z+AV73B[*'-#LV\(#M$/BVOX$U.37VG&\$[;*X@0H\#_#X!P+J -MO+N!"3$'_F$+")2^NX8-"A3G'S$TE+ZYA0$!R.\!/3:5O[^>&A6<E`\^,>N] -MLY80Y8*3"CLP[K"TY&.%M)XT.C#BM()-7HZPFC<[-N:/DVO^M[R$-S@T^H5` -M&>^SOH<T/PG^ZQX!E+RXAPHS`/Y,#`^1OKB$#C<<Y1$W"I.YN(4"#''@!S,T -MD+Z_G@<?E>X,/S:1O+*1'T2'E`HX,9>RMN-JDXB0-#LQE;:)W':#MIPW.C;I -MBX5A]K6RF#8[-..`^A#LL+^:-SX+YY(4!9:]N84T/0+E]`$#DKZXF@HQ&N5I -M"@Z<N;B8#PMOY!HQ-9^YOIP`!_[@`CTWG+Z]D05LGNX+.3:=O+#O$>V-E30[ -M-I"PM?1GA[21-CHVEK2`<]J(L)(Q.S3JC)<5XK:]G#8X"NR%?QZ6LKZ>-S\, -MX>P;!IR_N9XT,P?D?P\-F;FYGPLT$>4<-PB;N+Z2#`);Y``R-9NYO)8&$I?A -M"3\TF+^S[A_;ANPT.#>>LK?_:9^(ZS8[-YVVC$5$C+:4,3LTD8N98N2TLY$Q -M.#65@?40E[.\DS$^#N^0$1J<O+Z2-ST!X-P#`9JYN9,U-A_D%S4,A+B^D0D) -M9OH',`B$N+^4`@3F^@\\-82YLNX%9YCG-3DTA;RV^Q&5C>`V.S28LXO1>8&U -M[#`[-)^TAGKSBK'H,#LUD(SI%96QO94P.0F4FV$?G+V_ES$]B*^FOK2$_A4$ -M#`LQ,S\_/C\\,C`W"@P''6#3[).%@8*/B8N*BHJ+B(F/C8.&A)B=E^[D]%1U -M>F-N%1<6$!`3$Q,3$!$6%Q5K;FUA9'AR=$Q;4]?<Q<#/R_7T]_?W]_3URLC/ -MPL''VMG<T]'455=64%-275U<7%]?7U]<75U24U!15E=45%555=34U-?6UM;1 -MT='1UM;6UM;6UM;7U]?7U-35U-34U-74U-74U=75U=75U=74U=34U-34U-74 -MU-34U-34U-34U-34U-35U=34U-34U-35U=75U=75U-34U-34U-35U=75U=74 -MU-34U-74U=74U=74U-34U-34U=75U=75U=74U-34U-74U=75U=75U=34U-75 -MU=75U=75U=75U-75U=75U=75U=75U-35U-75U=75U=75U=74U=75U=75U=55 -MU=75U-75U=75U=75U=75U=75U=75U555U555U=75U=75U=5555755575U=75 -MU=75U=75U=75U=75U-74U=35U=75U=74U-74U=75U575U5755=75U=75U555 -M5555U=75U=75U=75U575U=75U=34U=34U=75U=75U=74U-75U=75U=75U=75 -MU=75U=75U5555=75U=75U=755=5555755=75U=75U=755=75U=75U=35U=75 -MU=75U=75U=75U=75U=55555555555=75U57555555=75U=75U=75U=75U=75 -MU=75U=75U=75555555755=75U=55U5555=75U=75U=75U=75U=75U=75U=75 -MU=75U5555555U=75U=75U=755=75U=75U=75U=75U=75U=75U=74U=75U=75 -MU=75U=75U-34U-35U=75U=75U=34U=75U=75U=7:ZY'@X?7;64AP>7MD9&=E -M9'AX?7-T2T%%4U?1TMO$P,+/SLC(RLO(R<[,PL''Q=C>W]+0UM?555=14%!2 -M4E)=4E%27UU24U!04%%65E=75%555=35U=?6U]?4U-35U-35U=34U-75U=75 -MU555555555555%155%5555555555555555755=755=75U=75U=74UM175575 -MU=75U=75U575U575U=555%75U=75U=55U=75U=75U575U555555555555575 -MU=75U=75U=75U=75U=75U=75U=555575U5555=76U5155=75U=35U=75U=35 -MU=75U=75U-75U55555555%755=75U=755=75U=75U=74U=75U=755=755=75 -MU=74U=75U=75U=75U=55U=75U=?55U14U575U=75U=75U-75U=75U5155575 -MU=75U=75U=355=75U=75U575U=355=75U=75U=75U=75U=55U=75U=755=75 -MU575U575U=74UM57U5155=75U=74U-34U-75U-75U=?4U57555555=755=75 -M5=755=75U=55U=35U=74U-75U=75U=75U=75U=75U=75U5555=555=55U=36 -MU5=55%55U575U=74U-75U]34U=545=74U-34U-35U=34U=34U=5555555=75 -MU=555=755=555=75U=75U=75U=75U=75U=75U575U=75U-;55U145575U=75 -M5=35U-75U-35U=77U-75U=55U=75U=55U=75U=75U=75U=75U=34U-35U=75 -MU555U575U=75U=555=755=75U575U=75U-75U=34U=75U=755=75U=55U=75 -M5%75U=35U=75U=35U=75U=75U=555555U5555=75U=75U=755575U575U=75 -MU575U555U=75U=75U=36U5=55=75U=35U-35U=75U=74U-75U]?5U=55U=75 -MU=75U=74U-34U-34U=74U=75U55555555=75U=75U-75U=75U=74U=75U-35 -MU-34U-;45-55U=75U=35U=555555555555=4U=75U-74U-75U=55U575U=75 -MU=75U=55U5555555U575U=74U=75U=55U=75U=35U=35U=35U=74UM145535 -MU=75U-75U-74U=755555U=345555551555555575U=75U=74U=75U=35U-75 -MU=555575U=555555557555555555U=75U=355=77U5=55=75U=34U=75U=75 -MU=75U=545=75U-34U-35U=5555555555U5555555555555755=55U=755=75 -MU-35U=75U=75U=74U=75U=55U=?55U55U=75U=74U=75U=74U=35U=74U-75 -M55555=555=55U5555575U575U=74U=34U=75U=755=75U=75U=75U5555555 -M55555=75U=74UM5755755=75U=74U=75U=55U=755%75U=75U-75U=75U=75 -MU575U575U=755=555555U=75U=75U=75U=75U=34U=75U=755555U=555=77 -MU5=55=75U=75U=75U=75U=74U=75U-35U555555555555=75U555U5555555 -M5=75U=75U=75U=55U=75U=75U=75U=75U=75U=75U=55U=?55%545555U575 -MU=75U-74U=75U555U=74U-34U-35U=74U=75U=74U=75U=55U=55U=35U-75 -MU=755=75U575U=75U=75U=555=75U-75UM575535U=74U=75U=75U=35U-75 -MU=77U=75U=75U=75U=75U=74U=35U=75U=75U=75U-75U-75U=75U-34U-34 -MU-34U=75U=75U-34U=36U%355=75U=75U=75U=34U=75U=155=75U=34U-34 -MU-34U=75U=75U=555=75U=55U=75U=75U-34U-34U-34U-75U=55U=55U575 -MU=75U=?55U15U=74U=74U=75U-35U=75U=74U-35U=755=55U=55U=75U-75 -MU=75U-75U-74U=75U=75U=75U-75U=75U=75U=74U-75U-75U-74UM175575 -M5=75U=35U-34U-75U=34U575U-34U-34U-35U=55U=75U=75U-75U-74U-75 -MU=75U575U=75U=75U-75U=755575U=74U=755=7755=55-75U=75U=35U=75 -MU=75U=75U-15U=555575U555U=75U=75U575U=74U-34U-35U=75U=74U=74 -MU=34U=75U=75U=75U-35U=75U-;55U175=74U=74U-35U=74U-75U-545=75 -MU-35U-34U-75U=75U=75U575U=7555555555U=75U-75U-355=75U5555=75 -M5575U=75U=74UM5655155=75U-35U=35U=75U=75U=37U]35U=75U575U=74 -MU-75U-75U=75U=75U=75U=75U=75U=75U=75U-35U555U-75U=75U-75U=76 -MU5=55-75U=75U=75U=35U-75U=355=75U-?5U=74U=34U=74U=75U=34U=75 -MU-75U=35U=75U=55U=755=75U-35U=74U-75U-35U=75U=35U=75U=75U=75 -M5575U=755=75U575U-35U=75U=35U=75U=555=755555U=75U=74U=75U=75 -MU=75U-35U=34U-75U-34U=75U-75U=74U575U=75U=75U-15U-34U-75U-35 -M5535U-75U=34U555U-355575U5555=7555555=555=75U=755=75U=75U575 -MU-75U5555555U575U=75U5555=75U575U=34U=75U-75U=75U-34U-75U575 -MU=555=75U=34U=35U=755575U-34U=75U5555=75U=75U=75U=75U=75U=75 -MU=75U=34U=75U=755=75U=55U=75U555U=54555"9F5P=D=;U-#%:B<A/#$# -M:^::@HNUMK:_IJ"]@Y&!B+6=8&F$L[R$-28F/6V:X@$V-P,;#CPE/7JVO((" -M/C\`F8^'_OV!MK?C"S(.@;JDL74)#&6<EFT>Q8N\L4@R)3#ZL;*"%``=\_P8 -M-#1BM+NRVC,[-MZ)B9%B39N-E`T\,A6QI;WB-3,/VY[F%!2=M["9"SL^'K2Y -ML.`##13F4P<(&H:_OH$(.S\:C;:/QQ98F9X7-S(-@+B[C0(\,!V9A.1H78&W -MC1\\.PJ'OKF"!34->>U^!@;EM[ZT$C\Z-9RPL)L1'EZ0]``Q-?FRI;%I/3X( -M[H^&R6SCC8[V-#DS5[*ZL7PT-@3GE6<;;X&SL.\V.CUDMK^U3P$%5NQN#C40 -MB;B_DC<[,VZ/M85[8I6`G00S/02+NKZ8"#(U89Z19!;CB[&!`#DX`X^YO9X& -M"1OU_AT/!I*RN8D!.3D-A[&U[A!LE)E\"S,(G;^ZM1H],@&0@)!G99FUB6<P -M.#:4O+N*$30+%^W+'@9UB+RQ2#(Z,>6QLH)N!&GIX!@T-&>WNK+V,#DWT(^, -MZVS5A(^4#S\R%K:EO>,U,`W?D\,2%Y^VLY@+.SX9M;ZQX0$`;>-/``H%@;ZY -M@`@X/!N#MX+6%,J$FQ$V/0V`N+N-`STQ$IR;P!30@K:/'#PX"H2^OH,:"@!T -MXV(``.2VN;<0/SLUD[&VGA83]YS*`C`U_;*EL6\R/P[M@H57;>N.B/(T.3-: -ML[JQ<C0T&N3L:P1N@+*SZ#8Z/6&WO(I)!Q_W[A4(-!*(N+^=-S@P:(V+F61D -MDXV?!S(]!XBZOI@),PIGG>AI$.^ULX,`.3D"C;ZRGP<,'?_W&`D!DK*XB`8Y -M.0V$MHOB%GN2FGDU,@N2O[JU&#(S!I&&ZVUXA;2+9#`X-NJ\N(L6-0YJXE,% -M`'2*O[%$,CHQ_+:S@&\8>I?C!3<W8+:ZO?PQ/C17C8/@;,N!B)<./ST0M[JR -MX@HQ`]J70AD1F;&RF@L[/QB*O[;F!@=^[W("-`2!OKF`"3@\&H"T@%QHYX:% -M$#$\#(&XNXT`,C83DIU"$<6,L8X</#L*A;^_@!@)!UGF%0T#Y;&YMQ$_.S61 -MMK><%!3@F,H,,S3WLJ6Q8S,\#^.`GG5MEHB*^30X,TJSN[9W-349Y.00!FB" -MO;*5-CH]8K2]B$X$$>;K%C4W'(B[OI\T.3!K@XZ29G.9CY@'/3P&B+N^FPXP -M"&60Y!82Z+2R@@`Y.`*"O[.<!`(6Y\,%"@"2O;B+!SX^#9JWCN<409B$>#4] -M-9"_NK4>,C,'EX7G:G^'MXI[,SLV[[VYBQ<+#&WC<08"<;6^L%8R.C'TM["& -M;1Q%DNT$-C9LMJ6]Y3$^-%V#AOQO^8**D0X^/1*WNK+M"#<!P>MD!1.;L+V$ -M"SL_&XB\M^<$&ECK90PW!X&^N(,..3T:AHJ'36WH@X<0,#P.AKBXC0$S-Q&0 -MEF02S8ZSB!T\.S68O+R`'@\%V>00#@WZL;BV%SPX-9>WM),5;Y6%]`\R-\.R -MI;!F,#T,YH:096V3M;3D-S@S?;"[MDD+"QWD]A\#%8*\LI8V.C)NM;*.3AMI -MZ)43-#8>B+N^GC4^,6N`C9=@0X6(F@8]/P&)N[Z;##$.>9?.'!^5M[V-`3DX -M#8.\LYT%`6GBW@8U`I*]NXH$/CX-F+6,_FK&A(9X-#PUEK^ZM1PS,`25F<X6 -M?8&QM7TS.S'CLKF(%0D#9.!D``Q\M;FSVS,[,<>TMH=B$/69[P8Q'ZBBI;./ -MDW4<``DT,#T^/SD\/S,P-`L`!!5E^NJ9A(.-B8B*BK6*BXB.C(*`AH6>D)7B -M^<1;<V=M:!06$1`3$Q,3$!$1%Q05:6QC9F5_<$I!7U33V,;-R?7T]_?W]_?T -M]<O)S,/!Q-C>TM#6U51645!24EU<7%]?7U]<75U24U!145975U15U=74U]?6 -MUM;6UM;6UM;6UM;6UM?7U]?4U-34U-34U-34U-35U=75U=75U=34U=75U-75 -MU=34U-34U-34U-34U=34U-34U-34U-34U=74U-75U-34U-34U-75U-75U=75 -MU-34U-74U=75U=34U-34U-74U=75U=75U=74U-34U-75U=75U=75U-34U-34 -MU-75U-34U-34U-34U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=35U-75U=75U=75U=75 -MU=75U=755=75U=75U=75U=555=75U=75U=35U=75U=75U=75U=75U=75U=55 -M5575U=75U=75U=75U=75U=75U=34U-75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=55U=75U=75U=75U=755=75U575U=75U=7555555=75U=75U=75 -MU=75U=75U=75U=75U=5555555555U=75U=75U=55U=75U=75U=75U=75U=75 -M5=75U=75U=75555555555=75U=75U=555=75U=75U-35U-75U=75U=75U=75 -MU=75U55555755=75U=75U=755555U=75U=75U=75U=55U=/BD.WA\\1727=Y -M>&1E9V5D>WA\<G=U0T1<4=;2V=K!P\S.R,C(R,G)SLS"P,;$VMG?TM/1U]15 -M5%915E!275U<7%Q=75)24U!045%65E=75%75U=34U-?4U-37U]34U-34U-75 -MU575U=75555555555=7555555%55U55555555555555555555515U=75U=75 -MU=74U=75U=75U555555555555575U=75U=555=75U=75U575U=75U-75U-75 -MU=75U=5555555555U=755=55U5755575U555U=34U=55U555555555755=75 -MU=75U=74U=755575U55555555555U=75U=755=75U=75U=75U-74U-75U=75 -MU=75U-75U=75U=55U=75U=555-75U=75U=75U=75U=75U=75U=75U5555=75 -MU=75U=74U555U=55U=75U=75U=75U=75U5555=77U5=55=55U=75U=74U=74 -MU=74U-34U-37U-755=755=555-555=5555755555U=75U=34U-75U575U=75 -MU=75U=75U=75U=75U=75U=75U-;55%55U575U=74U=75U=75U=755=755%35 -M5=75U=75U=75U=75U=755=555=55U=75U=75U=75U=75U-74U-34U-74U-75 -MU%755=75U=74UM5455355=755=75U=75U=75U=75U=75U-35U=7555555555 -M5575U=74U-34U-34U-34U-35U=7555755555U=75U=75U=75U=75U=75U=36 -MU5155=75U=75U=755=75U=75U=75U515U=75U-34U-34U-34U=35U=75U575 -MU5755555U=75U-75U=75U=75U=74U=74U=75U=75U=35U-;55U55U555U=75 -MU=75U-34U-35U-35U=34U5555575U=75U=75U-75U=75U-74U=34U=35U=75 -MU=75U=75U=75U=75U575U=75U=75U=74U]5755155=75U=75U-74U-74U-75 -MU-555=55U=75U=74U=75U=75U575U575U=75U5755=75U=55U=75U=35U=75 -MU=75U=35U=75U=75U=36U%155=55U-75U=75U-35U-75U=74U=74U]755555 -M5555U575U=55U=75U=75U=75U=34U-75U=75U=55U=75U=75U=555=75U=75 -MU=75U-;55U54U=75U=75U=75U=75U-75U=755%755=75U=74U-74U=75U575 -MU=755=75U=555=555=555555U=75U=75U=75U=75U=75U=75U=74UM545535 -MU=75U=75U=74U=35U=75U575U-35U5555555U5555575U=75U=75U=75U=35 -MU-75U=75U=75U=75U=75U=75U=555=75U=75U=76U5945%55U575U=75U=75 -MU=75U55555145575U-34U-35U-75U=555555U55555555555555555555=75 -MU=75U575U555U57555555555U=?55U555=75U=74U=75U=75U=75U-35U=34 -MU=555514555555555=755575U=75U=75U=75U=55U=55U555U5755575U=75 -MU=75U=75U=74UM5755155=75U=75U=75U=75U575U=555-75U=35U=75U=55 -MU=75U=75U=75U=75U5755575U=75U=74U=35U=75U=75U=75U=75U=755=36 -MU5=55-75U=75U=75U=75U-75U=35U=74U]3555555=75U=75U=75U=75U=75 -MU-75U=34U=75U=75U=55U=55U=75U=75U=75U-34U-34U-'55%55U=74U=35 -MU=34U=34U-35U=745535U=74U-35U-75U=75U=75U=75U=75U5755555U=75 -MU=75U=35U=75U=35U-35U=75U575U575UU575535U=74U-74U=34U=34U=35 -MU=75U-?4U575U=75U=75U=75U=75U=75U=35U=75U=75U575U=75U=74U-74 -MU-75U=75U=75U-35U-36U5155=75U-75U-34U-35U-75U555U5575%55U=34 -MU=34U-35U-75U=75U575U=55U555U5755555U=75U=75U=75U=55U5755575 -M5=75U=35U=55U=55U=75U=75U=75U=75U=75U=74U575U555U555U=75U=34 -MU=75U=74U=74U=34U=75U=75U=55U5555=75U=75U=74U=75U=75U=55U575 -MU=75U=75U=75U=55U=75U=155%75U=34U=74U-34U=35U-75U=75U=755=75 -M5555U=75U=75U=34U=74U=75U=34U=75U=75U=75U5555=55U=75U=75U-74 -MU=34U=74U=75U]5555555=75U5755=75U=75U=75U=34U-34U-5555755=75 -MU=75U=755=755=555=75U=75U-35U=75U=75U-75U=75U=75U=75U=74U575 -MU=74U-75U=75U=75U=74U=75U=34U=35U=75U=74U=35U=35U=75U=75U=55 -MU=75U=75U=34U]35U=75U5555575U575U=34U=75U=55U=35557555755=75 -MU=75U=75U=75U=55U=75U=75U=55U=75U=75U=75U=55U=75U=75U-34U-34 -MU%75U=75U=755=74U=75U=74U=75U=555=75U-34U-34U=35U=75U=75U=75 -MU=55U=55U=55U555U555U=75555555555575U=75U=75U=755555U=75U=75 -MU=75U=35U=755=75U=74U-75U=75U=55U555U555U575U=755=75U=35U=75 -MU=55U5755=74U=75U=75U=75U=75U-74U-35U=755=755=7555755555U=75 -MU=555U15U=35U-34U-75U=75U=75U575U=75U575U555U=75U=75U=75U=34 -MU-35U-34U=755575557555555=55U=75U=75U=35U=34U=75U575U]34U=75 -MU555U=75U=75U=75U=75U=75U=74U=75U=75U=75U=75U=75U=74U=75U=75 -MU=5!9F1P<49:U=':8B0@/C$"%/J9@XJUMK&ZH:2"Z96"O;F+D9:(CG(\)SD6 -MB8(=,STU`S0X)32%L(@'/S\"^NP5$I:PN8D#/S'GL+*-Y):(M>$U/`V.NKZ: -M!P-A[V((-6>QNK8</#T$EI!M'>^WLYTW)3+4M[:>:G^;AVDP/P*(N[SK#PD4 -MX&<,#O>SNK0$/S(<A816%9>WL>\Q)3#KL+"?$&F1GA`P/02TNK+&-340X'(# -M`^^RN(X,.3(4@(#\;)>UM-4S.C>8O;.3&1/MD1TQ,Q:QI;!A-C<3[M4$!)"R -MOH$U.S-[CH_C;>N(B6(R.PN#OK.5!QOWZ1PV-G"SI;82,S80E_X>'Y^RO)PV -M.C#+M8ON;^",@Q`].0*(N+/E`@9$X!TT-?B]NK4'/3$7G.@7%INSL^`P.C:5 -MMK7I%?>!A!@]/P6TN[!>"0)YYQ,*#Y>\NXP,/S%MA))C:9JQMDP].C2;L[?L -M$$":G`0R,A2QNK9L-0YAYA0/`9F_N88U.39W@)IV8)NVM14\.PF`O;?D&6"3 -ME`8S,4.RNK0<-@MC[&T#&X>_OY(V.#?PCH%49IFTCQX_.`")O[?-!Q;HXP8P -M-."\NH@&,S5FE'$'$(&\LN0S.S25M8W!8)*(@0<_/ABTN;=V`Q[[^`8V")*^ -MNX(,/35\G<$>:8.]L7T].PN9MX[,;I2,F0,_/6NPN+1H#@3&\@0T`H2YN(0U -M/S53A>`69(*RM!$_.`R`L(C8%^&!EPP\,U>RNXH<-0!0_1L+!(.YOI$V/C7_ -M@99O<X.PB04Y.0:.LHM$'=N;X`\]-^F_NX\'-P);Y!T,$H^YO?(S.0N5C)YD -M=8&V@P,Y/A^TO(MZ!7^3]P\R"IFYN(`-,`Q1[Q0`:8F^L&<\.0^>BX1S=H>U -MF@\Y/&VQOHEK`6CKTPPP#(&XN9L*,@_!EF8%?HN_MQ(^.0.&M(%Q>YN)E@LY -M,\>RN8\=#!/F4PTW!XR[OY4W/0_EGEL<7(N]BP<Y.02,L8-_;9*#YC4^-I6_ -MN8,$"!C\40`U'(N[O<,P/`SJA/P7P8BS@@PX/Q.ULX-A%^B'WC4_-9JYN8<" -M-`3QQ0<.:;6[L&(]/P.=@^ENRHZQA0L[/6>VO8-J'/V>=S4]#X.[OIP(-@;R -M_!L#=+>XMQ\_/P:$CI!CR8RTD30[,_>SO(`3!$26934P!HFZO^PT,`;G[1,' -MSK>^B@$Y/QB"M9]ATH"(Y3<X-I:\OX<:`&'I80LV'+6ZO5<Q,P;IEFX9Y[>\ -MC0X[/!>(MYMC3H2-6S8Y-86^OY@!#!7A9@XU;[:ZL&DR,@20GG(0[[>RA#4[ -M,G^TL9IH9YZ&83$_#X*XO)8/"Q#D>`T)1;&[MQD\/1N;A]H5Z+2QD38Z,/ZQ -ML)L6%9>9%3$]!HNZO>0*-!SF30$"^K"XBP`^/1*&@^1OZ8JT_C$[-I&RLYX? -M'>:0%C8S'[>ELT\W-Q_LP`4'ZK.^@@DX,FB,CNYMXHF(<3,X-82_LI`$!=KK -M$#<V;;&EL14P,1R4YAP9D+.\A30[,TJ*BI5O^(*-:S(Y#XVYLNX#`7;C$#4U -MU[.ZM!L],1.=E!40G+"REC$Z,>6WM)<5WX:'$C(_!HJ[L_<.#&'F%PL.XKV[ -MB`,_,!2%G&=JGK&Q]C,Z-Y"PMY40<YB>&#,]'+:ZL'TU"6[A:0\#D+RX@@@Y -M,6&!A$%MG[>T93T["H2]MNX>;I&6!3,P8["EMA<V-6CL9``$F+R^A30X,5^/ -M@,%@DK6)$3PX#(V_L>4$$^WO!#$WP+VZM1LP-&F46@0<A+R]E#$[-^>*C/-B -MEHB#&SP^!XJYMM`#&_#G!38*ZKRZC@,]-&.2\Q\4AKVPP#([-)"WB?]I[HV% -M!CP\$K:[MV4&I:"ZL8*59Q@""#0R,CX_.3P\,S$U"`$::G#DE)B'@XR)B(J* -MM8J+B(Z,@H"'FI^0E>/\VD1]9FQK%!81$!,3$Q,0$187%&IH;&-F97]Q2$9< -M5-/8QLW)]?3W]_?W]_3UR\[-P\;%V-_=T-;55%904U)=7%]?7UQ?7%Q=75)3 -M4%!15E=45=75U-34U]?6U];6T='1T=;6UM?7U]?7U]?7U-34U-35U=74U=74 -MU=75U=75U=75U-35U-34U-34U-75U-34U-34U-34U-34U-34U-34U-34U-34 -MU=75U=75U-34U-34U-74U=75U-34U-34U-34U-34U=35U-34U-35U=75U=75 -MU=75U-75U=75U=75U=75U=75U=75U=75U=75U=74U-35U=75U=75U=75U=35 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U575U=75U=75U=75U575 -MU=75U=75U=75U=75U=75U=75U=75U=75U=555=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=555=55U=75U=75U=75U=75U=75U=34U-35 -MU-75U=75U-75U-75U=75U=55U=75U=75U=75U=75U=75U=75U=75U=755=55 -MU=75U=75U=75U=75U=75U=35U-75U=75U=75U=75U=755=55555555555=75 -MU575U5555=75U=74U=75U=75U=75U=75U=75U=75555555555=75U=55U555 -M5555U=75U=75U=755=75U=75U=74U=75U=55U=75U=75U=75U=755=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U-75U=75U=75U=75U=35U=75 -MU=7WEI3FY\#90TM\>65E9&=D97AY<G!U24=;4%30W-K&PLW.R<C(R<G)SL_- -MPL#&Q=O>W]+0UM355%914%-275U=75U=4E)34U!145%145975%555=75U=34 -MU-74U];45-55U-74U-34U-35U5755=555%755515U-1555155%1455555=55 -MU=75U=555=555=755=75U5755575U575U=75U-75U-75U=75U=74U]575%35 -M5575U=75U=75U=55U=75U=55U5145=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U-75U=75U=75U575U5555=76U5=55%555=75U=755=75 -MU=34U=75U-75U=34U=555555U=55U=755=75U=75U=75U=74U=75U=75U=75 -MU=55U555U=75U5555=755575U=?55U145575U=35U=75U-35U-75U-35U=55 -M5U75U=75U=74U-35U=75U=5555555555U=55U=74U-35U=74U-34U=74U-35 -MU=75U=75U=75UM1755755=75U=75U=75U=75U=75U=75U=74U-75U5555575 -MU=755=7555555=75U575U575U-755575U=75U=755=75U=755=75U=75U=36 -MU%155=55U=75U-74U-35U=755=75U5755%15U=75U=75U-35U575U=555575 -MU=75U=75U575U=745=75U=755=75U-75U=75U=555555U==55U145=75U=74 -MU-74U-74U-34U-34U-35U-?5U=7555755575U=75U=75U555U555U575U=75 -MU=75U=755=5555555=75U=75U=75U575UM565575U=35U=75U=75U=75U=74 -MU=74U-55U=35U=74U-34U-75U-75U=75U=75555555755=75U=75U=75U=55 -MU=55U=75U=75U575U=76U5355575U=75U=75U=75U=74U=35U=75U=37U-75 -MU=55U575U=75U=75U=75U=75U=35U=35U-75U=75U=74U-34U=75U=75U=75 -MU=75U=;55U545575U=75U=75U-34U-75U555U=545-75U=35U=75U=75U=75 -M5=55U=75U=55U=555=75U-75U-75U-74U=75U=74U=74U=74U=74UM575515 -M5=75U=34U=75U=75U=75U=75U=74U]35U555555555555=55U575U=75U=55 -M5=75U=75U=55U=75U575U575U555U=75U=75U=34U574U=75U=75U=75U=75 -MU=75U=55U=34U555U=55U=75U=75U=75U555U55555555555555555555555 -M55755=75U=75U=5555555555U=955U545=55U=75U=75U=75U=75U=74U-75 -MU-?55554555455545575U=75U=75U=75U=74U=75U575U=75U555U=755=75 -MU=74U=34U=74UM5755355=555=55U=75U=75U=755555U=555=75U-74U-35 -MU=75U=55U5555555U=55U=55U=75U=75U=755=55U=75U555U555U5555=77 -M55=45-75U=75U=35U=75U=55U=55U=75U=37U%55555455555=55U=74U=75 -MU=75U=75U=74U=555=75U=755=755=75U=75U=75U=55U=?55U55U=75U-35 -MU=75U=75U=75U=75U=355=74U-34U-34U-75U-34U=34U-34U=75U=755575 -MU=75U=75U-74U-35U-35U=755=75U=75U]575575U=75U-75U=75U=75U=75 -MU=35U=75U]34U=75U=75U575U=75U=75U=75U=75U-34U=34U-35U=34U=35 -MU=75U575U=75U-75U-36U%155=74U-34U=34U-34U=74U=755=74U515U=74 -MU-35U-74U=35U-75U=75U=75U=74U=75U=74U-75U=75U=35U=35U=755=75 -M5=75U=?55U545575U-75U-35U=75U=75U575U=75U=?7U=75U575U=75U=75 -MU=55U=55U=75U=75U=35U=75U=35U=75U=75U=75U=75U=34U-34UM145575 -MU=75U=75U=75U=75U=75U=75U-15U=34U-34U-35U=5555555575U=75U=75 -M555555555=75U=35U=35U=75555555555575U=76U5=55555U=75U=75U=75 -MU575U=75U=75U=74U-7555555=555=75U=34U-34U-34U=74U=75U=35U=74 -MU-75U=75U=75U=75U=75U=75U-;45U55U=74U=34U-35U-75U=75U5555=75 -M5%75U=75U=75U=74U=75U=75U=34U-34U-75U=55U=555=75U575U=75U=74 -MU-75U=75U=74UM5755155=75U=75U=74U=35U=34U-34U-74U]?5U=75U=55 -M5=75U=755=75U=75U=74U-34U-75U=75U575U=75U=555=755=75U=75U=36 -MU5355=75U=35U-34U-34U-34U=35U=75U555U=74U-34U-35U=75U=75U=75 -MU=75U=75U5555=75U5755575U=75U=75U=7555755=75U=;55E1455755=75 -MU=75U=75U=75U=75U=35U=?4U=555575U=75U=75U=75U=75U575U=75U=75 -MU-755=75U=75U=34U=75U=75U=75U=74UM14U575U=55U=75U=75U=75U-74 -MU-35U=355575U=75U-34U-35U-74U-75U=75U=74U=74U=74U=75U=74U-34 -MU-34U-75U=755=55557755?55=75U-75U=75U=75U-34U-35U=35U=74U%55 -M5575U=75U=75U=75U575U=75U=34U=35U=35U=75U=355=555575U=75U=55 -MU=55U=35U=75U-75U=74U=74U=74U-34U-34U=755535U=74U=34U=75U=74 -MU=75U=34U=74U-75U=75U-35U=74U-35U=35U=75U=75U=75U=74UM545575 -MU=75U=75U=75U=75U=755=75U=74U]?4U=7555555555U=75U=75U-35U=35 -MU=74U-35U=75U=75U-75U575U=55U=75U=75U=31U5355-75U=34U-34U-75 -MU=555=75U=75U-545=55U=75U=75U=75U=75U=75U=75U=75U-75U-75U-75 -MU=75U-34U=75U=75U=75U=75U=?55U145=75U=34U=75U=75U=75U-75U=75 -MU=?7U=55555555555=55U=75U=75U=75U=75U=75555>969S<T)$5M;913TC -M)3,/$\N%@(N+MK:SMK>PIZRGA1]FFI@<#G:VL_H\)S\#`S`R!8.-!B4G,6!A -M``:>LK80/SUIC(#YX+>XMA@]-)&VB>SJM+V&-3@UA;:"0,2/M4D].@^,L(9I -M<H:!&CDY$[:RA!!DA9P"/C/IO+V2&FF2X`@\"X*[L\H"$NY8"C,%M[JW$`H; -M^V<*-T.]NHP"-@7^80D/G;FYDS0P&^)_`AJ-N+)D,C`0D%0$;;6XM`$^,7R$ -M^QW"M[^&-#LWZ8WJ:N^VL/HR.P^'BY!BE[2U$CDY'HJWD&V7BH$-.SW`L+:5 -M%.Z-E#0X-X2_MO<?_(1`,3X#M;BT;0=$D!0P,FZRNX\%#6;L'S$TE[ZYF0X( -M;N48-P*"N[S=-S5LY!X+$[2ZMADR-7+I$P/0L+N,"#\*_9)I&Y:ROY<P.0R3 -MA7(7A;*Q:3\^&H"#TF&&LXD#.SU_BH_.>8&WF#0Z,9"QB-9EAXC#,SL.C+V) -M96Z9@1$]/ARVOX(1$)>2!SPS^[R_FP<:Y^`",@J&N+WE#@;-Q@PQ!+6EL10T -M`]]1#35^L[J(`S`"]]X`#9>_N)@T,@'L^00;AKZ]33(]&)SH$FF/OK<$.3)M -M@9)K1XN]@#4[,>&)FF?WBK'L,SL+A[>$9/^)BQ4_.02*L(5N]8V&`3D]2;"S -MG!-:AY8(.3:9O[/@!&&=VC0\#8B[MF<-%^AF-#`7L+J+&@L=YVHT-.*_NX<. -M-QSD%0L#AKB_^38V$.]L#1*+N[$2/3%MDWP'2[>XC@XY-\&%V1WBL;R=,3@( -MDX+G:I"QL7L_.0:#B.YCG+:)!S@_;+6U[F*<M9H*.S"5L[3X%9&-^38X"X*_ -MM'0=[85L,S\;MKF)$03.D1XS,-B\N88&`TK@!#`*A;B_Z`@.>_T'-P>+NK-O -M-@M]_@0(8[&ZM0$R"-'B'@#BLKB$-#\/[9$6'IB\O<PR/P:9F&!H@;VW&#D\ -M%H*&='^"LX((.S/RM8)%3(*WE#$Z-86QC7%T@(YF/3@!BKV";V:%AQH_/&:S -MO(0<%).6`C\VD[Z\EP$?[_,),@R/N[-U"03_0P@Q$[&EM!@W!O9S#@KRO+N# -M#C`&^DX"`)NYONDQ,P65V@<=C+FP%SPS%IGF'WN*OHL-.3%%@)04]+2]F#8[ -M-)&)G6+CM+9>/3@"@[2>8.R*CALY/A:TL9UKX8R%#S@SX[*PZA++AN`T.36` -MOK'3!'2<?38\!+>[M!<";>L4-C%TO;N-`0@4YA,W"YRYN9,*-!?D$PH'C+N] -M>3`W:>\7#&BWN[0'/#1WD&T'\+"Y@#4^"N&%=1*1L[WF,CD-F(#,:)BPMQ,^ -M/A^,COMFA;:"##LRU[>*_F&:M9`W.S>8L[76:)^-3C,Y`HB_B&,3E)H3,CUJ -ML+Z"'AKEE`<R-I6^OI\#`=+Z`#`/@KN]VPH-0<\#-Q^WI;8<,0]2RP$(U;*Z -MC`\R#//D!0&3O+Z0,3P`E)42$H:_LV(\/!F%G&A@C+R*`#@R>HR$946.LX0T -M.S:5M8%]WHZW]S([#H.Q@6?7@HP3/SX?M+*'%7>'F@`^,O>RO9T9;9_O"3\U -MA[FR^0`1ZE<U,@:UNK9K"1GG934V9K.ZB08T!?EC"PB7OKB;-3$;X60,!X"X -MO%8P,!*42084B[BV!3\Q8YCU&5&WOH(*.#?Y@.(7X[:RE3,X"9B)EVR7M[=K -M/SD$C[218I:UC0`X/'RVMI5KE8^2-3@VG;VV^!+FAL0V/@^.N;1Z!=V<:#`] -M$[&XB1\#?N@<,3;GO[B$`@YMY!@V#X:[O^0T-6SE1M;JP$3`U>N(=#'&Q -MNX@,/`K%EA0$Z+*^GC8^#Y289Q"8O;-V/#X'A(%;;8:SM0<X/&F)C<5X@;:' -M"CLP[;>.W7F&M>8P.PJ!LHEP8YJ":3T^!;2_C147DYD%/#):O:"LI[R*F=$3 -M`0XU,#(_/CX^/STP-@H,!QUAW.^2A8&-CXB+BK6UBHN)CXV#AH28G9;NY/54 -M=7IC:147$1`3$Q,3$Q`1%A<5:VYM861X<G1-6U#7W\7#S\OU]_?W]_?T]<K( -MS\+!Q]K9W-+1U%5745!34EU=7%Q?7U]<7%U24U-045975%155=75U-?7U];6 -MUM;6UM;6UM;6UM?7U]?7U]34U=34U=74U-34U=75U=75U=74U=34U-34U-34 -MU-34U-34U-34U-34U-34U-34U-34U-34U-35U=75U=35U-74U-34U=75U=75 -MU-34U-34U-75U=74U-74U-74U=75U=75U=75U=75U=75U=75U=75U=34U-74 -MU=75U=75U=75U=74U=75U=75U=75U=74U-75U=75U=75U=74U-34U=75U=75 -MU=75U=75U=75U=55U=75U=75U=75U55555555=75U=75U=75U555U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=74U=75U=75U=75U=75U=75U=55 -M55555575U=75U=75U=75U=75U=74U-74U=35U=75U=75U-34U=75U=75U=75 -MU=74U=75U=5555755=55U=75U=755=555=55U=75U=75U=75U=75U=75U=75 -MU=75U555U575U=75U575555555555=75U=75U=755=75U=75U=35U=75U=75 -MU=75U=75U=75U55555555575U=75U57555555=75U=35U=75U=75U=75U=75 -MU-75U=755=75U=75U=75U=75U555U=75U=75U=75U=7'E9'AX<K:6DMS>7ID -M9&=E9'AX?7-T2D%%4E;1W=O$P\S.SLO(R\C(R<[-PL'&Q=O9W]+0UM155U91 -M4%)=4EU=4E)24U)34%!04%%15E975U=55575U=35U-34U-?4U-34U-34U=35 -MU=75U=555555555455145%55555555755555U=75U575U5755574U5155554 -M55555=75U=555=75U=75U575U=555=5555555=75U=75U5755575U=75U-36 -MU%155=75U=75U-7555555555U=75U-75U=555%75U=75U=74U=75U=755=75 -M55555=755=55U=75U=55U=75U=75U-75U=75U555U555U=75U=75U=75U=75 -MU=75U=75U=75U=75U575U=74U]35U=755=755=755=75U=75U=75U=75U=75 -MU-75U-35U=75U=75U=75U=75U=75U=75U-75U=75U=74U=75U=75U=75U=75 -MU=755=755%=55=74U=34U=35U=55U=15U=35U=75U5555575U=75U=75U=75 -MU-75U=75U=34U=74U-7555555%555575U=74U-34U=74U=75U=75U=55U=?5 -MU=55555555755555U=55U555U=75U=55U=75U=75U=74U=755=75U=75U555 -M5575U=755=75U575U=75U=75U=34U-35U=75555555175555U=75U=35U-35 -MU=75U=75U575U575U575U575U=75U=75U=34U=34U=75U=755575U=555575 -MU5755575U=35U=34U-?4U-35U=755=74U-5555555=755555U575U=75U-74 -MU-74U=74U=75U=75U=75U=34U=75U=75U=75U=34U-75U=35U=75U=75U=34 -MU=75U=75U-75U=345=75U=34U-74U-74U=74U=74U=75U55555555=75U=55 -MU=75U=75U=75U=75U=75U=35U=555555U=75U=34U-34U=75U=55U=75U=74 -MU=74U]35U5755=75U-74U-35U-75U=75U=35U=74U=34U=75U=755=555=75 -MU=75U-74U-35U-55U575U=75U=74U=75U575U=75U=35U=74U555U=74U=34 -MU=75U=755=5555555555555555555=5555555=75U=75U555U55555755575 -MU575U=75U=75U=75U=75U=75U=75U575U-75U=34U=75U575U=75U=75U=34 -MU=75U=75U=75U=75U555555555555575U=75U=755=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=545-75U-34U=75U=75U=75U=75U=75U=75U575 -MU=75U575U=75U=55555555555=555555U554555555555555555555755=75 -MU=75U=75U=74U%5555555575U=75U=5555555555U=75U=74U=75U=75U=75 -M5=75U=75U=75U=75U575U575U=75U=75U=75U=75U=75U=75U=75U=755%75 -MU=75U-75U=75U=75U=75U5755555555555555=75U=75U=75U=55U=75U=75 -MU=555=755=75U575U575U=75U575U555U=75U=75U=75U-15U55555555555 -MU=74U=75U-75U=75U=75U=755=75U=75U=75U=35U=75U=75U=75U-55U555 -M5=75U=74U=75U=75U=75U=755575U515U=74U-34U-34U=75U=35U=34U-75 -MU=75U=75U=75U-34U-75U=75U-35U-74U-75U=74U575U=35U=75U=75U=75 -MU=75U=75U=75U=75U=?7U-75U=75U=75U=75U=75U=75U=75U=35U=75U=55 -MU575U-74U-34U-35U=75U=75U-35U=75U=35U-75U=75U=74U-34U-34U=75 -MU=545=75U=75U=75U=75U5555575U=75U-75U=75U575U=75U=75U=74U-34 -MU=74U=75U=75U]575%155=55U=35U=75U=35U=75U=75U=34U=74U-75U=55 -MU=75U575U555U=75U=75U=74U-34U=34U=75U=75U=75U=75U=755=75U=36 -MU%355=55U=34U-34U=75U=75U=35U-35U-35U575U-34U-34U-74U-75U%75 -M555555555=755=75U=35U=74U=75U=34U=35U=55U=75U-?55U1455555=75 -MU-34U-35U-75U=75U=75U575U]?5U=74U=75U575U=75U=34U-34U=35U=75 -MU=75U=75555555555=55U5755=75U=74UM14U575U=75U=75U=75U=75U-34 -MU-34U=75U554U=74U-75U=74U-74U-75U=75U=75U=55U=55U=75U-35U-35 -MU=75U575U575U-75U=76U5=55%55U=75U=75U=75U=75U=75U575U=555=37 -MU5755575U575U=755=75U=55U5555=55U=35U=75U=55U=755=755=75U=75 -MU-75U=;45U55U=74U-34U-35U-74U=75U=74U=755=555-55U=35U-35U-34 -MU-35U=75U=55U=75U=55U575U5555555U=75U=75U=75U=75U=74UM145575 -M5=75U=75U=74U=35U-75U=35U=75U=74U]55U=55557555545=55U=55U=75 -MU=75U=75U=75U=75U=75U575U57555555=55U=71U%=55-55U=75U=74U-34 -MU-35U=75U575U=755575U=35U=75U-35U=75U=75U=75U555555555155575 -MU-34U-34U=34U=74U=35U=34U-;55U545575U=35U=75U=75U=75U-34U=75 -MU=55U-?5U5555515U555U5755=55U5555=75U=74U=75U=75U=75U=75U=55 -M5555U=75U=74T=175%155=75U=75U=75U=75U=75U=755W-@?W-*1%S6W=H" -M+2<S"A]WD(2/BK.[O(N.B+2DHJ2`&@UKGX#F'01\[7`T)"$_9;6)$#@A)0.0 -MA/`:!7"7\@0T#)&\I;!K,CT?M+B]A1$?5)V5:P5YC[RSYC$Z,.F\N8X%,300 -ME)5D$]:`M9@"/SP?M[J]RS$_"^*.@N%I7YZ%=0@P#82^N(,(.SP1BK.)=P<< -MQN)N`@Q$M;^W$3\Z"H:^O)H`-`-=E\43%Y.TM^HU.#/2O:6W$3,S!Y*"G')A -ME(.:'3$R!(B[OY<V.S''M;>%%1]PE?,%-0V7L[F.`CLY!XN_L?H-#A+GY1<$ -M88"PM'TS.S>>OKB-`3,T:IF:]VG%AHF3`CTS8K&ELV4R/@F1M8GB%F/KDGH. -M-P:!OKZ:-#H]8+>]B6`"!W3C>@<&]+6]BQH^.`R/N+R2#C8-T)SM;VF6BXKR -M-#XV[K^ZM04\,@6%B81+:>6%DQ\W,1"UN[WP,SLV[+:QA1,':N;S'@X'G;.\ -M@0D[/ARWN;%7"S49X.IE''V!MHAJ,CD+AKBX@0\]-VV'@>QM1YB#[@TS-M>S -MNK80/SD,FK:*XAP0]Y1[#34>@KZ]ES$Z,].POXX7"0-G[U8>&^6ULX(!/CX& -MM;N][C4S#_>$DW!MZXR,1S0\-9R^NHX#/C(9@+2!=!%;DY4<-31AM[NP>ST[ -M-)VSLYH;`ASP^Q8`'IFPLI@U.SQLL;NV9C0W&^B=Q!1TA[2"$C(_#8R[N9@U -M/S=\C8^6;&26A/@",37CLKJU!#DY`X"SM.<%&G;L<0$.%(R\L_,S.C'OO;Z, -M&30.8Y3E%!/AB+:$`CX\'+>ZLLPV/0_@@X70;.2&AF4T,@^$N;B`"#@R$8ZV -M@WX9;>SM$P@)7+>YMQ$_.PN'O+*?!@@%S>)C!1&8L;&5-#@SU+*ZM!$Q,1J0 -MA.UM<9B)AQ@S/02+NK^4-CDWWXB*DFL5Y)S.`#</D;VXB0(X/@2.O;?V``!L -MX%$:`&&/O;9\,CLWG[^Y@P8V"V*2EWL4YXRUG0\_,FRPI;!E,SP,EXZ`]VK3 -MF9MB-3`!@[FYFC0[,F"ULXUC!Q+VX1<,`ORWOXH:/C@,C;ZRD0TT!LR77!)H -MF;>T_38Y,>R\NHH:,C`8F8.09&60@Y\%,#`2M+J]\S,X-."TM)P1'$>4VP8U -M`9Z]OH`).S\<M;^W7@\/%^#R$`5WC+.U%3TX"X:YN8<,,S5GFIG?:?V`B>L. -M/#%6LJ6V$3P_#9ZUC/T19)23;P@W&(RYO)8Q.C!4MKV-%`(%7.!C`0?BM[V, -M`3DY!HNXLNP+-@#PG.=K8IR*B$TV/C2=OKN.`SPS'(:)F'EOXH27!38W8K>Z -MLWX].#60L;:<'P1MX\$:#AJ%LKR:-3L\;K&YM&8*"Q+O[F,<68*VCQP]/@R, -MN[Z9"STT<8&&Y&_2A8/X#C(TX+VZM`4^/P"&MHCP'A?XE6T/"A:)OK+_,SHQ -MXK.\@AP(`''O21@9Z+2SA@PY/Q^WNK/,-S`"YH26>V"6CX)A-CP)A+FX@PD^ -M,Q:-M81E%M^2[QHT-5^QN[86/S@(A;*PDP0"$/CS$@,2A+.SES<[,ERSN+46 -M-S0<EY-2%U"!M($%/3P'B[J_ES<_--R,C>AI?9.$V@\P")&\NXD#.#\$C+.* -MP`086.QD``]@B+^Q<#(Z-Y*\OX`$-`Q^E_,6$.N*MIX)/CUHL:6P>#$R`I6# -MF$9M[8"':S<R`X.XN84T.#-CB[:&8QEGZ.8>"P_YL;FU&CDX#(*_L)<#"1CS -MX6D$%82QMO@V.S'CO+N+&#`V'9V%YV]'A8F;!S(R'+2EO?\P/C7GBHB7%&GC -MG%T--P*8O+F#"3L_'(J]M40#`6?C2`0`=8B]M!4\.PJ'OKZ'`C8)?)WJ817N -MCK65"S\P1+*EMA8R/0.=B8;3:\N;GA0T,06/N+^1-CLP6;>P@14'$?GE$P\` -M[K&_C@`Y.0:(N;/B#C4$_Y1U'6*%M[5#,3DWDKZ[CP$],1.%@)1A<IV"D`8P -M,6ZVNK-S,CD*EK>TEA,=T)1:`#4'A+R_A34[/6BWO[5G#@QH[<\=!=:)LX@? -M/#D/C;B_F0DS"TB%GUENYH*.Y0L\-^:]NK0:/SP!A+6"V!%REI$7"C<3B+B] -MY#,Z,>>PLH$2`AO9YF@!!9>VO8`,.#\9M+NPSC4V!N><_!5GF+6.8S$^"X2X -MN(,//S$4@(Z<9F+HA.@&,31#L;JQ%#\X"9NPMY&+HJ2RB9U!'0`)-3`R/SX^ -M/SPR,3<(#043>\+JG82`C8Z(BXJ*BHN(B8^-@X:%F9*4[/K.779D8F@5%Q$0 -M$Q,3$Q,0$184%6AO8F%D>7-U0EA1T=[$PL[*]?3W]_?W]/7*R<_"P<3;WMW3 -MUM155U%04U)=7%]?7U]<7UQ=4E-04%%65E145=75U-?7U];6UM;6UM;6UM;6 -MUM;7U]?7U]34U-34U-34U-34U=75U=75U=75U-34U-34U=74U-34U-37U-34 -MU-34U-34U-34U-34U-34U-35U-35U-34U-75U=75U=74U=34U-34U-35U=35 -MU-34U-34U-35U=75U=74U-34U-34U-75U=75U=74U-34U=75U=75U=75U=75 -MU=75U=75U=75U=74U-35U=75U=75U=75U-35U-75U=75U=75U=75U-75U=75 -M5=75U=75U=75U=755=55U=75U=75U=75U55555555575U=75U=755=75U=75 -MU=75U=35U=75U=75U=34U-34U=75U=75U=75U=75U=755=555555U=75U=75 -MU5755=55U=75U=75U=75U=75U=75U=35U-75U=75U=75U=75U=75U=75U=75 -M5=55U=75U=75U555U=75U=75U=75U=555=75U=75U-75U=75U=75U=75U=75 -MU=75U55555755=75U=75U575U5755=75U=75U=75U=55U575U=75U=75U=55 -M55555=75U=75U=75U575U=75U=75U=75U=75U=75U=75U=35U=75U5555=55 -MU=75U=75U=75U=75U=75U=75U=755=75U=75U=75U=75U=55U=75U=74U=75 -MU=75U=75U=75U=35U=35U=55U=75U=GID./A]\5<2W%Y>V1D9V5D>'A]<W1+ -M0$525M;2V,7`PL_.R,C+R,C)SLS"P,;%VMG?W=#1U]555U914U-275U=7%)= -M4E-24U-04%%145=45%55U=34U-?4U]?4U]34U-35U-75555555555=755555 -M5555555555555555557555145%555=555=755555U5555575U=75U=74U-74 -MU]15U5555555555555755575U=75U=75U=75U=755=55U=75557555555555 -M5%155=755=75U=75U=35U=35U=35U=35U-35U-75U-75U%55U=74U-35U575 -MU5755555557555555%55U575U=74U-34U=35U-35U-75U=55U=75U=55U=75 -MU=75U=35U-75U-35U=55U555U575U=75U-?4U575557555555575U=75U=34 -MU-35U=75U=75U=75U=755=555=755=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U57555755575U-555=75U-34U=75U=75U=75U=75U=75U=75U=75U-35 -MU-75U=755=55U=75U=75U=75U=35U=75U-74U-75U=75U575U=75U575U=75 -MU=755=74U=75U=5555555=75U=75U-35U-75U-75U=75U=75U=5555555555 -M55555575U=75U-55U=75U=74U-74U575U=75U=755575U=75U=755535U=35 -MU-34U=555=75U=75U-75U55555555575U=74U=75U=74U=75U=75U=75U=74 -MU5555=75U555U=75U=75U=755=75U=75U=755575U]35U=75555555555=75 -MU=35U-34U-34U-34U-75U=755555U575U=75U=75U=75U=755=75U=74U=75 -MU=74U-34U=35U=35U=35U=75U514U575U-74U-34U-74U=75U=74U-35U=75 -MU-35U=75U=75U=75U=74U-75U=75U575UM5755155=74U=74U=74U-34U-75 -MU=75U5555=55U=34555555155575U=75U=74U-34U=74U=75U=75U=75U=75 -MU=75U=75U=755=75U=31U5=55%55U=75U-35U=75U=75U=75U=75U=75U-55 -M5=75U-34U-35U-75U=75U=55555555555=75U=75U5555575U=75U=75U=75 -MU=75U=;55U145575U=35U=75U-75U=75U=75U=75U=75U=74U%7555555=75 -M55555555U5555=75U=75U=75U=75U5755575U=75U=755=75U=74UM145575 -MU=75U=75U=75U=55U=75U=75U=755=755%155575U=75U=34U=35U=75U-75 -MU5755=75U575U=75U575U=75U575U=75U=75U=36U5=45-75U=75U=75U=75 -MU=75U=75U5755575U=74U]35U57555155555557555555555U5555555U=55 -M5575U=75555555755=755=75U=;55U5455755=75U=75U=35U=75U=75U=55 -M55555517U=75U-75U=75U=75U=75U=75U5555=75U=75U=75U=75U=75U=75 -MU=55U=75U=74UM5755155555U=75U-75U=55U=75U=75U=75U=755=34U=55 -M555555755=75U=755=75U=755=75U-35U=75U=7555755=75U=75U=55U=36 -MU%?5U=35U=55U5555=75U=75U=75U=74U-74U-355=34U-34U-34U=75U=75 -MU=75U=75U=75U=75U=35U-35U=35U-34U-75U-75U-75U-;45%55U=74U-75 -MU575U-36U]355%75U-?4U5545%35U]7555145%75U=75U=75U=5555555575 -MU575U=555555U=75U=75U-35U=75U-34UM575574U-34U=74U-74U=75U=75 -M5=74U-7555755U355=35U=15U=75U-?4U575U=34U-35U=75U-7555145=75 -MU-75U=74U-35U=75U-36U%=45-75U=75U=5?969S<T-%5]'91STC)3,/$\J8 -M@+"TBK2WL*6ELXJVO+#B#0SMO;B&-20["6X;"C0:^60P)B$WAK""!C`T%N1E -M!6B-O[W@,3\'M+N]G11SG)]H#`6#N+B%-SDTE[2.\!?VA94"/3'QO;N-#C\W -M?H218&":M(,'/C\0L+NT$30/<>IZ!!6#O;%L/SL-C[RT7082Y?X$-`"&OK^5 -M,#LUD+2,P17GAY4",C>5OKN#"3PUTX>087Z'M(``/CQNL[NU'S0,2.EB!VB- -MO;<0/CL`B+RU?0$0Y_<&-`:#N;SD,S@+GK2-56KMA^\//32=N;B&"CP*]H:7 -M8G:&M(<-.3USLKB)!30"7>]I!V..O+09.3@$M;R+8`$6X<$!-`6,N+W2/3@. -MA;2#0FOHA^<)/36:N+B;-3P)Y(:5;$&`M(4..3+'O;B,!S<#V>T5!WB(O(H' -M.#D>M+R.:0$5X]0#-!F)N+)^/#D"A[2!<VF4A_`+/0B&N+F3-ST/[(;N;E2" -MM)X+.#/AO+F#`#0!R.,6!TZ*O(D`.#X1M[R,%P9I[48"-1**N[!H/SX!@;2& -M>FR6A]TU/0^"N[[K-CT-E8?C:<:,M)`U.#&4O[F'`C0'\N80!].TO(\,.SQL -MMKV#$`9B['$,-1>TN[$3/SX$@[2$9F.0ATPT/0*/NKS[,3T`EH?D:/"/M.HW -M.#:<OKZ;##0$^^42!/&WO(,).SUPL;V&'`9G[WH/-6RWN[8;/C\8C;2;8F:= -MA'LW,@&(NKU5,#(&DX?]:.6.M.$V.#2%N;^=#C0;Y_X<!.>VO88U.C+;L+*$ -M&0=Y[V`."GZQN[0'.3P3C[2>;WN?A&TV,@2UNK)X,S(%G(3(:..(M?4Q.#6! -MN+R4"34>X/8>!>FQO84T.C/GL[*8&P1W[VD("E*PNXH#.3T5B;62:7.9A14Q -M,AFWI;!H,S,9GH7?:>F+M44P.0B"N+W@"S42XL(8&I>QO9PV.C'JLK.=!01& -M[!0+"/&SN(D/.#)AB+61:DF;FA`Q,Q"VI;$0,C`2FYI2;I2*BV4S.0^.N[+T -M"C41[-,:&)*PLI<Q.C:2LK"7!`57[1$*">.RN(T(.#!TBHJ5%5^:F1\P,&BP -MI;<9/3$6A9M";Y"UB&@R.0.+N[!;-0H4[EX%'IFSL^,S.C28O;'N!QO;XQ(* -M#I2]N(`U.#'9M8OO%=V%GQHS,'JSNK0$/39HA9EV;9VUCA$]/@:UN[%E-0AI -M[D@$'86RL\LR.S6'O;;G!AG(X1XU#)*\N80T.#;XM8CF%,Z$D@0S,5.]NHL! -M/3=FA)]_8)FTC!X\/QJWN[9N-`E@Z7T$$X>RL$X].PB`O+?U!A_PY!LU`IB_ -MOIXV.#?LM([_%/*$D0$R-OR\NHX-/#1PAYUE9YJTC04_/QVVN[06-`YEZ64' -M%H"]L6`\.`R-O+16!AWY^04U`(2^OY8Q.#67M(_)%>6'E`,R-^^_NX(./#5? -MAY!F>X2T@`8^/!6PN[4<-`QQ[F`':H*]MA<_.`..O+5V`1/D\`<U!H"YO.TS -M.`N2M(W3%>"'Z`TR-)&^NX$(/`K"AY9C<X:TA@,^/6>SNX@;-`U![V\';(^\ -MM!P^.0>+O(MD`1'FS@$T!(VYO?0R.0Z9M()::N^'X`XR-9ZYN(4U/`C^AI1M -M28&TA`PY,EBRN(\$-P/4[&H'9XF\M04Y/ANUO(EO`13@W``T&XZXLDP].0R% -MM(!T:.J'^0@]"X2XN9PT/0[@ANAO7H.TF`DY,_*\N((!-P#'XA<'<(N\BP8X -M/A*TO(\5`6KB70(U'(NXLV,\/@.&M(9^;Y>'S`H]#H&[OI<W/0SIA^UNW8VT -MG0HY,.^_N8$#-`;WX!$'7K6\C@(X/Q6WO8(1!F_M2`TU$;6[L!<_/@:`M(=D -M;9&'4C4R#(V[O^,V/0.4A^9IR(RTES0X-I&^OH4--`?_YQ,$P+2\C0\[/6:V -MO8`2!F#L?`PU:[2[MA\^/P6"M(5@8)*'<30R`XZZO/4Q,@&1A_AH_XZT[S<X -M-YF^OYX/-`7E^QT$_K>\@`L[,D"QLH<?!F7O9PXU8;:[MP4^/!^,M)AM9)R$ -M9C<R!HJZO4\P,@>2A/%HYXFU^#8X-(2YOY`.-!CF\A\%X[:]AS4[,_2PLH48 -M!WWO;0D*=+&[M0$Y/1&.M9QN?IZ%:38R!;2ZLV$S,QJ?A,-H[(BUV3`Y"H"X -MO.@(-1_C]1D%ZK&]F#<Z,..SLYX:!$KL:P@+W["[BP(Y,FF)M9-H<9B%%S$S -M'+>EL!0R,!^9A=%IZHJ*=S,Y"8VXLN4+-1/MQ1L;D;"RDS8Z,9>RLY,%!5CM -M%PL(^;*XCPXX,V6+M9=J0YN;$C$S%K&EMATR,!.;FEYOE[6+8#(Y#8F[L\0U -M"A;OU1H9G;.RZC`Z-YRRL+.BI+*.DW4?``DU,#T_/CX^/#(Q-P@-!1-YS96= -MA(",CHB+M8JUBXN)CXV#AH69DI3L^LY==F1B:!47$1`3$Q,3$Q`1%A05:&]B -M861Y<W5#6%'6WL3"SLKT]_?W]_?T]<K)S\+!Q]K>W-/6U%1645-375U<7%]? -M7UQ?7%U=4E-045975%555=74U-?7UM;6T=;1T=;6UM;6UM?7U]?4U-34U=74 -MU=75U-35U=75U=75U=75U=34U-74U-34U=34U-34U-34U-34U=75U=35U-34 -MU-34U=35U=75U=74U-34U-35U=75U=75U=34U-75U=75U=75U=74U=74U=75 -MU=75U=35U-34U=74U=75U=75U=74U=35U-35U=75U=75U=75U=75U=75U=75 -MU=35U=75U=75U=75U=74U-35U-75U575U575U=75U=755555U575U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=555=55U=75U=75U=555555 -MU=75U=75U=75U=755=75U=75U=75U=755555U=55U=75U=75U=75U=75U=74 -MU-34U-35U=75U-75U-35U-75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -M5555U555U=75U=75U555U=75U=75U-75U=755=55U=75U=75U57555555555 -MU=75U=75U=75U=75U=75U-35U=75U=75U=75U=75U=75U55555555575U=75 -MU5755575U=75U=75U=75U=75U=75U=75U=75U=755=55U=75U=75U=75U575 -MU=75U=75U=75U=7:ZY'@X?3$7DAP>7MD9&=E9'AX?7-T2T%%4E;1TMO%P\+. -MR<C(R,G(SL_-PL#&Q-O9W]W0T=#545%045-24E)24E)=4E)24U-04%%64597 -M5%155=755=74U-?7U]?7U]?7U-?4U-34U=755555U555555555555%145514 -M5515U=75U=74UM165%15U=75U=75U=75U=75U=55557555555=755575U-75 -M55755=555555U=75U=75U=75U=75U=74U-75U=5555555555555555755=76 -MU5945%75U=75U=75U=35U=75U=75U575U=555=55U514U575U=75U=75U=75 -MU=75U57555555=755575U=74U-34U=74U-75U=75U=75U-'45U1455755=75 -MU=75U=75U=35U=35U=55U575U=75U-34U=555555U575U=75U=75U=75U=75 -MU=35U-75U575U=74U=75555555555=75UM1655155=75U=75U-74U-75U-75 -MU=75U=75U=75U=545=75U-75U=75U=75U=75U=75U=75U=755=555575U=75 -MU=74U=34U-75U=74U=36U5945%555=75U=75U=75U=755=75U=75U575U555 -M5574U%75555555555=75U=75U=75U=755=75U=35U=75U=555=75U=55U=55 -M55555==55E55U=74U-34U-35U-74U=75U=75U=75U575U=555U355=75U=75 -MU=755=75U=75U=35U=75U=75U=75U=75U=75U=75U=75U=555575U-555=75 -MU=74U-75U=75U=75U=74U=34U-35U=75U=74U]35U=75U=75U=75U=75U=75 -MU-75U=75U-75U-35U=75U=75U=75U=75U=75U=34U%75U=75U-34U-35U=75 -MU=75U575U=755=755575U554U=75U-35U-35U=75U=75U=75U=75U=75U=75 -MU=75U575U=75U=74U-74U-34U-34555555555=75U=75U=75U=75U=75U=75 -MU=75U=75U=?4U=75U=75U=75U=75U=75U=75U-75U=75U555555555755555 -M557555555555U=55U=75U=35U=35U=75U=35U=75U=75U=75U=75U-555=74 -MU-34U-35U=75U=75555555555575U555557555555575U=75U=75U=35U=34 -MU5755=55U=75U=55U=75U-75U-35U575U=75U=755=74U%75555555155555 -M5575U575U=75U=74U=35U=74U-75U=75555555555=555=555%55U=75U=75 -MU575U=75U=75U=75U=75U-75U=755%74U=75U=74U=35U=75U=75U5555555 -M55555%555=75U=75U=755=75U=75U=75U-55U5555575U=75U=755=75U=75 -MU=75U5555575U575U-35U=75U=75U5555555U=75U=74U=755575U=555555 -M5575U=75U=355555U=74U575U=75U=75U=75U=75U5755=75U=75U=35U=75 -M55145575U=75U-75U=75U=75U=55U=75U=75U=75U=75U=75U575U575U=75 -MU=75U=355%5555555555U=75U=75U=75U575U=75U=75U=75U=37U=555515 -M5575U=75U=35U=75U575U575U=75U=75U=35U5555575U=75U=74U-55U=74 -M5=75U=75U=75U=34U-34U-35U=75U=75U=555-75U=75U-34U-34U-35U-55 -MU55555755=755575U=74U=75U=75U=75U=75U-37U%755=75U=35U=75U=75 -MU=75U=75U-74U-35U=75U=74U]34U=75U=755555U=75U-74U-34U-35U=34 -MU=555=75U=755=74U=755=75U=35U=75U-75U-75U-35U-75U=75U=755555 -MU=75U=75U575U-34U-34U-35U=35U=75U=75U=75U=75U=75U575U=75U=75 -MU=75U=75U=55U-5555555=55U=75U-74U-35U=75U=75U=74U=75U575U-?4 -MU=755575U=75U=34U=75U=74U5555=74U=34U-35U=75U=55U=75U575U=74 -MU5555=75U5755555U=75U=74U=74U=74U=75U=75U554U=35U-34U-34U-35 -M55555555U=55U=755555U575U575U=755575U=74U=75U=555555U=74U-34 -MU-75U=75U575U=75U=35U-75U=75U-37U-75U=75U=75U=75U=75U=75U5-Y -M87)S3$10UM_6-R(D,@D3T)^&L;>*M+:SO+:TN:"F@`P(T+2TRQMO[QXY(#IL -MCI$U/C$##ST_!;2RE#$^#Y292GB"O[!I/3#NO;*'QIN(GP\R![>EL&`(&^10 -M`@_NO+Z6,#X"DII_%)NVC`TZ//2PMN`?U)C6-#T$MKJT&S<!_,`&`9R_O_HR -M/@2&@O%AFK>!"3LPD[RQ_P5DD78T,Q&PNH@#,`/X^!H%FKRS9S\^'HR.YF"? -MBI\U.S>&OK%=`!3O>34V<+VZ@@@R`^SK$!*'O;8=.3]JM;7B;Y&,Z#0Y"X^X -MMF,/'^5Y"#7ZO+B%-SP`D9UL%8:RM08[/$:VM.(7XH'Q-S\#M+NW$S4%\G$, -M#Y:_OI4P/P:8A'1BA[&,##LR[;.VY!S#F$`W/1BQNK4$-P;]4`$!F;^\TCT_ -M!8&#QV:$MX<*.S&>O+;#!7Z1>S0P:+.ZCPTP`.?S!1N$O[-K/C\3CX_^89B* -MDS0X-("^MG$`%>YF-3=7O;N!"C(`Z>X2$(:]MQLY/&"UBN=ODXSC-SD.B;BW -M:P\=YV8+"NR_N)\V/0:0DFYH@;*+`SL]QK:TY!?N@=XV/P:WN[0?-1K^?@\, -MG;Z^XS,\!)J%<F&!L(().S"5L[?Q'/>8<C8R';"ZB`8W!_A'``:%OKUW/#\> -M@(#69(>WA34[-H6\MU`%<9%A-S!GLKJ-#S`&X?0%&8:_L!$^/!2.C_=GFHJ7 -M-S@U@KZW9`!IZ6TT-_:\NX0U,P;J[1T6@+RT!#@]?+6+_VV=C/@V.0V*N+07 -M#Q/G8@L+E+ZYD3$]!Y*0:V^#LHD-.S+YL;7S%.J!138_!+:[BALU&/MG#PV9 -MOK_S,CP:A9IX9("P@`L[,9"RM,0=_)AG-C(6L[J.`#<%Y74#!X>^LF$\/!*` -M@5YXAK>9-#LWA[RW2P5/D6\W,7>]NX`),0?CP`0?@+^Q'SD];HZ,P&6%BN@V -M.`B/N;1M`&WI:S0TYK^XF#0S!)3@'!2"O+4!.#);M(CT8I^,R#$^`[6XM1,/ -M$>9I"@B3OK[J,3(%G9$58X*RCPX[,^*QM<P4E(9S,3P8L;N(!0H?Y6`.`X6Y -MO-0R/1Z$F&1X@["&-3LVG[*T41WEF&TQ,FBRNXT"-QKG<@,$@;FS:C\]%H.& -M0WV!MYTW.S6!O+1_!5Z1%38QU[R[AP@Q!>W=!!V"OK8:.3UFB8W2>(2*XS$X -M#HFYM6L`8.D4-#3IOKB=-S,%E^<?:HR\B@,X,\>TB<1@F8S5,#X&M+B*'`\7 -MYA4U#I^YON$P,AB<EQ1FC+*-"#LPZK&+TA66AF0P/!VPNXX'"AWE;`D`A[F] -M<3T]$H2987*-L(0T.S>;LK5,$N:9:S$S9K*[@PTW&.9[`@6#N;`1/SUJ@H=T -M=H.WD38["H._M6<%U)$7-C;QO[B%"C$;[U$'$XR^MP<Y,G.(@E!\AXKY,#@- -MB[F*%`!DZ1$W-9>YN98W,!B6^AYNC[R(##LS_[2/UV:;C$@P/@2WN(@9#Q7A -M%S4/FKF_\3,R'YZ4%WJ/LH,*.S&1L8A<:I"&;3`]$;"[C`8*$^1K"0&!N+)A -M/3(1AY]C=(RPFS<[-(2RBG`2XYD7,#-VO;N!#S<?X6<"&(VYL1P^,FV"AW!/ -M@K>5,3L(C;^*8AK;D1`Q-N:_N)DU,1GN1P<6CKZT`3@S6(B#1'&!B\XP.0.U -MN8@1`7GN$S<*DKF^Z#8P'Y;\&6*)O(X..S#@MXQ>9)J->#,_&[:XCAL,:.81 -M-0R$N+S4,S,2GNL6<HFR@34[-IVQB4]HDX=J,SUKL[B"``L1Y!4(!H.XLFL\ -M,Q6'G&U`C["?-CLUAK*(>Q/OGA`P,%6\N(0.-!WA8PT>C[BQ&SXS9(V$?T6- -MM^TP.`Z/OXAI&LZ6'3$WZ;ZYDC4V'.E*!A2)OK4#.##%BX!)2H&+43,Y`;2^ -MB1(!<.\<-@N9N+[A,3`=D?<99HB\C`@[,>FWC4UZA8U@,C\<L;B,!0QOYA(U -M#8:XO'<R,Q&9Z1%*B+*'-#LWF;".<6Z=AQ8R,F"RN(`#"Q?G%P@'C;BS$3PS -M;H:2;%.)L9`Q.PJ`LHEF$.B?'3,P][^XF@DT$^!O#1R)N+8$/C!QC85[5HRW -MY3,X#(F_CA4;\9<>,326N;F6-#83Z',&:XN^B@PX,/.+@79&@(AU,CD'M[Z/ -M'`%*[!XV"(6XO_`Q,1"0S1AXBKR""CLVE[>"=WZ$@F@R/Q"PN8($#&/F'#0" -M@[N]9S(P%)CM$5J+LH4W.S2:L(Q^;)R'$S(R?;VXAP((%><0";6IH+NQ@^YC -M&@(+,3,_/SD^/STS-C4.`1EI0>&1FX:"C(F(BHJ*BHN)CHR"@8>;G)'KX?#2 -M3'YA;VH4%A$0$Q,3$Q`1%A<5:VYM8&=[?79.1%+5W=K!S,C*]/?W]_?T]/7( -MSLW`Q]K8W-+1U]545E%34EU<7%]?7UQ<75U24E-04%%65U15U=34U-?7UM;6 -MUM;6T='1T=;6UM;7U]?7U]37U-34U-34U=75U=75U=75U=75U=75U=75U=74 -MU-34U-35U-74U-34U-34U-34U-75U=34U-34U-74U-35U=75U=35U-34U-35 -MU-74U-34U-34U-34U-35U=75U=34U-34U-35U=75U=75U=74U=75U=75U=75 -MU=74U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=755=75U=75U=75 -MU=75U=755=75U=75U=75U=555=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=5555555575U=75U=75U575U=75U=74U=74U=75U=75U=75 -MU=74U=75U=75U=75U=34U=75U=75U=75U=75U=75U=75555555755=75U555 -MU55555555575U=75U=7555755575U=75U=75U=75U=75U=74U=75U=75U=75 -MU=75U=75U=75555555755=75U=75U=55U575U=75U=75U=755=755=55U=75 -MU=75U5555555U575U=75U=755=75U=75U=75U=75U=75U=75U=74U-75U=75 -MU=75U=75U=75U=7555555555U=75U=75U=55U=75U=7#E);AYLG:6DAS>7ID -M9&=E97YY?'-T2T9:4U?0W=O$P\+.SLO(R\C+R<[,PL#&Q=O9W-/3T-=55%91 -M4%-24EU=75U=4E)34U!045%65E=45%155=75U=34U-?4U-?4U-?7T-=4U575 -MU=75U=75555555155514551455155=555=755%=5U=75U=75U=75U=75U=75 -MU575555555555555U=75U=75U=75U=55U575U=36U5945%555=75U=74U=34 -MU=75U=75U=75U55555555555U=?5555555755=555=75U=75U=75U=75U=55 -MU=55551555555555U555U=75U=;55U54U575U-74U=75U=74U=75U=75U=35 -MU-34U=75U554U575U-34U-35U=75U=75U=75U=75U=75U5555555U575U=74 -MU-75U-75U575U=55U=75U=74U=755=75U=75U555U575U-75U-75U=755=74 -MU-755=5555555555U575U575U=75U-75U-35U-75U=75U=75U=75U=755=74 -MU5755=75U=755=75U=75U=35U=75U=75U555U555U5555535U=75U=75U=75 -MU=75U=5555555555U555U574U=74U=74U=75U=75U=34U=?45=55U=75U=75 -MU=75U=75U=75U575U=75U=75U=75U575U]75U57555555555U=55U5555=75 -M5=75U=34U=35U=75U=75U=55U5555=75U-55U555U=75U=75U=75U=75U=75 -MU=74U=75U-75U=755515U=75U=75U=75U-34U-34U-34U=75U=75U-75U=35 -MU=755=75U=55U=75U=74U5555=55U=75U=75U=75U-75U=75U=75U=75U=74 -MU=35U-?4U=75U555U=55U=75U-75U=75U=75U=35U-34U-74U-35U=75U=75 -MU=75U=355=75U-74U-74U-75U=74U=75U=74U=75U=35U-7555545=55U=75 -MU-34U=75U=35U-75U-35U-75U=75U=75U-74U=75U=75U555U=75U-75U=75 -MU=75U=75U=75U=75U-34U=74U=35U=75U=755574U-5555555=555=555555 -MU575U=75U-74U=75U=75U=75U-35U=75U=755=74U5755=74U-34U=75U=55 -MU=755=75U=35U=55U55555555%55U=75U=34U-75U=75U=75U=75U=75U=75 -M5=75U=74U=75U=75U=75U=75U=35U=55U=755=7555555=75U=74U-75U=75 -MU=55U=75U575U]35U575555555155575U=75U=75U575U=75U-75U=75U=35 -MU=755=755=75U-75U=75U=75U-75U=75U55555555555557555555575U514 -M5575U=74U-74U-35U=34U=755=75U=755=75U=75U=75U=75U=75U-35U=34 -MU5555%55555555755555U555U=75U=75U-75U=75U=75U=?4U5555%155555 -M5575U=75U=34U-75U=555=555%555555555555555575U=755555U555U=75 -MU=75U=75U=75U=74U=75U575555555545-75U=34U-35U=35U=35U=755=75 -MU=75U=75U=75U=75U=75U=55U555U575U-55U=75U=75U=75U=75U=75U=75 -MU=755=75U=555=755=74U-75U=55U=555=55U=75U=75U=75U=75U=34U=75 -MU=75U=75U=75U575U=75U5755=75U=75U=35U=75U=74U=75U=75U=75U-74 -MU=355=75U-34U-34U-34U=75U-35U=75U55555555575U=74U=75U-34U-34 -MU=75U-34U=34U-35U=75U=75U=75U=34U=75U=75U=75U=74U=74U]?5U=75 -MU=75U=75U=75U=34U-34U-74U=75U575U555U=75U5755=555=75UM575%35 -MU=35U=75U-75U=75U-75U=35U-75U=35U=75U555U=74U-34U-75U=74U=75 -MU=75U=75U=7555555=75U=75U=74U=755575U=75U555U555U=55U=75U=35 -MU=75U=75U=74U-35U-75U-75U=34U=5555555=75U=74U=34U=34U-34U=75 -MU=35U=555555U=55U=555=55U=555%55U=75U-75U=75U575U=75U=755=75 -MU=755=75U=545=74U=34U-35U=75U=75U=75U=75U=75U=75U=75U=74U=75 -MU=75U=55U575U555U=75U575U=75U=75U=35U=75U=75U=74U=75U=555=75 -MU-7555755=75U=555575U=75U=75U=75U=35U555U575U=75U=75U555U=74 -MU575U=74U=35U=7555555=75U=35U=34U-34U-35U=7555=4U=74U=34U-74 -MU-35U-35U=75U=75U=75U555U5555575U=75U=75U=75U=355=755=75U=75 -MU=75U=75U=555=75U=75U=75U-35U=75U-?4U=75555555555=55U=55U555 -M5575U=75U=75U=75U=34U=75U=755575U-555=75U=35U=35U=75U=75U=35 -MU=75U=75U-75U575U554U=34U-34U-34U=34U=35U=75U575555555555=75 -MU=75U=75U=75U=74U-74U5755=75U=55U=55U=75U-74U=75U=75U=74U=75 -MU=755=37U=75U575U=75U=75U-755=75U-35U=75U=75U=74U=75U5755=55 -MU=75U=35U=55U-75U=75U=75U575U-75U=75U=75U=75U=74U-355=34U=75 -MU=75U=155555U55555555=75U575U=75U=35U=75U=74U-35U575U-35U=75 -M5555U=75U5555=75U=75U=75U=75U=34U=345=75U]75U=75U=75U=75U=35 -M6F=G<'!!1531V'P[(#@P#!;SGH"TM;>WL+*]M[>]IZ>W&S4;B;NQ'3@E-VAX -M`#0*&@4V)24(@;:=,2<Y8[>QGQH$3)WM:FV&O;^:-3T&MZ2Y[C4T:8"-E7SF -M@8<6-C%CL+N)"3H]0;>VE@<!8^5B``>6L;#G,SL+C[NR6#8V$YN$]V/B@H80 -M,3!FL[J+##@SW+>VD!L;1.-I`@:3L[/@,SH*C+BS1C<W$)R<0V_JCX`=,S-B -ML[J*##@ST;2TEQX2].T6#@"=LK+B,SH*C;FS6C0U%Y.79&^0B(,<,C)LL[J* -M#3DP5+6UZQT5X.P="P.<O;WL,SH*@KFP6S4+:I'B:&Z?M8T?/3UNL[J*`CXQ -M4XN(XA!FE>X8-0V?O+SN,SH*@[ZQ6@L.;93W$6F:MX\9/#QKL[J*`S\V78F, -MY1=&DN@%-P^>O[_K,SH*@+^V6@X-9.A''FN$MHD9/SP5L[J*`#PW7(R#]VKT -MF^H'-@Z9O[^5,SL+@;RW10P`<>UG!16&L(L8/S\4L[J+`#TT7(*'TF_BAY0! -M,0B9OKZ4,SL+AK*T1P($7^%J!A2`LXH8/C\7L[N+`3(U4X&;0F"7@)<#,PN9 -MN;Z4,SL+A[.U0P$9P/H3`Q>"LK48/CX6L+N(!C`*5H>2?F6<C9$-,C68N;Z7 -M,#@(A+"(3`<0^?(9#!:,O+08.3X1L+B(!S$)U)KJ8'*:B9`//369N;F6,#D) -MA;:.=1INX\H$"1".O[08.3X0L;B)!#8/W9_E:TJ&BI(./#29N;F1,3X.F+>- -M=A]]E<0!"A*)OK<8.3X0L;F.!30"VI#2%D2#M)P(/S>9N+F0,3X/GK6`<Q#? -MD=`"-1V(N;89.3X3MKZ/&S4!PI1\$E&,MYX+/C>>N+F0-C\,G(N'?Q7DG%`/ -M-Q^+N+89.3X2M[^-&0L$].UN&=*)L9@*.3:?N;F0-SP-DHZ;>FV5FUL)-AF* -MN+$>.3X2M+V"'@\8\OH1!<2+L)LU.#:<N;Z3-S("DXV=9WB2A$,*,1NUN[$? -M.3\2M+*`'`(3^,D>!\VULX4U.#&=N;Z0-#,`D8"48$.:@4@U,`6UNK$</C\2 -MM;.!$@$5YU,$`<NTLH0U.S&2OK^0-3`&EX?@;=B&@W4W,@2UNK`=/CP2B[&' -M$`1GXW8!`O2VO8<U.S&3OK^0"C$'E)CU:?V#C'<V/0>UNK`2/SP2B;:%$1E! -M[F0-#/>QO(8T.S&1O[R0"#<%ZI)!%>&/CG8Q/`>UNK`3/ST2C[29%Q/TZFP. -M#O:QOX8T.C"6O+V1#C09Z)1G%^Z(BW8Q/`:UNK`1/#(3C+6=%!7BEQ4+"/:P -MOH$T.C"4O+V6#`H=[N,5$92UM78P/P&UNK`6/3,0@HB6:F:7D!8U"O>SN8`U -M.C&5O;.7#0X6[/<2$Y&WM'0S/@"UNK`7,C,1@(SH:$^?G1,W-?6RN(,U.S'K -MLK"4`PUHXE\8')*VMW4R.0.UNK`4,S$6AH/F;L*%GAPV-,ZRN(,U.S'NL['J -M`0!FX'@''I^QMDXR.0.UNK$5,#84A(?W;.>!FQDQ-\"]NX(U.S'ML;;I!P1T -MX6\`&YBSL4`].`**N[%K,3<5FIM18NN"A1LP-MN]NX(*.#;CMK?M!1G<X1<- -M!9JRL%H].`V+N+%I-C1IF9-R8Y&.AP4R,=*]NXT+.#;FM[7A&!#^YAT.!X6] -MLUT].`V(N+9O-PIMG>IC8)^+A@0],%6]NXT+.3?DM(OZ'&[LYA@+!H2\LE0] -M.PV)N;=L-`EFD.458)JU@`<\,UR]NHT(/C?ZBH[S$WR7X00U`(>_LM(].PV. -MOK=B"@QXE-P38(>W@@<_,T2]NHT)/S3XB(+"%]*=X08W`X:^O=H].`R/O[1C -M"`-WZ'(>8(&QC08_,DZ]NXT./#7_CX'7:^6:X`,V`H:YO,(].`R,O+5A#P9> -MXFP%8X*PCP$^/7>]NXT,/0K]@H5`8NN'X@TP#(:YO/4].`V"O8MF`AK8Y!8& -M8HRSC@$Y/7*]NXT-,@CS@)]R9).`[`\S#X&XO/$R.`V#LXEF`!WQ\A\#;(Z] -MB0$Y/'ZRN(T",P[PAY9G<IB-[PDR"8:XO_TR.0V`L(]G!Q3DS`4,;XB\BP$X -M/&6RN((#,0SPFNUM38>.Z`@]"(:XO_DR/@*&MHUG&F#LT`8.:8J_B@$X/&>S -MN8(`-@+SG_%J5H"+Z@H\"X:[O^4S/@*'MX!G'TR56`,+:K6^M0$X//VNK*>\ -MBIO%$`8.-3`R/C\Y/S\R,S<U`@<08,KOG(6`C8Z(BHJUBHJ(B8^-@(:%F9*7 -M[^7)4'=E8FD5%Q$0$Q,3$Q,0$184%6AO8F%D>7-T0EA1UM[$PL[*]/3W]_?W -M]/7*R<_"P<?;V=S3T=155U%04U)=7%]?7U]<7%U=4E-04%%65U=45=75U-?7 -MU];6UM;6UM;6UM'6UM;6U]?7U]34U-34U-34U-35U=75U=75U=74U=35U=75 -MU=75U=34U-34U-34U-34U-34U-34U-34U-35U=35U-74U-34U=75U=75U=75 -MU-34U-34U-75U=75U=74U-74U=34U=74U=75U-34U-34U-75U=75U=34U-34 -MU-75U=75U=75U=35U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=555=55U=55U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U575U=75U=35U=35U=75U=75U=75U=75U=75 -M5=55U=75U=75U=75U=75U=75U=74U=75U=75U=75U=75U=75U=75U=55U=75 -MU=74U=75U=755=75U=75U=75U=755=755=75U=75U=75U=75U=75U=75U-75 -MU=75U5555575U=75U=75U55555555=75U=75U=75U575U=75U=75U=75U=55 -MU=75U=75U=75U55555555575U=75U=75U575U=75U=75U=75U=75U=75U=75 -MU=75U=755555U575U=75U=75U575U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U/*1E>;EQM]-2WQY -M965D9&5E>'YS=W5*05I35-/?VL?"S,G)R\O*R,C.S\W#P<?%V][?TM#6U%57 -M5E934E)=75Q=75U24U)34%!145%75U=55574U=34U-34U-34U-34U-34U=36 -MU%=55=75U=74U55555545%1555545=5555555555555555545-55U=75U-35 -MU-75U=75555555555=75555555555=75U=75U-75U=55U-;55E54U555U=75 -MU=75U=555555U55555555=75U=55U=555=37U=75U=755=755=75U=74U=35 -MU-34U-35U=55U=55555455555555U=75UM565515U=74U-35U=35U=75U=74 -MU=35U=75U=75U=75U=755=75U=34U-34U=75U=75U=755=75U=75U=75U575 -MU=75U=55U=75U=55U=71U%945%55U=74U=74U=34U=74U-75U=75U=75U=75 -MU=755575U-75U=755=7555555555U=55U=75U=75U-74U=75U575U575U=75 -MU=75U-;45U145575U=75U=75U=755=75U=75U=34U=74U-75U=755515U=75 -MU=75U=35U=55555555555575U575U575U=74U-74U-34U=74U=74T=145535 -M5=75U=75U=75U=55U=75U=75U=75U=75U575U=35U=?4U=75U555U5555515 -MU=75U=75U=755=75U=75U=755575U=75U=75U=36U%=45=35U=75U=355=75 -MU=34U=55U=75U=55U=755575U-55U=75U-34U=34U-34U-74U-75U5555=75 -MU=555=755=75U=75U=75U=55U=;55U54U575U=75U=35U=75U-75U=74U=35 -MU=75U=75U=35U=77U]74U=55U=5555555=75U=75U=34U=34U=34U-75U=75 -MU-75U=75U-75U-35U574U=74U-34U-75U=75U=75U=75U=75U=75U=75U=34 -M5575U=34U=75U=75U=75U=75U=75U=75U=555%75U=75U=75U-75U=75U=71 -MU%=55555U555U=75U=75U=74U=75U=75U=75U=75U=75U=75U]1555555=55 -M5=755=75U=5555555555U=75U-35U-75U=35U-75U=75U=;45U55U5755=75 -MU=75U=75U=5555555=75U=75U=35U=34U%75U=75U=75U=75U=75U-75U=35 -MU=75U=75U=74U-75U-75U575U575U574UM565%355=75U=75U=755=74U=75 -MU=75U=75U=75U=55U=55U=34U=55U=75U=755575U=74U=75U=75U=75U-75 -MU=75U=755=75U=75U=31U%=55-55U=35U-35U=75U=75U=75U=75U=55U555 -MU555U5545=75U-74U-755555U=75U=75U55555555%155%55U=75U575U=75 -MU=75U-;55E145555U=55U=75U575U=75U=75U=35U=55U55555755574U%55 -M5%555%555%755=55U=75U=75U=75U=35U=35U=755=755=75U=75UM165555 -MU=75U=55U575U=75U=74U575U=75U575U=555=755515U=75U=75U=34U=35 -MU=755=75U=75U=55U575U575U=75U=75U=75U=76U5=45%555=75U=75U=35 -MU-75U=75U=74U=75U=755=75U=74U]?5U55555555=75U=75U=75U=75U=75 -MU=75U=35U=75U=75U=75U=75U-;45U55U575U=74U=35U-34U=74U-74U=74 -MU=75U=34U=34U-54U=74U-34U-35U-35U=75U=75U=75U555U5555575U=55 -M5575U=75U574UM175535U=75U=74U-34U-35U-75U=75U=75U=75U-74U-35 -MU=34U=75U=75U-75U=35U-34U-34U=75U=75U=75U5555575U=75U=75U=36 -MU5=55-75U=75U=75U=74U-34U-35U=34U=35U=35U=75U=545-75U-34U-34 -MU-75U-75U=75U=75U=74U=55U=75U=75U=74U=75U=75U=;55E145575U=75 -MU=35U-34U-35U-75U=75U575U=55U575U=74U]35U=55555555555575U=74 -MU-77U-34U=34U=74U=75U=75U=75U=75UM5655355=75U-35U-74U-35U=75 -MU-35U=74U=35U-75U=755%35U=74U=74U-75U=75U=75U=75U=75U=75U=75 -MU=34U=75U=75U=75U=36U%=55=555=555555U=75U575U=75U575U=75U=75 -MU=75U575U-355575557555755=75U=35U-35U-35U=35U-35U=75U=75U-34 -MU-74U-'45U55U575U-34U-35U-75U=75U=75U=34U=75U=74U=74U-54U=75 -MU-34U-35U-35U=75U=75U5555=555555U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=55U=55U575U=75U=75U=75U=75U=755=37U=5555555=75U=55 -MU=75U-75U-74U-74U=75U=755575U575U=75U=75U5755575U=75U=35U=75 -MU=75U=74U=74U=75U=75U=75U=555-75U=34U-35U=75U=75U=75U=75U575 -MU575U555U=75U=75U=75U=75U=;55E54U=75U=74U=35U-34U=75U=34U=75 -MU=75U=35U=75U=74U]75U=75U575U5555555U=75U=75U=74U=74U=74U=75 -MU=75U=75U=75UM5755355=75U=75U575U=74U-34U-74U-75U=75U=75U=75 -M5535U=74U-34U-34U-74U5755=755=5555555555U=755=75U=75U=755=76 -MU5=45=75U-75U-75U=75U=75U=75U=75U=75U-74U=75U-75U-?4U%555555 -M5555U=555=755=75U=755=555555U=75U4!F9'!Q1EK4T=IL)"`_,0(5Y9F# -MBK6QL;RRMHNWOJ&FMQ@T#9Z_OY<S)B0(E)\7,3X]"P8""@@?[)$3-C\*F+^Y -MAPHY-I^XI+<4-0SAM;>`]$;KFY47`1.$L+#J-S@VD;ZX@`H[/6VTLX,?"@UF -ME.-A%?Z!@LH.,`^;O[Z%-#HR_[R[B`8R-FF"BYMM'7GL^Q,#&9VVMNLT.3:6 -MOKN-"#L]8+>]CQ,*#V"3D5EIPX6`_0TQ#)^]OX4T.CW`O;N+!CTP%X*UA&T; -M:OCG:P8>EK2WE34^-I6_NX\..SQNMK^($#0+:)V9\VQ$G(?Z`#<,D[*_A#4Z -M/56]NHH'/#,3C;>`8P02QN-E&ASKBK27"#PV[KR[C@\[/Q6VOHH6-S46GX3L -M8WB4A><'-`V6L[R'"SL]0KVZM00_,AR,MHUF`1I#[%D=$N..M98./3?@O;N) -M##L_%K:YM!<V-Q*9@)9F;>>?X!L+`I6QO8<).#UPLKJT!3\\&(RPCGH#!F7I -M\!40_H**D0TR-^6RNXD-.SX3MKBW%3$V&9B-GG@5WI'C'0X`[+:RA@\Y/7JR -MI;<:/C\%C[.+<@T";NOB9A;"@8F0`S`T\+.XB`,[/ARVN[9H,3`%FXZ$<1!_ -MZ>T7`@'FM+.XR8;.EMQ@^/P>/LK5(#P\6ZI=;%5V%C)`&,33-L+B+`#@^ -M&;>[L6TP,P>;BX%''&CE[6T!!O^*L($#/S)LL*6V'SX^`8^\MUT)"QV5G?)O -M=IR#D`4W-="QN8L&.#X;M[JP9C,]`9NUC=`8$][M?`4$R8FQ@0$\,FBQNK8= -M/CD`C[^VV0LU&Y6;[F9EE(>0&30*6;:^B@<Y.06WNK-[,SP"F[>.RP4;<>)1 -M'!K0C+>!!S(S%;:ZL1`^.`*,O['W"C<$ZH>0?6+FFY$3"@M)M+^*!3XY!+2Z -MLW<S/PR;MHKY!P=BX_`7'EJ`M(8%,S,7MKJQ%SXX#(R^L_LU,0'K@)A$:-J2 -MEA0."7.UO(H8/SX'M;JR13,^#IBQM.`&`Q?AX&`2=(>*AADP,!:TN[!J/SL/ -MC;FRX#4P`NF"A]H4<Y67;`T/>(B]BA\\/@:UNKW3,CD(F;"WZ`$,'.>50Q9^ -MF(F''38Q$+6XL&P_.PZ"N;WI-#,/[X^#_1%OYY5[`0UGC[.*$ST^`8NZO,@S -M.`J>L[&7``@:^Y#Q:623C806-S83BKBP83P["(.XO)0T/0GBB8S@$Q'9Z4,% -M`&&"L(L6,C\`B+J\_S,X-9RRLY,#-0;SG.QG8.N!A6HU-Q*(N;!X/3L+@+B_ -MD30\"N&+B.H='G+MVQ\&8H&VB&HS/`".N[SF,SLTG;VRGP(T`\N;D75MY82; -M8@@T'8Z_L'0].PJ!N+Z=-#\UY;6UD1P$;N?]%P5LA+>);#$\`XR[O^TS.S>3 -MO;V;`C8,WH29WF[9GYEZ#S4<C;RP6#([-8:XOIXT/C?]M+><'@$0_^%C&6^8 -MM8YG-CT#C;B_ZS`Z-I&\O(0",0E<AH?Y:'&7G70""QR#O;'2,S@UA[BYFS0Y -M-LNWMIL>`AG)Z4X3;I*(CWTT,@.#N;^4,#HQE+R^A@(P"DJ`@.QK8N&04`8) -M'(:SL<DP.#6%N+B$-#DQWK>PA!D/!-64]!5IE(R-3C4S`H&^OY$Q.C'KO+F` -M`C(T?H.,EFH7QI3!&@P<A+"V_38Y-)NYN(<U.#!<MK*!&0@`3I'B9FGC@(-0 -M"#`#A[^_DS8Z,.^\N8("/3=FC8B<:AUR[_,=`QR8MK;E-SXTGKFX@34[,TJV -MO8(9-0QXDI9,;O.$@=H/-@.%O+R<-SHPX;RXC`(\,6^,M9IK&V[DY10&'9VW -MM^$T/S2=OKB`"CLR?[&\C!XT"6.?G\YO5)Z']0(W`YB]O)XT.S/[O+N.`SPP -M%8^WAV@'$/7@8042EK6T[34\-)&_N(,+.SUGL;^)'S<U:YF$X6USEIK\`34` -MG+.]F#0[,_&\NX@`/S,1CK:`;@$84^Q.'!/HB;7I"#TTE+RXC0@[/6VQOHL= -M-C06FX&48&/CG_H%"P"0L+V:-3@SQ+VZB@$^,A*.L(UM`@=RZ<D7$>&,B^H/ -M,C7HO;B,#CL\:[&YM1(Q-A*%C9UG%<R0YQX.`92VLH4(.3-6O;JU!CX]'XFS -MB6`,`V#JX&`7\X".E0TS->VRN(\/.S\4L;BT$#`Q'H6.FG@0=NO@$0T&Z;>S -MA0X^,TVRNK0'/CP;B;*+9`X/%9643A7=A(R4`#$UY[.YC@TX/Q&QN[<6,S,% -MA(N&<1QOY^-H`0?@M;"$##\SXZZLI[^UF\81!@XU,#(^/CD_/S(S-S4-!Q!C -MR>R<A8"-CHF*BK6*BHB)CXV#AH28DI?OY<A1=V5C:147$1`3$Q,3$Q`1%A05 -M:&]B861Y<W1"6%'1WL3"SLOU]/?W]_?T]<K)S\+!Q-O>W-/1U]5745!375Q< -M7U]?7%Q=75U24U!045975U15U=34U-?7U]?6UM;6UM;1T=;6UM;7U]?7U]?4 -MU-34U-35U=75U=75U=75U=75U=75U=75U=34U-34U-34U-74U-34U-34U-34 -MU-75U-74U-34U-35U-75U=75U=34U-34U-75U=75U=75U-34U-34U=75U=75 -MU=74U-75U=75U=75U=75U=35U-75U=75U=75U=34U-34U-35U=75U=75U-75 -MU=75U=75U=75U=75U=75U=75U=75U=75U-75U=75U=75U=75U=75U=75U555 -M5555U=75U=75U=755=55U575U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU-75U=75U=75U=75U=75U=75U=555=75U=75U=75U=75U=75U=75U=75U=75 -MU=55U=75U=75U=75U=5555555555U=75U=55555555555=75U575U=555555 -MU=75U=75U=75U=75U=75U=75U=35U=75U=75U=75U=75U=7555755575U=75 -MU=75U555U=75U=75U=75U=75U=75U=75U=75U=75U55555555=55U=555=55 -M5555U=75U=75U=75U=75U=75U-74U=35U=75U=75U=75U=75U=755555U575 -MU=75U=75U=75U=75U=?ZD.CA^\333G5^>61E9V1E>GA_<G9U3$1>4=33WL7& -MPLS.R,O(R\O+R<S"P\;$VMG?W=/1U]555U914%)34EU24EU24E)34U!14596 -M5E=45-755=75U=75U-34U-34U-34U=35U=75U=75U=55557555555%545U14 -M55555=75U=75U-75U=755=755555555555755=75557555755=75U=555555 -M5=755=755=555=755=75U=75U=75U=74U=75U=75U=74U]35557555555555 -M555555555=755=75U=75U=55U=75U=75U=75557555155-55U=75U=75U=75 -MU=75U=75U=75U=75U=75U=55U=74U575U=34U-34U-35U-35U=75U=755555 -M5555U575U=75U=75U=35U=35U-?55=75U=75U=75U=75U=75U=75U=74U-75 -MU575U575U=555555U=35U575U=75U=75U=75U=75U=75U=74U-75U=34U=75 -MU=5555555=75U-55U575U=75U=35U=75U=755=755=75U=75U=74U=74U=75 -MU=545=75U=75U=35U=75U=75U=75U55555755555U=75U-75U-75U=75U=74 -MU5755=74U-755=755=555=755=75U=75U=55U=35U=75U=755=74U5555555 -M55755=55557555555=75U575U=74U=75U=75U575U=75U=3555555575U=75 -MU=755=75U=75U=755=75U=75U=75U=75U=755575U=34U-34U-74U-74U-74 -MU=75U=7555555555U=55U=75U=74U=75U-555=75U=75U=75U=75U=555=55 -MU=75U=75U57555555575U575U-75U5555=55U=75U=75U=75U=75U=34U=74 -MU=75U=75U=75U=75U=74U-75U=74U=34U-34U-35U=75U=75U575U5555575 -M5=7555755515U=74U=74U-34U=75U=555555U=55U=75U=75U575U=75U=75 -MU-75U=34U=75U-35U=75U=75U-74U=75U=74U-75U=75U575U=75U=75U=34 -MU=75U=755=75U=555=5555555575U=55U=75U=55U55555555=74U-75U=74 -MU-75U=75U=75U575U=75U=75U=35U=755=755=755=545=75U=75U=75U-34 -MU-75U=75U=755=55U=75U=75U=75U=75U=75U-74U535U=75U=35U=755=75 -MU-75U=75U=75U=75U=75U=55U=55U=74U]75U555U575U=75U=75U-75U=75 -MU=75U=7555555555555555755=755%155575U=75U=75U=75U=75U=35U=75 -MU=74U=75U-75U=755515U=74U-74U-75U=75U=75U5555555555555155555 -M5555U=755=75U=54555555555555U=7555555555555555555=55U=75U=75 -MU=75U]35U=755555U555557555755=75U=75U=75U=75U=75U575U=75U=74 -MU5555555U555U=75U-35U=75U=555555U555U=75U=75U=75U5145=75U=74 -MU=74U=75U=7555555575U=75U=75U=75U=75U=75U=75U-'45U545575U=75 -MU=75U=75U=55U=75U=75U=75U=755575U=75U=34U=555555U=75U=75U=35 -MU=75U=75U=75U=35U=75U=75U=75U=75UM5655155=75U=75U-74U-34U-74 -MU=75U575U=75U=555=7555545-75U-34U-35U=55U=75U=75U=75U=55U=55 -MU=75U=75U=74U=75U=76U5945%55U=75U=75U=75U5755=75U=74U=75U=75 -MU=75U=75U=74U]755=55U555U575U=75U=75U-35U-75U-74U-75U-74U-74 -MU=34U-;45U55U=74U-34U-75U-75U=75U=75U=75U=55U=55U=35U=755515 -MU=75U=75U-75U=75U-55U57555555555U5555=75U=75U=75U=75UM565535 -MU=75U=75U=75U=755=755=75U=75U=35U-75U=75U=75U]?4U=75U=75U=75 -MU=74U=74U=75U=75U=75U-74U=75U=75U=75U=36U%=45-75U=75U=34U-35 -MU-74U-35U=555=555=55U=755575U514U=74U-74U-75U=75U=75U=75U=75 -MU575U=75U=75U=75U=75U=75U-;45E54U=75U=75U=75U=55U=75U=75U=75 -MU555U575U=74U=75U=37U555555555555555U555U=75U=755=75U=34U=35 -MU=75U=755575UM565%=5U=75U-75U-34U-35U-75U-35U-755=74U=75U=75 -MU-155=75U-34U-34U-35U=755=75U=75U=75U=555555U=75U-34U-34U-31 -MU%=55=55U=755575U=75U575U555U=75U=75U-34U=35U=75U=74U-75U=75 -MU=75U555U5555=55U=75U=75U=74U=755=75U=75U=75U-;45U54U=75U=75 -MU=34U=34U-35U=755575U=75U=75U=555=75U555U-34U-34U-74U=75U=75 -MU=75557555555555U=7555555=755575UM575%355=555555U=75U=75U=34 -MU-15U=75U=75U=75U=75U575U=?5U575U5555=75U575U=75U=74U=75U=75 -MU=74U=75U=55U=75U=36U%=45%55U=75U-75U=755=75U=75U-35U-75U-75 -MU=35U-75U-54U=35U-34U-74U=75U=75U=75U=75U=75U=75U=74U-75U=74 -MU=74U-'45U55U=75U-75U=75U5555=55U575U=75U=75U-75U=74U-34U=37 -MU-75U=5555555575U=75U=74U=35U=35U=35U-34U-35U=75U=74T=175535 -MU=74U=75U=75U=75U=75U-75U-74U-35U=75U=55U=355=74U-34U-34U-34 -MU=75U=75U=555=755=555555U=75U=75U=75U=76U5955%55U=75U=75U=75 -MU=75U=74U-74U=74U=75U=75U=755=74U-355=75U=755=75U=75U=75U=55 -MU=75U-75U=75U=75U=75U=75U=355-55U=75U=74U-34U-74U=34U=34U-35 -MU=745=75U=75U=74U%55U-34U-35U=75U=75U=55U=755=7555555575U=75 -MU=75U575U575UM565%15U=75U=74U-75U=75U=74U=75U=755=75U=55U=75 -MU=55U-?5U=55U555U=75U=75U=75U=35U-35U=35U-5555755=75U=75U=31 -MU%=55-75U=34U-75U=75U=75U=35U-74U-75U-34U=34U=75U=54U=35U-75 -MU-75U-35U=75U=75U=75U=75U-75U=75U=75U=74U-34U-'75]55U=75U=35 -MU5555=75U=75U=35U=55U=75U=75U=75U=75U=77U-74U=75U=7555555=75 -MU=355555U=34U-35U=75U=35U=75U=34T=175535U=75U=75U=75U=74U-34 -MU=75U575U575U=75U=75U=755%74U-34U-34U=75U=75U=75U57555555555 -M5=55U=75U=555=555=76U5=55-75U=74U-75U=75U-75U=75U=7555555575 -M5=75U=755=74U]35U575U55555754']@?7-.1%/1W-PU(B0R"!)<G(>)B["] -ML+6WL*:MO<P1E(^!<'2!M<8_(3[!BN`V.S(-#S`V;8Z&"R<Z:[:VX0<7E>(: -M`)>^I8(U/1^TO8S6_H:9!3<$M:6P!3\V^X^89DZ'AAD\,O"_ON\Q,!R=ZQ5R -M@K?I,3@"M+N*!#0%X_`8$(&]M0`[,I2\L/0#'_E0`P_BLK_A/3@$B[&>$F^7 -MY0TQ&K2ZM0\Y-)>+FF=;AX4%/3:<N+_',#%JA)!B7(VUQC,Y&K"[C`(W&N_\ -M'Q6#LHP).C&%O[9_#QCR60`#D+VR<C\Y$+>PDQD5Z,H--Q>QNXPU.`J8M9IB -M3X6<!C(UAKN];STQ>H&=9M&"B&<R/VJ]N(<(-AF4YQ-AC;"'-#LT@KFW%`@: -M_%P&!)N\L1`Y/WBQL.L$%N/6##5RL[B$-C@/@;>;:W.9EP,S#X^ZL!D\-MR" -MGV??@XT1/3+1O[F=-#$=D^P7<(RQDC8[#HJXM1DU&N75!!F&O;0'.#W[LK'X -M`1+D10T(_;*^EC,X`8^VGA9EDN(-,`:UNK<`/C?CCIEFWX"!&#TPE;F^YC$Q -M%YGJ:UB/M^8P.0:WN(X!-!O@VAH1@[V(##LPD[RQ6P(<^TX"#)2]O,\\.1FU -ML9(=8I;R##$<MKJ("#DUD(N98-2&F@<]-YJ[O'8S,6*$EFS<C+5",CX=L[B` -M##<9Z?<>;HVR@PH[-X>^MV(/'OY(`P"?O+-L/CYKM[&4&&CJW@\W;["[@#0Y -M"86UF6]>A)(#,@N#NK,6/39+@9-@PXV):#T\9;VXF@HV')?[$GJ/L)HW.PJ/ -MN;03"!G[3`$%A+RV&3@\7["QX`07[5H/-5&RN9DP.0*#M)\52ICJ#3,"B+JV -M!#\W\(*=8<F"@AP],_F^N90W-A&2X!9,CK&4,3@-M;B(!348YUH''("\M0`[ -M,NZRML(!$.9T#`GCO;_L,CD$CK>2$7^=YP\P!+2ZM0T^-.B.G&'/@(8$/3:3 -MN+_),39KF.EJT(ZW]#,Y!;&XC0`T&>+5!1>-O8\).S&9O+9R`A+E<PT-D+R] -M3#\^$K6VEAUFD<@.-A&QNX\*.0N<BY]BQ(:8`3TTA[N]8#,V9824;\^/BF4R -M/Q>RN(8.-QSKPQECC[*!-#LT@+ZT:@\<^G,#!IJ\L!8Y/V:VMNX;;Y52#C=E -ML[B'-CD,A[6<;M>$D0(R#HRZL!P]-U6!EF+VC(X6/3U&O+F<-3<3EO(2<XZP -MGS8["8FYBAP('^5Q`!J&O+<$.#WTL+;^!!7L=0XU]+VYDS,Y`8*TDA5%F^\/ -M,P"*NK<!/S3DC9-@\XV#&#PP[[Z^[3<V%)WD%E.)MNTP.`"TN(X'"A_F2P<2 -M@KR*#3LPE[VV4P$6X7P/#NJ\O_\]/AN(MY$1=IS_#C`8M[J+#CXUEXZ28_&# -MA`8\-IFXO%HP-F*8[17"B;11,CX>L+B#`C0<[5D%:HR]C0L[-H6_MV8"$.1[ -M#`*?O[)G/S\4M+:5'&61W`DV%;"[@C0Y"9F+DFWU@9\#/0J`N[(5,C=VA.MN -M\(Z*;#T\;;*YA0DT$NK=&62.LH0W.S6-OK46#Q+E>P('A+^Q'3D\=[:VX1MC -ME4P)-$^RN(4Q.0*&M9-HQ827##(,B;JQ&CPTS(&4;?Z/CQ(\,LR_OI$U-Q:1 -M]1U,B+"0,3@,BKF(&`@=Y'X`&("_M`8X,N>SML@':.]\"0KDO;Z5,CD'C+21 -M%%&;X`XS!K2ZM`,_->V-D6/XC(`%/#&7N;_^-C=HG?@1WHBV^C,Y![>YC`8* -M'>%P!A&,O(@/.S&2O;=T`13@90X/D;^\TSP^'(NWE!!,G/0(,!RVNHD(/@N0 -MCI!B^8*%`#PWA;N]>#`W9)O@%?&(M'`]/A.SN88--1+O3P5OCKV#-3LTAK^T -M;P(6YV<,`YN_LV@^/V^TM^P<?Y!="#9BL[N`-SX/FHB0;/*!G0T]"X*ZLQ`R -M-UB'[FG[B8L4/#Q^O;F9"S01E5$8?XBRFS8["(^^BA,/$.1F#02&O[$;.#W7 -ML;?X&V:4<`@TW;VXGS`^`("UD6C+A^H.,@*+NK8$/#3]@95LY(Z,&3PSY+Z^ -MZS0W%9'&'5*+L)4P.`*UN8X%"!/G9`,?@K^U`SLSZ;.WT0=L[F4("^^\ON,R -M/@6/M)<7WYKE"#,$M[JU#3\*ZX*78N>,@0<\,9*XO-LV-V*<\Q'(B[;,,CD: -MMKF#``H3X'D&%X^\C@@[-IF]M'@!:N-A"0R=O[UW/S\0BK3H$%B?V@LQ$;&Z -MC`H^"9V/EF+D@IH#/#2&N[)M,#1RF^04^8NU9CT_%;.YA`\U$>]V!&.(O8$T -M.S6`O[45`A?F8P\`A+ZS$3D\9+>WX1]VD$\+-GBRNX<V/@V$B)9O^("0#ST) -MC[JP'S(TW(?B:.:(B!`\/5F\OI(*-!>51!ATB[.?,3L.B;Z('`\6YV,-!8"^ -MM@0X,O:QM_0:EJVAN;>&X6D$#0LW,CT^/SD\/#`Q-0X&&&Q,XY::AH*,B8B* -MBK6*BXF.C(*!AYN<D>OA\--,>6%O:A06$1`3$Q,3$!$6%Q1J:6U@9WI\=DE$ -M7=7=VL#,R/7T]_?W]_3URLC.S<#&Q=C?TM'7U51645!24EU<7U]?7UQ<75)3 -M4U!15E975%55U=34U];6UM;6UM;6UM;6UM;6UM;7U]?4U-34U-34U-34U-75 -MU=75U=75U=35U=35U-75U=34U-34U-34U-34U-34U-34U-34U-34U-35U-74 -MU=34U-34U-74U=75U=74U-34U-74U=75U-35U=34U-74U=75U=75U=75U-75 -MU=75U=75U=75U=34U-75U=75U=75U=74U=75U=75U=75U=75U=74U=75U=75 -MU=75U-74U-75U=75U=75U=75U=75U=75U555U=75U=75U=75U=55U=75U=75 -MU=75U=755=75U=75U=35U=75U=75U=75U=74U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=555=755=75U=75U=75U=75U=75U=34U-35U-75U=75 -MU=74U-75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=555555U=55U=75 -MU=7555755=75U=75U=75U=75U=75U=75U=75U=75555555555=755=55U555 -MU575U=75U=75U=75U=75U=75U=75U=75U5555555U=75U=75U=55U=75U=75 -MU=75U=75U=75U=75U=34U=35U=55U=75U=75U=75U=755575U=75U=75U=75 -MU=75U=;FD^[A_L77271Y>&1D9V1D>GA\<W=U341?4=33WL7&PLS)R,C+R\C( -MSLS"P\;'VMG?W=#6U]545U914%!24E)=75)=4E)34U!045965E=45%555575 -MU-34U-?6U]34U=75U=74U=755575U57555555%54555555555=55U5555555 -M55555=55U575U=555=75U=75U=75555555555=75U=75U=75U5755%155=75 -MU=75U-74U=75U555555555555=755555U5555555U=55U=555555U=555=75 -M5=75U=75U=75U=55U555U575U=75U=755575U575U-5555555=555555U=75 -MU=75U=75U=35U=35U=75U5755=55U=74U-75U-75U=75U=75U-74U=34U=75 -MU=555575U=75U=74U=35U=34U5155=75U=74U-75U=75U=75U=75U=75U=55 -MU5555555U=75U=75U=75U=755=555=75U=75U=75U=75U=75U=74U=34U-34 -MU-35U=55U=55U=?4U=75U5555=555575U=75U-35U-35U=75U=75U=75U-75 -MU=75U-34U-7555755=555=75U=755=7555555=75U=55U=55555555555554 -M5=74U-34U]34U=35U=75U-75U=75U575U5555575U=35U=75U=75U=755=75 -MU=75U=75U=75U=75U=35U=75U=75U=755555U575U=75U=77U]75U=555555 -MU=75U=75U=75U=75U=74U=34U=75U=75U-35U=755=555=555575U=55U=75 -MU=75U-75U-75U=755575U=75U=75U=755535U=75U=75U5755=75U=75U555 -MU=755=755=75U=75U=755=75U5555555U=75U=75U=555=55U=75U=75U=75 -MU=35U-75U-75U-74U-34U]?4U=55555555755=555=75U=75U-35U-75U-75 -MU=75U-75U=34U=75U=75U=75U=74U-35U=55U555U=75U=755=75U=555555 -M5=755515U=75U-34U-34U-74U=755=75U=75U=55555555555555U=75U-75 -MU=555=55U=55U=55U5755575U575U=75U-74U-34U-75U555U=75U=?7U=55 -MU=555=75U=74U-75U-75U-75U555U5555=75U=75U=75U-355555U=75U=74 -MU=75U=74U=75U=75U=75U=34U=75U=755555U5545%55U=75U5555=555575 -MU=75U=75U=75U5755575U575U=75U=755=5555755=75U=34U=7555555555 -M55755=75U=34U-35U=75U=75U=74U]7555555=5555555555U=75U=75U=75 -MU=75U=75U=75U=75U=75U5755=555555U=35U-35U-355555U=75U-75U=75 -MU=75U=5555555%155=74U=34U=75U=75U=55555555755=5555155=555=75 -MU=75U=74U-34U=75U-75U5555554555555155=55U=75U=75U55555555555 -MU-35U=7555755=555=555555555555755=555555U=75U=75U=55U=555=75 -MU=55U=75U=34U-75U=75U575U-75U=75U=75U=755555U5545=35U=35U-34 -MU-34U-75U=55U=75U575U=555=75U=75U=35U=75U=75U=75U=75U=75U=75 -MU=75U=755=75U575U=75U=75U=75U=75U=37U=75U=555=555=75U=75U=75 -MU-75U=75U=35U=75U=75U555U575U=75U=75U-74U-34U-34U=75U=75U=75 -MU-75U=75U=75U=75U=155-75U=75U-75U=75U-75U-75U=555555U=75U=34 -MU-34U-75U=75U=75U-75U=75U=5555555=75U=74U=34U=34U-75U=75U=75 -MU=35U=74U]75U=755=755555U=75U=75U=75U=75U-74U-35U575U=75U575 -M5=755=75U-74U=35U-34U-75U=35U=35U=75U=75U=75U=75U=755575U-37 -MU-34U-34U-35U-75U=755=55555555555=75U=74U-34U-75U=75U=75U=34 -MU=35U=75U=75U=35U=75U=75U=75U-34U=75U=75U]?4U=75U=75U=75U=74 -MU=75U=75U=75U=34U=35U=75U=34U=75U=75U=75U=74U-34U-75U=75U=75 -MU-34U-35U=55U=75U-75U=75U5575%55U-74U-34U-34U=34U=75U555U575 -M5575U=35U=75U=35U-75U=75U=35U=75U555U575U=75U=75U=75U=75U=55 -M5555U=75U=75U=77U=755575U=5555555=75U=35U=75U=75U-34U575U555 -MU5555=75U=35U-75U=75U=75U575U=75U=74U=75U=75U=75U=75U-75U=15 -M5-75U=34U=74U=34U=34U=75U5555555U5555=55U=75U=75U=75U=75U=75 -MU=75U-75U575U=75U=75U=75U=555=75U=75U=34U=75U=74U]35U5555555 -MU=755=75U=75U-75U=74U=75U575U=75U=75U=75U=75U=75U=75U=35U=34 -MU=74U=75U=75U=75U555U=75U-35U=75U535U=74U-34U-34U-35U=75U=55 -MU=55U5755575U=75U=75U=75U575U575U=75U=75U=75U=75U=75U=75U=75 -M5=555575U=75U=55U555U=35555555555555U=75U=75U=75U=75U=74U=34 -MU=75U=75U=75U=755=75U=75U=75U=75U-75U=75U=35U-34U-35U=75U=55 -MU575U=55U=75U-34U-34U-34U-35U=75U=35U=35U=75U=75U=75U=74U-34 -MU-75U=75U=35U=75U=75U=74U-75U=75U=75U=75U=75U-75U-75U=34U575 -M55755=75U=75U=7555555575U=74U-?4U-755=755=75U=355=75U=75U=75 -MU=75U=75U=34U=755=55U=75U=75U=35U-35U=755575U=35U-34U-34U=75 -MU=7555555575U=755555U575U575U=75U=555=75U=75U=75U5555=75U=75 -MU575U=75U=75U=74U=345=755575U-75U=75U5755575U=35U=75U=555=35 -MU=35U=75U=75U575U=75U=75U=55U575U=74U-34U=34U-35U=75U=75U=75 -MU=35U=75U=75U555U=74U-34U-34U-75U=555575U=75U=75U5555=555=35 -MU=35U=55U=55U=75U-74U-75U575U=34U=35U=75U=75U=74U=75U5555555 -MU=?4U=75U575U=55U575U=755=75U=75U=75U=75U575U575U=75U-755=75 -MU=75U=75U=75U=34U=74U=75U=35U=35U=75U=75U=75U=54U=34U-34U=34 -MU-74U=75U=75U=75U=75U=75U=75U=755=75U=75U5755=55U=75U=75U-75 -MU=75U=75U=75U=7555555=75U=75U-74U=77U]74U=755=55555555555=75 -MU=75U=75U=75U-75U=75U=34U-34U=75U=75U=75U=74U=35U=75U555U=75 -MU=74U=75U5755=755=755%34U-77U-34U-75U=75U=75U=755=555=555=75 -MU=75U=34U=34U]35U-75U-75U-35U=75U=75U-74U=75U=75U=75U-74U-34 -MU-75U575U-35555555755=755=75U=75U-34U-35U-75U-75U=75U=75U=75 -MU575U=75U=74U=75U=75U-74U-75U=74U=75U=75U=75U=35U=74U555U-75 -MU-35U=35U=75U=75U=555=75U=75U=75U=75U=75U-75U=7555555=55U=75 -MU=75U5555=755=75U=75U=35U=75U=755=75U=75U=?7U=75U5555555U575 -MU=75U-35U=75U=75U=755575U=75U=75U-75U=75U=75U=75U=75U=75U=75 -MU=34U-34U-34U=75U=75U=75U=545=75U=35U=75U=75U=755=55U=75U575 -MU555U575U=75U=75U=75U5555=75U=75U=75U=75U=75U=75U=75U=555=55 -MU=35U=75U=34U=37U]7555755575U555U=755=555=55U=75U=34U-75U=75 -MU=75U=35U=75U=75U=55U5555=75U=75U-35U-35U-75U=75U=75U-35U=75 -M5535U=75U=34U-34U-74U575U575555555555=555=75U=35U=34U-35U=75 -MU-35U=75U=555=75U=75U=55U555U=55U=74U=74U=74U=74U]35U-75U=75 -MU=75U=75U=75U=74U=35U-34U]34U=7555755575U=75U=75U=34U=34U-74 -MU=74U=74U=75U=75U-34U=75U=755=75U555U=74U-34U-74U-34U=75U=75 -MU=75U=555=55U=75U=75U=75U=355555U5555575U=75U=75U=55U=75U=75 -MU=75U=74U=75U=75U=55U=34U=555=755=55U=55U=75U-75U-35U=75U-75 -MU=5555555575U=555=75U=75U=75U=75U=75U=75U-75U=75U=35U-34U-75 -MU=74U=555%75U=34U-34U-34U=75U=755=75U=75U=75U=74U-34U-75U=74 -MU-55U=75U=75U=755=75U=75U=34U=75U=75U=55U=75U=75U=75U=77U]34 -MU=7555755=75U=75U575U575U=55U=75U=75U=74U=75U=355555U=75U=75 -MU=75U=75U=75U=74U-34U-35U=75U=75U=75U=755574U-34U-34U-35U=75 -MU=555=7555555555U555U575U=75U=75U-55U=75U=75U=555=75U=75U-75 -MU=75U-75U=75U-34U-75U=74U=75U-?4U=74U=74U-74U575U5755=75U=35 -MU-34U=75U=555555U575U%75U=75U=75U=75U=74U-34U-34U-75U=75U=75 -MU=74U=74U=75U554U=75U-34U-35U-35U=75U=75U=75U=34U-75U=75U=35 -MU=34U=35U=75U=35U-34U=75U=75U=75U575U=55U=75U=75U=75U=75U=35 -MU=37U=75555555555=75U=75U=75U=75U=75U=35U=75U5555555U=55U=75 -MU=75U=75U=75U-74U-34U=74U=7555755=75U=75U-75U=555%55U=75U=75 -MU=74U=75U555U555U555U=55U=75U=55U=75U=74U575U=75U575U5555575 -MU=75U-34U=74U-35U=35U=35U=75U=34U=74U-75U=555=755=55U=75U575 -MU=75U575U=74U-35U=75U=75U=34U=75U=75U=755=755=75U=35U=75U=75 -MU=75U=75U-35U-75U=345535U=74U-34U-74U-34U-74U-75U=75U=75U=75 -MU=34U=75U=75U-555=74U=75U=75U=75U=75U=35U=35U=74U=75U=555555 -MU575U=75U-?4U5755575U=74U=755=75U=75U=75U-74U-35U=75U=75U=75 -MU575U=55U=75U=75U=75U=34U-34U]34U-75U=755=55U=75U575U5545=75 -MU-74U-34U-35U=75U5755=755=7555555575U=755=75U=75U=75U=755=55 -MU=75U=755575U=75U=75U=75U=74U-74U-75U=755=37U=75U=555=755=75 -MU=75U=755=75U=75U=75U=75U=75U=75U-75U575U=75U=75U-75U-75U=75 -MU=75U=75U=74U=74U=74U=75U=355-74U-34U-34U-75U=75U=75U=34U=75 -MU575U=75U-74U-74U-74U=755=75U=755%74U-?5U-=55=555-555=75U-55 -MU-34U=75U-35U=74UM75U5555555U575U=75U=75U=75U-34U-74U-74U535 -MU-755=7455555=75U=75U555U555U=75U=77U-35U=34U=75U=75U=55U=55 -M5515U=74U-?4U-35U-75U55555755=74U=75U555U=75U=75U=74U-34U-34 -MU=75U555U555U=75U=75U=75U=75U=75U=75U575U-74U-55U=34U555U=55 -M5555U=75U=75U=75U=75U=74U=75557555555=555555U=55U=75U=35U=34 -MU-35U-35U=75U=55U=75U-35U=55U57555545=75U]34U-34U=75U=75U=75 -MU=55U=7555555555U=74U=75U=34U=555=55U=75U=55U=75U=75U=75U=75 -MU=34U-34U-75U-55U=55U=77U-75U=55557555755575U=75U=74U-74U-35 -MU=75U=75U=75U=75U=755575U=75U=75U-34U=75U-75U=75U=75U=74U-34 -MU=35U=755%35U=34U-34U-34U=75U5555555U=75U=55U5755=75U=75U=75 -M5575U=75U=75U=75U=75U=755=75U5755575U575U=75U=75U=75U=74U]35 -MU=75U=75U=555=75U=55U=75U=55U=75U=75U=75U=75U=75U575U575U=75 -MU=75U=75U=75U=75U=75U=75U575U=75U=74U=34U%15U=75U=34U-34U-75 -MU=75U=75U=555575U=75U-34U-75U-75U-75U=75U=75U=755=755=75U=75 -MU=75U-75U=75U5555=75U=75U=35U-?4U=75U575U=75U=75U=755=555555 -MU=75U=75U=75U=75U=75U=755=75U=555555U=75U-34U-34U=75U=75U=75 -MU=75U=75U=55U=545-55U=35U-35U=34U-34U=75U=75U575U=75U=75U-34 -MU-75U=35U=755=75U=75U=75U=75U=75U=75U=35U=75U=75U=74U-75U=75 -MU=37U-75U=5555555555U=75U=75U=75U=75U=35U=755=75U=75U=75U=55 -MU=75U=75U-75U=75U=75U-75U575U=75U575U=75U-35U-345=75U=34U-34 -MU-74U=75U=75U=755555U=555555555555555575U=75U=75U-75U=75U=55 -M5575U-35U=75U-75U=75U=74U=34U-34U-75U]?4U555555555545=75U=75 -MU=75U=75U=74U=74U=75U=555555U=55U=55U=75U=75U=34U=75U=75U=75 -MU=75U=74U-75U=35U=75U575U-34U-35U-35U-34U-35U-34U=75U=75U=75 -MU-75U-74U-75U-75U=555575U=75U=34U-74U=355=755575U=74U-75U=75 -MU=55U=55U=?4U=75U57555555=555575U=35U=75U-75U=75U575U=74U-34 -MU=75U=75U575U=75U=75U-75U-75U=75U=75U=35U-35U=34U=75U=555=75 -MU=34U]34U=75U=755=75U=34U575U=75U=75U=75U=74U-74U=35U=35U=75 -M5=755=555555U=75U=75U=75U=75U=55U=75U=75U=77U]34U55555755555 -M5=55U=75U=75U575U=74U=75U=75U-75U575U=75U=75U575U=34U-35U-35 -MU=35U=34U-34U=74U=75U=75U-755574U-34U=34U-75U=75U=74U=74U=75 -MU=75U=75U=75U=75U=34U=75U=35U=75U=34U=75U5755=75U555U5555575 -MU-35U=75U=34U575U-?4U55555555555U=75U=75U=75U=35U=755=75U=75 -M5=75U=555=55U=55U=55U=74U-75U=75U-75U=75U=75U=75U-75U=75U=75 -MU515U=34U-35U=35U=75U-74U-35U=75U-75U=75U=75U=755=75U=75U=74 -MU=74U-75U575U=75U=75U=75U=755575U=75U=75U=75U=55U=34U=75U=55 -M5=55U=75U=75U=75U=755=55U=75U-55U=75U=55U575U=75U=75U-35U=74 -MU=75U575U=75U=75U=75U=75U-75U=34U=755-745=35U=35U=75U=75U-15 -MU=55U=7555555555U575U=755575U=75U555U=555=55U=75U=75U=75U=75 -MU=34U-75U=75U=755=74U-34U]35U-155555U555U575U=75U=75U=555=75 -MU=75U=74U=75U=555=74U=755=74U=75U=34U-75U=35U=55U=74U=75U=35 -MU=555=755515U=74U-75U=75U=75U=75U=75U575U=5555555575U=75U-35 -M5=75U=75U=75U=35U=75U=75U=555575U=75U=75U-35U-34U=75U555U=35 -M55755=5555555575U=75U=75U=75U=75U=34U=35U=55U=75U=755=555555 -MU=75U-75U=75U=75U=74U-35U=74U=75U-34U%75U554U=74U-34U=35U=75 -MU=75U=75U=555575U555U=75U-34U-75U-75U=75U=75U-75U=75U=75U=55 -MU555U=75U=75U=75U=75U=75U=35U=37U55555555555U=75U-74U=35U=75 -MU-35U=74U-34U=75U=75U=75U=75U=75U=75U=75U=74U-35U=74U-75U=75 -MU=75U=75U=35U=355=75U=34U-34U=75U=5555555575U=55U=34U-75U=75 -MU=5555555=75U=75U5755555U=74U-34U=75U=35U=75U=75U=74U-75U555 -M5574U%555=755=75U=555=55U=75U=75U=34U=34U-75U575U=75U=75U=75 -MU=75U=75U=75U=34U=75U=75U=75U-35U=75U=75U=75U=355575U=34U-34 -MU=34U575U=75U-75U=75U=5455545=75U=74U=34U-34U=75U=75U=75U=75 -M5=555=555575U=75U=74U-34U-34U=75U=75U=355=75U=75U=55U=755=75 -MU=75U=75U=75U=755=75U=75U=55U=75U=55U=755=74U-34U-35U-75U=55 -MU=34U-75U=755575U-74U-55U=75U-34U=34U-75U=35U=75U=55U=75U515 -M5=755=77U=74U=75U-35U-15U=75U555U=75U=34U%75U575U-75U-34U=75 -MU=555=555=77U-75U=75U=75555555555=75U=34U-75U-34U=55U=55U=75 -MU=75U=35U=75U555U=75U-75U-34U=755=75U=75U=34U-34U-55U=755%15 -MU=34U=34U=34U=75U=75U=75U=55U=75U=74U-75U=75U575U5755555U=55 -MU=75U=75U-74U-37U-75U=75U=75U=75U=75U=75U=74U]35U=75U=755575 -M5=75U=74U=75U=55U=75U-35U=75U5555=75U575U=75U-75U=34U=55U=75 -MU=74U=34U=75U=75U=35U=15U=75U515U=34U-35U-75U=34U-35U=555=75 -M5=55U5555575U=75U=75U=555=555=75U-35U=755555U=75U=35U=755575 -MU=555=74U-75U-35U=34U=5555155=555=75U-75U-34U-74U=34U=75U=75 -MU=75U=755=7555555=75U-34U-35U5555=75U=74U=34U-75U=75U=75U=75 -MU5545=75U-75U=35U-34U-74U=5555555575U=35U=75U=75U555U=74U-74 -MU=75U=75U-34U=555=75U=75U=75U=75U=75U=75U=55U=75U=77U]75U554 -M55155=75U=34U-35U-755575U=34U-34U=75U=74U-34U-34U=75U=75U=75 -MU=74U-75U-75U=75U=75U=34U=35U-3555755%35U=37U-34U-35U=755=75 -MU=75U=75555555555=55U=75U=75U=75U-55U-34U-75U=555575U=755555 -MU=34U-75U=74U=75U=75U575U-35U5755575U575U=74U=75U=75U=75U=75 -MU=75U=75U=75U-35U-75U=75U=75U=75U575U=75U=75U=75U-35U=75U=75 -MU=74U=35U554U=34U-34U-35U=35U=75U=75U=75U=75U=75U=34U-75U=34 -MU=55U=55U575U=74U-75U=75U=75U=74U575U=75U=75U=75U=75U555U=?4 -MU=75U55555545575U=74U=35U=75U-35U-34U-75U-75U=75U=75U=755575 -MU575U=74U-75U=75U=75U=34U-35U=35U=75U575U-545=35U-75U=35U-35 -MU=34U-35U-75U-75U=75U575U=74U=75U=75U5755=74U=74U-34U=55U555 -MU575U=75U=35U=34U=75U=55U=75U=74U%75U5545575U=75U=75U-74U=34 -MU-75U=75U=74U-34U=75U5555575U=75U=755=55557555555575U=75U=75 -MU=55U575U555U5755-74U-34U-34U=75U=75U=35U-35U=75U=55U575U=75 -MU=75U=74U=75U=75U=75U=75U=75U=75U=75U=75U=755575U=75U=74U575 -MU=75U-15U5555575U=75U=75U=75U=74U-75U=75U=55U=75U-75U=75U555 -M5555U=75U=75U=34U-75U=74U=34U-75U575U=75U=35U=35U515U=74U-34 -MU=74U=75U=34U=35U-755575U=75U=74U-35U=35U=75U-74U=75U-34U=75 -MU=555=75U5755=75U=35U=75U=75U=75U=55U=?7U=55555555555=75U=75 -MU=555575U=75U-74U=75U=55U=75U=755=75U=34U=35U=35U-75U=75U=75 -MU-35U=75U=555575U=75U=555=75U-35U-34U-75U=75U=75U=75U5555575 -MU575U=74U575U-34U-75U=755=75U=75U=75U=755=75U=75U=55U=75U=55 -MU=55U=75U=77U]75U=75557555555555U=75U=75U=75U-37U-75U=75U=75 -MU57555555555U=75U-74U-75U=75U=75U=35U-75U=75U=75U=75U=755574 -MU=34U=74U=75U=75U=74U=34U=75U=34U=75U-75U=75U-755=75U=74U-34 -MU=75U5755=555555U=75U=75U-35U-74U-75U=75U=75U-35U5555%15U=75 -MU=74U=34U-75U=75U=74U-35U=74U=75U=15U=74U-75U-75U=75U=34U-55 -MU575U=75U=75U575U=74U=755=555514U=74U-75U=75U=75U=75U=75U=74 -MU=34U=75U=75U-74U-34U-75U=75U-75U-75U555U555555555755=75U=34 -MU=34U=35U=75U=75U=34U=555555U5755555U=35U=75U-35U=75U=75U555 -MU555U575U=75U=75U=75U-34U-34U=75U=75U=755575U=74U-74U-34U=75 -MU=755-75U-34U-34U-34U=35U=55U=55U=55U%55U=75U575U575U=75U575 -M5=755=75U=75U=35U=75U=35U-34U-34U=75U=34U=35U=75U=74U]75U=55 -MU5555555U=75U=75U=75U575U=74U=755575U=75U-75U=75U=35U-75U-75 -MU-74U=35U=75U=75U=75U-35U=75U-75U=755535U=34U=34U=75U=75U=75 -MU=75U=75U575U=755=75U=75U-3555555555U=75U=35U=35U=75U-75U=75 -MU=75U-35U-34U-74U=75U-75U-34U=75U575U55555755575U=34U-74U-75 -MU-75U=34U-34U-35U=75U=75U=75U-35U-35U=75U=755=75U=75U=75U=75 -MU5755=75U555U=74U-74U-35U-34U-35U-35U555U5555555U5755=75U=34 -MU=75U=35U=35U-34U-35U=75U575U=75U=75U=75U-75U=75U=75U=74U=36 -MU-75555455555=75U=75U=75U-75U-74U-75U575U=555=755555U=75U555 -MU=75U=75U=35U=75U=75U=75U=75U=35U=75U-75U=745%75U=34U-34U=34 -MU=34U-75U=55555555555575U=75U=75U-75U=75U-75U-74U-75U=75U=75 -MU=75U=75U=75U=75U=755=755=75U=74U]35U=5555755575U=75U=75U=75 -MU=75U=75U=75U=75U=74U55555555=55U=75U-34U=75U=75U=75U=75U=75 -MU=75U=35U=75U=75U515U-74U=75U-34U=75U=34U=75U555U5555555U=75 -MU=75U=7555555=75U=74U=74U=755555U=75U=75U=75U=75U=75U=75U575 -MU=75U-?4U=75U555U=75U575U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U-34U-35U-75U-74U-74U=75U=545-75U=34 -MU-35U=75U=75U=75U=75U=75U=75U=75U=75U=75U5555555U575U=555555 -M55555=75U=75U=75U=75U=75U=75U=75U=75U=37U-5555555=555=75U-35 -MU-34U-35U=35U-34U-34U=75U=35U=35U-75U-74U-755=75U=75U=75U=75 -MU5555=755=75U=755=75U=355=74U=35U=75U-34U-75U=75U=75U=75U=75 -MU-75U=75U=75U-35U=75U=75U-75U=755555U=75U=75U=75U=75U=75U=75 -MU=35U-35U=75U-35U5555555U575U=75U=75U575U=75U=75U=75U=75U=74 -MU575U=755=75U=74U=34U=34U=75U=75U=75U=75U=75U=75U-35U=74U515 -MU=74U-34U-74U=75U=75U=75U=75U=7555555575U=75U=355=75U=75U=75 -MU-34U-74U=35U=75U=75U=55U=75U555U=75U575U=75U-?4U=75U575U=55 -MU=75U=75U5755=75U=74U=75U=75U=75U=5555555555U=75U=75U=35U-34 -MU-75U-75U=75U=75U=75U=75U575U=545-75U=34U-34U=35U=75U=75U=75 -MU=75555555555=75U=74U=5555755=555=55U=75U575U575U=75U555U555 -MU=75U=74U=75U=75U=77U-7555755=55U=755=55U=75U=34U-34U-35U=55 -M5=55U=35U=75U=75U=75U=75U=75U-75U-75U=75U=75U=75U-35U=74U-75 -MU=555%75U=34U-34U-34U=75U=55U=75U=55U=55U=75U=55U=75U-75U=75 -MU=75U=55U=755555U5755=755=75U=34U-34U-34U-34U-34U-74U]?4U-75 -M5555U=75U=35U-75U=75U=55U=74U-34U-75U=75U575U=75U=75U=74U=34 -MU-74U=755=755=75U-34U-35U=55U=75U=75U575U-34U-34U-75U=35U=75 -MU=75U=75U=7555545555U=74U-?4U=75U=75U=74U=34U=34U-35U=75U=75 -MU=35U=34U-75U=75U575U=55U=34U=55U55555555555U=75U575U=75U=74 -MU=75U=75U=75U=555575U=75U=755=555=75U=75U=35U-75U=75U=75U=75 -MU=75U-35U=55U=34U-35U-75U=75U=75U575U=75U=75U=75U=75U=34U-34 -MU=75U=75U=75U=75U=75U=55U=55U=75U=75U=35U=555=75U=75U=75U=37 -MU]75U=555=75557555755=75U=75U=74U-34U=555=75U=755=55U=75U=75 -M5=75U=74U-35U-75U-75U=75U-75U-75U=75U=74U=755%74U=34U-74U=75 -MU=75U=755=75U=75U=75U=5555555=75U=55U=75U=75U=555555U=75U=55 -MU=555575U57555755=75U57555755=75U-35U=55557555555555U575U=75 -MU=35U=75U=75U=755=75U=75U55555555=75U=74U-34U-35U=75U=75U=75 -MU=75U=755=755575U555U=34U-35U-35U=755=755=75U=75555555555=75 -MU=75U-34U=75U=74U=75U-34U-74U=74U-75U=34U=35U=75U=75U=75U=55 -MU=55U=?4U=55U5555555U=55U575U=75U=75U=75U=75U=75U=75U=75U=75 -M5=555=755=75U=75U=74U=75U=75U=75U=75U=35U=75U=75U-145=75U-34 -MU-74U-35U=755575U=75U=74U=75U=75U=34U=74U=74U=75U=75U=75U=75 -MU=75U=75U=55U555U=55U=75U=74U=35U-34U=77U]7555555555U=755=75 -MU=75U=74U=34U=34U=75U=75U=355=75U=75U=75U=75U575U=75U=34U-75 -MU=75U=75U=75U=75U-75U=345574U=34U=34U-34U=34U-75U=75U=75U=75 -MU=75U=34U-35U-355=75U=75U-35U-35U-75U=55U=75U575U575U575U=75 -MU=74U=74U=74U-?5U=55551555555=75U=75U=75U=75U-74U-75U=75U=75 -M55155555U=74U-74U=34U-35U=75U=755=75U=75U=55U=75U=75U=75U557 -M5=75U=74U-75U=75U575U=75U=75U5555555U=75U-74U-34U=75U=74U-75 -MU=75U=74U=35U=35U=75U=74U-74U-35U=75U=75U5555=34U=555=555=55 -MU=75U=74U=34U-74U-75U=75U=75U-74U-35U=75U=75U=75U=75U=75U=75 -MU=35U=75U=755=75U=35U-34U-35U=555-75U-34U-34U-35U=75U=555575 -MU5755=755555U5555=75U575U=75U=75U=7555555=55U=75U=75U=55U=55 -MU=75U575U=55U=75U=74U]75U=75U=74U=75U=75U5755575U=75U-34U=75 -M5555U=755=75U=755575U=75U=75U=55U=75U=75U=75U=75U=75U=75U=75 -MU-355575U=34U-34U-75U=34U-74U=75U=75U=75U=75U=75U=74U-35U=75 -MU=75U=75U=75U-74U-75U=755575U=75U=34U-35U=75U=75U=75U-?4U=75 -MU5755%555555U=75U-34U-35U=75U=75U=75U=75U=75U=75U=75U575U=74 -MU=34U-34U-75U=75U=74U=75U-75U=755555U=545=75U-34U-34U=75U=55 -MU=55U=75U=75U=555555U=75U=74U=75U=75U575U=74U=75U=75U=755=75 -M5=755=75U=34U-75U=75U=755=37U=75555555555555U=74U-34U-34U-75 -MU-34U-75U=75U=55U575U=75U=75U=74U=34U-75U=75U=75U=75U=75U=55 -M5=75U=35U-355=75U-35U-35U-35U-75U=75U=75U575U=75U=74U=75U575 -MU5755=74U=34U=75U=75U=75U=75U=34U-75U=75U5555=75U=74U=74U-74 -MU]355=75U=75U=75U=75U=75U=75U575U=74U-75U=75U=555=55U=35U=75 -MU=75U=75U-74U=75U=75U=34U=75U=75U=75U=74U-34U535U=74U=74U-34 -MU=75U=75U=75U=75U=7555555=755575U=75U5755575U=75U=75U=35U=75 -MU=55U555U575U=75U=75U-75U=75U-35U-?4U=755575U=755=755=55U=75 -MU=75U=35U-35U=75U=35U=75U=75U=555575U=75U=75U=75U=75U=35U=75 -MU=75U=34U=74U-75U5545-75U-34U-34U-34U-75U=7555555=755555U=75 -MU=75U=75U=75U=75U-74U-74U=75U5555=75U=75U-74U=34U=75U=75U=75 -MU=35U=37U=5555555=555=55U=75U=75U=75U=75U-74U-75U=75U5555555 -M5=75U575U=74U=34U-34U-75U=35U=35U=755=75U=75U=75U=755-75U-35 -MU-34U-75U=75U=75U=75U=75U-75U=75U-34U-75U=75U=75U=75U=75U=75 -MU=755=75U=75U=75U-35U=75U=75U=75U=75U=74U]35U5555575U555U=75 -MU=75U=75U=75U=75U575U=75U=75U=75U=75U=55U=75U=75U-35U=55U=75 -MU=75U=755575U=75U=75U=75U535U-74U-75U-74U=75U55555755=55U=75 -MU=755=75U555U=755575U=75U=75U=75U=55U=75U=75U=75U=75U575U=75 -MU-35U=74U-35U-?4U=55U5755555U=755=75U=75U=74U-34U-34U-35U575 -MU=75U=75U=75U=75U=75U=75U575U=75U=75U=75U=74U-35U=75U=75U=15 -M5=75U=34U-74U-35U=75U=75U=75U575U=55U575U=755=75U=75U=75U=75 -MU=75U=75U5555=555=75U=75U=75U=75U=75U=75U=555=74U-5555545555 -MU=75U=75U=74U=75U=75U=75U=75U=75U555U=75U=75U=75U=75U=75U=75 -MU=75U=74U=34U=75U=75U=34U=75U=555%75U=34U-74U-75U=75U=755=75 -M5555U=555575U=75U=75U-74U-34U-34U=74U575U=75U=75U=75U=75U=75 -MU=75U=35U=75U=75U575U-155=555=75U=75U=75U=75U-75U-35U=34U-35 -MU=7555755=75U=75U=755=75U=75U=75U=74U-34U-34U-75U=75U=35U-34 -MU=75U515U-75U-74U-74U-74U=75U=755575U=755=755=75U=75U=75U=75 -MU=75U=55U=75U=55U575U=75U=75U=75U575U=75U=75U=75U=75U-?7U=75 -MU575U5755575U=75U=75U=755=75U=75U=75U=75U=55U=75U=75U=75U=75 -MU=75U=75U-75U=75U=75U=75U=75U=75U=75U=555=75U-75U-34U-34U=75 -MU=75U=75U55555555555U=75U-34U-35U=75U=35U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=74U-7555555=75U=75U=75U=75U=75U=75 -MU=34U=555=75U=55U575U=75U=75U=74U=75U=35U-74U-75U=75U=755575 -M5=75U=75U=345535U=34U=34U-74U-34U=34U=75U=35U=75U=75U=75U=75 -MU=75U=74U=75U-74U=35U=75U575U575U=75U=75U=74U=75U=75U=74U=75 -MU-35U55555555=75U=75U=75U-35U=75U=75U-75U575U=75U=75U=75U=75 -MU575U=74U=75U=75U=75U=75U=75U=75U=75U=75U=75U555U-74U-34U-35 -MU=75U=55U555U=75U=75U575U=755575U=75U=75U=75U575U=755=755=75 -MU=75U=75U=75U=75U=75U=35U=75U=755=34U=75U575U=75U=7555755=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=34U-35U=55U555 -MU=75U=75U=34U=75U=155=75U=34U-34U=75U=75U=75U=75U=74U=35U=35 -MU=35U=75U=75U=35U-35U-34U=755=555=75U=75U=75U=75U=55U=75U=34 -MU-34U-37U]55555555555=75U=74U=75U=75U=75U-34U-75U=75U=55U=75 -MU=75U=75U=75U=75U=74U=75U=75U=74U-34U=755=75U=75U=74U535U=74 -MU=74U-34U-75U=75U=7555555555U555U=75U=75U5555=75U=75U-74U=75 -MU5755575U=7444%64TQ37-34TM_>V-C8V=G?W]+2T]S>45C81%#&6]907515 -M1E344=9`T-13UE-7WUE6TE_?T%/25]#04]?65MW75=95UM965-15U]76T]54 -MUU96TE35UU'6U5=45=745%#7U%165M?5U=?5U-!6T]57TU/7UU+25%?15M'6 -M4M?7U=96U]74U=54UM75U5;45]?7U==7U57545365-=6U=17U5775=;45=55 -MU%=5U5365%755M95U-16UE755%575==1UN2AHZ4J*BXA.30%6Y*#B[>QL+.S -ML["VM[6(C(&%G97DW'-B%!`<&!H%!`0$!`0%&A@>'1,6%&EB9W]T1%39S/?R -M_OOEY.?GY^3DY?KY__+P]\H)(*NFL)P=-3T[)"8F(28F)R4[/S(V"P,;%4+G -MD9N&@H^(B[6UM;6*BXB.C(*!AYJ>DY3LY/?307-E86UN:VH5%106$1`0$184 -M%6EM87IR2%O4V\_W\O[[Y>3DY^?DY.7[^?SR\?3(PL39T]=74U];149`0TU- -M34Q-34)#0$%'1%I;6%Y?75-045975%75U=34U-34U-35U=5555555%145U=7 -M5E965E965E9645965E9645965E975E975U=75U=75%145%145%145%145%14 -M5%145%145%145%145%145%=45%175%145%155%1455155%55555555555555 -M5%555555555455555%555555555555555555555555555555555555555555 -M55555%5555555555555555555555555555755=55U=75U=75U=75U=755=75 -M55755=555=5555555=75U=75U=75U=55U=75U=75U=75U=75U=75U=75U575 -MU=75U=75U=75U=75U=75U=75U=55U55555755575U555U=75U=75U=55U575 -MU=75U575U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=74U-75U-35U-34U-75U-75U=75U=75U5755=555=555555 -M5555555555555575U555U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=55U=75U=75U=75U=75U=75U=75U=75U=75U=75U=55U=75U575U=755=75 -MU=755=75U5755=75U=755=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U-75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U-75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=31T=?45=755%165E=45%15 -M5=75U=74U-74U-34U-34U=34U-75U=55U=74U-745%74U%;5E[2U@(25Y'9@ -M%A(9&P4%!1H8&1P2%A5O87YU4M[U_>7FX^WO[NGIZ>[O[.WCX>?E^?WVRL+: -MW==67%M'0TU.24A+2TA(3D],0D!&1%M97UU345=5U=36UM'0T]/3T]/3T-#0 -MT=;6U]?7U-7555545%145U=75E=75E=75U=75U=75U175%145%1555555555 -M55555555555555555555555555555555555555555555555555555555U555 -M5=555=55555555555555U5555555557555755555557555555555U575U=75 -M5=75U=75U=75U=75U=75U=75U=55U=75U575U555U5755=55U555U575U=55 -MU=75U575U=75U=755555U555U575U=75U=75U=55U5755=555=755=55U=75 -MU=55U=75U575U575U=755=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U555U555U555U575U=55U575U=75U575U=75U=755=75 -M5=55U=55U575U=75U=75U=75U=75U=75U=35U-75U-75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=74U=35U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=35U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U575U=75U=755=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=755=755=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=55U=75U5755=55U=55U=75U=75U575 -MU=75U=55U=55U575U=75U=55U=75U=55U=75U=75U=75U=75U=75U=75U=75 -M5=75U=75U=75U=75U575U5755=75U=75U=75U=75U=75U=75U575U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=35U=75U=75U=55U=55U=755=75U=75U=75U=75U=55U=75U=75U=75U=75 -MU=75U=75U=75U=55U575U57555755=55U555U5755=55U555U555U575U575 -M557555755=555=555=555=55U57555755555U5755=555=5555555=555575 -M5555U555555555555=555=55U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=755=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=755=755=75U575U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=55U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U575U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75U=75 -MU=75U=75U=75U=75U575U=75U575U=75U=755=75U=75U575U=75U575U=75 -MU=75U=75U=75U=75U=75U=75U=75U=7_____________________________ -M__________________________________________________________]5 -M555555555555555555555555555555555555555555555555555555555555 -M55555555555555555555555553HX,@L1DHJ]N+JXO8J2$0LR.#HX/34<E(BR -MN+J[O+29:PDS.3H[/#0:[8ZSN;J[O+>%9@PP.3H[/S<'_HVPN;J[O[:&=`(Q -M/CH[/C8!V8.QOKJZOK&#W`$V/CLZ/C$"2H:VO[NZN;"-_P<W/SLZ.3`,9X2W -MO+NZN;./[1HT/#LZ.3,):)FTO+NZN+*(E!\U/3@Z.#(+$9*UO;BZN+V*DQ$+ -M,C@Z.#TU')>(LKBZN[RTF6L),SDZ.SPT&^R.L[FZN[RWA6$/,SDZ.S\W!/B- -ML+FZN[^VAG<",#XZ.S\V`=J#L;ZZNKZQ@-,`,3X[.CXQ`DF&MK^[NKZPC?T' -M-S\[.CDP#&2$M[^[NKFSC^(:-#P[.CDS"6F8M+R[NKBRB)0?-3TX.C@R"Q:2 -MM;VXNKB]BI,0"C(X.C@]-1R7B+*XNKN\M9YJ"3(X.CL\-!OOCK.YNKN\MX5A -M#S,Y.CL_-P3ZC+"YNKN_MH9Q`C`^.CL_-@''@[&^NKJ^L8#6`#$^.CH^,0-, -MAK:_N[J^L(WR!S8_.SHY,`QDA+>_N[JYLX_C!30\.SHY,PYNF+2\N[JXLHB5 -M'S4].#HX,@L6G;6]N+JXO8J0$`H].#HX/34=EXNRN+J[O;6>%0DR.#H[/#08 -M[HZSN;J[O+>%8`\S.3H[/S<$Y8RPN;J[O[:'<`(P/CH[/S8!P(.QOKJZOK&` -MU0`Q/CHZ/C$#0(&VO[NZOK""\`<V/SLZ.3`,982WO[NZN;./X`4W/#LZ.3,. -M;IBTO+NZN+*)E1XU/3LZ.#(+%YVUO;BZN+V*D!`*/3@Z.#TU'9:+LKBZN+VU -MGQ4(,C@Z.SPT&.Z.L[FZN[RTA6,/,SDZ.S\W!.2,L+FZN[^VAW(-,#XZ.S\V -M!LR#L;ZZNKZQ@%8`,3XZ.CXQ`T>!MK^[NKZP@O$&-C\[.CDP#'J$M[^[NKFS -MC^$%-SP[.CDS#F^;M+R[NKBRB>H>-3P[.C@R"!><M;VXNKBRBI`3"CTX.C@] -M-1*6B[*XNKB]M9\4"#(X.CL\-!CIB;.YNKN\M)IB#S,Y.CL_-P3DC+"YNKN_ -MMX=]#3`^.CL_-@;)@K&^NKN^L8!3`#$^.CH^,0-:@;:_N[J^L(+W!C8_.SHY -M,`UXA+>_N[JYLX_A!3<\.SHY,PYLF[2\N[JYLXGK&30\.SHX,@@7G+6]N+JX -MLHN1$PH].#HX/342D8NRN+JXO;6?%`@R.#H[/#09Z(FSN;J[O+2:;0\S.3H[ -M/#<$YXRPN;J[O[>'?PTP.3H[/S8&RH*QOKJ[OK:!7`,Q/CHZ/C$#68&VOKNZ -MOK&"]`8V/SLZ.3`-?H>WO[NZN;",Y@4W/#LZ.3,.;9JTO+NZN;.)ZQDT/#LZ -M.#((%)RUO;BZN+*+D1(*/3@Z.#T*$I&+LKBZN+VUG!0(,C@Z.SPT&>N)L[FZ -MN[RTFFT.,SDZ.SPW!>:,L+FZN[^WAWX-,#DZ.S\V!O2"L;ZZN[ZV@5D#,3XZ -M.CXQ`UR!MKZ[NKZQ@LH&-C\[.CDP#7^'M[^[NKFPC.<$-SP[.CDS#VV:M+R[ -MNKFSB>@9-#P[.C@R"!2?M;VXNKBRBY$2-3TX.C@]"A.1B[*XNKB]M9P7"#(X -M.CL\-!GKB;.YNKN\M)ML#C,Y.CL\-P7AC[.YNKN_MX1X#3`Y.CL_-@;W@K"^ -MNKN_MH%:`S$^.CH^,0!3@+&^N[J^L8+)!C8_.SH^,`U]A[>_N[JYL(SD!#<_ -M.SHY,P]BFK2\N[JYLXGI�\.SHX,@@4G[6]N+JXLHN6$C4].#HX/0H3D(JR -MN+JXO;6<%P@R.#H[/#4>ZHFRN+J[O+2;;PXS.3H[/#<%X8^SN;J[O[>$>@PP -M.3H[/S8&\8*POKJ[NU555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -M555555555555555555555555555555555555555555555555555555555555 -755555555555555555555555555555555 -` -end diff --git a/usr.sbin/i4b/g711conv/Makefile b/usr.sbin/i4b/g711conv/Makefile deleted file mode 100644 index f24d6e8d568b..000000000000 --- a/usr.sbin/i4b/g711conv/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -#--------------------------------------------------------------------------- -# -# $FreeBSD$ -# -# last edit-date: [Thu May 20 11:58:43 1999] -# -#--------------------------------------------------------------------------- - -PROG= g711conv - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/g711conv/g711conv.1 b/usr.sbin/i4b/g711conv/g711conv.1 deleted file mode 100644 index 1a7b32813805..000000000000 --- a/usr.sbin/i4b/g711conv/g711conv.1 +++ /dev/null @@ -1,93 +0,0 @@ -.\" -.\" Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: g711conv.1,v 1.3 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 22:54:33 1999] -.\" -.Dd March 15, 1999 -.Dt G711CONV 1 -.Os -.Sh NAME -.Nm g711conv -.Nd conversions according to G.711 -.Sh SYNOPSIS -.Nm -.Op Fl a -.Op Fl u -.Op Fl P -.Op Fl A -.Op Fl R -.Sh DESCRIPTION -The -.Nm -utility -is part of the isdn4bsd package and is used to convert between the A-Law and -u-law formats as specified in ITU G.711. -It is based on a freely available -and freely usable reference implementation done by Sun Microsystems, Inc. -.Pp -The following options are available: -.Bl -tag -width Ds -.It Fl a -Convert A-law to u-law -.It Fl u -Convert u-law to A-law -.It Fl r -Reverse bits before conversion -.It Fl R -Reverse bits after conversion -.It Fl P -Print the resulting conversion tables (as C-source) to stdout instead of -doing the actual conversion. -.El -.Sh EXAMPLES -The command: -.Bd -literal -offset indent -g711conv -P -a -.Ed -.Pp -prints out the A-law to u-law conversion table as C-source to stdout. -.Pp -The command: -.Bd -literal -offset indent -cat max_headroom.ul | g711conv -u -R > /dev/i4btel0 -.Ed -.Pp -converts the u-law coded voice of Max Headroom to A-law, reverses the -bits of the result and moves that to an active isdn4bsd telephone connection. -.Sh STANDARDS -A-Law and u-Law conversions are specified in ITU Recommendation G.711. -.Pp -The reference implementation done by Sun Microsystems, Inc.\& is available -from http://www.itu.int/itudoc/itu-t/rec/g/g700-799/refimpl.txt -.Sh AUTHORS -The -.Nm -utility and this manpage were written by -.An Hellmuth Michaelis Aq hm@kts.org -based on the G.711 conversion reference code written by Sun Microsystems, -Inc.\& and code contributed to isdn4bsd by Stefan Bethke. diff --git a/usr.sbin/i4b/g711conv/g711conv.c b/usr.sbin/i4b/g711conv/g711conv.c deleted file mode 100644 index f158a9d2e34c..000000000000 --- a/usr.sbin/i4b/g711conv/g711conv.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * --- - * - * The A-law to u-law and u-law to A-law conversion routines and tables - * were taken from the G.711 reference implementation from Sun and freely - * available as http://www.itu.int/itudoc/itu-t/rec/g/g700-799/refimpl.txt. - * - * Therefore for that part of the code, the following restrictions apply: - * - * - * This source code is a product of Sun Microsystems, Inc. and is provided - * for unrestricted use. Users may copy or modify this source code without - * charge. - * - * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING - * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun source code is provided with no support and without any obligation on - * the part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - * - * --- - * - * The bitreverse table was contributed by Stefan Bethke. - * - *--------------------------------------------------------------------------- - * - * A-law / u-law conversions as specified in G.711 - * ----------------------------------------------- - * - * last edit-date: [Mon Dec 13 21:44:01 1999] - * - * $Id: g711conv.c,v 1.5 1999/12/13 21:25:24 hm Exp $ - * - * $FreeBSD$ - * - *---------------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <i4b/i4b_ioctl.h> - -/* copy from CCITT G.711 specifications */ - -/* u- to A-law conversions */ - -unsigned char _u2a[128] = { - 1, 1, 2, 2, 3, 3, 4, 4, - 5, 5, 6, 6, 7, 7, 8, 8, - 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, - 25, 27, 29, 31, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, - 46, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, - 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, - 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128 -}; - -/* A- to u-law conversions */ - -unsigned char _a2u[128] = { - 1, 3, 5, 7, 9, 11, 13, 15, - 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, - 32, 32, 33, 33, 34, 34, 35, 35, - 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 48, 49, 49, - 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 64, - 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 79, - 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127 -}; - -/* reverse bits (7->0, 6->1, 5->2 etc) for tx to / rx from ISDN */ - -unsigned char bitreverse[256] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -/* A-law to u-law conversion */ - -unsigned char alaw2ulaw(unsigned char aval) -{ - aval &= 0xff; - return ((aval & 0x80) ? (0xFF ^ _a2u[aval ^ 0xD5]) : - (0x7F ^ _a2u[aval ^ 0x55])); -} - -/* u-law to A-law conversion */ - -unsigned char ulaw2alaw(unsigned char uval) -{ - uval &= 0xff; - return ((uval & 0x80) ? (0xD5 ^ (_u2a[0xFF ^ uval] - 1)) : - (0x55 ^ (_u2a[0x7F ^ uval] - 1))); -} - -void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "g711conv - do conversions according to ITU G.711, (version %d.%d.%d)\n",VERSION, REL, STEP); - fprintf(stderr, "usage: g711conv -a -r -R -u -P\n"); - fprintf(stderr, " -a A-law to u-law conversion\n"); - fprintf(stderr, " -r reverse bits before conversion\n"); - fprintf(stderr, " -R reverse bits after conversion\n"); - fprintf(stderr, " -u u-law to A-law conversion\n"); - fprintf(stderr, " -P print conversion table as C source\n"); - fprintf(stderr, "\n"); - exit(1); -} - -int -main(int argc, char **argv) -{ - int i; - int c; - int opt_a = 0; - int opt_u = 0; - int opt_r = 0; - int opt_P = 0; - int opt_R = 0; - unsigned char uc; - - while ((c = getopt(argc, argv, "aurPR")) != -1) - { - switch(c) - { - case 'a': - opt_a = 1; - break; - - case 'u': - opt_u = 1; - break; - - case 'r': - opt_r = 1; - break; - - case 'R': - opt_R = 1; - break; - - case 'P': - opt_P = 1; - break; - - case '?': - default: - usage(); - break; - } - } - - if((opt_a + opt_u) > 1) - usage(); - - if(opt_P) - { - printf("\n/* "); - - if((opt_a + opt_u) == 0) - printf("No Conversion"); - - if(opt_a) - printf("A-law to u-law conversion"); - - if(opt_u) - printf("u-law to A-law conversion"); - - if(opt_r) - printf(", reverse bits BEFORE conversion"); - - if(opt_R) - printf(", reverse bits AFTER conversion"); - - if(opt_a) - { - printf(" */\n\nunsigned char a2u_tab[256] = {"); - } - else if(opt_u) - { - printf(" */\n\nunsigned char u2a_tab[256] = {"); - } - else - { - printf(" */\n\nunsigned char table[256] = {"); - } - - for(i=0; i < 256; i++) - { - uc = i; - - if(!(i % 8)) - printf("\n/* %02x */\t", i); - - if(opt_r) - uc = bitreverse[uc]; - - if(opt_u) - uc = ulaw2alaw(uc); - - if(opt_a) - uc = alaw2ulaw(uc); - - if(opt_R) - uc = bitreverse[uc]; - - if(i == 255) - printf("0x%02x", uc); - else - printf("0x%02x, ", uc); - } - printf("\n};\n"); - } - else - { - unsigned char ib[1]; - - while(fread(ib, 1, 1, stdin) == 1) - { - if(opt_r) - ib[0] = bitreverse[ib[0]]; - - if(opt_u) - ib[0] = ulaw2alaw(ib[0]); - - if(opt_a) - ib[0] = alaw2ulaw(ib[0]); - - if(opt_R) - ib[0] = bitreverse[ib[0]]; - - fwrite(ib, 1, 1, stdout); - } - } - return(0); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/Makefile b/usr.sbin/i4b/isdnd/Makefile deleted file mode 100644 index ce6c51c464e6..000000000000 --- a/usr.sbin/i4b/isdnd/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# $FreeBSD$ - -PROG= isdnd -MAN= isdnd.rc.5 isdnd.rates.5 isdnd.acct.5 isdnd.8 -SRCS= rc_parse.y rc_scan.l main.c rc_config.c log.c curses.c \ - process.c rates.c msghdl.c fsm.c support.c timer.c \ - exec.c dial.c monitor.c pcause.c controller.c alias.c \ - y.tab.h holiday.c - -# compile debug support -CFLAGS+= -DDEBUG - -# avoid wacky merging of string constants from -# source code with compile-time timestamp -CFLAGS+= -fno-merge-constants - -# enable rtprio usage -CFLAGS+= -DUSE_RTPRIO - -CFLAGS+= -I. -I${.CURDIR}/../isdnmonitor -I${.CURDIR}/../isdntel -I${.CURDIR} - -.include "${.CURDIR}/../Makefile.inc" - -.if !defined(I4B_WITHOUT_CURSES) -CFLAGS+= -DUSE_CURSES -DPADD= ${LIBCURSES} -LDADD= -lcurses -.endif - -.if defined(I4B_EXTERNAL_MONITOR) -CFLAGS+= -DI4B_EXTERNAL_MONITOR -.if defined(I4B_NOTCPIP_MONITOR) -CFLAGS+= -DI4B_NOTCPIP_MONITOR -.endif -.endif - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/isdnd/alias.c b/usr.sbin/i4b/isdnd/alias.c deleted file mode 100644 index f91a0a17b44e..000000000000 --- a/usr.sbin/i4b/isdnd/alias.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnd - common aliasfile handling - * ================================= - * - * NOTE: this has to stay in sync with isdntel/alias.c to be able - * to share a common aliasfile! - * - * $Id: alias.c,v 1.8 1999/12/13 21:25:24 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:04:40 2006] - * - *----------------------------------------------------------------------------*/ - -#include "isdnd.h" - -static struct alias *firsta = NULL; - -#define MAXBUFSZ 256 - -static void free_alias(struct alias *ptr); - -/*---------------------------------------------------------------------------* - * read in and init aliases - *---------------------------------------------------------------------------*/ -void -init_alias(char *filename) -{ - FILE *fp; - unsigned char buffer[MAXBUFSZ + 1]; - unsigned char number[MAXBUFSZ + 1]; - unsigned char name[MAXBUFSZ + 1]; - unsigned char *s, *d; - struct alias *newa = NULL; - struct alias *lasta = NULL; - - firsta = NULL; - - if((fp = fopen(filename, "r")) == NULL) - { - llog(LL_ERR, "init_alias: error opening aliasfile %s: %s!", filename, strerror(errno)); - exit(1); - } - - while((fgets(buffer, MAXBUFSZ, fp)) != NULL) - { - if(buffer[0] == '#' || buffer[0] == ' ' || - buffer[0] == '\t' || buffer[0] == '\n') - { - continue; - } - - s = buffer; - d = number; - - while(*s && (isdigit(*s))) - *d++ = *s++; - - *d = '\0'; - - while(*s && (isspace(*s))) - s++; - - d = name; - - while(*s && (isprint(*s))) - *d++ = *s++; - - *d = '\0'; - - if((strlen(number) > 1) && (strlen(name) > 1)) - { - if((newa = (struct alias *) malloc(sizeof(struct alias))) == NULL) - { - llog(LL_ERR, "init_alias: malloc failed for struct alias!\n"); - exit(1); - } - - if((newa->number = (char *) malloc(strlen(number)+1)) == NULL) - { - llog(LL_ERR, "init_alias: malloc failed for number alias!\n"); - exit(1); - } - - if((newa->name = (char *) malloc(strlen(name)+1)) == NULL) - { - llog(LL_ERR, "init_alias: malloc failed for name alias!\n"); - exit(1); - } - - strcpy(newa->name, name); - strcpy(newa->number, number); - newa->next = NULL; - - if(firsta == NULL) - { - firsta = newa; - } - else - { - lasta->next = newa; - } - lasta = newa; - } - } - fclose(fp); -} - -/*---------------------------------------------------------------------------* - * free all aliases - *---------------------------------------------------------------------------*/ -void -free_aliases(void) -{ - free_alias(firsta); -} - -/*---------------------------------------------------------------------------* - * free aliases - *---------------------------------------------------------------------------*/ -static void -free_alias(struct alias *ptr) -{ - - if(ptr == NULL) - return; - - if(ptr->next != NULL) - free_alias(ptr->next); - - if(ptr->number != NULL) - free(ptr->number); - - if(ptr->name != NULL) - free(ptr->name); - - free(ptr); -} - -/*---------------------------------------------------------------------------* - * try to find alias for number. if no alias found, return number. - *---------------------------------------------------------------------------*/ -char * -get_alias(char *number) -{ - struct alias *ca = NULL; - - if(firsta == NULL) - return(number); - - ca = firsta; - - for(;;) - { - if(strlen(number) == strlen(ca->number)) - { - if(!(strcmp(number, ca->number))) - return(ca->name); - } - if(ca->next == NULL) - break; - ca = ca->next; - } - return(number); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/config.h b/usr.sbin/i4b/isdnd/config.h deleted file mode 100644 index a4b05f171bc8..000000000000 --- a/usr.sbin/i4b/isdnd/config.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - compile time configuration header file - * --------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Mon May 21 11:21:15 2001] - * - *---------------------------------------------------------------------------*/ - -#ifndef _CONFIG_H_ -#define _CONFIG_H_ - -/* general values */ - -#define UMASK 022 /* file creation perm mask */ -#define CFG_ENTRY_MAX 60 /* max no of config entries */ -#define ISDN_CTRL_MAX 4 /* max no of controllers */ -#define MAX_RE 8 /* max regular expression entries */ - -/* monitor max values */ - -#define MAX_MHOSTS 8 /* max allowed monitor hosts */ - -/* timouts */ - -#define TIMEOUT_CONNECT_ACTIVE 30 /* seconds to wait for MSG_CONN_ACT */ - -/* utility programs forked */ - -#define REGPROG_DEF "program" /* default program to use for regexpr */ -#define ANSWERPROG_DEF "answer" /* default telephone answer program */ - -#endif /* _CONFIG_H_ */ - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/controller.c b/usr.sbin/i4b/isdnd/controller.c deleted file mode 100644 index bdaa3c4bde8c..000000000000 --- a/usr.sbin/i4b/isdnd/controller.c +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - controller state support routines - * ---------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:24:05 2006] - * - *---------------------------------------------------------------------------*/ - -#include <sys/types.h> -#include <sys/mman.h> - -#include "isdnd.h" - -static int -init_controller_state(int controller, int ctrl_type, int card_type, int tei, int nbch); - -/*---------------------------------------------------------------------------* - * get name of a controller - *---------------------------------------------------------------------------*/ -const char * -name_of_controller(int ctrl_type, int card_type) -{ - static char *passive_card[] = { - "Teles S0/8", - "Teles S0/16", - "Teles S0/16.3", - "AVM A1 or Fritz!Card", - "Teles S0/16.3 PnP", - "Creatix S0 PnP", - "USRobotics Sportster ISDN TA", - "Dr. Neuhaus NICCY Go@", - "Sedlbauer win speed", - "Dynalink IS64PH", - "ISDN Master, MasterII or Blaster", - "AVM PCMCIA Fritz!Card", - "ELSA QuickStep 1000pro/ISA", - "ELSA QuickStep 1000pro/PCI", - "Siemens I-Talk", - "ELSA MicroLink ISDN/MC", - "ELSA MicroLink MCall", - "ITK ix1 micro", - "AVM Fritz!Card PCI", - "ELSA PCC-16", - "AVM Fritz!Card PnP", - "Siemens I-Surf 2.0 PnP", - "Asuscom ISDNlink 128K PnP", - "ASUSCOM P-IN100-ST-D (Winbond W6692)", - "Teles S0/16.3c PnP", - "AcerISDN P10 PnP", - "TELEINT ISDN SPEED No. 1", - "Cologne Chip HFC-S PCI based", - "Traverse Tech NETjet-S / Teles PCI-TJ", - "Eicon.Diehl DIVA 2.0 / 2.02 ISA PnP", - "Compaq Microcom 610", - "AVM Fritz!Card PCI Version 2", - }; - - static char *daic_card[] = { - "EICON.Diehl S", - "EICON.Diehl SX/SXn", - "EICON.Diehl SCOM", - "EICON.Diehl QUADRO", - }; - - static char *capi_card[] = { - "AVM T1 PCI", - "AVM B1 PCI", - "AVM B1 ISA", - }; - - static char *capimgr_card[] = { - "CAPI manager driven board" - }; - - if(ctrl_type == CTRL_PASSIVE) - { - int index = card_type - CARD_TYPEP_8; - if (index >= 0 && index < (sizeof passive_card / sizeof passive_card[0])) - return passive_card[index]; - } - else if(ctrl_type == CTRL_DAIC) - { - int index = card_type - CARD_TYPEA_DAIC_S; - if (index >= 0 && index < (sizeof daic_card / sizeof daic_card[0] )) - return daic_card[index]; - } - else if(ctrl_type == CTRL_TINADD) - { - return "Stollmann tina-dd"; - } - else if(ctrl_type == CTRL_CAPI) - { - int index = card_type - CARD_TYPEC_AVM_T1_PCI; - if (index >= 0 && index < (sizeof capi_card / sizeof capi_card[0] )) - return capi_card[index]; - } - else if(ctrl_type == CTRL_CAPIMGR) - { - return capimgr_card[0]; - } - - return "unknown card type"; -} - -/*---------------------------------------------------------------------------* - * init controller state array - *---------------------------------------------------------------------------*/ -void -init_controller(void) -{ - int i; - int max = 1; - msg_ctrl_info_req_t mcir; - - for(i=0; i < max; i++) - { - mcir.controller = i; - - if((ioctl(isdnfd, I4B_CTRL_INFO_REQ, &mcir)) < 0) - { - llog(LL_ERR, "init_controller: ioctl I4B_CTRL_INFO_REQ failed: %s", strerror(errno)); - do_exit(1); - } - - if((ncontroller = max = mcir.ncontroller) == 0) - { - llog(LL_ERR, "init_controller: no ISDN controller found!"); - do_exit(1); - } - - if(mcir.ctrl_type == -1 || mcir.card_type == -1) - { - llog(LL_ERR, "init_controller: ctrl/card is invalid!"); - do_exit(1); - } - - /* init controller tab */ - - if((init_controller_state(i, mcir.ctrl_type, mcir.card_type, mcir.tei, mcir.nbch)) == ERROR) - { - llog(LL_ERR, "init_controller: init_controller_state for controller %d failed", i); - do_exit(1); - } - } - DBGL(DL_RCCF, (llog(LL_DBG, "init_controller: found %d ISDN controller(s)", max))); -} - -/*--------------------------------------------------------------------------* - * init controller state table entry - *--------------------------------------------------------------------------*/ -static int -init_controller_state(int controller, int ctrl_type, int card_type, int tei, - int nbch) -{ - int i; - - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "init_controller_state: invalid controller number [%d]!", controller); - return(ERROR); - } - - /* init controller tab */ - - switch (ctrl_type) { - case CTRL_PASSIVE: - if((card_type > CARD_TYPEP_UNK) && - (card_type <= CARD_TYPEP_MAX)) - { - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = card_type; - isdn_ctrl_tab[controller].state = CTRL_UP; - } - else - { - llog(LL_ERR, "init_controller_state: unknown card type %d", card_type); - return(ERROR); - } - break; - - case CTRL_DAIC: - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = card_type; - isdn_ctrl_tab[controller].state = CTRL_DOWN; - break; - - case CTRL_TINADD: - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = 0; - isdn_ctrl_tab[controller].state = CTRL_DOWN; - break; - - case CTRL_CAPI: - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = card_type; - isdn_ctrl_tab[controller].state = CTRL_UP; - break; - - case CTRL_CAPIMGR: - isdn_ctrl_tab[controller].ctrl_type = ctrl_type; - isdn_ctrl_tab[controller].card_type = card_type; - isdn_ctrl_tab[controller].state = CTRL_UP; - break; - - default: - llog(LL_ERR, "init_controller_state: unknown controller type %d", ctrl_type); - return(ERROR); - } - - isdn_ctrl_tab[controller].nbch = nbch; - isdn_ctrl_tab[controller].freechans = nbch; - for (i = 0; i < nbch; i++) - isdn_ctrl_tab[controller].stateb[i] = CHAN_IDLE; - isdn_ctrl_tab[controller].tei = tei; - isdn_ctrl_tab[controller].l1stat = LAYER_IDLE; - isdn_ctrl_tab[controller].l2stat = LAYER_IDLE; - - llog(LL_DMN, "init_controller_state: controller %d is %s", - controller, - name_of_controller(isdn_ctrl_tab[controller].ctrl_type, - isdn_ctrl_tab[controller].card_type)); - - return(GOOD); -} - -/*--------------------------------------------------------------------------* - * init active or capi controller - *--------------------------------------------------------------------------*/ -void -init_active_controller(void) -{ - int ret; - int unit = 0; - int controller; - char cmdbuf[MAXPATHLEN+128]; - - for(controller = 0; controller < ncontroller; controller++) - { - if(isdn_ctrl_tab[controller].ctrl_type == CTRL_TINADD) - { - DBGL(DL_RCCF, (llog(LL_DBG, "init_active_controller, tina-dd %d: executing [%s %d]", unit, tinainitprog, unit))); - - snprintf(cmdbuf, sizeof(cmdbuf), "%s %d", tinainitprog, unit); - - if((ret = system(cmdbuf)) != 0) - { - llog(LL_ERR, "init_active_controller, tina-dd %d: %s returned %d!", unit, tinainitprog, ret); - do_exit(1); - } - } - - /* - * Generic microcode loading. If a controller has - * defined a microcode file, load it using the - * I4B_CTRL_DOWNLOAD ioctl. - */ - - if(isdn_ctrl_tab[controller].firmware != NULL) - { - int fd, ret; - struct isdn_dr_prot idp; - struct isdn_download_request idr; - - fd = open(isdn_ctrl_tab[controller].firmware, O_RDONLY); - if (fd < 0) { - llog(LL_ERR, "init_active_controller %d: open %s: %s!", - controller, isdn_ctrl_tab[controller].firmware, - strerror(errno)); - do_exit(1); - } - - idp.bytecount = lseek(fd, 0, SEEK_END); - idp.microcode = mmap(0, idp.bytecount, PROT_READ, - MAP_SHARED, fd, 0); - if (idp.microcode == MAP_FAILED) { - llog(LL_ERR, "init_active_controller %d: mmap %s: %s!", - controller, isdn_ctrl_tab[controller].firmware, - strerror(errno)); - do_exit(1); - } - - DBGL(DL_RCCF, (llog(LL_DBG, "init_active_controller %d: loading firmware from [%s]", controller, isdn_ctrl_tab[controller].firmware))); - - idr.controller = controller; - idr.numprotos = 1; - idr.protocols = &idp; - - ret = ioctl(isdnfd, I4B_CTRL_DOWNLOAD, &idr, sizeof(idr)); - if (ret) { - llog(LL_ERR, "init_active_controller %d: load %s: %s!", - controller, isdn_ctrl_tab[controller].firmware, - strerror(errno)); - do_exit(1); - } - - munmap(idp.microcode, idp.bytecount); - close(fd); - } - } -} - -/*--------------------------------------------------------------------------* - * init controller D-channel ISDN protocol - *--------------------------------------------------------------------------*/ -void -init_controller_protocol(void) -{ - int controller; - msg_prot_ind_t mpi; - - for(controller = 0; controller < ncontroller; controller++) - { - mpi.controller = controller; - mpi.protocol = isdn_ctrl_tab[controller].protocol; - - if((ioctl(isdnfd, I4B_PROT_IND, &mpi)) < 0) - { - llog(LL_ERR, "init_controller_protocol: ioctl I4B_PROT_IND failed: %s", strerror(errno)); - do_exit(1); - } - } -} - -/*--------------------------------------------------------------------------* - * set controller state to UP/DOWN - *--------------------------------------------------------------------------*/ -int -set_controller_state(int controller, int state) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "set_controller_state: invalid controller number [%d]!", controller); - return(ERROR); - } - - if(state == CTRL_UP) - { - isdn_ctrl_tab[controller].state = CTRL_UP; - DBGL(DL_CNST, (llog(LL_DBG, "set_controller_state: controller [%d] set UP!", controller))); - } - else if (state == CTRL_DOWN) - { - isdn_ctrl_tab[controller].state = CTRL_DOWN; - DBGL(DL_CNST, (llog(LL_DBG, "set_controller_state: controller [%d] set DOWN!", controller))); - } - else - { - llog(LL_ERR, "set_controller_state: invalid controller state [%d]!", state); - return(ERROR); - } - return(GOOD); -} - -/*--------------------------------------------------------------------------* - * get controller state - *--------------------------------------------------------------------------*/ -int -get_controller_state(int controller) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "set_controller_state: invalid controller number [%d]!", controller); - return(ERROR); - } - return(isdn_ctrl_tab[controller].state); -} - -/*--------------------------------------------------------------------------* - * decrement number of free channels for controller - *--------------------------------------------------------------------------*/ -int -decr_free_channels(int controller) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "decr_free_channels: invalid controller number [%d]!", controller); - return(ERROR); - } - if(isdn_ctrl_tab[controller].freechans > 0) - { - (isdn_ctrl_tab[controller].freechans)--; - DBGL(DL_CNST, (llog(LL_DBG, "decr_free_channels: ctrl %d, now %d chan free", controller, isdn_ctrl_tab[controller].freechans))); - return(GOOD); - } - else - { - llog(LL_ERR, "decr_free_channels: controller [%d] already 0 free chans!", controller); - return(ERROR); - } -} - -/*--------------------------------------------------------------------------* - * increment number of free channels for controller - *--------------------------------------------------------------------------*/ -int -incr_free_channels(int controller) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "incr_free_channels: invalid controller number [%d]!", controller); - return(ERROR); - } - if(isdn_ctrl_tab[controller].freechans < isdn_ctrl_tab[controller].nbch) - { - (isdn_ctrl_tab[controller].freechans)++; - DBGL(DL_CNST, (llog(LL_DBG, "incr_free_channels: ctrl %d, now %d chan free", controller, isdn_ctrl_tab[controller].freechans))); - return(GOOD); - } - else - { - llog(LL_ERR, "incr_free_channels: controller [%d] already %d free chans!", controller, isdn_ctrl_tab[controller].nbch); - return(ERROR); - } -} - -/*--------------------------------------------------------------------------* - * get number of free channels for controller - *--------------------------------------------------------------------------*/ -int -get_free_channels(int controller) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "get_free_channels: invalid controller number [%d]!", controller); - return(ERROR); - } - DBGL(DL_CNST, (llog(LL_DBG, "get_free_channels: ctrl %d, %d chan free", controller, isdn_ctrl_tab[controller].freechans))); - return(isdn_ctrl_tab[controller].freechans); -} - -/*--------------------------------------------------------------------------* - * set channel state to busy - *--------------------------------------------------------------------------*/ -int -set_channel_busy(int controller, int channel) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "set_channel_busy: invalid controller number [%d]!", controller); - return(ERROR); - } - - if ((channel < 0) || (channel >= isdn_ctrl_tab[controller].nbch)) - { - llog(LL_ERR, "set_channel_busy: controller [%d] invalid channel [%d]!", controller, channel); - return(ERROR); - } - - if(isdn_ctrl_tab[controller].stateb[channel] == CHAN_RUN) - { - DBGL(DL_CNST, (llog(LL_DBG, "set_channel_busy: controller [%d] channel B%d already busy!", controller, channel+1))); - } - else - { - isdn_ctrl_tab[controller].stateb[channel] = CHAN_RUN; - DBGL(DL_CNST, (llog(LL_DBG, "set_channel_busy: controller [%d] channel B%d set to BUSY!", controller, channel+1))); - } - return(GOOD); -} - -/*--------------------------------------------------------------------------* - * set channel state to idle - *--------------------------------------------------------------------------*/ -int -set_channel_idle(int controller, int channel) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "set_channel_idle: invalid controller number [%d]!", controller); - return(ERROR); - } - - if ((channel < 0) || (channel >= isdn_ctrl_tab[controller].nbch)) - { - llog(LL_ERR, "set_channel_busy: controller [%d] invalid channel [%d]!", controller, channel); - return(ERROR); - } - - if (isdn_ctrl_tab[controller].stateb[channel] == CHAN_IDLE) - { - DBGL(DL_CNST, (llog(LL_DBG, "set_channel_idle: controller [%d] channel B%d already idle!", controller, channel+1))); - } - else - { - isdn_ctrl_tab[controller].stateb[channel] = CHAN_IDLE; - DBGL(DL_CNST, (llog(LL_DBG, "set_channel_idle: controller [%d] channel B%d set to IDLE!", controller, channel+1))); - } - return(GOOD); -} - -/*--------------------------------------------------------------------------* - * return channel state - *--------------------------------------------------------------------------*/ -int -ret_channel_state(int controller, int channel) -{ - if((controller < 0) || (controller >= ncontroller)) - { - llog(LL_ERR, "ret_channel_state: invalid controller number [%d]!", controller); - return(ERROR); - } - - if ((channel < 0) || (channel >= isdn_ctrl_tab[controller].nbch)) - { - llog(LL_ERR, "set_channel_busy: controller [%d] invalid channel [%d]!", controller, channel); - return(ERROR); - } - - return(isdn_ctrl_tab[controller].stateb[channel]); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/curses.c b/usr.sbin/i4b/isdnd/curses.c deleted file mode 100644 index a086b23c129c..000000000000 --- a/usr.sbin/i4b/isdnd/curses.c +++ /dev/null @@ -1,891 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - curses fullscreen output - * ------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:05:36 2006] - * - *---------------------------------------------------------------------------*/ - -#ifdef USE_CURSES - -#include "isdnd.h" - -#define CHPOS(cfgp) (((cfgp)->isdncontrollerused*2) + (cfgp)->isdnchannelused) - -static void display_budget(void); -static void display_cards(void); -static void menuexit(WINDOW *menu_w); - -/*---------------------------------------------------------------------------* - * init curses fullscreen display - *---------------------------------------------------------------------------*/ -void -init_screen(void) -{ - char buffer[512]; - int uheight, lheight; - int i, j; - cfg_entry_t *p; - - initscr(); /* curses init */ - - if((COLS < 80) || (LINES < 24)) - { - llog(LL_ERR, "ERROR, minimal screensize must be 80x24, is %dx%d, terminating!",COLS, LINES); - do_exit(1); - } - - noecho(); - raw(); - - uheight = ncontroller * 2; /* cards * b-channels */ - lheight = LINES - uheight - 6 + 1; /* rest of display */ - - if((upper_w = newwin(uheight, COLS, UPPER_B, 0)) == NULL) - { - llog(LL_ERR, "ERROR, curses init upper window, terminating!"); - exit(1); - } - - if((mid_w = newwin(1, COLS, UPPER_B+uheight+1, 0)) == NULL) - { - llog(LL_ERR, "ERROR, curses init mid window, terminating!"); - exit(1); - } - - if((lower_w = newwin(lheight, COLS, UPPER_B+uheight+3, 0)) == NULL) - { - llog(LL_ERR, "ERROR, curses init lower window, LINES = %d, lheight = %d, uheight = %d, terminating!", LINES, lheight, uheight); - exit(1); - } - - scrollok(lower_w, 1); - - snprintf(buffer, sizeof(buffer), "----- isdn controller channel state ------------- isdnd %02d.%02d.%d [pid %d] -", VERSION, REL, STEP, (int)getpid()); - - while(strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1) - strcat(buffer, "-"); - - move(0, 0); - standout(); - addstr(buffer); - standend(); - - move(1, 0); - /* 01234567890123456789012345678901234567890123456789012345678901234567890123456789 */ - addstr("c tei b remote iface dir outbytes obps inbytes ibps units"); - - snprintf(buffer, sizeof(buffer), "----- isdn userland interface state ------------------------------------------"); - while(strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1) - strcat(buffer, "-"); - - move(uheight+2, 0); - standout(); - addstr(buffer); - standend(); - - snprintf(buffer, sizeof(buffer), "----- isdnd logfile display --------------------------------------------------"); - while(strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1) - strcat(buffer, "-"); - - move(uheight+4, 0); - standout(); - addstr(buffer); - standend(); - - refresh(); - - for(i=0, j=0; i <= ncontroller; i++, j+=2) - { - if(isdn_ctrl_tab[i].tei == -1) - mvwprintw(upper_w, j, H_CNTL, "%d --- 1 ", i); - else - mvwprintw(upper_w, j, H_CNTL, "%d %3d 1 ", i, isdn_ctrl_tab[i].tei); - mvwprintw(upper_w, j+1, H_CNTL, " L12 2 "); - } - wrefresh(upper_w); - - for(i=0, j=0; i < nentries; i++) /* walk thru all entries */ - { - p = &cfg_entry_tab[i]; /* get ptr to enry */ - - mvwprintw(mid_w, 0, j, "%s%d ", bdrivername(p->usrdevicename), p->usrdeviceunit); - - p->fs_position = j; - - j += ((strlen(bdrivername(p->usrdevicename)) + (p->usrdeviceunit > 9 ? 2 : 1) + 1)); - } - wrefresh(mid_w); - - wmove(lower_w, 0, 0); - wrefresh(lower_w); - - curses_ready = 1; -} - -/*---------------------------------------------------------------------------* - * curses menu for fullscreen command mode - *---------------------------------------------------------------------------*/ -void -do_menu(void) -{ - static char *menu[WMITEMS] = - { - "1 - (D)isplay refresh", - "2 - (H)angup (choose a channel)", - "3 - (R)eread config file", - "4 - (S)how card types", - "5 - (B)udget information", - "6 - (Q)uit the program", - }; - - WINDOW *menu_w; - int c; - int mpos; - fd_set set; - struct timeval timeout; - - /* create a new window in the lower screen area */ - - if((menu_w = newwin(WMENU_HGT, WMENU_LEN, WMENU_POSLN, WMENU_POSCO )) == NULL) - { - llog(LL_WRN, "ERROR, curses init menu window!"); - return; - } - - /* create a border around the window */ - - box(menu_w, '|', '-'); - - /* add a title */ - - wstandout(menu_w); - mvwaddstr(menu_w, 0, (WMENU_LEN / 2) - (strlen(WMENU_TITLE) / 2), WMENU_TITLE); - wstandend(menu_w); - - /* fill the window with the menu options */ - - for(mpos=0; mpos <= (WMITEMS-1); mpos++) - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - - /* highlight the first menu option */ - - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - - /* input loop */ - - for(;;) - { - wrefresh(menu_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT; - timeout.tv_usec = 0; - - /* if no char is available within timeout, exit menu*/ - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - goto mexit; - - c = wgetch(menu_w); - - switch(c) - { - case ' ': - case '\t': /* hilite next option */ - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - mpos++; - if(mpos >= WMITEMS) - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - break; - - case ('0'+WBUDGET+1): /* display budget info */ - case 'B': - case 'b': - display_budget(); - goto mexit; - - case ('0'+WREFRESH+1): /* display refresh */ - case 'D': - case 'd': - wrefresh(curscr); - goto mexit; - - case ('0'+WQUIT+1): /* quit program */ - case 'Q': - case 'q': - menuexit(menu_w); - do_exit(0); - goto mexit; - - case ('0'+WHANGUP+1): /* hangup connection */ - case 'H': - case 'h': - display_chans(); - goto mexit; - - case ('0'+WREREAD+1): /* reread config file */ - case 'R': - case 'r': - rereadconfig(42); - goto mexit; - - case ('0'+WSHOW+1): /* reread config file */ - case 'S': - case 's': - display_cards(); - goto mexit; - - case '\n': - case '\r': /* exec highlighted option */ - switch(mpos) - { - case WREFRESH: - wrefresh(curscr); - break; - - case WQUIT: - menuexit(menu_w); - do_exit(0); - break; - - case WHANGUP: - display_chans(); - break; - - case WREREAD: - rereadconfig(42); - break; - - case WBUDGET: - display_budget(); - break; - - case WSHOW: - display_cards(); - break; - } - goto mexit; - break; - - default: - goto mexit; - break; - } - } - -mexit: - menuexit(menu_w); -} - -static void -menuexit(WINDOW *menu_w) -{ - int uheight = ncontroller * 2; /* cards * b-channels */ - char buffer[512]; - - /* delete the menu window */ - - delwin(menu_w); - - /* re-display the original lower window contents */ - - touchwin(mid_w); - wrefresh(mid_w); - - touchwin(lower_w); - wrefresh(lower_w); - - touchwin(upper_w); - wrefresh(upper_w); - - move(1, 0); - /* 01234567890123456789012345678901234567890123456789012345678901234567890123456789 */ - addstr("c tei b remote iface dir outbytes obps inbytes ibps units"); - - sprintf(buffer, "----- isdn userland interface state ------------------------------------------"); - while(strlen(buffer) < COLS) - strcat(buffer, "-"); - - move(uheight+2, 0); - standout(); - addstr(buffer); - standend(); - - sprintf(buffer, "----- isdnd logfile display --------------------------------------------------"); - while(strlen(buffer) < COLS) - strcat(buffer, "-"); - - move(uheight+4, 0); - standout(); - addstr(buffer); - standend(); - - refresh(); -} - -/*---------------------------------------------------------------------------* - * display the charge in units - *---------------------------------------------------------------------------*/ -void -display_charge(cfg_entry_t *cep) -{ - mvwprintw(upper_w, CHPOS(cep), H_UNITS, "%d", cep->charge); - wclrtoeol(upper_w); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display the calculated charge in units - *---------------------------------------------------------------------------*/ -void -display_ccharge(cfg_entry_t *cep, int units) -{ - mvwprintw(upper_w, CHPOS(cep), H_UNITS, "(%d)", units); - wclrtoeol(upper_w); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display accounting information - *---------------------------------------------------------------------------*/ -void -display_acct(cfg_entry_t *cep) -{ - mvwprintw(upper_w, CHPOS(cep), H_OUT, "%-10d", cep->outbytes); - mvwprintw(upper_w, CHPOS(cep), H_OUTBPS, "%-4d", cep->outbps); - mvwprintw(upper_w, CHPOS(cep), H_IN, "%-10d", cep->inbytes); - mvwprintw(upper_w, CHPOS(cep), H_INBPS, "%-4d", cep->inbps); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display connect information - *---------------------------------------------------------------------------*/ -void -display_connect(cfg_entry_t *cep) -{ - char buffer[256]; - - /* remote telephone number */ - - if(aliasing) - { - if(cep->direction == DIR_IN) - snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->real_phone_incoming.number)); - else - snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->remote_phone_dialout.number)); - } - else - { - if(cep->direction == DIR_IN) - snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->real_phone_incoming.number); - else - snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->remote_phone_dialout.number); - } - - buffer[H_IFN - H_TELN - 1] = '\0'; - - mvwprintw(upper_w, CHPOS(cep), H_TELN, "%s", buffer); - - /* interface */ - - mvwprintw(upper_w, CHPOS(cep), H_IFN, "%s%d ", - bdrivername(cep->usrdevicename), cep->usrdeviceunit); - - mvwprintw(upper_w, CHPOS(cep), H_IO, - cep->direction == DIR_OUT ? "out" : "in"); - - mvwprintw(upper_w, CHPOS(cep), H_OUT, "-"); - mvwprintw(upper_w, CHPOS(cep), H_OUTBPS, "-"); - mvwprintw(upper_w, CHPOS(cep), H_IN, "-"); - mvwprintw(upper_w, CHPOS(cep), H_INBPS, "-"); - - if(do_bell) - display_bell(); - - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * erase line at disconnect time - *---------------------------------------------------------------------------*/ -void -display_disconnect(cfg_entry_t *cep) -{ - wmove(upper_w, CHPOS(cep), - H_TELN); - wclrtoeol(upper_w); - wrefresh(upper_w); - - if(do_bell) - display_bell(); - -} - -/*---------------------------------------------------------------------------* - * display interface up/down information - *---------------------------------------------------------------------------*/ -void -display_updown(cfg_entry_t *cep, int updown) -{ - if(updown) - wstandend(mid_w); - else - wstandout(mid_w); - - mvwprintw(mid_w, 0, cep->fs_position, "%s%d ", - bdrivername(cep->usrdevicename), cep->usrdeviceunit); - - wstandend(mid_w); - wrefresh(mid_w); -} - -/*---------------------------------------------------------------------------* - * display interface up/down information - *---------------------------------------------------------------------------*/ -void -display_l12stat(int controller, int layer, int state) -{ - if(controller > ncontroller) - return; - if(!(layer == 1 || layer == 2)) - return; - - if(state) - wstandout(upper_w); - else - wstandend(upper_w); - - if(layer == 1) - { - mvwprintw(upper_w, (controller*2)+1, H_TEI+1, "1"); - if(!state) - mvwprintw(upper_w, (controller*2)+1, H_TEI+2, "2"); - } - else if(layer == 2) - { - mvwprintw(upper_w, (controller*2)+1, H_TEI+2, "2"); - if(state) - mvwprintw(upper_w, (controller*2)+1, H_TEI+1, "1"); - } - - wstandend(upper_w); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display TEI - *---------------------------------------------------------------------------*/ -void -display_tei(int controller, int tei) -{ - if(controller > ncontroller) - return; - - if(tei == -1) - mvwprintw(upper_w, controller*2, H_TEI, "---"); - else - mvwprintw(upper_w, controller*2, H_TEI, "%3d", tei); - - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display bell :-) - *---------------------------------------------------------------------------*/ -void -display_bell(void) -{ - static char bell[1] = { 0x07 }; - write(STDOUT_FILENO, &bell[0], 1); -} - -/*---------------------------------------------------------------------------* - * display channel information for shutdown - *---------------------------------------------------------------------------*/ -void -display_chans(void) -{ - char buffer[80]; - int i; - int cnt = 0; - WINDOW *chan_w; - int nlines, ncols, pos_x, pos_y; - fd_set set; - struct timeval timeout; - cfg_entry_t *cep = NULL; - - /* need this later to close the connection */ - struct ctlr_chan { - int cntl; - int chn; - } *cc = NULL; - - for (i = 0; i < ncontroller; i++) - { - if((get_controller_state(i)) != CTRL_UP) - continue; - if((ret_channel_state(i, CHAN_B1)) == CHAN_RUN) - cnt++; - if((ret_channel_state(i, CHAN_B2)) == CHAN_RUN) - cnt++; - } - - if(cnt > 0) - { - if ((cc = (struct ctlr_chan *)malloc (cnt * - sizeof (struct ctlr_chan))) == NULL) - { - return; - } - nlines = cnt + 4; - ncols = 60; - } - else - { - nlines = 5; - ncols = 22; - } - - pos_y = WMENU_POSLN + 4; - pos_x = WMENU_POSCO + 10; - - /* create a new window in the lower screen area */ - - if((chan_w = newwin(nlines, ncols, pos_y, pos_x )) == NULL) - { - llog(LL_WRN, "ERROR, curses init channel window!"); - if (cnt > 0) - free(cc); - return; - } - - /* create a border around the window */ - - box(chan_w, '|', '-'); - - /* add a title */ - - wstandout(chan_w); - mvwaddstr(chan_w, 0, (ncols / 2) - (strlen("Channels") / 2), "Channels"); - wstandend(chan_w); - - /* no active channels */ - if (cnt == 0) - { - mvwaddstr(chan_w, 2, 2, "No active channels"); - wrefresh(chan_w); - sleep(1); - - /* delete the channels window */ - - delwin(chan_w); - return; - } - - nlines = 2; - ncols = 1; - - for (i = 0; i < ncontroller; i++) - { - if((get_controller_state(i)) != CTRL_UP) - continue; - - if((ret_channel_state(i, CHAN_B1)) == CHAN_RUN) - { - snprintf(buffer, sizeof(buffer), "%d - Controller %d channel %s", ncols, i, "B1"); - mvwaddstr(chan_w, nlines, 2, buffer); - cc[ncols - 1].cntl = i; - cc[ncols - 1].chn = CHAN_B1; - nlines++; - ncols++; - } - if((ret_channel_state(i, CHAN_B2)) == CHAN_RUN) - { - snprintf(buffer, sizeof(buffer), "%d - Controller %d channel %s", ncols, i, "B2"); - mvwaddstr(chan_w, nlines, 2, buffer); - cc[ncols - 1].cntl = i; - cc[ncols - 1].chn = CHAN_B2; - nlines++; - ncols++; - } - } - - for(;;) - { - wrefresh(chan_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT; - timeout.tv_usec = 0; - - /* if no char is available within timeout, exit menu*/ - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - break; - - ncols = wgetch(chan_w); - - if (!(isdigit(ncols))) - { - display_bell(); - continue; - } - - nlines = ncols - '0'; - - if ((nlines == 0) || (nlines > cnt)) - { - display_bell(); - continue; - } - - if((cep = get_cep_by_cc(cc[nlines-1].cntl, cc[nlines-1].chn)) - != NULL) - { - llog(LL_CHD, "%05d %s manual disconnect (fullscreen menu)", cep->cdid, cep->name); - cep->hangup = 1; - break; - } - } - - free(cc); - - /* delete the channels window */ - - delwin(chan_w); -} - -/*---------------------------------------------------------------------------* - * display card type information - *---------------------------------------------------------------------------*/ -static void -display_cards(void) -{ - WINDOW *chan_w; - int nlines, ncols, pos_x, pos_y; - fd_set set; - struct timeval timeout; - int i; - - nlines = 6+ncontroller; - ncols = 60; - pos_y = WMENU_POSLN; - pos_x = WMENU_POSCO; - - /* create a new window in the lower screen area */ - - if((chan_w = newwin(nlines, ncols, pos_y, pos_x )) == NULL) - { - llog(LL_WRN, "ERROR, curses init channel window!"); - return; - } - - /* create a border around the window */ - - box(chan_w, '|', '-'); - - /* add a title */ - - wstandout(chan_w); - mvwaddstr(chan_w, 0, (ncols / 2) - (strlen("Cards") / 2), "Cards"); - wstandend(chan_w); - - mvwprintw(chan_w, 2, 2, "ctrl description"); - mvwprintw(chan_w, 3, 2, "---- ----------------------------------------------"); - for (i = 0; i < ncontroller; i++) - { - mvwprintw(chan_w, 4+i, 2, " #%d %s", i, - name_of_controller(isdn_ctrl_tab[i].ctrl_type, - isdn_ctrl_tab[i].card_type)); - } - - wrefresh(chan_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT*2; - timeout.tv_usec = 0; - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - { - delwin(chan_w); - return; - } - - wgetch(chan_w); - delwin(chan_w); -} - -/*---------------------------------------------------------------------------* - * display budget info - *---------------------------------------------------------------------------*/ -static void -display_budget(void) -{ - WINDOW *bud_w; - int nlines, ncols, pos_x, pos_y; - fd_set set; - struct timeval timeout; - int i, j; - cfg_entry_t *cep; - time_t now; - double uptime; - int minutes; - int hours; - int days; - - nlines = 0; - ncols = 73; - pos_y = WMENU_POSLN; - pos_x = WMENU_POSCO-3; - - for(i=0, j=0; i < nentries; i++) /* walk thru all entries */ - { - cep = &cfg_entry_tab[i]; /* get ptr to entry */ - - if(cep->budget_callbackperiod && cep->budget_callbackncalls) - nlines++; - if(cep->budget_calloutperiod && cep->budget_calloutncalls) - nlines++; - } - - if(nlines == 0) - return; - - nlines += 6; - - /* create a new window in the lower screen area */ - - if((bud_w = newwin(nlines, ncols, pos_y, pos_x )) == NULL) - { - llog(LL_WRN, "ERROR, curses init budget window!"); - return; - } - - now = time(NULL); - uptime = difftime(now, starttime); - - minutes = (time_t) (uptime / 60) % 60; - hours = (time_t) (uptime / (60*60)) % (60*60); - days = (time_t) (uptime / (60*60*24)) % (60*60*24); - - uptime = uptime / (60*60); - - /* create a border around the window */ - - box(bud_w, '|', '-'); - - /* add a title */ - - wstandout(bud_w); - mvwaddstr(bud_w, 0, (ncols / 2) - (strlen("Budget") / 2), "Budget"); - wstandend(bud_w); - - mvwprintw(bud_w, 1, 2, "isdnd uptime: %d %s - %d %s - %d %s", - days, - days == 1 ? "day" : "days", - hours, - hours == 1 ? "hour" : "hours", - minutes, - minutes == 1 ? "minute" : "minutes"); - - mvwprintw(bud_w, 2, 2, "name t period rest ncall rest rqsts /hr rdone /hr rrjct /hr "); - mvwprintw(bud_w, 3, 2, "-------- - ------ ------ ----- ----- ----- ---- ----- ---- ----- ----"); - - for(i=0, j=4; i < nentries; i++) /* walk thru all entries */ - { - cep = &cfg_entry_tab[i]; /* get ptr to enry */ - - if(cep->budget_calloutperiod && cep->budget_calloutncalls) - { - mvwprintw(bud_w, j, 2, "%-8s %c %-6d %-6ld %-5d %-5d %-5d %-4.1f %-5d %-4.1f %-5d %-4.1f", - cep->name, - 'o', - cep->budget_calloutperiod, - (long)(cep->budget_calloutperiod_time - now), - cep->budget_calloutncalls, - cep->budget_calloutncalls_cnt, - cep->budget_callout_req, - (double)cep->budget_callout_req / uptime, - cep->budget_callout_done, - (double)cep->budget_callout_done / uptime, - cep->budget_callout_rej, - (double)cep->budget_callout_rej / uptime); - j++; - } - if(cep->budget_callbackperiod && cep->budget_callbackncalls) - { - mvwprintw(bud_w, j, 2, "%-8s %c %-6d %-6ld %-5d %-5d %-5d %-4.1f %-5d %-4.1f %-5d %-4.1f", - (cep->budget_calloutperiod && cep->budget_calloutncalls) ? "" : cep->name, - 'b', - cep->budget_callbackperiod, - (long)(cep->budget_callbackperiod_time - now), - cep->budget_callbackncalls, - cep->budget_callbackncalls_cnt, - cep->budget_callback_req, - (double)cep->budget_callback_req / uptime, - cep->budget_callback_done, - (double)cep->budget_callback_done / uptime, - cep->budget_callback_rej, - (double)cep->budget_callback_rej / uptime); - j++; - } - } - - wrefresh(bud_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT*3; - timeout.tv_usec = 0; - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - { - delwin(bud_w); - return; - } - - wgetch(bud_w); - delwin(bud_w); -} - -#endif - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/dial.c b/usr.sbin/i4b/isdnd/dial.c deleted file mode 100644 index 158e1c0ed087..000000000000 --- a/usr.sbin/i4b/isdnd/dial.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - dial handling routines - * ----------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:05:52 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -/*---------------------------------------------------------------------------* - * select the first remote number to dial according to the - * dial strategy - *---------------------------------------------------------------------------*/ -void -select_first_dialno(cfg_entry_t *cep) -{ - int i, j; - - if(cep->keypad[0] != '\0') - return; - - if(cep->remote_numbers_count < 1) - { - llog(LL_ERR, "select_first_dialno: remote_numbers_count < 1!"); - return; - } - - if(cep->remote_numbers_count == 1) - { - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: only one no, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = 0; - return; - } - - if(cep->remote_numbers_handling == RNH_FIRST) - { - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: use first, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = 0; - return; - } - - i = cep->last_remote_number; - - for(j = cep->remote_numbers_count; j > 0; j--) - { - if(cep->remote_numbers[i].flag == RNF_SUCC) - { - if(cep->remote_numbers_handling == RNH_LAST) - { - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[i].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[i].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: use last, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = i; - return; - } - else - { - if(++i >= cep->remote_numbers_count) - i = 0; - - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[i].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[i].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: use next, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = i; - return; - } - } - - if(++i >= cep->remote_numbers_count) - i = 0; - } - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number); - DBGL(DL_DIAL, (llog(LL_DBG, "select_first_dialno: no last found (use 0), no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = 0; -} - -/*---------------------------------------------------------------------------* - * select next remote number to dial (last was unsuccesfull) - *---------------------------------------------------------------------------*/ -void -select_next_dialno(cfg_entry_t *cep) -{ - if(cep->remote_numbers_count < 1) - { - llog(LL_ERR, "select_next_dialno: remote_numbers_count < 1!"); - return; - } - - if(cep->remote_numbers_count == 1) - { - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number); - strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr); - DBGL(DL_DIAL, (llog(LL_DBG, "select_next_dialno: only one no, no = %s", cep->remote_phone_dialout.number))); - cep->last_remote_number = 0; - return; - } - - /* mark last try as bad */ - - cep->remote_numbers[cep->last_remote_number].flag = RNF_IDLE; - - /* next one to try */ - - cep->last_remote_number++; - - if(cep->last_remote_number >= cep->remote_numbers_count) - cep->last_remote_number = 0; - - strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[cep->last_remote_number].number); - - DBGL(DL_DIAL, (llog(LL_DBG, "select_next_dialno: index=%d, no=%s", - cep->last_remote_number, - cep->remote_numbers[cep->last_remote_number].number))); -} - -/*---------------------------------------------------------------------------* - * dial succeded, store this number as the last successful - *---------------------------------------------------------------------------*/ -void -select_this_dialno(cfg_entry_t *cep) -{ - cep->remote_numbers[cep->last_remote_number].flag = RNF_SUCC; - - DBGL(DL_DIAL, (llog(LL_DBG, "select_this_dialno: index = %d, no = %s", - cep->last_remote_number, - cep->remote_numbers[cep->last_remote_number].number))); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/exec.c b/usr.sbin/i4b/isdnd/exec.c deleted file mode 100644 index 2f24384eb370..000000000000 --- a/usr.sbin/i4b/isdnd/exec.c +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * exec.h - supplemental program/script execution - * ---------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 16:55:23 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -#include <sys/wait.h> -#include <sys/socket.h> -#include <net/if.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <paths.h> - -#define MAX_PIDS 32 - -static struct pid_tab { - pid_t pid; - cfg_entry_t *cep; -} pid_tab[MAX_PIDS]; - -/*---------------------------------------------------------------------------* - * SIGCHLD signal handler - *---------------------------------------------------------------------------*/ -void -sigchild_handler(int sig) -{ - int retstat; - register int i; - pid_t pid; - - if((pid = waitpid(-1, &retstat, WNOHANG)) <= 0) - { - llog(LL_ERR, "ERROR, sigchild_handler, waitpid: %s", strerror(errno)); - error_exit(1, "ERROR, sigchild_handler, waitpid: %s", strerror(errno)); - } - else - { - if(WIFEXITED(retstat)) - { - DBGL(DL_PROC, (llog(LL_DBG, "normal child (pid=%d) termination, exitstat = %d", - pid, WEXITSTATUS(retstat)))); - } - else if(WIFSIGNALED(retstat)) - { - if(WCOREDUMP(retstat)) - llog(LL_WRN, "child (pid=%d) termination due to signal %d (coredump)", - pid, WTERMSIG(retstat)); - else - llog(LL_WRN, "child (pid=%d) termination due to signal %d", - pid, WTERMSIG(retstat)); - } - } - - /* check if hangup required */ - - for(i=0; i < MAX_PIDS; i++) - { - if(pid_tab[i].pid == pid) - { - if(pid_tab[i].cep->cdid != CDID_UNUSED) - { - DBGL(DL_PROC, (llog(LL_DBG, "sigchild_handler: scheduling hangup for cdid %d, pid %d", - pid_tab[i].cep->cdid, pid_tab[i].pid))); - pid_tab[i].cep->hangup = 1; - } - pid_tab[i].pid = 0; - break; - } - } -} - -/*---------------------------------------------------------------------------* - * execute prog as a subprocess and pass an argumentlist - *---------------------------------------------------------------------------*/ -pid_t -exec_prog(char *prog, char **arglist) -{ - char tmp[MAXPATHLEN]; - char path[MAXPATHLEN]; - pid_t pid; - int a; - - snprintf(path, sizeof(path), "%s/%s", ETCPATH, prog); - - arglist[0] = path; - - tmp[0] = '\0'; - - for(a=1; arglist[a] != NULL; ++a ) - { - strcat(tmp, " " ); - strcat(tmp, arglist[a]); - } - - DBGL(DL_PROC, (llog(LL_DBG, "exec_prog: %s, args:%s", path, tmp))); - - switch(pid = fork()) - { - case -1: /* error */ - llog(LL_ERR, "ERROR, exec_prog/fork: %s", strerror(errno)); - error_exit(1, "ERROR, exec_prog/fork: %s", strerror(errno)); - case 0: /* child */ - break; - default: /* parent */ - return(pid); - } - - /* this is the child now */ - - /* - * close files used only by isdnd, e.g. - * 1. /dev/i4b - * 2. /var/log/isdnd.acct (or similar, when used) - * 3. /var/log/isdnd.log (or similar, when used) - */ - close(isdnfd); - - if(useacctfile && acctfp) - fclose(acctfp); - - if(uselogfile && logfp) - fclose(logfp); - - if(execvp(path,arglist) < 0 ) - _exit(127); - - return(-1); -} - -/*---------------------------------------------------------------------------* - * run interface up/down script - *---------------------------------------------------------------------------*/ -int -exec_connect_prog(cfg_entry_t *cep, const char *prog, int link_down) -{ - char *argv[32], **av = argv; - char devicename[MAXPATHLEN], addr[100]; - char *device; - int s; - struct ifreq ifr; - - /* the obvious things */ - device = bdrivername(cep->usrdevicename); - snprintf(devicename, sizeof(devicename), "%s%d", device, cep->usrdeviceunit); - *av++ = (char*)prog; - *av++ = "-d"; - *av++ = devicename; - *av++ = "-f"; - *av++ = link_down ? "down" : "up"; - - /* try to figure AF_INET address of interface */ - addr[0] = '\0'; - memset(&ifr, 0, sizeof ifr); - ifr.ifr_addr.sa_family = AF_INET; - strncpy(ifr.ifr_name, devicename, sizeof(ifr.ifr_name)); - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s >= 0) { - if (ioctl(s, SIOCGIFADDR, (caddr_t)&ifr) >= 0) { - struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; - strcpy(addr, inet_ntoa(sin->sin_addr)); - *av++ = "-a"; - *av++ = addr; - } - close(s); - } - - /* terminate argv */ - *av++ = NULL; - - return exec_prog((char*)prog, argv); -} - -/*---------------------------------------------------------------------------* - * run answeringmachine application - *---------------------------------------------------------------------------*/ -int -exec_answer(cfg_entry_t *cep) -{ - char *argv[32]; - u_char devicename[MAXPATHLEN]; - int pid; - char *device; - - device = bdrivername(cep->usrdevicename); - - snprintf(devicename, sizeof(devicename), "%si4b%s%d", _PATH_DEV, device, - cep->usrdeviceunit); - - argv[0] = cep->answerprog; - argv[1] = "-D"; - argv[2] = devicename; - argv[3] = "-d"; - argv[4] = "unknown"; - argv[5] = "-s"; - argv[6] = "unknown"; - argv[7] = NULL; - - /* if destination telephone number avail, add it as argument */ - - if(*cep->local_phone_incoming.number) - argv[4] = cep->local_phone_incoming.number; - - /* if source telephone number avail, add it as argument */ - - if(*cep->real_phone_incoming.number) - argv[6] = cep->real_phone_incoming.number; - - if(*cep->display) - { - argv[7] = "-t"; - argv[8] = cep->display; - argv[9] = NULL; - } - - /* exec program */ - - DBGL(DL_PROC, (llog(LL_DBG, "exec_answer: prog=[%s]", cep->answerprog))); - - pid = exec_prog(cep->answerprog, argv); - - /* enter pid and conf ptr entry addr into table */ - - if(pid != -1) - { - int i; - - for(i=0; i < MAX_PIDS; i++) - { - if(pid_tab[i].pid == 0) - { - pid_tab[i].pid = pid; - pid_tab[i].cep = cep; - break; - } - } - return(GOOD); - } - return(ERROR); -} - -/*---------------------------------------------------------------------------* - * check if a connection has an outstanding process, if yes, kill it - *---------------------------------------------------------------------------*/ -void -check_and_kill(cfg_entry_t *cep) -{ - int i; - - for(i=0; i < MAX_PIDS; i++) - { - if(pid_tab[i].cep == cep) - { - pid_t kp; - - DBGL(DL_PROC, (llog(LL_DBG, "check_and_kill: killing pid %d", pid_tab[i].pid))); - - kp = pid_tab[i].pid; - pid_tab[i].pid = 0; - kill(kp, SIGHUP); - break; - } - } -} - -/*---------------------------------------------------------------------------* - * update budget callout/callback statistics counter file - *---------------------------------------------------------------------------*/ -void -upd_callstat_file(char *filename, int rotateflag) -{ - FILE *fp; - time_t s, l, now; - int n; - int ret; - - now = time(NULL); - - fp = fopen(filename, "r+"); - - if(fp == NULL) - { - /* file not there, create it and exit */ - - llog(LL_WRN, "upd_callstat_file: creating %s", filename); - - fp = fopen(filename, "w"); - if(fp == NULL) - { - llog(LL_ERR, "ERROR, upd_callstat_file: cannot create %s, %s", filename, strerror(errno)); - return; - } - - ret = fprintf(fp, "%d %d 1", now, now); - if(ret <= 0) - llog(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno)); - - fclose(fp); - return; - } - - /* get contents */ - - ret = fscanf(fp, "%d %d %d", &s, &l, &n); - - /* reset fp */ - - rewind(fp); - - if(ret != 3) - { - /* file corrupt ? anyway, initialize */ - - llog(LL_WRN, "upd_callstat_file: initializing %s", filename); - - s = l = now; - n = 0; - } - - if(rotateflag) - { - struct tm *stmp; - int dom; - - /* get day of month for last timestamp */ - stmp = localtime(&l); - dom = stmp->tm_mday; - - /* get day of month for just now */ - stmp = localtime(&now); - - if(dom != stmp->tm_mday) - { - FILE *nfp; - char buf[MAXPATHLEN]; - - /* new day, write last days stats */ - - sprintf(buf, "%s-%02d", filename, stmp->tm_mday); - - nfp = fopen(buf, "w"); - if(nfp == NULL) - { - llog(LL_ERR, "ERROR, upd_callstat_file: cannot open for write %s, %s", buf, strerror(errno)); - return; - } - - ret = fprintf(nfp, "%d %d %d", s, l, n); - if(ret <= 0) - llog(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno)); - - fclose(nfp); - - /* init new days stats */ - n = 0; - s = now; - - llog(LL_WRN, "upd_callstat_file: rotate %s, new s=%ld l=%ld n=%d", filename, s, l, n); - } - } - - n++; /* increment call count */ - - /* - * the "%-3d" is necessary to overwrite any - * leftovers from previous contents! - */ - - ret = fprintf(fp, "%d %d %-3d", s, now, n); - - if(ret <= 0) - llog(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno)); - - fclose(fp); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/fsm.c b/usr.sbin/i4b/isdnd/fsm.c deleted file mode 100644 index b87b17e1c113..000000000000 --- a/usr.sbin/i4b/isdnd/fsm.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * FSM for isdnd - * ------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:06:40 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -/* table of state descriptions */ - -static char *state_text[N_STATES] = { - "idle", - "dialing", - "waitdialretry", - "dialretry", - - "pcb-dialing", - "pcb-dialfail", - "pcb-waitcall", - - "acb-waitdisc", - "acb-waitdial", - "acb-dialing", - "acb-dialfail", - - "accepted", - "connected", - "waitdisconnect", - "down", - "alert", - - "Illegal State" -}; - -/* table of event descriptions */ - -static char *event_text[N_EVENTS] = { - - /* incoming messages */ - - "msg-con-ind", - "msg-con-act-ind", - "msg-disc-ind", - "msg-dialout", - - /* local events */ - - "timeout", - "disconnect-req", - "callback-req", - "alert-req", - - /* illegal */ - - "Illegal Event" -}; - -/*---------------------------------------------------------------------------* - * illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ill(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_ill: Illegal State reached !!!"))); -} - -/*---------------------------------------------------------------------------* - * No change, No action - *---------------------------------------------------------------------------*/ -static void -F_NcNa(cfg_entry_t *cep) -{ -} - -/*---------------------------------------------------------------------------* - * incoming CONNECT, accepting call - *---------------------------------------------------------------------------*/ -static void -F_MCI(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_MCI: tx SETUP_RESP_ACCEPT"))); - sendm_connect_resp(cep, cep->cdid, SETUP_RESP_ACCEPT, 0); - start_timer(cep, TIMEOUT_CONNECT_ACTIVE); -} - -/*---------------------------------------------------------------------------* - * incoming connect active, call is now active - *---------------------------------------------------------------------------*/ -static void -F_MCAI(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_MCAI: Connection active!"))); - - stop_timer(cep); - - if((cep->dialin_reaction == REACT_ANSWER) && - (cep->b1protocol == BPROT_NONE)) - { - exec_answer(cep); - } -} - -/*---------------------------------------------------------------------------* - * timeout - *---------------------------------------------------------------------------*/ -static void -F_TIMO(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_TIMO: Timout occured!"))); - sendm_disconnect_req(cep, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - cep->cdid = CDID_UNUSED; -} - -/*---------------------------------------------------------------------------* - * incoming disconnect indication - *---------------------------------------------------------------------------*/ -static void -F_IDIS(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_IDIS: disconnect indication"))); - cep->cdid = CDID_UNUSED; -} - -/*---------------------------------------------------------------------------* - * local disconnect request - *---------------------------------------------------------------------------*/ -static void -F_DRQ(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_DRQ: local disconnect request"))); - sendm_disconnect_req(cep, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); -} - -/*---------------------------------------------------------------------------* - * disconnect indication after local disconnect req - *---------------------------------------------------------------------------*/ -static void -F_MDI(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_MDI: disconnect indication, local disconnected"))); - cep->cdid = CDID_UNUSED; -} - -/*---------------------------------------------------------------------------* - * local requested outgoing dial - *---------------------------------------------------------------------------*/ -static void -F_DIAL(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_DIAL: local dial out request"))); - - if(cep->dialrandincr) - cep->randomtime = (random() & RANDOM_MASK) + cep->recoverytime; - - cep->dial_count = 0; - - select_first_dialno(cep); - - sendm_connect_req(cep); -} - -/*---------------------------------------------------------------------------* - * outgoing dial successfull - *---------------------------------------------------------------------------*/ -static void -F_DOK(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_DOK: dial out ok"))); - select_this_dialno(cep); -} - -/*---------------------------------------------------------------------------* - * outgoing dial fail (ST_SUSE !!!) - *---------------------------------------------------------------------------*/ -static void -F_DFL(cfg_entry_t *cep) -{ - cep->last_release_time = time(NULL); - - if(cep->dialouttype == DIALOUT_NORMAL) - { - cep->dial_count++; - - if(cep->dial_count < cep->dialretries || cep->dialretries == -1) - { - /* inside normal retry cycle */ - - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: dial fail, dial retry"))); - select_next_dialno(cep); - cep->cdid = CDID_RESERVED; - cep->state = ST_DIALRTMRCHD; - return; - } - - /* retries exhausted */ - - if(!cep->usedown) - { - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: dial retry fail, dial retries exhausted"))); - dialresponse(cep, DSTAT_TFAIL); - cep->cdid = CDID_UNUSED; - cep->dial_count = 0; - cep->state = ST_IDLE; - return; - } - - /* interface up/down active */ - - cep->down_retry_count++; - - if(cep->down_retry_count > cep->downtries) - { - /* set interface down */ - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: dial retry cycle fail, setting interface down!"))); - dialresponse(cep, DSTAT_PFAIL); - if_down(cep); - cep->state = ST_DOWN; - } - else - { - /* enter new dial retry cycle */ - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: dial retry cycle fail, enter new retry cycle!"))); - select_next_dialno(cep); - cep->state = ST_DIALRTMRCHD; - } - - cep->dial_count = 0; - cep->cdid = CDID_RESERVED; - } - else /* cdp->dialouttype == DIALOUT_CALLEDBACK */ - { - DBGL(DL_STATE, (llog(LL_DBG, "F_DFL: calledback dial done, wait for incoming call"))); - cep->cdid = CDID_RESERVED; - cep->state = ST_PCB_WAITCALL; - } -} - -/*---------------------------------------------------------------------------* - * local requested outgoing dial - *---------------------------------------------------------------------------*/ -static void -F_ACBW(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBW: local callback, wait callback recovery time"))); - - if(cep->dialrandincr) - cep->randomtime = (random() & RANDOM_MASK) + cep->recoverytime; - - cep->dial_count = 0; - - cep->cdid = CDID_RESERVED; -} - -/*---------------------------------------------------------------------------* - * active callback dialout retry (ST_SUSE !!!) - *---------------------------------------------------------------------------*/ -static void -F_ACBR(cfg_entry_t *cep) -{ - cep->dial_count++; - - if(cep->dial_count < cep->dialretries || cep->dialretries == -1) - { - /* inside normal retry cycle */ - - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBR: dial fail, dial retry"))); - select_next_dialno(cep); - cep->cdid = CDID_RESERVED; - cep->state = ST_ACB_DIALFAIL; - return; - } - - /* retries exhausted */ - - if(!cep->usedown) - { - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBR: dial retry fail, dial retries exhausted"))); - dialresponse(cep, DSTAT_TFAIL); - cep->cdid = CDID_UNUSED; - cep->dial_count = 0; - cep->state = ST_IDLE; - return; - } - - /* interface up/down active */ - - cep->down_retry_count++; - - if(cep->down_retry_count > cep->downtries) - { - /* set interface down */ - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBR: dial retry cycle fail, setting interface down!"))); - dialresponse(cep, DSTAT_PFAIL); - if_down(cep); - cep->state = ST_DOWN; - } - else - { - /* enter new dial retry cycle */ - DBGL(DL_STATE, (llog(LL_DBG, "F_ACBR: dial retry cycle fail, enter new retry cycle!"))); - select_next_dialno(cep); - cep->state = ST_ACB_DIALFAIL; - } - - cep->dial_count = 0; - cep->cdid = CDID_RESERVED; -} - -/*---------------------------------------------------------------------------* - * local requested to send ALERT message - *---------------------------------------------------------------------------*/ -static void -F_ALRT(cfg_entry_t *cep) -{ - DBGL(DL_STATE, (llog(LL_DBG, "F_ALRT: local send alert request"))); - - cep->alert_time = cep->alert; - - sendm_alert_req(cep); -} - -/*---------------------------------------------------------------------------* - * isdn daemon state transition table - *---------------------------------------------------------------------------*/ -struct state_tab { - void(*func)(cfg_entry_t *cep); /* function to execute */ - int newstate; /* next state */ -} state_tab[N_EVENTS][N_STATES] = { - -/* STATE: ST_IDLE ST_DIAL ST_DIALRTMRCHD ST_DIALRETRY ST_PCB_DIAL ST_PCB_DIALFAIL ST_PCB_WAITCALL ST_ACB_WAITDISC ST_ACB_WAITDIAL ST_ACB_DIAL ST_ACB_DIALFAIL ST_ACCEPTED ST_CONNECTED ST_WAITDISCI ST_DOWN ST_ALERT ST_ILLEGAL */ -/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* messages */ -/* EV_MCI */{{F_MCI, ST_ACCEPTED}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_MCI, ST_ACCEPTED}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_MCI, ST_ACCEPTED}, {F_ill, ST_ILL}}, -/* EV_MCAI */{{F_ill, ST_ILL}, {F_DOK, ST_CONNECTED}, {F_ill, ST_ILL}, {F_DOK, ST_CONNECTED}, {F_DOK, ST_CONNECTED}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_DOK, ST_CONNECTED}, {F_ill, ST_ILL}, {F_MCAI,ST_CONNECTED}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_MDI */{{F_ill, ST_ILL}, {F_DFL, ST_SUSE}, {F_ill, ST_ILL}, {F_DFL, ST_SUSE}, {F_DFL, ST_SUSE}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ACBW,ST_ACB_WAITDIAL},{F_ill, ST_ILL}, {F_ACBR, ST_SUSE}, {F_ACBR,ST_SUSE}, {F_IDIS,ST_IDLE}, {F_IDIS,ST_IDLE}, {F_MDI, ST_IDLE}, {F_ill, ST_ILL}, {F_MDI, ST_IDLE}, {F_ill, ST_ILL}}, -/* EV_MDO */{{F_DIAL,ST_DIAL}, {F_NcNa,ST_DIAL}, {F_NcNa,ST_DIALRTMRCHD},{F_NcNa,ST_DIALRETRY}, {F_NcNa,ST_PCB_DIAL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, - -/* local requests */ -/* EV_TIMO */{{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_TIMO,ST_IDLE}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_DRQ */{{F_NcNa, ST_IDLE}, {F_DRQ, ST_WAITDISCI}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_DRQ, ST_WAITDISCI}, {F_NcNa,ST_WAITDISCI}, {F_NcNa, ST_DOWN}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_CBRQ */{{F_NcNa,ST_ACB_WAITDIAL},{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_NcNa,ST_ACB_WAITDIAL},{F_NcNa, ST_ACB_DIAL}, {F_NcNa,ST_ACB_DIALFAIL},{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_ALRT */{{F_ALRT,ST_ALERT}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, - -/* illegal */ - -/* EV_ILL */{{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void -next_state(cfg_entry_t *cep, int event) -{ - int currstate, newstate; - - if(event > N_EVENTS) - { - llog(LL_ERR, "next_state: event > N_EVENTS"); - error_exit(1, "next_state: event > N_EVENTS"); - } - - currstate = cep->state; - - if(currstate > N_STATES) - { - llog(LL_ERR, "next_state: currstate > N_STATES"); - error_exit(1, "next_state: currstate > N_STATES"); - } - - newstate = state_tab[event][currstate].newstate; - - if(newstate > N_STATES) - { - llog(LL_ERR, "next_state: newstate > N_STATES"); - error_exit(1, "next_state: newstate > N_STATES"); - } - - if(newstate != ST_SUSE) - { - DBGL(DL_STATE, (llog(LL_DBG, "FSM event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[newstate]))); - } - - (*state_tab[event][currstate].func)(cep); - - if(newstate == ST_ILL) - { - llog(LL_ERR, "FSM ILLEGAL STATE, event=%s: oldstate=%s => newstate=%s]", - event_text[event], - state_text[currstate], - state_text[newstate]); - } - - if(newstate == ST_SUSE) - { - DBGL(DL_STATE, (llog(LL_DBG, "FSM (SUSE) event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[cep->state]))); - } - else - { - cep->state = newstate; - } -} - -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -printstate(cfg_entry_t *cep) -{ - return((char *) state_text[cep->state]); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/holiday.c b/usr.sbin/i4b/isdnd/holiday.c deleted file mode 100644 index 714bd066ba34..000000000000 --- a/usr.sbin/i4b/isdnd/holiday.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnd - holiday file handling - * ============================= - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:06:56 2006] - * - * Format: - * - * day.month.year optional comment (different day every year) or - * day.month optional comment (same day every year) - * - * i.e.: - * - * 23.4.2000 Ostersonntag - * 3.10 Tag der deutschen Einheit - * - *----------------------------------------------------------------------------*/ - -#include "isdnd.h" - -struct holiday { - int day; - int month; - int year; - struct holiday *next; -}; - -static struct holiday *firsth = NULL; - -#define MAXBUFSZ 256 - -static void free_holiday(struct holiday *ptr); - -/*---------------------------------------------------------------------------* - * read in and init holidayes - *---------------------------------------------------------------------------*/ -void -init_holidays(char *filename) -{ - FILE *fp; - unsigned char buffer[MAXBUFSZ + 1]; - struct holiday *newh = NULL; - struct holiday *lasth = NULL; - int ret; - int day, month, year; - - firsth = NULL; - - if((fp = fopen(filename, "r")) == NULL) - { - DBGL(DL_VALID, (llog(LL_DBG, "init_holiday: error opening holidayfile %s: %s!", filename, strerror(errno)))); - return; - } - - while((fgets(buffer, MAXBUFSZ, fp)) != NULL) - { - if(buffer[0] == '#' || buffer[0] == ' ' || - buffer[0] == '\t' || buffer[0] == '\n') - { - continue; - } - - ret = sscanf(buffer, "%d.%d.%d", &day, &month, &year); - - if(ret != 3) - { - ret = sscanf(buffer, "%d.%d", &day, &month); - if(ret != 2) - { - llog(LL_ERR, "init_holiday: parse error for string [%s]!", buffer); - exit(1); - } - year = 0; - } - - if((newh = (struct holiday *) malloc(sizeof(struct holiday))) == NULL) - { - llog(LL_ERR, "init_holiday: malloc failed for struct holiday!\n"); - exit(1); - } - - if(year) - { - DBGL(DL_VALID, (llog(LL_DBG, "init_holidays: add %d.%d.%d", day, month, year))); - } - else - { - DBGL(DL_VALID, (llog(LL_DBG, "init_holidays: add %d.%d", day, month))); - } - - newh->day = day; - newh->month = month; - newh->year = year; - newh->next = NULL; - - if(firsth == NULL) - { - firsth = newh; - } - else - { - lasth->next = newh; - } - lasth = newh; - } - fclose(fp); -} - -/*---------------------------------------------------------------------------* - * free all holidays - *---------------------------------------------------------------------------*/ -void -free_holidays(void) -{ - free_holiday(firsth); -} - -/*---------------------------------------------------------------------------* - * free holidayes - *---------------------------------------------------------------------------*/ -static void -free_holiday(struct holiday *ptr) -{ - - if(ptr == NULL) - return; - - if(ptr->next != NULL) - free_holiday(ptr->next); - - free(ptr); -} - -/*---------------------------------------------------------------------------* - * check if date/month/year is a holiday - *---------------------------------------------------------------------------*/ -int -isholiday(int d, int m, int y) -{ - struct holiday *ch = NULL; - - if(firsth == NULL) - return(0); - - ch = firsth; - - for(;;) - { - if(ch->day == d && ch->month == m) - { - if(ch->year == 0) - { - DBGL(DL_VALID, (llog(LL_DBG, "isholiday: %d.%d is a holiday!", d, m))); - return(1); - } - else if(ch->year == y) - { - DBGL(DL_VALID, (llog(LL_DBG, "isholiday: %d.%d.%d is a holiday!", d, m, y))); - return(1); - } - } - - if(ch->next == NULL) - break; - - ch = ch->next; - } - return(0); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/isdnd.8 b/usr.sbin/i4b/isdnd/isdnd.8 deleted file mode 100644 index b3c749a7aed5..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.8 +++ /dev/null @@ -1,428 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdnd.8,v 1.29 2000/05/02 11:50:28 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Wed May 2 10:48:30 2001] -.\" -.Dd July 5, 2007 -.Dt ISDND 8 -.Os -.Sh NAME -.Nm isdnd -.Nd isdn4bsd ISDN connection management daemon -.Sh SYNOPSIS -.Nm -.Op Fl c Ar configfile -.Op Fl d Ar debuglevel -.Op Fl f -.Op Fl F -.Op Fl l -.Op Fl L Ar logfile -.Op Fl P -.Op Fl r Ar device -.Op Fl s Ar facility -.Op Fl t Ar terminaltype -.Op Fl u Ar charging unit length -.Op Fl m -.Sh DESCRIPTION -The -.Nm -utility -is the isdn4bsd package daemon which manages all ISDN related connection -and disconnection of ISDN devices supported by the package. -.Pp -The options are as follows: -.Bl -tag -width Ds -.It Fl c -Use -.Ar configfile -as the name of the runtime configuration filename for -.Nm -instead of the default file -.Li /etc/isdn/isdnd.rc . -.It Fl d -If debugging support is compiled into -.Nm -this option is used to specify the debugging level, or better which kind -of debugging messages are displayed. -The debugging level is the sum of the -following values: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar 0x001 -general debugging. -.It Ar 0x002 -rates calculation. -.It Ar 0x004 -timing calculations. -.It Ar 0x008 -state transitions. -.It Ar 0x010 -retry handling. -.It Ar 0x020 -dialing. -.It Ar 0x040 -process handling. -.It Ar 0x080 -isdn4bsd kernel i/o calls. -.It Ar 0x100 -controller and channel busy/free messages. -.It Ar 0x200 -isdnd.rc configuration file processing. -.It Ar 0x400 -outgoing call budget handling. -.It Ar 0x800 -valid keyword and holiday file processing. -.El -.Pp -The value can be specified in any number base supported by the -.Xr sscanf 3 -library routine. -.Pp -In addition, this option accepts also the character 'n' as an argument to -disable displaying debug messages on the full-screen display. -.Pp -.It Fl f -Specifying this option causes -.Nm -to enter the full-screen mode of operation. -When operating in this mode, -entering the control character -.Em Control-L -causes the display to be refreshed and entering -.Em Carriage-Return -or -.Em Enter -will pop-up a command window. -Because the -.Nm -utility will not listen to messages while the command window is active, -this command window will disappear automatically after 5 seconds without -any command key press. -.Pp -While the command window is active, -.Em Tab -or -.Em Space -advances to the next menu item. -To execute a command, press -.Em Return -or -.Em Enter -for the highlighted menu item, or enter the number corresponding to the -item to be executed or enter the capitalized character in the menu item -description. -.It Fl l -If this option is set, logging is not done via the -.Xr syslogd 8 -facility but instead is appended to a file. -.It Fl L -Specifies the name of the logfile which is used when the option -.Em -l -is set. -See also the keyword -.Em rotatesuffix -in the system section of -.Xr isdnd.rc 5 . -.It Fl P -This option prints out the parsed and verified isdnd configuration in the same -format as the isdnd.rc file. -This output can be used as an isdnd.rc file. -This -feature is especially useful when debugging an isdnd.rc file to see, what the -default settings of options are when they are not set in the isdnd.rc input -file. -.Pp -The -.Nm -exits after the printout is done. -.It Fl F -This option prevents -.Nm -to detach from the controlling tty and become a daemon. -.It Fl r -In conjunction with the -.Fl t -option, -.Ar device -specifies a terminal device which becomes the controlling tty for -.Nm -and on which the full-screen mode output is displayed. -.It Fl s -This option may be used to specify the logging facility in case -.Xr syslog 3 -logging is configured and another facility than the default LOCAL0 -facility shall be used. -The facility is to be specified as an integer in -the range 0-11 or 16-23 (see the file /usr/include/syslog.h). -.It Fl t -In conjunction with the -.Fl f -and -.Fl r -options, -.Ar terminaltype -specifies a terminal type or termcap entry name (such as vt220) for the device -used for -.Nm -full-screen output. -This is useful if an unused (no getty running) tty line is -used for full-screen output for which no -.Li TERM -environment variable exists. -.It Fl u -Specifies the length of a charging unit in case the config file entry -keyword -.Em unitlenghtsrc -is set to -.Em cmdl . -.It Fl m -If the isdn daemon is compiled with local or remote monitoring support, -this option disables all monitoring access. -It overrides the config -file option -.Em monitor-allowed . -.El -.Sh INTERACTION WITH THE KERNEL -The -.Nm -utility -communicates with the kernel part of isdn4bsd by receiving status and -event messages -.Xr ( read 2 -from device -.Pa /dev/i4b ) -and by transmitting commands and responses -.Xr ( ioctl 2 -from device -.Pa /dev/i4b ) . -.Pp -The messages and message parameters are documented in the include -file -.Em /usr/include/i4b/i4b_ioctl.h . -.Pp -Supported command and response messages (ioctls) to the kernel are: -.Bl -tag -width Ds -compact -offset indent -.It Ar I4B_CDID_REQ -Request a unique Call Description IDentifier (cdid) which identifies -uniquely a single interaction of the local D channel with the exchange. -.It Ar I4B_CONNECT_REQ -Actively request a call setup to a remote ISDN subscriber. -.It Ar I4B_CONNECT_RESP -Respond to an incoming call, either accept, reject or ignore it. -.It Ar I4B_DISCONNECT_REQ -Actively terminate a connection. -.It Ar I4B_CTRL_INFO_REQ -Request information about an installed ISDN controller card. -.It Ar I4B_DIALOUT_RESP -Give information about call setup to driver who requested dialing out. -.It Ar I4B_TIMEOUT_UPD -Update the kernels timeout value(s) in case of dynamically calculated -shorthold mode timing changes. -.It Ar I4B_UPDOWN_IND -Inform the kernel userland drivers about interface soft up/down status -changes. -.It Ar I4B_CTRL_DOWNLOAD -Download firmware to active card(s). -.It Ar I4B_ACTIVE_DIAGNOSTIC -Return diagnostic information from active cards. -.El -.Pp -.Pp -Supported status and event messages from the kernel are: -.Bl -tag -width Ds -compact -offset indent -.It Ar MSG_CONNECT_IND -An incoming call from a remote ISDN user is indicated. -.It Ar MSG_CONNECT_ACTIVE_IND -After an incoming call has been accepted locally or an outgoing call has -been accepted by a remote, the exchange signaled an active connection -and the corresponding B-channel is switched through. -.It Ar MSG_DISCONNECT_IND -A call was terminated. -.It Ar MSG_DIALOUT_IND -A userland interface driver requests the daemon to dial out (typically a -network interface when a packet arrives in its send queue). -.It Ar MSG_IDLE_TIMEOUT_IND -A call was terminated by the isdn4bsd kernel driver because a B-channel -idle timeout occurred. -.It Ar MSG_ACCT_IND -Accounting information from a network driver. -.It Ar MSG_CHARGING_IND -Charging information from the kernel. -.El -.Pp -.Ss OUTGOING CALLS -Currently the only possibility to trigger an outgoing call is that an -isdn4bsd network driver -.Em (ipr<n>) -sends a -.Em MSG_DIALOUT_IND -to the -.Nm -utility. -.Pp -The daemon requests a new CDID from the kernel by using the -.Em I4B_CDID_REQ -ioctl message, this CDID is now used in all interactions with the kernel -to identify this single call until a disconnect occurs. -.Pp -After getting the CDID, the daemon looks up several additional information -in its entry section of the configuration corresponding to that connection -and issues a -.Em I4B_CONNECT_REQ -ioctl message to the kernel. -The kernel now dials the remote side and -if the remote side accepts the call, the kernel sends a -.Em MSG_CONNECT_ACTIVE_IND -to the daemon. -.Pp -The call is terminated by either the local side timing out or the remote -side hanging up the connection or the local side actively sending a -.Em I4B_DISCONNECT_REQ -ioctl message, both events are signaled to the -.Nm -by the kernel sending the -.Em I4B_DISCONNECT_IND -message and the CDID corresponding to the call is no longer valid. -.Pp -.Ss INCOMING CALLS -Incoming calls are signaled to the -.Nm -by the kernel transmitting the -.Em MSG_CONNECT_IND -message to the daemon. -.Pp -With the information contained in this message, the -.Nm -searches the entry section of its configuration database and if a match is -found, it accepts or rejects the call or, if no match is found, it ignores the -call - all by issuing a -.Em I4B_CONNECT_RESP -ioctl message with the appropriate parameters to the kernel. -.Pp -In case the daemon decided to accept the call, the kernel signals this -by sending a -.Em MSG_CONNECT_ACTIVE_IND -message to the daemon. -.Pp -The call is terminated by either the local side timing out or the remote -side hanging up the connection or the local side actively sending a -.Em I4B_DISCONNECT_REQ -ioctl message, both events are signaled to the -.Nm -by the kernel sending the -.Em I4B_DISCONNECT_IND -message and the CDID corresponding to the call is no longer valid. -.Sh SIGNALS -Sending a HUP signal to -.Nm -causes all open connections to be terminated and the configuration file is -reread. -In case aliasfile handling was enabled, the aliasfile is also -reread. -.Pp -Sending a USR1 signal to -.Nm -causes the accounting file and the logfile (if logging to a file is used -instead of logging via the -.Xr syslog 3 -facility) to be closed and reopened to make logfile rotation possible. -.Sh ENVIRONMENT -The following environment variables affect the execution of -.Nm : -.Bl -tag -width Ds -.It Ev TERM -The terminal type when running in full-screen display mode. -See -.Xr environ 7 -for more information. -.El -.Sh FILES -.Bl -tag -width /etc/isdn/isdnd.rates -.It Pa /dev/i4b -The device-file used to communicate with the kernel ISDN driver subsystem. -.It Pa /var/log/messages -A record of the actions in case of syslogd logging support. -.It Pa /var/log/isdnd.acct -The default accounting information filename (if accounting is configured). -.It Pa /var/log/isdnd.log -The default logging filename (if logging to a file is configured). -.It Pa /var/run/isdnd.pid -The process id of the isdn daemon (also known as "lockfile" to isdnd, preventing multiple invocations of it). -.It Pa /usr/local/lib/isdn -.It Pa /etc/isdn -The directory where isdnd expects some supplementary data files and programs -for telephone answering support. -.It Pa /etc/isdn/isdnd.rc -The default runtime configuration file. -.It Pa /etc/isdn/isdnd.rates -The default unit charging rates specification file. -.It Pa /etc/isdn/isdntel.alias -The default table (if aliasing is enabled) to convert phone number to caller's name. -.El -.Sh EXIT STATUS -Exit status is 0 on success, 1 on error. -.Sh EXAMPLES -For a first try, the following command should be used to start -.Nm -in foreground mode for better debugging the configuration setup: -.Bd -literal -offset indent -isdnd -d0xf9 -F -.Ed -.Pp -This will start isdnd with reasonable debugging settings and produce -output on the current terminal. -The -.Nm -utility can then be terminated by entering Control-C. -.Pp -Another example, the command: -.Bd -literal -offset indent -isdnd -d0xf9 -f -r /dev/ttyv3 -t vt100 -.Ed -.Pp -will start -.Nm -with reasonable debugging messages enabled, full-screen mode of operation, -full-screen display redirected to /dev/ttyv3 and using a termcap entry -for vt100 on this display. -.Sh SEE ALSO -.Xr i4bing 4 , -.Xr i4bipr 4 , -.Xr i4bisppp 4 , -.Xr isdnd.rates 5 , -.Xr isdnd.rc 5 , -.Xr isdntel 8 , -.Xr isdntrace 8 , -.Xr syslogd 8 -.Sh AUTHORS -The -.Nm -utility and this manual page were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -.Sh BUGS -Still one or more left. diff --git a/usr.sbin/i4b/isdnd/isdnd.acct.5 b/usr.sbin/i4b/isdnd/isdnd.acct.5 deleted file mode 100644 index b2db667db742..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.acct.5 +++ /dev/null @@ -1,108 +0,0 @@ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdnd.acct.5,v 1.11 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 22:58:12 1999] -.\" -.Dd September 11, 1998 -.Dt ISDND.ACCT 5 -.Os -.Sh NAME -.Nm isdnd.acct -.Nd isdn4bsd ISDN management daemon accounting file format -.Sh DESCRIPTION -The file -.Pa isdnd.acct -contains accounting information which is written if the variable -.Em useacctfile -in the -.Xr isdnd 8 -configuration file -.Xr isdnd.rc 5 -is set to -.Em on -and charging information transmission has been subscribed for the -ISDN connection (AOCD or AOCE). -.Pp -If the variable -.Em acctall -is set to -.Em on , -accounting information is written even if the local site was not charged -or no charging information is available or is not subscribed. -.Pp -The general format of an accounting line is as follows: -.Pp -.Dl FROM - UNTIL NAME UNITS (SECONDS) (INBYTES/OUTBYTES) -.Pp -.Em FROM -is the time the connection was established in the format -.Dl Day.Month.Year Hour:Minutes:seconds -.Pp -.Em UNTIL -is the time the connection was closed. -The format is the same as -described for -.Em FROM -above. -.Pp -.Em NAME -is the symbolic name got from the -.Em name -entry of the -.Xr isdnd.rc 5 -config file for this connection. -.Pp -.Em UNITS -is the amount of charging units billed for the connection. -.Pp -.Em SECONDS -is the number of seconds the connection lasted. -.Pp -.Em INBYTES -and -.Em OUTBYTES -is the (optional) number of bytes that were transferred. -.Sh FILES -.Bl -tag -width /var/log/isdnd.acct -compact -.It Pa /var/log/isdnd.acct -The default accounting information file for the -.Nm isdnd -ISDN daemon. -.El -.Sh EXAMPLES -This is a typical accounting line: -.Pp -.Dl 12.06.97 10:41:37 - 12.06.97 10:45:18 GROGGY 2 (65) (4711/1147) -.Sh SEE ALSO -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh AUTHORS -The -.Xr isdnd 8 -daemon and this manual page were written by -.An Hellmuth Michaelis Aq hm@kts.org . diff --git a/usr.sbin/i4b/isdnd/isdnd.h b/usr.sbin/i4b/isdnd/isdnd.h deleted file mode 100644 index 4e65bfe6efec..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.h +++ /dev/null @@ -1,907 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - main header file - * ----------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:18:48 2006] - * - *---------------------------------------------------------------------------*/ - -#ifndef _ISDND_H_ -#define _ISDND_H_ - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <unistd.h> -#include <strings.h> -#include <string.h> -#include <ctype.h> -#include <syslog.h> -#include <regex.h> -#include <time.h> - -#ifdef USE_CURSES -#include <curses.h> -#endif - -#include <fcntl.h> -#include <errno.h> -#include <signal.h> - -#include <sys/queue.h> /* TAILQ_ macros */ -#include <sys/param.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/ioctl.h> - -#ifdef USE_RTPRIO -#include <sys/rtprio.h> -#endif - -#include <net/if_sppp.h> - -#include <i4b/i4b_ioctl.h> -#include <i4b/i4b_cause.h> - -#include "config.h" /* compile time configuration */ -#include "pathnames.h" /* location of files */ -#include "alias.h" /* alias file processing */ - -/*---------------------------------------------------------------------------* - * some general definitions - *---------------------------------------------------------------------------*/ -#define GOOD 0 /* general "good" or "ok" return*/ -#define ERROR (-1) /* general error return */ -#define WARNING (-2) /* warning return */ -#define INVALID (-1) /* an invalid integer */ - -/*---------------------------------------------------------------------------* - * misc - *---------------------------------------------------------------------------*/ -#define RTPRIO_NOTUSED (-1) /* rtprio is not used for isdnd */ - -/*---------------------------------------------------------------------------* - * debug flag bits - *---------------------------------------------------------------------------*/ -#define DL_MSG 0x0001 /* general debug messages */ -#define DL_RATES 0x0002 /* messages related to rates */ -#define DL_TIME 0x0004 /* messages related to timing */ -#define DL_STATE 0x0008 /* messages related to states changes */ -#define DL_RCVRY 0x0010 /* messages related to dial recovery */ -#define DL_DIAL 0x0020 /* messages related to dial recovery */ -#define DL_PROC 0x0040 /* messages related to process handling */ -#define DL_DRVR 0x0080 /* messages related to kernel i4b msg i/o*/ -#define DL_CNST 0x0100 /* messages related to controller state */ -#define DL_RCCF 0x0200 /* messages related to isdnd.rc at boot */ -#define DL_BDGT 0x0400 /* messages related to budgets */ -#define DL_VALID 0x0800 /* messages related to valid keyword */ - -#ifdef DEBUG -#define DBGL(cond, dolog) if(cond & debug_flags) dolog -#else -#define DBGL(cond, dolog) -#endif - -/*---------------------------------------------------------------------------* - * curses fullscreen display definitions - *---------------------------------------------------------------------------*/ - -/* window dimensions */ -#define UPPER_B 2 /* upper window start */ - -/* horizontal positions for upper window */ -#define H_CNTL 0 /* controller */ -#define H_TEI 2 /* TEI */ -#define H_CHAN (H_TEI+4) /* channel */ -#define H_TELN (H_CHAN+2) /* telephone number */ -#define H_IFN (H_TELN+23) /* interfacename */ -#define H_IO (H_IFN+7) /* incoming or outgoing */ -#define H_OUT (H_IO+4) /* # of bytes out */ -#define H_OUTBPS (H_OUT+11) /* bytes per second out */ -#define H_IN (H_OUTBPS+5) /* # of bytes in */ -#define H_INBPS (H_IN+11) /* bytes per second in */ -#define H_UNITS (H_INBPS+6) /* # of charging units */ - -/* fullscreen mode menu window */ -#define WMENU_LEN 35 /* width of menu window */ -#define WMENU_TITLE "Command" /* title string */ -#define WMENU_POSLN 10 /* menu position, line */ -#define WMENU_POSCO 5 /* menu position, col */ -#define WMITEMS 6 /* no of menu items */ -#define WMENU_HGT (WMITEMS + 4) /* menu window height */ - -#define WREFRESH 0 -#define WHANGUP 1 -#define WREREAD 2 -#define WSHOW 3 -#define WBUDGET 4 -#define WQUIT 5 - -#define WMTIMEOUT 5 /* timeout in seconds */ - -/*---------------------------------------------------------------------------* - * charging rates - *---------------------------------------------------------------------------*/ -#define NDAYS 7 /* number of days in a week */ -#define NRATES 4 /* number of rate structures supported */ - -/* struct for rates - each day has one or more */ -struct rates -{ - int start_time; /* hour and min at which this rate starts, e.g. 12:20 12*60+20*/ - int end_time; /* hour and min at which this rate ends, e.g. 19:10 19*60+10*/ - int rate; /* how long can I telephone at this price, seconds */ - struct rates *next; -}; - -/*---------------------------------------------------------------------------* - * the internal identifiers for isdnd log levels. CAUTION: this has to stay - * in sync with the loglevel to text and sysloglevel table in log.c !! - *---------------------------------------------------------------------------*/ -enum logids -{ - LL_ERR, /* error conditions - everything which caused an error */ - LL_WRN, /* warning conditions - nonfatal abnormal conditions */ - LL_DMN, /* normal but significant condition - status of daemon */ - LL_CHD, /* informational - everything regarding call handling */ - LL_DBG, /* debug messages - everything which helps debugging */ - LL_MER, /* monitor error messages - not sent to remote */ - LL_PKT /* packet logging - log the first few packets */ -}; - -/*---------------------------------------------------------------------------* - * state machine events - *---------------------------------------------------------------------------*/ -enum events -{ - /* incoming messages */ - - EV_MCI, /* MSG_CONNECT_IND */ - EV_MCAI, /* MSG_CONNECT_ACTIVE_IND */ - EV_MDI, /* MSG_DISCONNECT_IND */ - EV_MDO, /* MSG_DIALOUT */ - - /* local requests */ - - EV_TIMO, /* timer expired */ - EV_DRQ, /* disconnect request */ - EV_CBRQ, /* callback request */ - EV_ALRT, /* alerting request */ - - /* illegal */ - - EV_ILL /* illegal event */ -}; - -#define N_EVENTS (EV_ILL+1) /* no of possible events */ - -/*---------------------------------------------------------------------------* - * this struct describes the numbers to try to dial out - *---------------------------------------------------------------------------*/ -typedef struct { - char number[TELNO_MAX]; /* number */ - char subaddr[SUBADDR_MAX]; /* subaddr */ -} number_t; - -/*---------------------------------------------------------------------------* - * this struct describes the numbers to try to dial out - *---------------------------------------------------------------------------*/ -typedef struct { - char number[TELNO_MAX]; /* remote number to dial */ - char subaddr[SUBADDR_MAX]; /* remote subaddr */ - int flag; /* usage flag */ -#define RNF_IDLE 0 -#define RNF_SUCC 1 /* last dial was ok */ -} remote_number_t; - -/*---------------------------------------------------------------------------* - * this struct describes numbers allowed to dial in - *---------------------------------------------------------------------------*/ -typedef struct { - char number[TELNO_MAX]; /* calling party number */ - char subaddr[SUBADDR_MAX];/* calling party subaddr */ -} incoming_number_t; - -/*---------------------------------------------------------------------------* - * this structure describes a prematurely aborted called-back dialout - *---------------------------------------------------------------------------*/ -typedef struct { - int cdid; /* call handle */ - int controller; /* the controller used to dial out */ - int channel; /* the channel assigned to the outgoing call */ - /* XXX - timeout handling and error recovery? */ -} phantom_t; - -/*---------------------------------------------------------------------------* - * this struct describes one complete configuration entry - *---------------------------------------------------------------------------*/ -typedef struct cfg_entry { - - /* ====== filled in at startup configuration, then static ===========*/ - - char name[32]; /* id for this entry */ - - int isdncontroller; /* controller to use 0 ... n */ - int isdnchannel; /* channel to use */ - - int isdntxdelin; /* tx delay, incoming connections */ - int isdntxdelout; /* tx delay, outgoing connections */ - - int usrdevicename; /* userland device to use */ - int usrdeviceunit; /* userland unit to use */ - - int remote_numbers_count; /* number of remote numbers */ - int remote_subaddr_count; /* number of remote subaddr */ -#define MAXRNUMBERS 8 /* max remote numbers */ - - remote_number_t remote_numbers[MAXRNUMBERS]; /* remote numbers to dial */ - - - int remote_numbers_handling; /* how to handle the remote dialing */ -#define RNH_NEXT 0 /* use next number after last successfull */ -#define RNH_LAST 1 /* use last successfull for next call */ -#define RNH_FIRST 2 /* always use first number for next call */ - - number_t local_phone_dialout; /* our number to tell remote*/ - number_t local_phone_incoming; /* answer calls for this local number */ - -#define MAX_INCOMING 8 - int incoming_numbers_count; /* number of incoming allowed numbers */ - int incoming_subaddr_count; /* number of incoming allowed subaddr */ - incoming_number_t remote_phone_incoming[MAX_INCOMING]; /* answer calls from this remote machine */ - - int dialin_reaction; /* what to do with incoming calls */ -#define REACT_ACCEPT 0 -#define REACT_REJECT 1 -#define REACT_IGNORE 2 -#define REACT_ANSWER 3 -#define REACT_CALLBACK 4 - - int b1protocol; /* hdlc / raw */ - - int bcap; /* special bearer capability (DoV) */ - - int idle_time_in; /* max idle time incoming calls */ - int idle_time_out; /* max idle time outgoing calls */ - - int shorthold_algorithm; /* shorthold algorithm */ - - int unitlength; /* length of a charging unit */ -#define UNITLENGTH_DEFAULT 60 /* last resort unit length */ - - int earlyhangup; /* time in seconds to hangup */ - /* before the next expected */ - /* charging unit */ -#define EARLYHANGUP_DEFAULT 5 - - int ratetype; /* type of rate */ -#define NO_RATE (NRATES+1) -#define INVALID_RATE (-1) - - int unitlengthsrc; /* where we get the unit length from */ -#define ULSRC_NONE 0 /* nowhere specified */ -#define ULSRC_CMDL 1 /* specified on commandline */ -#define ULSRC_CMDLMIN 5 /* minimum value from cmdl */ -#define ULSRC_CMDLMAX 3600 /* minimum value from cmdl */ -#define ULSRC_CONF 2 /* get it from config file */ -#define ULSRC_RATE 3 /* get it dynamic from ratesfile*/ -#define ULSRC_DYN 4 /* dynamic calculated from AOCD */ - - char *answerprog; /* program to use for answering */ - char *connectprog; /* program run after negotiation finished */ - char *disconnectprog; /* program run after shutdown is complete */ - - int callbackwait; /* time to wait before calling back */ -#define CALLBACKWAIT_MIN 1 - - int calledbackwait; /* time to wait for remote callback */ -#define CALLEDBACKWAIT_MIN 2 - - int dialretries; /* no. of dial tries */ -#define DIALRETRIES_DEF 1 - - int recoverytime; /* time between 2 dial tries */ -#define RECOVERYTIME_MIN 1 - - int dialrandincr; /* use random dial time incr */ - - int usedown; /* set interface down yes/no */ - int downtries; /* retries before i/f is set down */ -#define DOWN_TRIES_MIN 2 -#define DOWN_TRIES_MAX 20 - int downtime; /* time i/f is down */ -#define DOWN_TIME_MIN 10 /* 10 seconds */ -#define DOWN_TIME_MAX 3600 /* 1 hour */ - - int dialouttype; /* type of outgoing connection */ -#define DIALOUT_NORMAL 0 /* normal dialout behaviour */ -#define DIALOUT_CALLEDBACK 1 /* remote is expected to callback */ - - int alert; /* alert time in sec if nonzero */ -#define MINALERT 5 /* 5 secs min */ -#define MAXALERT (3*60) /* 3 minutes max */ - - int inout; /* in/out, in-only or out-only */ -#define DIR_INOUT 0 -#define DIR_INONLY 1 -#define DIR_OUTONLY 2 - - int usesubaddr; /* use subaddresses */ - - int budget_callbackperiod; /* length of a budget period (s)*/ - int budget_callbackncalls; /* call budget for a period */ - char *budget_callbacks_file; /* filename to store callback stats */ - char budget_callbacksfile_rotate; - - int budget_calloutperiod; /* length of a budget period (s)*/ - int budget_calloutncalls; /* call budget for a period */ - char *budget_callouts_file; /* filename to store callout stats */ - char budget_calloutsfile_rotate; - - int ppp_expect_auth; - int ppp_send_auth; -#define AUTH_UNDEF 0 -#define AUTH_NONE 1 -#define AUTH_PAP 2 -#define AUTH_CHAP 3 - - int ppp_auth_flags; -#define AUTH_RECHALLENGE 0x01 -#define AUTH_REQUIRED 0x02 - - char ppp_expect_name[AUTHNAMELEN]; /* PPP PAP/CHAP login name */ - char ppp_send_name[AUTHNAMELEN]; - - char ppp_expect_password[AUTHKEYLEN]; - char ppp_send_password[AUTHKEYLEN]; - - int day; /* days valid */ -#define SU 0x01 -#define MO 0x02 -#define TU 0x04 -#define WE 0x08 -#define TH 0x10 -#define FR 0x20 -#define SA 0x40 -#define HD 0x80 /* holiday */ - int fromhr; /* time valid */ - int frommin; - int tohr; - int tomin; - - time_t maxconnecttime; /* maximum connection time */ - -/*===========================================================================*/ -/*============ filled in after start, then dynamic ==========================*/ -/*===========================================================================*/ - - int cdid; /* cdid for call */ -#define CDID_RESERVED (-1) - - int isdncontrollerused; /* the one we are using */ - int isdnchannelused; /* the one we are using */ - - int fs_position; /* fullscreen position */ - - int state; /* state of connection */ -#define ST_IDLE 0 /* connection is idle / disconnected */ - - /* normal dial out to remote */ -#define ST_DIAL 1 /* dialing */ -#define ST_DIALRTMRCHD 2 /* wait for dial retry time reached */ -#define ST_DIALRETRY 3 /* last/first dialing failed, retry */ - - /* PCB: passive callback, i'm being called back */ -#define ST_PCB_DIAL 4 /* dialing, trigger a callback */ -#define ST_PCB_DIALFAIL 5 /* dialing failed triggering a callbk */ -#define ST_PCB_WAITCALL 6 /* waiting for callback from remote */ - - /* ACB: active callback, i'm calling back */ -#define ST_ACB_WAITDISC 7 /* got call, wait for disconnect */ -#define ST_ACB_WAITDIAL 8 /* wait until allowed to callback */ -#define ST_ACB_DIAL 9 /* callback to remote */ -#define ST_ACB_DIALFAIL 10 /* callback to remote failed */ - - /* normal non-dialling states */ -#define ST_ACCEPTED 11 /* remote accepted */ -#define ST_CONNECTED 12 /* connected with remote */ -#define ST_WAITDISCI 13 /* tx disc req, wait for disc ind */ -#define ST_DOWN 14 /* interface is down */ -#define ST_ALERT 15 /* interface is waiting for alert time*/ - - /* illegal and pseudo states */ -#define ST_ILL 16 /* illegal state */ -#define ST_SUSE 17 /* subroutine sets new state */ - -#define N_STATES (ST_ILL+1) /* max number of states */ - - cause_t disc_cause; /* cause from disconnect */ - - int local_disconnect; /* flag, who disconnected */ -#define DISCON_LOC 0 -#define DISCON_REM 1 - - int timerval; /* value for timer, 0 if inactive */ - int timerremain; /* remaining time */ - - int hangup; /* flag, hangup connection asap */ - - number_t real_phone_incoming; /* real remote telno in case of wildcard */ - - int last_remote_number; /* index of last used dialout number*/ - - number_t remote_phone_dialout; /* used remote number to dial */ - - int direction; /* incoming or outgoing */ -#define DIR_IN 0 -#define DIR_OUT 1 - - int charge; /* charge in units */ - int last_charge; /* last charge in units */ - - int inbytes; /* # of bytes from remote */ - int iinbytes; /* # of bytes from remote on the line */ - int inbps; /* bytes/sec from remote */ - int outbytes; /* # of bytes to remote */ - int ioutbytes; /* # of bytes to remote on the line */ - int outbps; /* bytes/sec to remote */ - - time_t connect_time; /* time connection was established */ - - time_t aoc_last; /* last AOCD timestamp */ - time_t aoc_now; /* current AOCD timestamp */ - time_t aoc_diff; /* current unit length */ - time_t aoc_lastdiff; /* last charge unit length */ - int aoc_valid; /* flag: time diff is valid */ -#define AOC_INVALID 0 /* aoc_diff is NOT valid */ -#define AOC_VALID 1 /* aoc_diff is valid */ - - time_t last_dial_time; /* time of last dialing */ - time_t last_release_time; /* time of last hangup */ - - int dial_count; /* number of dialout tries */ - int randomtime; /* random() part of recoverytime*/ -#define RANDOM_MASK 0x04 /* bits used from randomtime */ - - int down_retry_count; /* retry cycle count for usedown*/ - time_t went_down_time; /* time i/f went down */ - phantom_t saved_call; /* outgoing call state if called - back too early */ - - int alert_time; /* count down of alert time */ - char display[DISPLAY_MAX]; - - time_t budget_callbackperiod_time; /* end of current period */ - int budget_callbackncalls_cnt; /* amount of calls left */ - - int budget_callback_req; /* requests */ - int budget_callback_done; /* call done */ - int budget_callback_rej; /* call refused */ - - time_t budget_calloutperiod_time; /* end of current period */ - int budget_calloutncalls_cnt; /* amount of calls left */ - - int budget_callout_req; /* requests */ - int budget_callout_done; /* call done */ - int budget_callout_rej; /* call refused */ - - int budget_calltype; /* type of call */ -#define BUDGET_TYPE_CBACK 1 -#define BUDGET_TYPE_COUT 2 - - char keypad[KEYPAD_MAX]; /* keypad string */ -} cfg_entry_t; - -/*---------------------------------------------------------------------------* - * this struct describes state of controller with MAX_BCHAN b channels - *---------------------------------------------------------------------------*/ -typedef struct isdn_ctrl_state { - int ctrl_type; /* type: active/passive */ - int card_type; /* manufacturer (CARD_XXXX) */ - int protocol; /* ISDN D-channel protocol */ - char* firmware; /* loadable fimrware file name */ - - int state; /* controller state */ -#define CTRL_DOWN 0 /* controller inoparable */ -#define CTRL_UP 1 /* controller may be used */ -#define MAX_BCHAN 30 - int stateb[MAX_BCHAN]; /* b channel state */ -#define CHAN_IDLE 0 /* channel is free for usage */ -#define CHAN_RUN 1 /* channel is occupied */ - int nbch; /* number of b channels */ - int freechans; /* number of unused channels */ - int tei; /* tei or -1 if invalid */ - int l1stat; /* layer 1 state */ - int l2stat; /* layer 2 state */ -} isdn_ctrl_state_t; - -/*---------------------------------------------------------------------------* - * this struct describes a logging regular expression - *---------------------------------------------------------------------------*/ -struct rarr { - int re_flg; /* valid entry flag */ - char *re_expr; /* plain text expression */ - regex_t re; /* compiled expression */ - char *re_prog; /* the program to be executed */ -}; - -#ifdef I4B_EXTERNAL_MONITOR -/* for each rights entry we keep one of this structures around: */ -struct monitor_rights { - TAILQ_ENTRY(monitor_rights) list; /* a list of this structures */ - char name[FILENAME_MAX]; /* net/host spec or filename */ - int rights; /* bitmask of allowed acces rights */ - u_int32_t net; /* net/host address (host byte order!) */ - u_int32_t mask; /* bitmask 1 = network, 0 = host (host byte order!) */ - int local; /* zero if remote access via tcp/ip */ -}; -#endif - -/*---------------------------------------------------------------------------* - * global variables, storage allocation - *---------------------------------------------------------------------------*/ -#ifdef MAIN - -int isdnfd; /* file handle, /dev/i4b */ - -char mailto[MAXPATHLEN] = ""; /* panic mail address */ -char mailer[MAXPATHLEN] = ""; /* panic mail address */ - -char *configfile = CONFIG_FILE_DEF; /* configuration filename */ -int config_error_flag = 0; /* error counter */ - -#ifdef DEBUG -int do_debug = 0; /* debug mode flag */ -int debug_flags = 0; /* debug options */ -int debug_noscreen = 0; /* not on fullscreen */ -#endif - -int do_bell = 0; /* bell on connect/disconnect */ - -int do_fork = 1; /* run as daemon/foreground */ - -int do_ttytype = 0; /* got new terminal type */ -char *ttype = ""; /* termcap entry name string */ - -int do_rdev = 0; /* redirect output */ -char *rdev = ""; /* new device string */ - -int do_print = 0; /* config file printout */ - -int got_unitlen = 0; /* flag, got length of a unit */ -time_t unit_length; /* length of a unit */ - -cfg_entry_t cfg_entry_tab[CFG_ENTRY_MAX]; /* configuration table */ -isdn_ctrl_state_t isdn_ctrl_tab[ISDN_CTRL_MAX]; /* controller states table */ - -int ncontroller = 0; /* # of controllers available */ -int nentries = 0; /* # of entries in config tab */ - -int uselogfile = 0; /* flag, use a logfile */ -char logfile[MAXPATHLEN] = LOG_FILE_DEF; /* log filename */ -FILE *logfp = NULL; /* log file pointer */ -int logfacility = LOG_LOCAL0; /* the syslog facility used */ -int nregex = 0; /* number of reg expr */ -struct rarr rarr[MAX_RE]; /* regexpr & progs table */ - -char ratesfile[MAXPATHLEN] = RATES_FILE_DEF; /* rates filename */ -char *rate_error = NULL; /* errorcase: error string */ -int got_rate = 0; /* flag, ratesfile found */ -struct rates *rates[NRATES][NDAYS]; /* the rates structure */ - -int useacctfile = 0; /* flag, write accounting */ -char acctfile[MAXPATHLEN] = ACCT_FILE_DEF; /* accounting filename */ -FILE *acctfp = NULL; /* accounting file pointer */ -int acct_all = 1; /* account all connections */ - -int aliasing = 0; /* enable alias processing */ -char aliasfile[MAXPATHLEN] = ALIASFILE; /* alias file location */ - -int do_fullscreen = 0; /* fullscreen log */ -int curses_ready = 0; /* curses initialized */ - -#ifdef USE_CURSES -WINDOW *upper_w; /* curses upper window pointer */ -WINDOW *mid_w; /* curses mid window pointer */ -WINDOW *lower_w; /* curses lower window pointer */ -#endif - -int rt_prio = RTPRIO_NOTUSED; /* realtime priority */ - -/* monitor via network */ - -int do_monitor = 0; -int inhibit_monitor = 0; -#ifdef I4B_EXTERNAL_MONITOR -int monitorport = DEF_MONPORT; -#else -int monitorport = -1; -#endif -int accepted = 0; - -int isdntime = 0; /* flag, log time from exchange */ -int extcallattr = 0; /* flag, display extended caller attributes */ - -char tinainitprog[MAXPATHLEN] = TINA_FILE_DEF; - -char rotatesuffix[MAXPATHLEN] = ""; - -time_t starttime = 0; - -char holidayfile[MAXPATHLEN] = HOLIDAY_FILE_DEF; /* holiday filename */ - -int addprefix = 0; -char prefixnational[TELNO_MAX] = ""; -char prefixinternational[TELNO_MAX] = ""; - -#else /* !MAIN */ - -int isdnfd; - -char mailto[MAXPATHLEN]; -char mailer[MAXPATHLEN]; - -char *configfile; -int config_error_flag; - -#ifdef DEBUG -int do_debug; -int debug_flags; -int debug_noscreen; -#endif - -int do_bell; - -int do_fork; - -int do_ttytype; -char *ttype; - -int do_rdev; -char *rdev; - -int do_print; - -int got_unitlen; -time_t unit_length; - -cfg_entry_t cfg_entry_tab[CFG_ENTRY_MAX]; /* configuration table */ -isdn_ctrl_state_t isdn_ctrl_tab[ISDN_CTRL_MAX]; /* controller states table */ - -int ncontroller; -int nentries; - -int uselogfile; -char logfile[MAXPATHLEN]; -FILE *logfp; -int logfacility; -int nregex; -struct rarr rarr[MAX_RE]; - -char ratesfile[MAXPATHLEN]; -char *rate_error; -int got_rate; -struct rates *rates[NRATES][NDAYS]; - -int useacctfile; -char acctfile[MAXPATHLEN]; -FILE *acctfp; -int acct_all; - -int aliasing; -char aliasfile[MAXPATHLEN]; - -int do_fullscreen; -int curses_ready; - -#ifdef USE_CURSES -WINDOW *upper_w; -WINDOW *mid_w; -WINDOW *lower_w; -#endif - -int rt_prio; - -int do_monitor; -int inhibit_monitor; -int monitorport; -int accepted; - -int isdntime; -int extcallattr; - -char tinainitprog[MAXPATHLEN]; - -char rotatesuffix[MAXPATHLEN]; - -time_t starttime; - -char holidayfile[MAXPATHLEN]; - -int addprefix; -char prefixnational[TELNO_MAX]; -char prefixinternational[TELNO_MAX]; - -#endif /* MAIN */ - -int add_number_prefix( char *number, int type_of_number ); -char * bdrivername ( int drivertype ); -void cfg_setval ( int keyword ); -void check_and_kill ( cfg_entry_t *cep ); -void check_pid ( void ); -void close_allactive ( void ); -void configure ( char *filename, int reread ); -void daemonize ( void ); -void dialresponse(cfg_entry_t *cep, int dstat); -void display_acct ( cfg_entry_t *cep ); -void display_bell ( void ); -void display_ccharge ( cfg_entry_t *cep, int units ); -void display_chans ( void ); -void display_charge ( cfg_entry_t *cep ); -void display_connect ( cfg_entry_t *cep ); -void display_disconnect ( cfg_entry_t *cep ); -void display_l12stat(int controller, int layer, int state); -void display_tei(int controller, int tei); -void display_updown ( cfg_entry_t *cep, int updown ); -void do_exit ( int exitval ); -void do_menu ( void ); -int exec_answer ( cfg_entry_t *cep ); -int exec_connect_prog ( cfg_entry_t *cep, const char *prog, int link_down ); -pid_t exec_prog ( char *prog, char **arglist ); -cfg_entry_t * find_by_device_for_dialout ( int drivertype, int driverunit ); -cfg_entry_t *find_by_device_for_dialoutnumber(msg_dialoutnumber_ind_t *mp); -cfg_entry_t *find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd); -cfg_entry_t * find_matching_entry_incoming ( msg_connect_ind_t *mp ); -cfg_entry_t * find_active_entry_by_driver ( int drivertype, int driverunit ); -void finish_log ( void ); -char * getlogdatetime ( void ); -int get_cdid ( void ); -cfg_entry_t * get_cep_by_cc ( int ctrlr, int chan ); -cfg_entry_t * get_cep_by_driver ( int drivertype, int driverunit ); -cfg_entry_t * get_cep_by_cdid ( int cdid ); -int get_current_rate ( cfg_entry_t *cep, int logit ); -void handle_charge ( cfg_entry_t *cep ); -void handle_recovery ( void ); -void handle_scrprs(int cdid, int scr, int prs, char *caller); -void if_up(cfg_entry_t *cep); -void if_down(cfg_entry_t *cep); -void init_controller ( void ); -void init_controller_protocol ( void ); -void init_log ( void ); -void init_screen ( void ); -void llog ( int what, const char *fmt, ... ); -int main ( int argc, char **argv ); -void msg_accounting ( msg_accounting_ind_t *mp ); -void msg_alert_ind ( msg_alert_ind_t *mp ); -void msg_charging_ind ( msg_charging_ind_t *mp ); -void msg_connect_active_ind ( msg_connect_active_ind_t *mp ); -void msg_connect_ind ( msg_connect_ind_t *mp ); -void msg_pdeact_ind(msg_pdeact_ind_t *md); -void msg_negcomplete_ind(msg_negcomplete_ind_t *ind); -void msg_ifstatechg_ind(msg_ifstatechg_ind_t *ind); -void msg_drvrdisc_req(msg_drvrdisc_req_t *mp); -void msg_dialout ( msg_dialout_ind_t *mp ); -void msg_dialoutnumber(msg_dialoutnumber_ind_t *mp); -void msg_disconnect_ind ( msg_disconnect_ind_t *mp ); -void msg_idle_timeout_ind ( msg_idle_timeout_ind_t *mp ); -void msg_l12stat_ind(msg_l12stat_ind_t *ml); -void msg_teiasg_ind(msg_teiasg_ind_t *mt); -void msg_proceeding_ind ( msg_proceeding_ind_t *mp ); -void msg_packet_ind( msg_packet_ind_t *mp ); -void msg_keypad(msg_keypad_ind_t *mp); -const char * name_of_controller(int ctrl_type, int card_type); -void next_state ( cfg_entry_t *cep, int event ); -char * print_i4b_cause( cause_t code ); -char * printstate ( cfg_entry_t *cep ); -int readrates ( char *filename ); -int ret_channel_state(int controller, int channel); -void reopenfiles ( int dummy ); -void rereadconfig ( int dummy ); -void select_first_dialno ( cfg_entry_t *cep ); -void select_next_dialno ( cfg_entry_t *cep ); -void select_this_dialno ( cfg_entry_t *cep ); -int sendm_alert_req ( cfg_entry_t *cep ); -int sendm_connect_req ( cfg_entry_t *cep ); -int sendm_connect_resp ( cfg_entry_t *cep, int cdid, int response, cause_t cause ); -int sendm_disconnect_req ( cfg_entry_t *cep, cause_t cause ); -int set_channel_busy(int controller, int channel); -int set_channel_idle(int controller, int channel); -int setup_dialout(cfg_entry_t *cep); -void sigchild_handler ( int sig ); -void start_timer ( cfg_entry_t *cep, int seconds ); -void stop_timer ( cfg_entry_t *cep ); -void unitlen_chkupd( cfg_entry_t *cep ); -void write_pid ( void ); -void yyerror ( const char *msg ); - -void error_exit(int exitval, const char *fmt, ...); - -/* montior server module */ -void monitor_init(); -void monitor_exit(); -void monitor_clear_rights(); -void monitor_fixup_rights(); -int monitor_start_rights(const char *clientspec); -void monitor_add_rights(int rights); - -/* possible return codes from monitor_start_rights: */ -#define I4BMAR_OK 0 /* rights added successfully */ -#define I4BMAR_LENGTH 1 /* local socket name to long */ -#define I4BMAR_DUP 2 /* entry already exists */ -#define I4BMAR_CIDR 3 /* cidr netmask is invalid */ -#define I4BMAR_NOIP 4 /* host/net could not be resolved */ - -int monitor_create_local_socket(); - -#ifndef I4B_NOTCPIP_MONITOR -int monitor_create_remote_socket(int portno); -#endif - -void monitor_prepselect(fd_set *selset, int *max_fd); -void monitor_handle_input(fd_set *selset); -void monitor_handle_connect(int sockfd, int is_local); -void monitor_evnt_charge(cfg_entry_t *cep, int units, int estimated); -void monitor_evnt_connect(cfg_entry_t *cep); -void monitor_evnt_disconnect(cfg_entry_t *cep); -void monitor_evnt_updown(cfg_entry_t *cep, int up); -void monitor_evnt_log(int prio, const char * what, const char * msg); - -void monitor_evnt_l12stat(int controller, int layer, int state); -void monitor_evnt_tei(int controller, int tei); -void monitor_evnt_acct(cfg_entry_t *cep); - -/* controller.c */ - -void init_active_controller(void); -int set_controller_state(int controller, int state); -int get_controller_state(int controller); -int decr_free_channels(int controller); -int incr_free_channels(int controller); -int get_free_channels(int controller); -int set_channel_busy(int controller, int channel); -int set_channel_idle(int controller, int channel); -int ret_channel_state(int controller, int channel); - -/* alias.c */ - -void init_alias(char *filename); -void free_aliases(void); -char *get_alias(char *number); - -void upd_callstat_file(char *filename, int rotateflag); - -/* holiday.c */ - -void init_holidays(char *filename); -void free_holidays(void); -int isholiday(int d, int m, int y); - -#endif /* _ISDND_H_ */ diff --git a/usr.sbin/i4b/isdnd/isdnd.rates.5 b/usr.sbin/i4b/isdnd/isdnd.rates.5 deleted file mode 100644 index b4542e07591b..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.rates.5 +++ /dev/null @@ -1,117 +0,0 @@ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdnd.rates.5,v 1.10 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 22:59:31 1999] -.\" -.Dd September 11, 1998 -.Dt ISDND.RATES 5 -.Os -.Sh NAME -.Nm isdnd.rates -.Nd isdn4bsd ISDN management daemon rates description file -.Sh DESCRIPTION -The file -.Pa isdnd.rates -contains descriptions how long charging units last at a given time of day, -day of week and the distance to the destination. -If this file is available, -this information may be used by the -.Xr isdnd 8 -ISDN connection management daemon to calculate the short hold time for a -connection. -.Pp -The format of a rate entry line is as follows: -.Pp -The first field, the -.Pq Fa rate-code -defines a collection of rates (for each day of the week) which can be -referenced in the -.Xr isdnd 8 -configuration file -.Xr isdnd.rc 5 . -This field must start with the identifier -.Dq ra -followed by a digit in the range of zero to four. -.Pp -The second field, the -.Pq Fa day-number -selects the day of week for which this entry defines the rates, where 0 stands -for Sunday, 1 for Monday and so on until the digit 6 which stands for Saturday. -.Pp -The rest of the line consists of one or more space separated fields which have -the following syntax: -.Bd -ragged -offset indent -start_hour.start_minutes-end_hour.end_minutes:charge_unit_length -.Ed -.Pp -Start_hour and start_minutes define the begin of a time section and end_hour -and end_minutes define the end. -Charge_unit_length define the length of a -charging unit in the previously defined time section. -No spaces or tabs are -allowed inside this field. -The hour and minutes specifications MUST have -exactly 2 digits, in case just one digit is needed, a leading 0 must be used. -.Pp -For example, -.Bd -ragged -offset indent -14.00-18.00:90 -.Ed -.Pp -defines, that between 2:00 PM and 6:00 PM the length of one charging unit -lasts 90 seconds. -.Sh FILES -.Bl -tag -width /etc/isdn/isdnd.rates -compact -.It Pa /etc/isdn/isdnd.rates -The default rates specification file for the -.Nm isdnd -ISDN daemon. -.El -.Sh EXAMPLES -The line: -.Bd -literal -ra0 0 00.00-05.00:240 05.00-21.00:150 21.00-24.00:240 -.Ed -.Pp -defines the unit lengths for a Sunday. -.Sh SEE ALSO -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh AUTHORS -.An -nosplit -The rates subsystem for the -.Xr isdnd 8 -daemon to which -.Nm -belongs was designed and written by -.An Gary Jennejohn . -.Pp -The -.Xr isdnd 8 -daemon and this manual page were written by -.An Hellmuth Michaelis Aq hm@kts.org . diff --git a/usr.sbin/i4b/isdnd/isdnd.rc.5 b/usr.sbin/i4b/isdnd/isdnd.rc.5 deleted file mode 100644 index d3d2ed894d0b..000000000000 --- a/usr.sbin/i4b/isdnd/isdnd.rc.5 +++ /dev/null @@ -1,1115 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Aug 11 20:07:38 2002] -.\" -.Dd August 11, 2002 -.Dt ISDND.RC 5 -.Os -.Sh NAME -.Nm isdnd.rc -.Nd isdn4bsd ISDN connection management daemon config file format -.Sh DESCRIPTION -The file -.Pa /etc/isdn/isdnd.rc -contains (if not otherwise specified on the command line) the runtime -configuration for the -.Xr isdnd 8 -ISDN connection management daemon which is part of the isdn4bsd package. -.Pp -The configuration file consists of keywords which start in column 1 followed by -one or more spaces or tabs, an equal sign, one or more spaces or tabs -and a keyword dependent parameter value. -.Pp -A line beginning with '#' is treated as a comment line. -.Pp -For keywords requiring the specification of a boolean value, the truth -value can be either -.Em yes -or -.Em on -while the false value can be either -.Em no -or -.Em off . -.Pp -The configuration file consists of one -.Em system -section, one or more optional -.Em controller -sections and one or more -.Em entry -sections. -In the -.Em system -section parameters regarding the daemon operation or parameters -not associated with a single remote connection can be set. -In the -.Em controller -section parameters regarding a particular controller can be set. -In the -.Em entry -section(s) parameters directly associated with a single remote -connection can be set. -.Pp -The following keywords are recognized by -.Nm isdnd : -.Pp -.Bl -tag -width system -.It Li system -This keyword starts the system configuration section. -It must not -have a parameter and may be used only once. -The keyword is mandatory. -The following keywords are valid in the system configuration section: -.Bl -tag -width useacctfile -.It Li acctall -If this parameter is set to -.Em on , -accounting information is written even if the local site was not charged -or no charging information is available or is not subscribed. -(optional) -.It Li acctfile -Specifies the name of the accounting file which is used when the keyword -.Em useacctfile -(see below) is set to -.Em on . -See also system keyword -.Em rotatesuffix . -If this keyword is omitted the system default is used. -(optional) -.It Li add-prefix -If set to -.Em on , -for incoming numbers, have a look at the "type of number" indicator and -adjust the number as specified by the -.Em prefix-national -and -.Em prefix-international -keywords described later. -If this keyword is omitted, the system default (off) is used. -(optional) -.It Li aliasing -If this parameter is set to -.Em on , -alias processing of telephone-number to name is enabled (see also the -.Em aliasfile -keyword below). -The default is off. -(optional) -.It Li aliasfile -Specifies the name of the telephone number-to-name alias database file shared -with the -.Xr isdntel 8 -utility when alias processing is enabled via the -.Em aliasing -keyword. -(optional) -.It Li beepconnect -In full-screen mode, if this parameter is set to -.Em on , -ring the bell when connecting or disconnecting a call. -.It Li extcallattr -If this parameter is set to -.Em on , -the extended caller attributes "screening indicator" and "presentation -indicator" are written to the log-file. -The default is off. -(optional) -.It Li holidayfile -Specifies the name of the holiday file containing the dates of holidays. -This file is used in conjunction with the -.Em valid -keyword to lookup the dates of holidays. -(optional) -.It Li isdntime -If this parameter is set to -.Em on , -date/time information from the exchange (if provided) is written to the -log-file. -The default is off. -(optional) -.It Li mailer -This keyword is used to specify the path/name of a mail program -which is able to use the "-s" flag to specify a subject on its -command line. -In case of a fatal error exit of -.Nm -this program is used to send mail to an administrator specified by -the keyword -.Em mailto . -(optional) -.It Li mailto -This keyword is used to specify the email address of someone to notify -in case of a fatal error exit of -.Nm . -(See also keyword -.Em mailer ) . -(optional) -.It Li monitor-allowed -If this parameter is set to -.Em on -or -.Em yes , -monitoring via a local or remote machine is enabled. -This parameter is optional and is set to -.Em off -by default. -.It Li monitor-port -sets the TCP port number for remote monitoring. -This integer parameter is optional and is set to port 451 by default. -.It Li monitor -This keyword specifies a local socket name or a host or network for remote -monitoring. -The -.Em monitor -specification may either be: -.Pp -.Bl -tag -width Ds -compact -.It Ar the name of a local (UNIX-domain) socket -this MUST start with a "/", example: /var/run/isdn-monitor -.It Ar a dotted-quad host specification -example: 192.168.1.2 -.It Ar a dotted-quad network address with netmask -example: 192.168.1.0/24 -.It Ar a resolvable host name -example: localhost -.It Ar a resolvable network name with netmask -example: up-vision-net/24 -.El -.It Li monitor-access -This keyword specifies the access rights for a previously used -.Em monitor -keyword. -The supported access rights are: -.Pp -.Bl -tag -width Ds -compact -.It Ar fullcmd -.It Ar restrictedcmd -.It Ar channelstate -.It Ar logevents -.It Ar callin -.It Ar callout -.El -.It Li prefix-international -In conjunction with the -.Em add-prefix -switch (see above), specify the prefix number string for incoming numbers -with the international number tag. -If aliases are used, they have to be adjusted accordingly. -(optional) -.It Li prefix-national -In conjunction with the -.Em add-prefix -switch (see above), specify the prefix number string for incoming numbers -with the national number tag. -If aliases are used, they have to be adjusted accordingly. -(optional) -.It Li ratesfile -Specifies the name of the ratesfile. -If this keyword is omitted the system -default is used. -(optional) -.It Li regexpr -This keyword is used to specify regular expressions. -It can be specified -more than once up to a compile time dependent value (currently set to 5 by -the MAX_RE definition in the source). -.Pp -All specified regular expressions are compared to the log strings at runtime -and if a match is found, a program is run with the log text as a parameter -(see also the keyword -.Em regprog -below). -.Pp -For an explanation how regular expressions are specified, please have a -look at -.Xr re_format 7 -and -.Xr regex 3 . -The -.Em extended -regular expression syntax is supported here. -.Pp -Hint: it might be necessary to properly quote the expression to avoid -improper interpretation by the configuration file parser. -(optional) -.It Li regprog -This keyword is used to specify the name of a program which is run in -case a corresponding regular expression is matched by a logging string. -.Nm Isdnd -expects to find the program below the path -.Pa /etc/isdn -which is prepended to the string specified as a parameter to this keyword. -(optional) -.It Li rotatesuffix -Specifies a suffix for renaming the log- and the accounting-filename. -In case -rotatesuffix is used and a USR1 signal is sent to isdnd, the log-file and the -accounting file is not only closed and reopened but the old log-file is also -renamed to the former filename with the rotatesuffix string appended. -If this keyword is omitted, the log-files are just closed and reopened; this -is also the default behavior. -(optional) -.It Li rtprio -Specifies the real-time priority -.Nm isdnd -runs at as an integer value in the range 0...31 with 0 being the highest -priority. -This keyword is optional; if not specified the process priority of -.Nm isdnd -is not touched in any way. -( See also -.Xr rtprio 1 ) . -This keyword is only available if -.Nm -was compiled with -DUSE_RTPRIO. -.It Li useacctfile -If this parameter is set to -.Em on -charging (if available) and accounting information is written to the -accounting file. -(optional) -.El -.It Li controller -This keyword starts the controller configuration section. -It must not -have a parameter and may be used once for every controller. -The keyword -is optional. -The following keywords are valid in a controller -configuration section: -.Bl -tag -width useacctfile -.It Li protocol -This keyword is used to set the D-channel protocol for the S0-bus a -controller is connected to. -The following parameters are currently -supported: -.Pp -.Bl -tag -width calledback -compact -.It Ar dss1 -The DSS1 or so-called "Euro-ISDN" D-channel protocol according to -ITU Recommendations Q.921 and Q.931. -.It Ar d64s -An ISDN leased line with a single B-channel (called D64S in Germany). -.El -.It Li firmware -This keyword is used like -.Li firmware Ns = Ns Ar /path/to/file -to download the -firmware to active controllers supported by the -.Em iavc -driver (AVM B1, T1). -This keyword is supported for all controller types, -and causes -.Dv I4B_CTRL_DOWNLOAD -ioctl to be invoked with the specified file -as an argument. -In systems equipped with both active and passive adapters, -and the passive cards being detected first, dummy -.Ql controller -entries -are required for the passive cards to get the correct firmwares to -correct adapters. -.El -.It Li entry -This keyword starts one configuration entry. -It must not have a parameter. -This keyword must be used at least once. -The following keywords are valid in an entry section: -.Bl -tag -width unitlengthsrc -.It Li answerprog -This keyword is used to specify the name of a program which is run in -case an incoming telephone connection specified -.Em answer -in its configuration entry. -The default name is -.Em answer . -.Nm Isdnd -expects to find this program beneath the path -.Pa /etc/isdn -which is prepended to the string specified as a parameter to this keyword. -(optional) -.It Li alert -is used to specify a time in seconds to wait before accepting a call. -This -keyword is only usable for incoming telephone calls (dialin-reaction = answer). -It is used to have a chance to accept an incoming call on the phone before -the answering machine starts to run. -The minimum value for the alert parameter -is 5 seconds and the maximum parameter allowed is 180 seconds. -(optional) -.It Li b1protocol -The B channel layer 1 protocol used for this connection. -The keyword is mandatory. -The currently configurable values are: -.Pp -.Bl -tag -width Ds -compact -.It Ar hdlc -HDLC framing. -.It Ar raw -No framing at all (used for telephony). -.El -.It Li bcap -Use a special bearer capability for this connection. -The keyword is optional. -.Pp -Any other value than -.Em dov -sets the bearer capability as configured by the -.Em b1protocol -keyword (see above). -The currently configurable values are: -.Pp -.Bl -tag -width Ds -compact -.It Ar dov -This connection is a -.Em Dov (Data over Voice) -connection. -The b1protocol keyword must be set to -.Em hdlc . -This feature is experimental and does work on outgoing calls only. -.El -.It Li budget-calloutperiod -is used to specify a time period in seconds. -Within this period, the number of calls -specified by -.Em budget-calloutncalls -are allowed to succeed, any further attempt to call out will be blocked for the rest -of the time left in the time period. -(optional) -.It Li budget-calloutncalls -The number of outgoing calls allowed within the time period specified by -.Em budget-calloutperiod . -(optional) -.It Li budget-calloutsfile -A path/filename to which the number of successful callouts are written. -The contents of the file is preserved when it exists during startup of isdnd. -The format of this file is: start time, last update time, number of calls. -(optional) -.It Li budget-calloutsfile-rotate -If set to -.Em on -rotate budget-calloutsfile every night when an attempt is made to update -the file on a new day. -The statistics for the previous day are written to -a file with the filename specified by budget-calloutsfile to which a hyphen -and the new day's (!) day of month number is appended. -(optional) -.It Li budget-callbackperiod -.It Li budget-callbackncalls -.It Li budget-callbacksfile -.It Li budget-calloutsfile-rotate -See -.Em budget-calloutperiod , -.Em budget-calloutncalls , -.Em budget-calloutsfile , -and -.Em budget-calloutsfile-rotate -above. -These are used to specify the budgets for calling back a remote site. -.It Li callbackwait -The time in seconds to wait between hanging up the call from a remote site -and calling back the remote site. -(optional) -.It Li calledbackwait -The time in seconds to wait for a remote site calling back the local site -after a call from the local site to the remote site has been made. -(optional) -.It Li clone -This causes the contents of the specified entry to be copied from the -existing named entry to the current one. -When using this feature at least a new entry specific -.Ql name -and -.Ql usrdeviceunit -value should be specified for the current entry. -.It Li connectprog -specifies a program run every time after a connection is established and -address negotiation is complete (i.e.: the connection is usable). -.Nm Isdnd -expects to find the program below the path -.Pa /etc/isdn -which is prepended to the string specified as a parameter to this keyword. -The programs specified by connect and disconnect will get the following -command line arguments: -d (device) -f (flag) [ -a (addr) ] where -.Em device -is the name of device, e.g.\& "isp0", -.Em flag -will be "up" if connection just got up, or "down" if interface changed to down -state and -.Em addr -the address that got assigned to the interface as a dotted-quad ip address -(optional, only if it can be figured out by isdnd). -(optional) -.It Li dialin-reaction -Used to specify what to do when an incoming connection request is received. -The keyword is mandatory. -The currently supported parameters are: -.Pp -.Bl -tag -width calledback -compact -.It Ar accept -Accept an incoming call. -.It Ar reject -Reject an incoming call. -.It Ar ignore -Ignore an incoming call. -.It Ar answer -Start telephone answering for an incoming voice call. -.It Ar callback -When a remote site calls, hang up and call back the remote site. -.El -.It Li dialout-type -This keyword is used to configure what type of dialout mode is used. -The keyword is mandatory. -The currently supported parameters are: -.Pp -.Bl -tag -width Ds -compact -.It Ar normal -Normal behavior, call the remote site which is supposed to accept the call. -.It Ar calledback -Callback behavior, call the remote side which rejects the call and calls -us back. -.El -.It Li dialrandincr -When dialing or re-dialing and this parameter is set to -.Em on , -the dial retry time is added with a random value (currently 0...3 seconds) -to minimize the chance of two sites dialing synchronously so each gets a busy -each time it dials because the other side is also dialing. -.It Li dialretries -The number of dialing retries before giving up. -Setting this to -.Em -1 -gives an unlimited number of retries! -(optional) -.It Li direction -This keyword is used to configure if incoming and outgoing, incoming-only or -outgoing only connections are possible. -The keyword is optional, the default is -.Em inout . -.Pp -The currently supported parameters are: -.Pp -.Bl -tag -width Ds -compact -.It Ar inout -Normal behavior, connection establishment is possible from remote and local. -.It Ar in -Only incoming connections are possible. -.It Ar out -Only outgoing connections are possible. -.El -.It Li disconnectprog -specifies a program run every time after a connection was shut down. -.Nm Isdnd -expects to find the program below the path -.Pa /etc/isdn -which is prepended to the string specified as a parameter to this keyword. -(optional) -.It Li downtries -is used to configure the number of unsuccessful tries (= retry cycles!) before -the interface is disabled (for -.Em downtime -seconds). -(see also the keyword -.Em usedown -further up). -This keyword is optional. -.It Li downtime -is used to configure the time in seconds an interface is disabled -after the configured number of -.Em downtries . -(see also the keyword -.Em usedown -further up). -This keyword is optional and is set to 60 seconds by default. -.It Li earlyhangup -A (safety) time in seconds which specifies the time to hang up before an -expected next charging unit will occur. -(optional) -.It Li idle-algorithm-outgoing -The algorithm used to determine when to hang up an outgoing call when the -line becomes idle. -The current algorithms are: -.Pp -.Bl -tag -width calledback -compact -.It Ar fix-unit-size -idle algorithm which assumes fixed sized charging units during the whole call. -.It Ar var-unit-size -idle algorithm which assumes that the charging is time based after the first -units time has expired. -.El -.It Li idletime-outgoing -The time in seconds an outgoing connection must be idle before hanging up. -An idle timeout of zero disables this functionality. -(optional) -.It Li idletime-incoming -The time in seconds an incoming connection must be idle before hanging up. -An idle timeout of zero disables this functionality. -(optional) -.It Li isdncontroller -The ISDN controller number to be used for connections for this entry. -(mandatory) -.It Li isdnchannel -The ISDN controller channel number to be used for connections for this entry. -In case a channel is explicitly selected here, the SETUP message will request -this channel but mark the request as -.Em preferred -(the indicated channel is preferred) instead of exclusive (only the indicated -channel is acceptable). -Thus the exchange is still free to select another -than the requested channel! -(mandatory) -.It Li isdntxdel-incoming -A delay value suitable for the -.Xr timeout 9 -kernel subroutine to delay the transmission of the first packet after a -successful connection is made by this value for -.Em incoming -ISDN connections. -The specification unit is 1/100 second. -A zero (0) disables -this feature and is the default value. -This feature is implemented (and makes -sense only) for the -.Xr i4bipr 4 -IP over raw HDLC ISDN driver. -(optional) -.It Li isdntxdel-outgoing -A delay value suitable for the -.Xr timeout 9 -kernel subroutine to delay the transmission of the first packet after a -successful connection is made by this value for -.Em outgoing -ISDN connections. -The specification unit is 1/100 second. -A zero (0) disables -this feature and is the default value. -This feature is implemented (and makes -sense only) for the -.Xr i4bipr 4 -IP over raw HDLC ISDN driver. -(optional) -.It Li local-phone-dialout -The local telephone number used when the local site dials out. -When dialing -out to a remote site, the number specified here is put into the -.Em "Calling Party Number Information Element" . -.Pp -This keyword is mandatory for the -.Em ipr -user-land interfaces. -.It Li local-subaddr-dialout -The local subaddress used when the local site dials out. -When dialing -out to a remote site, the subaddress specified here is put into the -.Em "Calling Party Subaddress Information Element" . -.Pp -This keyword is mandatory for the -.Em ipr -user-land interfaces. -.It Li local-phone-incoming -The local telephone number used for verifying the destination of incoming -calls. -When a remote site dials in, this number is used to verify that it -is the local site which the remote site wants to connect to. -It is compared -with the -.Em "Called Party Number Information Element" -got from the telephone exchange. -.Pp -This keyword is mandatory for the -.Em ipr -interfaces. -.It Li local-subaddr-incoming -The local subaddress used for verifying the destination of incoming -calls. -When a remote site dials in, this subaddress is used to verify that it -is the local site which the remote site wants to connect to. -It is compared -with the -.Em "Called Party Subaddress Information Element" -got from the telephone exchange. -.Pp -This keyword is mandatory for the -.Em ipr -interfaces. -.It Li name -Defines a symbolic name for this configuration entry. -Its purpose is to -use this name in the full-screen display for easy identification of a link -to a remote site and for accounting purposes. -(mandatory) -.It Li maxconnecttime -Specify a maximum connection time in seconds. -Use this to define an absolute -upper limit for a connection on the B-channel to last. -.Em CAUTION: -This feature is used to limit the connection time, _not_ number of attempts -to establish a connection: when using this please take care to also enable -the use of budgets to limit the connection establish attempts (otherwise -the line will cycle thru an endless loop of connections and reconnections -which will have an undesired effect on your telco bill)! -.It Li ppp-auth-paranoid -If set to -.Em no , -the remote site is not required to prove its authentity for connections -that are initiated by the local site. -The default is -.Em yes -and requires the remote site to always authenticate. -.Pp -This keyword is only used if -.Em ppp-send-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-auth-rechallenge -Set to -.Em no , -if the other side does not support re-challenging for chap. -The default is -.Em yes , -which causes verification of the remote site's authentity once in a while. -.Pp -This keyword is only used if -.Em ppp-expect-auth -has been set to chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-expect-auth -The local site expects the authentity of the remote site to be proved by -the specified method. -The supported methods are: -.Pp -.Bl -tag -width Ds -compact -.It Ar none -Do not require the other side to authenticate. -Typical uses are dial-out to an ISP -(many ISPs do not authenticate themselves to clients) -or offering anonymous dial-in at the local site. -.It Ar chap -The preferred authentication method, which does not require a password to be sent -in the clear. -.It Ar pap -The unprotected authentication method, which allows anybody watching the wire -to grab name and password. -.El -.Pp -If -.Em ppp-auth-paranoid -is set to -.Em no -(the default is -.Em yes ) -outgoing connections will not require the remote site to authenticate itself. -.Pp -This keyword is only used for the -.Em isp -PPP interfaces. -(optional) -.It Li ppp-expect-name -The name that has to be provided by the remote site to prove its authentity. -.Pp -This keyword is only used if -.Em ppp-expect-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-expect-password -The secret that has to be provided by the remote site to prove its authentity. -.Pp -This keyword is only used if -.Em ppp-expect-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-send-auth -The authentication method required by the remote site. -The currently supported parameters are: -.Pp -.Bl -tag -width Ds -compact -.It Ar none -The remote site does not expect or support authentication. -.It Ar chap -The preferred authentication method, which does not require a password to be sent -in the clear. -.It Ar pap -The unprotected authentication method, which allows anybody watching the wire -to grab name and password. -.El -.Pp -This keyword is only used for the -.Em isp -PPP interfaces. -(optional) -.It Li ppp-send-name -The authentication name sent to the remote site. -.Pp -This keyword is only used if -.Em ppp-send-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ppp-send-password -The secret used to prove the local site's authentity to the remote site. -.Pp -This keyword is only used if -.Em ppp-send-auth -has been set to pap or chap for an -.Em isp -PPP interface. -(optional) -.It Li ratetype -The rate entry used from the rates file. -(optional) -.Pp -For example, ratetype=0 selects lines beginning "ra0" in /etc/isdn/isdnd.rates; -(typically ra0 lines are a set of tables for local call rates on different -days of the week & times per day). -.It Li recoverytime -The time in seconds to wait between dial retries. -(optional) -.It Li remdial-handling -is used to specify the dialout behavior in case more than one outgoing -number is specified. -The currently supported parameters are: -.Pp -.Bl -tag -width Ds -compact -.It Ar first -For every new (non-retry) call setup, start with the first number. -.It Ar last -For every new (non-retry) call setup, start with the last number with -which a successful connection was made. -.It Ar next -For every new (non-retry) call setup, start with the next number which -follows the last one used. -.El -.It Li remote-phone-dialout -The remote telephone number used when the local site dials out. -When dialing -out to a remote site, the number specified here is put into the -.Em "Called Party Number Information Element" . -.Pp -This keyword is mandatory for the -.Em ipr -interfaces. -It may be specified more than once to try to dial to several -numbers until one succeeds. -.It Li remote-subaddr-dialout -The remote subaddress used when the local site dials out. -When dialing -out to a remote site, the subaddress specified here is put into the -.Em "Called Party Subaddress Information Element" . -.Pp -This keyword is mandatory for the -.Em ipr -interfaces. -It may be specified more than once to linked it to the -remote-phone-dialout numbers until one succeeds. -.It Li remote-phone-incoming -The remote telephone number used to verify an incoming call. -When a remote site -dials in, this number is used to verify that it is the correct remote site -which is herewith authorized to connect into the local system. -This parameter -is compared against the -.Em "Calling Party Number Information Element" -got from the telephone exchange. -.Pp -This keyword is mandatory for the ipr interfaces. -.Pp -This keyword may have a wildcard parameter '*' to permit anyone dialing in. -.It Li remote-subaddr-incoming -The remote subaddress used to verify an incoming call. -When a remote site -dials in, this subaddress is used to verify that it is the correct remote site -which is herewith authorized to connect into the local system. -This parameter -is compared against the -.Em "Calling Party Subaddress Information Element" -got from the telephone exchange. -.Pp -This keyword is mandatory for the ipr interfaces. -.Pp -This keyword may have a wildcard parameter '*' to permit anyone dialing in. -.It Li unitlength -The length of a charging unit in seconds. -This is used in conjunction with -the idletime to decide when to hang up a connection. -(optional) -.It Li unitlengthsrc -This keyword is used to specify from which source -.Xr isdnd 8 -takes the unitlength for short-hold mode. -The currently configurable values are: -.Pp -.Bl -tag -width Ds -compact -.It Ar none -Then unitlength is not specified anywhere. -.It Ar cmdl -Use the unitlength specified on the command line. -.It Ar conf -Use the unitlength specified in the configuration file with the keyword -.Em unitlength . -.It Ar rate -Use the unitlength from the ratesfile specified in the configuration -file with the keyword -.Em ratetype . -.It Ar aocd -Use a dynamically calculated unitlength in case AOCD is subscribed on -the ISDN line. -(AOCD is an acronym for ``Advice Of Charge During the call'' -which is a service provided by the telecommunications (ie phone) provider, -to indicate billable units). -.El -.It Li usrdevicename -Specifies the user-land interface which is used for interfacing ISDN B channel -data to the user-land. -The keyword is mandatory. -This keyword accepts the following parameters: -.Pp -.Bl -tag -width Ds -compact -.It Ar ipr -This parameter configures a raw HDLC IP over ISDN interface. -.It Ar isp -This parameter configures a synchronous PPP over ISDN interface. -.It Ar rbch -This specifies a Raw B CHannel access interface. -.It Ar tel -ISDN telephony. -.It Ar ing -configures an ISDN B-channel to NetGraph interface. -.El -.It Li usrdeviceunit -Specifies the unit number for the device which is specified with -usrdevicename. -.It Li usedown -is used to enable the use of the keywords -.Em downtries -and -.Em downtime -in the entries section(s). -It is used in the -.Nm isdnd -daemon to dynamically enable and disable the IP interfaces to avoid excessive -dialing activities in case of transient failures (such as busy lines). -This parameter is optional and is set to -.Em off -by default. -.It Li usesubaddr -is used to enable the use of subaddresses. -This parameter is optional and is set to -.Em off -by default. -.It Li valid -.Em Note : -this feature is considered experimental! -The parameter to this keyword is a string specifying a time range within -which this entry is valid. -The time specification consists of a list of weekdays and/or a holiday -indicator ( see also the -.Em holidayfile -keyword in the system section ) separated by commas followed by an optional -daytime range specification in the form hh:mm-hh:mm. -The weekdays are specified as numbers from 0 to 6 and the number 7 for -holidays: -.Pp -.Bl -tag -width Ds -compact -.It Ar 0 -Sunday -.It Ar 1 -Monday -.It Ar 2 -Tuesday -.It Ar 3 -Wednesday -.It Ar 4 -Thursday -.It Ar 5 -Friday -.It Ar 6 -Saturday -.It Ar 7 -a Holiday -.El -.Pp -The following examples describe the "T-ISDN xxl" tariff of the german Telekom: -.Bl -tag -width Ds -compact -.It Ar 1,2,3,4,5,6,09:00-18:00 -Monday through Saturday, daytime 9:00 to 18:00 -.It Ar 1,2,3,4,5,6,18:00-9:00 -Monday through Saturday, nighttime 18:00 to 9:00 -.It Ar 0,7 -Sunday and on holidays, all 24 hours -.El -.Pp -The use of this keyword is optional. -.El -.El -.Sh IDLETIME CALCULATION AND SHORT-HOLD MODE -.Bl -tag -width "incoming calls -.It Li incoming calls -It is assumed that the calling side knows most about charging structures and -such and as a consequence only the keyword -.Em idletime-incoming -has a function for incoming calls. -.Pp -For incoming calls the line is constantly monitored, and in case there was -not traffic taking place for the time in seconds specified by -.Em idletime-incoming -the call is closed. -.Pp -Typically, -.Em idletime-incoming -is used as a last resort and is therefore set much higher than a charging -unit time: typical values are one to five minutes. -.It Li outgoing calls -Outgoing call disconnect time can be setup in one of three ways: -.Bl -tag -width "shorthold mode -.It Li simple mode -For simple mode, the -.Em idle-algorithm-outgoing -must be -.Em fix-unit-size -and the selected -.Em unitlength -must be 0 (zero) and -.Em idletime-outgoing -greater zero. -.Pp -The outgoing traffic is constantly monitored, and in case there was -not traffic taking place for the time in seconds specified by -.Em idletime-outgoing -the call is closed. -.Pp -Typical values in simple mode are 10 to 30 seconds. -.It Li shorthold mode for fixed unit charging -For shorthold mode, the -.Em idle-algorithm-outgoing -must be -.Em fix-unit-size -and the selected -.Em unitlength -and -.Em idletime-outgoing -must be greater than 0 (zero); -.Em earlyhangup -must be >= 0 (zero). -.Bd -literal -|<unchecked-window>|<checkwindow>|<safetywindow>| -| | | | -+------------------+-------------+--------------+ -| | | | -| |<-idle-time->|<earlyhangup->| -|<--------------unitlength--------------------->| -.Ed -.Pp -During the unchecked window which is (unitlength - (idle-time+earlyhangup)) -in length, no idle check is done. -After the unchecked window has ended, -the line is checked for idle-time length if no traffic takes place. -In case -there was traffic detected in the check-window, the same procedure is restarted -at the beginning of the next unit. -In case no traffic was detected during -the check-window, the line is closed at the end of the check window. -.Pp -Notice: -.Em unitlength -must (!) be greater than the sum of -.Em idletime-outgoing -and -.Em earlyhangup ! -.It Li shorthold mode for variable unit charging -For shorthold mode, the -.Em idle-algorithm-outgoing -must be -.Em var-unit-size -and the selected -.Em unitlength -and -.Em idletime-outgoing -must be greater than 0 (zero); -.Pp -This shorthold mode is suitable when your calls are billed on -the elapse time of the call plus a fixed connection charge. -For example British Telecom bill this way. -.Pp -Each call is divided into two periods, the first is the -.Em unchecked -period and the second is the -.Em checked . -The -.Em checked -period starts 1 second before the first units time expires. -.Pp -During the -.Em checked -period if there is no traffic for -.Em idle-time -seconds the call is disconnected. -.Pp -.Bd -literal -|<---unchecked------------------>|<------checked------> -+------------------+-------------+ -| |<-idle-time->| -|<--------------unitlength------->| -.Ed -.Pp -Experience shows that useful values for idle-time are from 15 to 30 seconds. -.Pp -If idle-time is too short an application that is not yet finished with the -network will cause a new call to be placed. -.Pp -.El -.El -.Sh FILES -.Bl -tag -width /etc/isdn/isdnd.rc -compact -.It Pa /etc/isdn/isdnd.rc -The default configuration file for the -.Nm isdnd -ISDN daemon. -.El -.Sh SEE ALSO -.Xr regex 3 , -.Xr re_format 7 , -.Xr isdnd 8 , -.Xr isdnmonitor 8 -.Sh AUTHORS -.An -nosplit -The -.Xr isdnd 8 -daemon and this manual page were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -.Pp -Additions to this manual page by -.An Barry Scott Aq barry@scottb.demon.co.uk . diff --git a/usr.sbin/i4b/isdnd/log.c b/usr.sbin/i4b/isdnd/log.c deleted file mode 100644 index 41179091d176..000000000000 --- a/usr.sbin/i4b/isdnd/log.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - logging routines - * ----------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:07:18 2006] - * - *---------------------------------------------------------------------------*/ - -#ifdef __FreeBSD__ -#include <osreldate.h> -#endif - -#include "isdnd.h" - -#define LOGBUFLEN 256 - -extern int do_monitor; -extern int accepted; -extern FILE *logfp; - -static void check_reg(char *logstring); - -struct logtab { - char *text; - int pri; -}; - -/*---------------------------------------------------------------------------* - * table for converting internal log levels into syslog levels - *---------------------------------------------------------------------------*/ -static struct logtab logtab[] = { - {"ERR", LOG_ERR}, /* error conditions */ - {"WRN", LOG_WARNING}, /* warning conditions, nonfatal */ - {"DMN", LOG_NOTICE}, /* significant conditions of the daemon */ - {"CHD", LOG_INFO}, /* informational, call handling */ - {"DBG", LOG_DEBUG}, /* debug messages */ - {"MER", LOG_ERR}, /* monitor error conditions */ - {"PKT", LOG_INFO} /* packet logging */ -}; - -/*---------------------------------------------------------------------------* - * initialize logging - *---------------------------------------------------------------------------*/ -void -init_log(void) -{ - int i; - - if(uselogfile) - { - if((logfp = fopen(logfile, "a")) == NULL) - { - fprintf(stderr, "ERROR, cannot open logfile %s: %s\n", - logfile, strerror(errno)); - exit(1); - } - - /* set unbuffered operation */ - - setvbuf(logfp, (char *)NULL, _IONBF, 0); - } - else - { -#if DEBUG - if(do_debug && do_fork == 0 && do_fullscreen == 0) - (void)openlog("isdnd", - LOG_PID|LOG_CONS|LOG_NDELAY|LOG_PERROR, - logfacility); - else -#endif - (void)openlog("isdnd", LOG_PID|LOG_CONS|LOG_NDELAY, - logfacility); - } - - /* initialize the regexp array */ - - for(i = 0; i < MAX_RE; i++) - { - char *p; - char buf[64]; - - snprintf(buf, sizeof(buf), "%s%d", REGPROG_DEF, i); - - rarr[i].re_flg = 0; - - if((p = malloc(strlen(buf) + 1)) == NULL) - { - llog(LL_DBG, "init_log: malloc failed: %s", strerror(errno)); - do_exit(1); - } - - strcpy(p, buf); - - rarr[i].re_prog = p; - } -} - -/*---------------------------------------------------------------------------* - * finish logging - *---------------------------------------------------------------------------*/ -void -finish_log(void) -{ - if(uselogfile && logfp) - { - fflush(logfp); - fclose(logfp); - } - else - { - (void)closelog(); - } -} - -/*---------------------------------------------------------------------------* - * place entry into logfile - *---------------------------------------------------------------------------*/ -void -llog(int what, const char *fmt, ...) -{ - char buffer[LOGBUFLEN]; - register char *dp; - va_list ap; - - va_start(ap, fmt); - vsnprintf(buffer, LOGBUFLEN-1, fmt, ap); - va_end(ap); - - dp = getlogdatetime(); /* get time string ptr */ - -#ifdef USE_CURSES - - /* put log on screen ? */ - - if((do_fullscreen && curses_ready) && - ((!debug_noscreen) || (debug_noscreen && (what != LL_DBG)))) - { - wprintw(lower_w, "%s %s %-.*s\n", dp, logtab[what].text, - -/* - * FreeBSD-current integrated ncurses. Since then it is no longer possible - * to write to the last column in the logfilewindow without causing an - * automatic newline to occur resulting in a blank line in that window. - */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 400009 -#warning "FreeBSD ncurses is buggy: write to last column = auto newline!" - COLS-((strlen(dp))+(strlen(logtab[what].text))+3), buffer); -#else - (int)(COLS-((strlen(dp))+(strlen(logtab[what].text))+2)), buffer); -#endif - wrefresh(lower_w); - } -#endif - -#ifdef I4B_EXTERNAL_MONITOR - if(what != LL_MER) /* don't send monitor errs, endless loop !!! */ - monitor_evnt_log(logtab[what].pri, logtab[what].text, buffer); -#endif - - if(uselogfile) - { - fprintf(logfp, "%s %s %s\n", dp, logtab[what].text, buffer); - } - else - { - register char *s = buffer; - - /* strip leading spaces from syslog output */ - - while(*s && (*s == ' ')) - s++; - - syslog(logtab[what].pri, "%s %s", logtab[what].text, s); - } - - -#if DEBUG - if(what != LL_DBG) /* don't check debug logs, endless loop !!! */ -#endif - check_reg(buffer); -} - -/*---------------------------------------------------------------------------* - * return ptr to static area containing date/time - *---------------------------------------------------------------------------*/ -char * -getlogdatetime() -{ - static char logdatetime[41]; - time_t tim; - register struct tm *tp; - - tim = time(NULL); - tp = localtime(&tim); - strftime(logdatetime,40,I4B_TIME_FORMAT,tp); - return(logdatetime); -} - -/*---------------------------------------------------------------------------* - * check for a match in the regexp array - *---------------------------------------------------------------------------*/ -static void -check_reg(char *logstring) -{ - register int i; - - for(i = 0; i < MAX_RE; i++) - { - if(rarr[i].re_flg && (!regexec(&(rarr[i].re), logstring, (size_t) 0, NULL, 0))) - { - char* argv[3]; - argv[0] = rarr[i].re_prog; - argv[1] = logstring; - argv[2] = NULL; - - exec_prog(rarr[i].re_prog, argv); - break; - } - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/main.c b/usr.sbin/i4b/isdnd/main.c deleted file mode 100644 index df531b703210..000000000000 --- a/usr.sbin/i4b/isdnd/main.c +++ /dev/null @@ -1,840 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - main program entry - * ------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:03:56 2006] - * - *---------------------------------------------------------------------------*/ - -#include <locale.h> -#include <paths.h> - -#ifdef I4B_EXTERNAL_MONITOR -#include "monitor.h" -#endif - -#define MAIN -#include "isdnd.h" -#undef MAIN - -#ifdef I4B_EXTERNAL_MONITOR - -#ifdef I4B_NOTCPIP_MONITOR -/* monitor via local socket */ -static void mloop(int sockfd); -#else /* I4B_NOTCPIP_MONITOR */ -/* monitor via local and tcp/ip socket */ -static void mloop(int localsock, int remotesock); -#endif /* I4B_NOTCPIP_MONITOR */ - -#else /* I4B_EXTERNAL_MONITOR */ -/* no monitoring at all */ -static void mloop(); -#endif /* I4B_EXTERNAL_MONITOR */ - -#ifdef USE_CURSES -static void kbdrdhdl(void); -#endif - -static void isdnrdhdl(void); -static void usage(void); - -#define MSG_BUF_SIZ 1024 /* message buffer size */ - -/*---------------------------------------------------------------------------* - * usage display and exit - *---------------------------------------------------------------------------*/ -static void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "isdnd - i4b ISDN manager daemon, version %02d.%02d.%d\n", VERSION, REL, STEP); -#ifdef DEBUG - fprintf(stderr, " usage: isdnd [-c file] [-d level] [-F] [-f [-r dev] [-t termtype]]\n"); -#else - fprintf(stderr, " usage: isdnd [-c file] [-F] [-f [-r dev] [-t termtype]]\n"); -#endif - fprintf(stderr, " [-l] [-L file] [-m] [-s facility] [-u time]\n"); - fprintf(stderr, " -c <filename> configuration file name (def: %s)\n", CONFIG_FILE_DEF); -#ifdef DEBUG - fprintf(stderr, " -d <level> set debug flag bits:\n"); - fprintf(stderr, " general = 0x%04x, rates = 0x%04x, timing = 0x%04x\n", DL_MSG, DL_RATES, DL_TIME); - fprintf(stderr, " state = 0x%04x, retry = 0x%04x, dial = 0x%04x\n", DL_STATE, DL_RCVRY, DL_DIAL); - fprintf(stderr, " process = 0x%04x, kernio = 0x%04x, ctrlstat = 0x%04x\n", DL_PROC, DL_DRVR, DL_CNST); - fprintf(stderr, " rc-file = 0x%04x, budget = 0x%04x, valid = 0x%04x\n", DL_RCCF, DL_BDGT, DL_VALID); - fprintf(stderr, " -dn no debug output on fullscreen display\n"); -#endif - fprintf(stderr, " -f fullscreen status display\n"); - fprintf(stderr, " -F do not become a daemon process\n"); - fprintf(stderr, " -l use a logfile instead of syslog\n"); - fprintf(stderr, " -L <file> use file instead of %s for logging\n", LOG_FILE_DEF); - fprintf(stderr, " -P pretty print real config to stdout and exit\n"); - fprintf(stderr, " -r <device> redirect output to other device (for -f)\n"); - fprintf(stderr, " -s <facility> use facility instead of %d for syslog logging\n", LOG_LOCAL0 >> 3); - fprintf(stderr, " -t <termtype> terminal type of redirected screen (for -f)\n"); - fprintf(stderr, " -u <time> length of a charging unit in seconds\n"); -#ifdef I4B_EXTERNAL_MONITOR - fprintf(stderr, " -m inhibit network/local monitoring (protocol %02d.%02d)\n", MPROT_VERSION, MPROT_REL); -#endif - fprintf(stderr, "\n"); - exit(1); -} - -/*---------------------------------------------------------------------------* - * program entry - *---------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - int i; - msg_vr_req_t mvr; - -#ifdef I4B_EXTERNAL_MONITOR - int sockfd = -1; /* local monitor socket */ -#ifndef I4B_NOTCPIP_MONITOR - int remotesockfd = -1; /* tcp/ip monitor socket */ -#endif -#endif - - setlocale (LC_ALL, ""); - - while ((i = getopt(argc, argv, "mc:d:fFlL:Pr:s:t:u:")) != -1) - { - switch (i) - { -#ifdef I4B_EXTERNAL_MONITOR - case 'm': - inhibit_monitor = 1; - break; -#endif - - case 'c': - configfile = optarg; - break; - -#ifdef DEBUG - case 'd': - if(*optarg == 'n') - debug_noscreen = 1; - else if((sscanf(optarg, "%i", &debug_flags)) == 1) - do_debug = 1; - else - usage(); - break; -#endif - - case 'f': - do_fullscreen = 1; - do_fork = 0; -#ifndef USE_CURSES - fprintf(stderr, "Sorry, no fullscreen mode available - daemon compiled without USE_CURSES\n"); - exit(1); -#endif - break; - - case 'F': - do_fork = 0; - break; - - case 'l': - uselogfile = 1; - break; - - case 'L': - strlcpy(logfile, optarg, sizeof(logfile)); - break; - - case 'P': - do_print = 1; - break; - - case 'r': - rdev = optarg; - do_rdev = 1; - break; - - case 's': - if(isdigit(*optarg)) - { - int facility; - logfacility = strtoul(optarg, NULL, 10); - facility = logfacility << 3; - - if((facility < LOG_KERN) || - (facility > LOG_FTP && facility < LOG_LOCAL0) || - (facility > LOG_LOCAL7)) - { - fprintf(stderr, "Error, option -s has invalid logging facility %d", logfacility); - usage(); - } - logfacility = facility; - } - else - { - fprintf(stderr, "Error: option -s requires a numeric argument!\n"); - usage(); - } - break; - - case 't': - ttype = optarg; - do_ttytype = 1; - break; - - case 'u': - if(isdigit(*optarg)) - { - unit_length = strtoul(optarg, NULL, 10); - if(unit_length < ULSRC_CMDLMIN) - unit_length = ULSRC_CMDLMIN; - else if(unit_length > ULSRC_CMDLMAX) - unit_length = ULSRC_CMDLMAX; - got_unitlen = 1; - } - else - { - fprintf(stderr, "Error: option -T requires a numeric argument!\n"); - usage(); - } - break; - - case '?': - default: - usage(); - break; - } - } -#ifdef DEBUG - if(!do_debug) - debug_noscreen = 0; -#endif - - if(!do_print) - { - umask(UMASK); /* set our umask ... */ - - init_log(); /* initialize the logging subsystem */ - } - - check_pid(); /* check if we are already running */ - - if(!do_print) - { - if(do_fork || (do_fullscreen && do_rdev)) /* daemon mode ? */ - daemonize(); - - write_pid(); /* write our pid to file */ - - /* set signal handler(s) */ - - signal(SIGCHLD, sigchild_handler); /* process handling */ - signal(SIGHUP, rereadconfig); /* reread configuration */ - signal(SIGUSR1, reopenfiles); /* reopen acct/log files*/ - signal(SIGPIPE, SIG_IGN); /* handled manually */ - signal(SIGINT, do_exit); /* clean up on SIGINT */ - signal(SIGTERM, do_exit); /* clean up on SIGTERM */ - signal(SIGQUIT, do_exit); /* clean up on SIGQUIT */ - } - - /* open isdn device */ - - if((isdnfd = open(I4BDEVICE, O_RDWR)) < 0) - { - llog(LL_ERR, "main: cannot open %s: %s", I4BDEVICE, strerror(errno)); - exit(1); - } - - /* check kernel and userland have same version/release numbers */ - - if((ioctl(isdnfd, I4B_VR_REQ, &mvr)) < 0) - { - llog(LL_ERR, "main: ioctl I4B_VR_REQ failed: %s", strerror(errno)); - do_exit(1); - } - - if(mvr.version != VERSION) - { - llog(LL_ERR, "main: version mismatch, kernel %d, daemon %d", mvr.version, VERSION); - do_exit(1); - } - - if(mvr.release != REL) - { - llog(LL_ERR, "main: release mismatch, kernel %d, daemon %d", mvr.release, REL); - do_exit(1); - } - - if(mvr.step != STEP) - { - llog(LL_ERR, "main: step mismatch, kernel %d, daemon %d", mvr.step, STEP); - do_exit(1); - } - - /* init controller state array */ - - init_controller(); - - /* read runtime configuration file and configure ourselves */ - - configure(configfile, 0); - - if(config_error_flag) - { - llog(LL_ERR, "there were %d error(s) in the configuration file, terminating!", config_error_flag); - exit(1); - } - - /* set controller ISDN protocol */ - - init_controller_protocol(); - - /* init active controllers, if any */ - - signal(SIGCHLD, SIG_IGN); /*XXX*/ - - init_active_controller(); - - signal(SIGCHLD, sigchild_handler); /*XXX*/ - - /* handle the rates stuff */ - - if((i = readrates(ratesfile)) == ERROR) - { - if(rate_error != NULL) - llog(LL_ERR, "%s", rate_error); - exit(1); - } - - if(i == GOOD) - { - got_rate = 1; /* flag, ratesfile read and ok */ - DBGL(DL_RCCF, (llog(LL_DBG, "ratesfile %s read successfully", ratesfile))); - } - else - { - if(rate_error != NULL) - llog(LL_WRN, "%s", rate_error); - } - - /* if writing accounting info, open file, set unbuffered */ - - if(useacctfile) - { - if((acctfp = fopen(acctfile, "a")) == NULL) - { - llog(LL_ERR, "ERROR, can't open acctfile %s for writing, terminating!", acctfile); - exit(1); - } - setvbuf(acctfp, (char *)NULL, _IONBF, 0); - } - - /* initialize alias processing */ - - if(aliasing) - init_alias(aliasfile); - - /* init holidays */ - - init_holidays(holidayfile); - - /* init remote monitoring */ - -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor) - { - monitor_init(); - sockfd = monitor_create_local_socket(); -#ifndef I4B_NOTCPIP_MONITOR - remotesockfd = monitor_create_remote_socket(monitorport); -#endif - } -#endif - - /* in case fullscreendisplay, initialize */ - -#ifdef USE_CURSES - if(do_fullscreen) - { - init_screen(); - } -#endif - - /* init realtime priority */ - -#ifdef USE_RTPRIO - if(rt_prio != RTPRIO_NOTUSED) - { - struct rtprio rtp; - - rtp.type = RTP_PRIO_REALTIME; - rtp.prio = rt_prio; - - if((rtprio(RTP_SET, getpid(), &rtp)) == -1) - { - llog(LL_ERR, "rtprio failed: %s", strerror(errno)); - do_exit(1); - } - } -#endif - - starttime = time(NULL); /* get starttime */ - - srandom(580403); /* init random number gen */ - - mloop( /* enter loop of no return .. */ -#ifdef I4B_EXTERNAL_MONITOR - sockfd -#ifndef I4B_NOTCPIP_MONITOR - , remotesockfd -#endif -#endif - ); - do_exit(0); - return(0); -} - -/*---------------------------------------------------------------------------* - * program exit - *---------------------------------------------------------------------------*/ -void -do_exit(int exitval) -{ - close_allactive(); - - unlink(PIDFILE); - - llog(LL_DMN, "daemon terminating, exitval = %d", exitval); - -#ifdef USE_CURSES - if(do_fullscreen) - endwin(); -#endif - -#ifdef I4B_EXTERNAL_MONITOR - monitor_exit(); -#endif - - exit(exitval); -} - -/*---------------------------------------------------------------------------* - * program exit - *---------------------------------------------------------------------------*/ -void -error_exit(int exitval, const char *fmt, ...) -{ - close_allactive(); - - unlink(PIDFILE); - - llog(LL_DMN, "fatal error, daemon terminating, exitval = %d", exitval); - -#ifdef USE_CURSES - if(do_fullscreen) - endwin(); -#endif - -#ifdef I4B_EXTERNAL_MONITOR - monitor_exit(); -#endif - - if(mailto[0] && mailer[0]) - { - -#define EXITBL 2048 - - char ebuffer[EXITBL]; - char sbuffer[EXITBL]; - va_list ap; - - va_start(ap, fmt); - vsnprintf(ebuffer, EXITBL-1, fmt, ap); - va_end(ap); - - signal(SIGCHLD, SIG_IGN); /* remove handler */ - - snprintf(sbuffer, sizeof(sbuffer), "%s%s%s%s%s%s%s%s", - "cat << ENDOFDATA | ", - mailer, - " -s \"i4b isdnd: fatal error, terminating\" ", - mailto, - "\nThe isdnd terminated because of a fatal error:\n\n", - ebuffer, - "\n\nYours sincerely,\n the isdnd\n", - "\nENDOFDATA\n"); - system(sbuffer); - } - - exit(exitval); -} - -/*---------------------------------------------------------------------------* - * main loop - *---------------------------------------------------------------------------*/ -static void -mloop( -#ifdef I4B_EXTERNAL_MONITOR - int localmonitor -#ifndef I4B_NOTCPIP_MONITOR - , int remotemonitor -#endif -#endif -) -{ - fd_set set; - struct timeval timeout; - int ret; - int high_selfd; - - /* go into loop */ - - llog(LL_DMN, "i4b isdn daemon started (pid = %d)", getpid()); - - for(;;) - { - FD_ZERO(&set); - -#ifdef USE_CURSES - if(do_fullscreen) - FD_SET(fileno(stdin), &set); -#endif - - FD_SET(isdnfd, &set); - - high_selfd = isdnfd; - -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor) - { - if (localmonitor != -1) { - /* always watch for new connections */ - FD_SET(localmonitor, &set); - if(localmonitor > high_selfd) - high_selfd = localmonitor; - } -#ifndef I4B_NOTCPIP_MONITOR - if (remotemonitor != -1) { - FD_SET(remotemonitor, &set); - if(remotemonitor > high_selfd) - high_selfd = remotemonitor; - } -#endif - - /* if there are client connections, let monitor module - * enter them into the fdset */ - if(accepted) - { - monitor_prepselect(&set, &high_selfd); - } - } -#endif - - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - ret = select(high_selfd + 1, &set, NULL, NULL, &timeout); - - if(ret > 0) - { - if(FD_ISSET(isdnfd, &set)) - isdnrdhdl(); - -#ifdef USE_CURSES - if(FD_ISSET(fileno(stdin), &set)) - kbdrdhdl(); -#endif - -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor) - { - if(localmonitor != -1 && FD_ISSET(localmonitor, &set)) - monitor_handle_connect(localmonitor, 1); - -#ifndef I4B_NOTCPIP_MONITOR - if(remotemonitor != -1 && FD_ISSET(remotemonitor, &set)) - monitor_handle_connect(remotemonitor, 0); -#endif - if(accepted) - monitor_handle_input(&set); - } -#endif - } - else if(ret == -1) - { - if(errno != EINTR) - { - llog(LL_ERR, "mloop: ERROR, select error on isdn device, errno = %d!", errno); - error_exit(1, "mloop: ERROR, select error on isdn device, errno = %d!", errno); - } - } - - /* handle timeout and recovery */ - - handle_recovery(); - } -} - -#ifdef USE_CURSES -/*---------------------------------------------------------------------------* - * data from keyboard available, read and process it - *---------------------------------------------------------------------------*/ -static void -kbdrdhdl(void) -{ - int ch = getch(); - - if(ch == ERR) - { - llog(LL_ERR, "kbdrdhdl: ERROR, read error on controlling tty, errno = %d!", errno); - error_exit(1, "kbdrdhdl: ERROR, read error on controlling tty, errno = %d!", errno); - } - - switch(ch) - { - case 0x0c: /* control L */ - wrefresh(curscr); - break; - - case '\n': - case '\r': - do_menu(); - break; - } -} -#endif - -/*---------------------------------------------------------------------------* - * data from /dev/isdn available, read and process them - *---------------------------------------------------------------------------*/ -static void -isdnrdhdl(void) -{ - static unsigned char msg_rd_buf[MSG_BUF_SIZ]; - msg_hdr_t *hp = (msg_hdr_t *)&msg_rd_buf[0]; - - register int len; - - if((len = read(isdnfd, msg_rd_buf, MSG_BUF_SIZ)) > 0) - { - switch(hp->type) - { - case MSG_CONNECT_IND: - msg_connect_ind((msg_connect_ind_t *)msg_rd_buf); - break; - - case MSG_CONNECT_ACTIVE_IND: - msg_connect_active_ind((msg_connect_active_ind_t *)msg_rd_buf); - break; - - case MSG_DISCONNECT_IND: - msg_disconnect_ind((msg_disconnect_ind_t *)msg_rd_buf); - break; - - case MSG_DIALOUT_IND: - msg_dialout((msg_dialout_ind_t *)msg_rd_buf); - break; - - case MSG_ACCT_IND: - msg_accounting((msg_accounting_ind_t *)msg_rd_buf); - break; - - case MSG_IDLE_TIMEOUT_IND: - msg_idle_timeout_ind((msg_idle_timeout_ind_t *)msg_rd_buf); - break; - - case MSG_CHARGING_IND: - msg_charging_ind((msg_charging_ind_t *)msg_rd_buf); - break; - - case MSG_PROCEEDING_IND: - msg_proceeding_ind((msg_proceeding_ind_t *)msg_rd_buf); - break; - - case MSG_ALERT_IND: - msg_alert_ind((msg_alert_ind_t *)msg_rd_buf); - break; - - case MSG_DRVRDISC_REQ: - msg_drvrdisc_req((msg_drvrdisc_req_t *)msg_rd_buf); - break; - - case MSG_L12STAT_IND: - msg_l12stat_ind((msg_l12stat_ind_t *)msg_rd_buf); - break; - - case MSG_TEIASG_IND: - msg_teiasg_ind((msg_teiasg_ind_t *)msg_rd_buf); - break; - - case MSG_PDEACT_IND: - msg_pdeact_ind((msg_pdeact_ind_t *)msg_rd_buf); - break; - - case MSG_NEGCOMP_IND: - msg_negcomplete_ind((msg_negcomplete_ind_t *)msg_rd_buf); - break; - - case MSG_IFSTATE_CHANGED_IND: - msg_ifstatechg_ind((msg_ifstatechg_ind_t *)msg_rd_buf); - break; - - case MSG_DIALOUTNUMBER_IND: - msg_dialoutnumber((msg_dialoutnumber_ind_t *)msg_rd_buf); - break; - - case MSG_PACKET_IND: - msg_packet_ind((msg_packet_ind_t *)msg_rd_buf); - break; - - case MSG_KEYPAD_IND: - msg_keypad((msg_keypad_ind_t *)msg_rd_buf); - break; - - default: - llog(LL_WRN, "ERROR, unknown message received from %sisdn (0x%x)", _PATH_DEV, msg_rd_buf[0]); - break; - } - } - else - { - llog(LL_WRN, "ERROR, read error on isdn device, errno = %d, length = %d", errno, len); - } -} - -/*---------------------------------------------------------------------------* - * re-read the config file on SIGHUP or menu command - *---------------------------------------------------------------------------*/ -void -rereadconfig(int dummy) -{ - extern int entrycount; - - llog(LL_DMN, "re-reading configuration file"); - - close_allactive(); - -#if I4B_EXTERNAL_MONITOR - monitor_clear_rights(); -#endif - - entrycount = -1; - nentries = 0; - - /* read runtime configuration file and configure ourselves */ - - configure(configfile, 1); - - if(config_error_flag) - { - llog(LL_ERR, "rereadconfig: there were %d error(s) in the configuration file, terminating!", config_error_flag); - error_exit(1, "rereadconfig: there were %d error(s) in the configuration file, terminating!", config_error_flag); - } - - if(aliasing) - { - /* reread alias database */ - free_aliases(); - init_alias(aliasfile); - } -} - -/*---------------------------------------------------------------------------* - * re-open the log/acct files on SIGUSR1 - *---------------------------------------------------------------------------*/ -void -reopenfiles(int dummy) -{ - if(useacctfile) - { - /* close file */ - - if(acctfp) - { - fflush(acctfp); - fclose(acctfp); - } - - /* if user specified a suffix, rename the old file */ - - if(rotatesuffix[0] != '\0') - { - char filename[MAXPATHLEN]; - - snprintf(filename, sizeof(filename), "%s%s", acctfile, rotatesuffix); - - if((rename(acctfile, filename)) != 0) - { - llog(LL_ERR, "reopenfiles: acct rename failed, cause = %s", strerror(errno)); - error_exit(1, "reopenfiles: acct rename failed, cause = %s", strerror(errno)); - } - } - - if((acctfp = fopen(acctfile, "a")) == NULL) - { - llog(LL_ERR, "ERROR, can't open acctfile %s for writing, terminating!", acctfile); - error_exit(1, "ERROR, can't open acctfile %s for writing, terminating!", acctfile); - } - setvbuf(acctfp, (char *)NULL, _IONBF, 0); - } - - if(uselogfile) - { - finish_log(); - - /* if user specified a suffix, rename the old file */ - - if(rotatesuffix[0] != '\0') - { - char filename[MAXPATHLEN]; - - snprintf(filename, sizeof(filename), "%s%s", logfile, rotatesuffix); - - if((rename(logfile, filename)) != 0) - { - llog(LL_ERR, "reopenfiles: log rename failed, cause = %s", strerror(errno)); - error_exit(1, "reopenfiles: log rename failed, cause = %s", strerror(errno)); - } - } - - if((logfp = fopen(logfile, "a")) == NULL) - { - fprintf(stderr, "ERROR, cannot open logfile %s: %s\n", - logfile, strerror(errno)); - error_exit(1, "reopenfiles: ERROR, cannot open logfile %s: %s\n", - logfile, strerror(errno)); - } - - /* set unbuffered operation */ - - setvbuf(logfp, (char *)NULL, _IONBF, 0); - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/monitor.c b/usr.sbin/i4b/isdnd/monitor.c deleted file mode 100644 index 36739d10c657..000000000000 --- a/usr.sbin/i4b/isdnd/monitor.c +++ /dev/null @@ -1,1284 +0,0 @@ -/* - * Copyright (c) 1998, 1999 Martin Husemann. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - network monitor server module - * ------------------------------------------ - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:08:15 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -#ifndef I4B_EXTERNAL_MONITOR - -/* - * dummy version of routines needed by config file parser - * (config files should be valid with and without external montioring - * support compiled into the daemon) - */ - -void monitor_clear_rights() -{ } - -int monitor_start_rights(const char *clientspec) -{ return I4BMAR_OK; } - -void monitor_add_rights(int rights_mask) -{ } - -void monitor_fixup_rights() -{ } - -#else - -#include "monitor.h" -#include <sys/socket.h> -#include <sys/un.h> -#ifndef I4B_NOTCPIP_MONITOR -#include <netinet/in.h> -#include <arpa/inet.h> -#include <netdb.h> -#endif - - -static TAILQ_HEAD(rights_q, monitor_rights) rights = TAILQ_HEAD_INITIALIZER(rights); - -static struct monitor_rights * local_rights = NULL; /* entry for local socket */ - -/* for each active monitor connection we have one of this: */ - -struct monitor_connection { - TAILQ_ENTRY(monitor_connection) connections; - int sock; /* socket for this connection */ - int rights; /* active rights for this connection */ - int events; /* bitmask of events client is interested in */ - char source[FILENAME_MAX]; -}; - -static TAILQ_HEAD(connections_tq, monitor_connection) connections = TAILQ_HEAD_INITIALIZER(connections); - -/* local prototypes */ -static int cmp_rights(const struct monitor_rights *pa, const struct monitor_rights *pb); -static int monitor_command(struct monitor_connection *con, int fd, int rights); -static void cmd_dump_rights(int fd, int rights, u_int8_t *cmd, const char * source); -static void cmd_dump_mcons(int fd, int rights, u_int8_t *cmd, const char * source); -static void cmd_reread_cfg(int fd, int rights, u_int8_t *cmd, const char * source); -static void cmd_hangup(int fd, int rights, u_int8_t *cmd, const char * source); -static void monitor_broadcast(int mask, u_int8_t *pkt, size_t bytes); -static int anybody(int mask); -static void hangup_channel(int controller, int channel, const char *source); -static ssize_t sock_read(int fd, void *buf, size_t nbytes); -static ssize_t sock_write(int fd, void *buf, size_t nbytes); - -/* - * Due to the way we structure config files, the rights for an external - * monitor might be stated in multiple steps. First a call to - * monitor_start_rights opens an entry. Further (optional) calls to - * montior_add_rights assemble additional rights for this "current" - * entry. When closing the sys-file section of the config file, the - * "current" entry becomes invalid. - */ -static struct monitor_rights * cur_add_entry = NULL; - -/*--------------------------------------------------------------------------- - * Initialize the monitor server module. This affects only active - * connections, the access rights are not modified here! - *---------------------------------------------------------------------------*/ -void -monitor_init(void) -{ - struct monitor_connection * con; - accepted = 0; - while ((con = TAILQ_FIRST(&connections)) != NULL) - { - TAILQ_REMOVE(&connections, con, connections); - free(con); - } -} - -/*--------------------------------------------------------------------------- - * Prepare for exit - *---------------------------------------------------------------------------*/ -void -monitor_exit(void) -{ - struct monitor_connection *c; - - /* Close all open connections. */ - while((c = TAILQ_FIRST(&connections)) != NULL) { - close(c->sock); - TAILQ_REMOVE(&connections, c, connections); - free(c); - } -} - -/*--------------------------------------------------------------------------- - * Initialize access rights. No active connections are affected! - *---------------------------------------------------------------------------*/ -void -monitor_clear_rights(void) -{ - struct monitor_rights *r; - while ((r = TAILQ_FIRST(&rights)) != NULL) { - TAILQ_REMOVE(&rights, r, list); - free(r); - } - cur_add_entry = NULL; - local_rights = NULL; -} - -/*--------------------------------------------------------------------------- - * Add an entry to the access lists. The clientspec either is - * the name of the local socket or a host- or networkname or - * numeric ip/host-bit-len spec. - *---------------------------------------------------------------------------*/ -int -monitor_start_rights(const char *clientspec) -{ - struct monitor_rights r; - - /* initialize the new rights entry */ - - memset(&r, 0, sizeof r); - - /* check clientspec */ - - if (*clientspec == '/') - { - struct sockaddr_un sa; - - /* this is a local socket spec, check if we already have one */ - - if (local_rights != NULL) - return I4BMAR_DUP; - - /* does it fit in a local socket address? */ - - if (strlen(clientspec) > sizeof sa.sun_path) - return I4BMAR_LENGTH; - - r.local = 1; - strcpy(r.name, clientspec); - -#ifndef I4B_NOTCPIP_MONITOR - - } - else - { - /* remote entry, parse host/net and cidr */ - - struct monitor_rights * rp; - char hostname[FILENAME_MAX]; - char *p; - - p = strchr(clientspec, '/'); - - if (!p) - { - struct hostent *host; - u_int32_t hn; - - /* must be a host spec */ - - r.mask = ~0; - host = gethostbyname(clientspec); - - if (!host) - return I4BMAR_NOIP; - - memcpy(&hn, host->h_addr_list[0], sizeof hn); - r.net = (u_int32_t)ntohl(hn); - } - else if(p[1]) - { - /* must be net/cidr spec */ - - int l; - struct netent *net; - u_int32_t s = ~0U; - int num = strtol(p+1, NULL, 10); - - if (num < 0 || num > 32) - return I4BMAR_CIDR; - - s >>= num; - s ^= ~0U; - l = p - clientspec; - - if (l >= sizeof hostname) - return I4BMAR_LENGTH; - - strncpy(hostname, clientspec, l); - - hostname[l] = '\0'; - - net = getnetbyname(hostname); - - if (net == NULL) - r.net = (u_int32_t)inet_network(hostname); - else - r.net = (u_int32_t)net->n_net; - - r.mask = s; - r.net &= s; - } - else - { - return I4BMAR_CIDR; - } - - /* check for duplicate entry */ - - for (rp = TAILQ_FIRST(&rights); rp != NULL; rp = TAILQ_NEXT(rp, list)) - { - if (rp->mask == r.mask && - rp->net == r.net && - rp->local == r.local) - { - return I4BMAR_DUP; - } - } -#endif - } - - r.rights = 0; - - /* entry ok, add it to the collection */ - - cur_add_entry = malloc(sizeof(r)); - memcpy(cur_add_entry, &r, sizeof(r)); - TAILQ_INSERT_TAIL(&rights, cur_add_entry, list); - - if(r.local) - local_rights = cur_add_entry; - - DBGL(DL_RCCF, (llog(LL_DBG, "system: monitor = %s", clientspec))); - - return I4BMAR_OK; -} - -/*--------------------------------------------------------------------------- - * Add rights to the currently constructed entry - if any. - *---------------------------------------------------------------------------*/ -void -monitor_add_rights(int rights_mask) -{ - if(cur_add_entry == NULL) - return; /* noone under construction */ - - cur_add_entry->rights |= rights_mask; - - DBGL(DL_RCCF, (llog(LL_DBG, "system: monitor-access = 0x%x", rights_mask))); -} - -/*--------------------------------------------------------------------------- - * All rights have been added now. Sort the to get most specific - * host/net masks first, so we can travel the list and use the first - * match for actual rights. - *---------------------------------------------------------------------------*/ -void -monitor_fixup_rights(void) -{ - struct monitor_rights * cur, * test, * next; - - /* no more rights may be added to the current entry */ - - cur_add_entry = NULL; - - /* sort the rights */ - for (next = NULL, cur = TAILQ_FIRST(&rights); cur != NULL; cur = next) - { - next = TAILQ_NEXT(cur, list); - for (test = TAILQ_FIRST(&rights); test != NULL && test != cur; test = TAILQ_NEXT(test, list)) - { - if (cmp_rights(cur, test) > 0) { - /* move cur up the list and insert before test */ - TAILQ_REMOVE(&rights, cur, list); - if (test == TAILQ_FIRST(&rights)) - TAILQ_INSERT_HEAD(&rights, cur, list); - else - TAILQ_INSERT_BEFORE(test, cur, list); - break; - } - } - } -} - -/*--------------------------------------------------------------------------- - * comparator for rights - *---------------------------------------------------------------------------*/ -static int -cmp_rights(const struct monitor_rights *pa, const struct monitor_rights *pb) -{ - u_int32_t mask; - - /* local sorts first */ - - if (pa->local) - return -1; - - /* which is the less specific netmask? */ - - mask = pa->mask; - - if ((pb->mask & mask) == 0) - mask = pb->mask; - - /* are the entries disjunct? */ - - if ((pa->net & mask) != (pb->net & mask)) - { - /* simply compare net part of address */ - return ((pa->net & mask) < (pb->net & mask)) ? -1 : 1; - } - - /* One entry is part of the others net. We already now "mask" is - * the netmask of the less specific (i.e. greater) one */ - - return (pa->mask == mask) ? 1 : -1; -} - -#ifndef I4B_NOTCPIP_MONITOR -/*--------------------------------------------------------------------------- - * Check if access rights for a remote socket are specified and - * create this socket. Return -1 otherwise. - *---------------------------------------------------------------------------*/ -int -monitor_create_remote_socket(int portno) -{ - struct sockaddr_in sa; - int val; - int remotesockfd; - - remotesockfd = socket(AF_INET, SOCK_STREAM, 0); - - if(remotesockfd == -1) - { - llog(LL_MER, "could not create remote monitor socket: %s", strerror(errno)); - return(-1); - } - - val = 1; - - if(setsockopt(remotesockfd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof val)) - { - llog(LL_MER, "could not setsockopt: %s", strerror(errno)); - return(-1); - } - - memset(&sa, 0, sizeof sa); - sa.sin_len = sizeof sa; - sa.sin_family = AF_INET; - sa.sin_port = htons(portno); - sa.sin_addr.s_addr = htonl(INADDR_ANY); - - if(bind(remotesockfd, (struct sockaddr *)&sa, sizeof sa) == -1) - { - llog(LL_MER, "could not bind remote monitor socket to port %d: %s", portno, strerror(errno)); - return(-1); - } - - if(listen(remotesockfd, 0)) - { - llog(LL_MER, "could not listen on monitor socket: %s", strerror(errno)); - return(-1); - } - - return(remotesockfd); -} -#endif - -/*--------------------------------------------------------------------------- - * Check if access rights for a local socket are specified and - * create this socket. Return -1 otherwise. - *---------------------------------------------------------------------------*/ -int -monitor_create_local_socket(void) -{ - int s; - struct sockaddr_un sa; - - /* check for a local entry */ - - if (local_rights == NULL) - return(-1); - - /* create and setup socket */ - - s = socket(AF_LOCAL, SOCK_STREAM, 0); - - if (s == -1) - { - llog(LL_MER, "could not create local monitor socket, errno = %d", errno); - return(-1); - } - - unlink(local_rights->name); - - memset(&sa, 0, sizeof sa); - sa.sun_len = sizeof sa; - sa.sun_family = AF_LOCAL; - strcpy(sa.sun_path, local_rights->name); - - if (bind(s, (struct sockaddr *)&sa, SUN_LEN(&sa))) - { - llog(LL_MER, "could not bind local monitor socket [%s], errno = %d", local_rights->name, errno); - return(-1); - } - - chmod(local_rights->name, 0500); - - if (listen(s, 0)) - { - llog(LL_MER, "could not listen on local monitor socket, errno = %d", errno); - return(-1); - } - - return(s); -} - -/*--------------------------------------------------------------------------- - * Prepare a fd_set for a select call. Add all our local - * filedescriptors to the set, increment max_fd if appropriate. - *---------------------------------------------------------------------------*/ -void -monitor_prepselect(fd_set *selset, int *max_fd) -{ - struct monitor_connection * con; - - for (con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) - { - int fd = con->sock; - - if (fd > *max_fd) - *max_fd = fd; - - FD_SET(fd, selset); - } -} - -/*--------------------------------------------------------------------------- - * Check if the result from a select call indicates something - * to do for us. - *---------------------------------------------------------------------------*/ -void -monitor_handle_input(fd_set *selset) -{ - struct monitor_connection * con, * next; - - for (next = NULL, con = TAILQ_FIRST(&connections); con != NULL; con = next) - { - int fd = con->sock; - next = TAILQ_NEXT(con, connections); - - if (FD_ISSET(fd, selset)) - { - /* handle command from this client */ - - if (monitor_command(con, fd, con->rights) != 0) - { - /* broken or closed connection */ - - char source[FILENAME_MAX]; - - strcpy(source, con->source); - TAILQ_REMOVE(&connections, con, connections); - free(con); - llog(LL_DMN, "monitor closed from %s", source ); - } - } - } - - /* all connections gone? */ - - if (TAILQ_FIRST(&connections) == NULL) - accepted = 0; -} - -/*--------------------------------------------------------------------------- - * Try new incoming connection on the given socket. - * Setup client descriptor and send initial data. - *---------------------------------------------------------------------------*/ -void -monitor_handle_connect(int sockfd, int is_local) -{ - struct monitor_connection *con; - struct monitor_rights *rp; - -#ifndef I4B_NOTCPIP_MONITOR - struct sockaddr_in ia; - u_int32_t ha = 0; -#endif - - struct sockaddr_un ua; - u_int8_t idata[I4B_MON_IDATA_SIZE]; - int fd = -1, s, i, r_mask, t_events; - char source[FILENAME_MAX]; - - /* accept the connection */ - - if(is_local) - { - s = sizeof ua; - fd = accept(sockfd, (struct sockaddr *)&ua, &s); - strcpy(source, "local"); - -#ifndef I4B_NOTCPIP_MONITOR - } - else - { - struct hostent *hp; - - s = sizeof ia; - fd = accept(sockfd, (struct sockaddr *)&ia, &s); - - hp = gethostbyaddr((char *)&ia.sin_addr, 4, AF_INET); - - if(hp == NULL) - snprintf(source, sizeof source, "%s (%s)", inet_ntoa(ia.sin_addr), inet_ntoa(ia.sin_addr)); - else - snprintf(source, sizeof source, "%s (%s)", hp->h_name, inet_ntoa(ia.sin_addr)); - - memcpy(&ha, &ia.sin_addr.s_addr, sizeof ha); - - ha = ntohl(ha); -#endif - } - - /* check the access rights of this connection */ - - r_mask = 0; - - for (rp = TAILQ_FIRST(&rights); rp != NULL; rp = TAILQ_NEXT(rp, list)) - { - if(rp->local) - { - if(is_local) - { - r_mask = rp->rights; - break; - } - -#ifndef I4B_NOTCPIP_MONITOR - } - else - { - if((ha & rp->mask) == rp->net) - { - r_mask = rp->rights; - break; - } -#endif - } - } - - if(r_mask == 0) - { - /* no rights - go away */ - llog(LL_MER, "monitor access denied from %s", source); - close(fd); - return; - } - - accepted = 1; - - con = malloc(sizeof(struct monitor_connection)); - memset(con, 0, sizeof *con); - TAILQ_INSERT_TAIL(&connections, con, connections); - con->sock = fd; - con->rights = r_mask; - strcpy(con->source, source); - - llog(LL_DMN, "monitor opened from %s rights 0x%x", source, r_mask); - - /* send initial data */ - I4B_PREP_CMD(idata, I4B_MON_IDATA_CODE); - I4B_PUT_2B(idata, I4B_MON_IDATA_VERSMAJOR, MPROT_VERSION); - I4B_PUT_2B(idata, I4B_MON_IDATA_VERSMINOR, MPROT_REL); - I4B_PUT_2B(idata, I4B_MON_IDATA_NUMCTRL, ncontroller); - I4B_PUT_2B(idata, I4B_MON_IDATA_NUMENTR, nentries); - I4B_PUT_4B(idata, I4B_MON_IDATA_CLACCESS, r_mask); - - if((sock_write(fd, idata, sizeof idata)) == -1) - { - llog(LL_MER, "monitor_handle_connect: sock_write 1 error - %s", strerror(errno)); - } - - for (i = 0; i < ncontroller; i++) - { - u_int8_t ictrl[I4B_MON_ICTRL_SIZE]; - - I4B_PREP_CMD(ictrl, I4B_MON_ICTRL_CODE); - I4B_PUT_STR(ictrl, I4B_MON_ICTRL_NAME, name_of_controller(isdn_ctrl_tab[i].ctrl_type, isdn_ctrl_tab[i].card_type)); - I4B_PUT_2B(ictrl, I4B_MON_ICTRL_BUSID, 0); - I4B_PUT_4B(ictrl, I4B_MON_ICTRL_FLAGS, 0); - I4B_PUT_4B(ictrl, I4B_MON_ICTRL_NCHAN, 2); - - if((sock_write(fd, ictrl, sizeof ictrl)) == -1) - { - llog(LL_MER, "monitor_handle_connect: sock_write 2 error - %s", strerror(errno)); - } - - } - - /* send device names from entries */ - - for(i=0; i < nentries; i++) /* walk thru all entries */ - { - u_int8_t ictrl[I4B_MON_IDEV_SIZE]; - cfg_entry_t *p; - char nbuf[64]; - p = &cfg_entry_tab[i]; /* get ptr to enry */ - - snprintf(nbuf, sizeof(nbuf), "%s%d ", bdrivername(p->usrdevicename), p->usrdeviceunit); - - I4B_PREP_CMD(ictrl, I4B_MON_IDEV_CODE); -/*XXX*/ I4B_PUT_2B(ictrl, I4B_MON_IDEV_STATE, 1); - I4B_PUT_STR(ictrl, I4B_MON_IDEV_NAME, nbuf); - - if((sock_write(fd, ictrl, sizeof ictrl)) == -1) - { - llog(LL_MER, "monitor_handle_connect: sock_write 3 error - %s", strerror(errno)); - } - } - -/*XXX*/ t_events = con->events; -/*XXX*/ con->events = -1; - - /* current state of controller(s) */ - - for(i=0; i < ncontroller; i++) - { - monitor_evnt_tei(i, isdn_ctrl_tab[i].tei); - monitor_evnt_l12stat(i, LAYER_ONE, isdn_ctrl_tab[i].l1stat); - monitor_evnt_l12stat(i, LAYER_TWO, isdn_ctrl_tab[i].l2stat); - } - - /* current state of entries */ - - for(i=0; i < nentries; i++) - { - cfg_entry_t *cep = &cfg_entry_tab[i]; - - if(cep->state == ST_CONNECTED) - { - monitor_evnt_connect(cep); - monitor_evnt_acct(cep); - monitor_evnt_charge(cep, cep->charge, 1); - } - } - -/*XXX*/ con->events = t_events; - -} - -/*--------------------------------------------------------------------------- - * dump all monitor rights - *---------------------------------------------------------------------------*/ -static void -cmd_dump_rights(int fd, int r_mask, u_int8_t *cmd, const char *source) -{ - struct monitor_rights * r; - int num_rights; - u_int8_t drini[I4B_MON_DRINI_SIZE]; - u_int8_t dr[I4B_MON_DR_SIZE]; - - for (num_rights = 0, r = TAILQ_FIRST(&rights); r != NULL; r = TAILQ_NEXT(r, list)) - num_rights++; - - I4B_PREP_EVNT(drini, I4B_MON_DRINI_CODE); - I4B_PUT_2B(drini, I4B_MON_DRINI_COUNT, num_rights); - - if((sock_write(fd, drini, sizeof drini)) == -1) - { - llog(LL_MER, "cmd_dump_rights: sock_write 1 error - %s", strerror(errno)); - } - - for (r = TAILQ_FIRST(&rights); r != NULL; r = TAILQ_NEXT(r, list)) - { - I4B_PREP_EVNT(dr, I4B_MON_DR_CODE); - I4B_PUT_4B(dr, I4B_MON_DR_RIGHTS, r->rights); - I4B_PUT_4B(dr, I4B_MON_DR_NET, r->net); - I4B_PUT_4B(dr, I4B_MON_DR_MASK, r->mask); - I4B_PUT_1B(dr, I4B_MON_DR_LOCAL, r->local); - if((sock_write(fd, dr, sizeof dr)) == -1) - { - llog(LL_MER, "cmd_dump_rights: sock_write 2 error - %s", strerror(errno)); - } - } -} - -/*--------------------------------------------------------------------------- - * rescan config file - *---------------------------------------------------------------------------*/ -static void -cmd_reread_cfg(int fd, int rights, u_int8_t *cmd, const char * source) -{ - rereadconfig(42); -} - -/*--------------------------------------------------------------------------- - * drop one connection - *---------------------------------------------------------------------------*/ -static void -cmd_hangup(int fd, int rights, u_int8_t *cmd, const char * source) -{ - int channel = I4B_GET_4B(cmd, I4B_MON_HANGUP_CHANNEL); - int ctrl = I4B_GET_4B(cmd, I4B_MON_HANGUP_CTRL); - - hangup_channel(ctrl, channel, source); -} - -/*--------------------------------------------------------------------------- - * dump all active monitor connections - *---------------------------------------------------------------------------*/ -static void -cmd_dump_mcons(int fd, int rights, u_int8_t *cmd, const char * source) -{ - int num_connections; - struct monitor_connection *con; - u_int8_t dcini[I4B_MON_DCINI_SIZE]; - - for (num_connections = 0, con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) - num_connections++; - - I4B_PREP_EVNT(dcini, I4B_MON_DCINI_CODE); - I4B_PUT_2B(dcini, I4B_MON_DCINI_COUNT, num_connections); - - if((sock_write(fd, dcini, sizeof dcini)) == -1) - { - llog(LL_MER, "cmd_dump_mcons: sock_write 1 error - %s", strerror(errno)); - } - - for (con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) - { -#ifndef I4B_NOTCPIP_MONITOR - int namelen; - struct sockaddr_in name; -#endif - u_int8_t dc[I4B_MON_DC_SIZE]; - - I4B_PREP_EVNT(dc, I4B_MON_DC_CODE); - I4B_PUT_4B(dc, I4B_MON_DC_RIGHTS, con->rights); - -#ifndef I4B_NOTCPIP_MONITOR - namelen = sizeof name; - - if (getpeername(con->sock, (struct sockaddr*)&name, &namelen) == 0) - memcpy(dc+I4B_MON_DC_WHO, &name.sin_addr, sizeof name.sin_addr); -#endif - if((sock_write(fd, dc, sizeof dc)) == -1) - { - llog(LL_MER, "cmd_dump_mcons: sock_write 2 error - %s", strerror(errno)); - } - } -} - -/*--------------------------------------------------------------------------- - * Handle a command from the given socket. The client - * has rights as specified in the rights parameter. - * Return non-zero if connection is closed. - *---------------------------------------------------------------------------*/ -static int -monitor_command(struct monitor_connection * con, int fd, int rights) -{ - char cmd[I4B_MAX_MON_CLIENT_CMD]; - u_int code; - - /* command dispatch table */ - typedef void (*cmd_func_t)(int fd, int rights, u_int8_t *cmd, const char *source); - - static struct { - cmd_func_t call; /* function to execute */ - u_int rights; /* necessary rights */ - } cmd_tab[] = - { - /* 0 */ { NULL, 0 }, - /* 1 */ { cmd_dump_rights, I4B_CA_COMMAND_FULL }, - /* 2 */ { cmd_dump_mcons, I4B_CA_COMMAND_FULL }, - /* 3 */ { cmd_reread_cfg, I4B_CA_COMMAND_FULL }, - /* 4 */ { cmd_hangup, I4B_CA_COMMAND_FULL }, - }; -#define NUMCMD (sizeof cmd_tab / sizeof cmd_tab[0]) - - u_long u; - int bytes; - - /* Network transfer may deliver two or more packets concatenated. - * Peek at the header and read only one event at a time... */ - - ioctl(fd, FIONREAD, &u); - - if (u < I4B_MON_CMD_HDR) - { - if (u == 0) - { - /* llog(LL_MER, "monitor read 0 bytes"); */ - /* socket closed by peer */ - close(fd); - return 1; - } - return 0; /* not enough data there yet */ - } - - bytes = recv(fd, cmd, I4B_MON_CMD_HDR, MSG_PEEK); - - if (bytes < I4B_MON_CMD_HDR) - { - llog(LL_MER, "monitor read only %d bytes", bytes); - return 0; /* errh? something must be wrong... */ - } - - bytes = I4B_GET_2B(cmd, I4B_MON_CMD_LEN); - - if (bytes >= sizeof cmd) - { - close(fd); - llog(LL_MER, "monitor: garbage on connection"); - return 1; - } - - /* now we know the size, it fits, so lets read it! */ - - if(sock_read(fd, cmd, bytes) <= 0) - { - llog(LL_MER, "monitor: sock_read <= 0"); - close(fd); - return 1; - } - - /* decode command */ - code = I4B_GET_2B(cmd, I4B_MON_CMD); - - /* special case: may modify our connection descriptor, is - * beyound all rights checks */ - - if (code == I4B_MON_CCMD_SETMASK) - { -/*XXX*/ - /* - u_int major = I4B_GET_2B(cmd, I4B_MON_ICLIENT_VERMAJOR); - u_int minor = I4B_GET_2B(cmd, I4B_MON_ICLIENT_VERMINOR); - */ - - int events = I4B_GET_4B(cmd, I4B_MON_ICLIENT_EVENTS); - con->events = events & rights; - return 0; - } - - if (code < 0 || code >= NUMCMD) - { - llog(LL_MER, "illegal command from client, code = %d\n", - code); - return 0; - } - - if (cmd_tab[code].call == NULL) - return 0; - - if ((cmd_tab[code].rights & rights) == cmd_tab[code].rights) - cmd_tab[code].call(fd, rights, cmd, con->source); - - return 0; -} - -/*--------------------------------------------------------------------------- - * Check if somebody would receive an event with this mask. - * We are lazy and try to avoid assembling unneccesary packets. - * Return 0 if no one interested, nonzero otherwise. - *---------------------------------------------------------------------------*/ -static int -anybody(int mask) -{ - struct monitor_connection * con; - - for (con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) - { - if ((con->events & mask) == mask) - return 1; - } - return 0; -} - -/*--------------------------------------------------------------------------- - * exec hangup command - *---------------------------------------------------------------------------*/ -static void -hangup_channel(int controller, int channel, const char *source) -{ - cfg_entry_t * cep = NULL; - int i; - - if(controller < ncontroller) - { - if(isdn_ctrl_tab[controller].state != CTRL_UP) - return; - for (i = 0; i < isdn_ctrl_tab[controller].nbch; i++) - { - if(isdn_ctrl_tab[controller].stateb[i] != CHAN_IDLE) - { - cep = get_cep_by_cc(controller, i); - if (cep != NULL && cep->isdnchannelused == channel && - cep->isdncontrollerused == controller) - goto found; - } - } - } - /* not found */ - return; - -found: - llog(LL_CHD, "%05d %s manual disconnect (remote from %s)", cep->cdid, cep->name, source); - cep->hangup = 1; - return; -} - -/*--------------------------------------------------------------------------- - * Send an event to every connection interested in this kind of - * event - *---------------------------------------------------------------------------*/ -static void -monitor_broadcast(int mask, u_int8_t *pkt, size_t bytes) -{ - struct monitor_connection *con; - - for (con = TAILQ_FIRST(&connections); con != NULL; con = TAILQ_NEXT(con, connections)) - { - if ((con->events & mask) == mask) - { - int fd = con->sock; - - if((sock_write(fd, pkt, bytes)) == -1) - { - llog(LL_MER, "monitor_broadcast: sock_write error - %s", strerror(errno)); - } - } - } -} - -/*--------------------------------------------------------------------------- - * Post a logfile event - *---------------------------------------------------------------------------*/ -void -monitor_evnt_log(int prio, const char * what, const char * msg) -{ - u_int8_t evnt[I4B_MON_LOGEVNT_SIZE]; - time_t now; - - if (!anybody(I4B_CA_EVNT_I4B)) - return; - - time(&now); - - I4B_PREP_EVNT(evnt, I4B_MON_LOGEVNT_CODE); - I4B_PUT_4B(evnt, I4B_MON_LOGEVNT_TSTAMP, (long)now); - I4B_PUT_4B(evnt, I4B_MON_LOGEVNT_PRIO, prio); - I4B_PUT_STR(evnt, I4B_MON_LOGEVNT_WHAT, what); - I4B_PUT_STR(evnt, I4B_MON_LOGEVNT_MSG, msg); - - monitor_broadcast(I4B_CA_EVNT_I4B, evnt, sizeof evnt); -} - -/*--------------------------------------------------------------------------- - * Post a charging event on the connection described - * by the given config entry. - *---------------------------------------------------------------------------*/ -void -monitor_evnt_charge(cfg_entry_t *cep, int units, int estimate) -{ - int mask; - time_t now; - u_int8_t evnt[I4B_MON_CHRG_SIZE]; - - mask = (cep->direction == DIR_IN) ? I4B_CA_EVNT_CALLIN : I4B_CA_EVNT_CALLOUT; - - if(!anybody(mask)) - return; - - time(&now); - - I4B_PREP_EVNT(evnt, I4B_MON_CHRG_CODE); - I4B_PUT_4B(evnt, I4B_MON_CHRG_TSTAMP, (long)now); - I4B_PUT_4B(evnt, I4B_MON_CHRG_CTRL, cep->isdncontrollerused); - I4B_PUT_4B(evnt, I4B_MON_CHRG_CHANNEL, cep->isdnchannelused); - I4B_PUT_4B(evnt, I4B_MON_CHRG_UNITS, units); - I4B_PUT_4B(evnt, I4B_MON_CHRG_ESTIMATED, estimate ? 1 : 0); - - monitor_broadcast(mask, evnt, sizeof evnt); -} - -/*--------------------------------------------------------------------------- - * Post a connection event - *---------------------------------------------------------------------------*/ -void -monitor_evnt_connect(cfg_entry_t *cep) -{ - u_int8_t evnt[I4B_MON_CONNECT_SIZE]; - char devname[I4B_MAX_MON_STRING]; - int mask; - time_t now; - - mask = (cep->direction == DIR_IN) ? I4B_CA_EVNT_CALLIN : I4B_CA_EVNT_CALLOUT; - - if (!anybody(mask)) - return; - - time(&now); - - snprintf(devname, sizeof devname, "%s%d", bdrivername(cep->usrdevicename), cep->usrdeviceunit); - - I4B_PREP_EVNT(evnt, I4B_MON_CONNECT_CODE); - I4B_PUT_4B(evnt, I4B_MON_CONNECT_TSTAMP, (long)now); - I4B_PUT_4B(evnt, I4B_MON_CONNECT_DIR, cep->direction == DIR_OUT ? 1 : 0); - I4B_PUT_4B(evnt, I4B_MON_CONNECT_CTRL, cep->isdncontrollerused); - I4B_PUT_4B(evnt, I4B_MON_CONNECT_CHANNEL, cep->isdnchannelused); - I4B_PUT_STR(evnt, I4B_MON_CONNECT_CFGNAME, cep->name); - I4B_PUT_STR(evnt, I4B_MON_CONNECT_DEVNAME, devname); - - if(cep->direction == DIR_OUT) - { - I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->remote_phone_dialout.number); - I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_dialout.number); - } - else - { - I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->real_phone_incoming.number); - I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_incoming.number); - } - monitor_broadcast(mask, evnt, sizeof evnt); -} - -/*--------------------------------------------------------------------------- - * Post a disconnect event - *---------------------------------------------------------------------------*/ -void -monitor_evnt_disconnect(cfg_entry_t *cep) -{ - u_int8_t evnt[I4B_MON_DISCONNECT_SIZE]; - int mask; - time_t now; - - mask = (cep->direction == DIR_IN) ? I4B_CA_EVNT_CALLIN : I4B_CA_EVNT_CALLOUT; - - if (!anybody(mask)) - return; - - time(&now); - - I4B_PREP_EVNT(evnt, I4B_MON_DISCONNECT_CODE); - I4B_PUT_4B(evnt, I4B_MON_DISCONNECT_TSTAMP, (long)now); - I4B_PUT_4B(evnt, I4B_MON_DISCONNECT_CTRL, cep->isdncontrollerused); - I4B_PUT_4B(evnt, I4B_MON_DISCONNECT_CHANNEL, cep->isdnchannelused); - - monitor_broadcast(mask, evnt, sizeof evnt); -} - -/*--------------------------------------------------------------------------- - * Post an up/down event - *---------------------------------------------------------------------------*/ -void -monitor_evnt_updown(cfg_entry_t *cep, int up) -{ - u_int8_t evnt[I4B_MON_UPDOWN_SIZE]; - int mask; - time_t now; - - mask = (cep->direction == DIR_IN) ? I4B_CA_EVNT_CALLIN : I4B_CA_EVNT_CALLOUT; - - if (!anybody(mask)) - return; - - time(&now); - - I4B_PREP_EVNT(evnt, I4B_MON_UPDOWN_CODE); - I4B_PUT_4B(evnt, I4B_MON_UPDOWN_TSTAMP, (long)now); - I4B_PUT_4B(evnt, I4B_MON_UPDOWN_CTRL, cep->isdncontrollerused); - I4B_PUT_4B(evnt, I4B_MON_UPDOWN_CHANNEL, cep->isdnchannelused); - I4B_PUT_4B(evnt, I4B_MON_UPDOWN_ISUP, up); - - monitor_broadcast(mask, evnt, sizeof evnt); -} - -/*--------------------------------------------------------------------------- - * Post a Layer1/2 status change event - *---------------------------------------------------------------------------*/ -void -monitor_evnt_l12stat(int controller, int layer, int state) -{ - u_int8_t evnt[I4B_MON_L12STAT_SIZE]; - time_t now; - - if(!anybody(I4B_CA_EVNT_I4B)) - return; - - time(&now); - - I4B_PREP_EVNT(evnt, I4B_MON_L12STAT_CODE); - I4B_PUT_4B(evnt, I4B_MON_L12STAT_TSTAMP, (long)now); - I4B_PUT_4B(evnt, I4B_MON_L12STAT_CTRL, controller); - I4B_PUT_4B(evnt, I4B_MON_L12STAT_LAYER, layer); - I4B_PUT_4B(evnt, I4B_MON_L12STAT_STATE, state); - - monitor_broadcast(I4B_CA_EVNT_I4B, evnt, sizeof evnt); -} - -/*--------------------------------------------------------------------------- - * Post a TEI change event - *---------------------------------------------------------------------------*/ -void -monitor_evnt_tei(int controller, int tei) -{ - u_int8_t evnt[I4B_MON_TEI_SIZE]; - time_t now; - - if(!anybody(I4B_CA_EVNT_I4B)) - return; - - time(&now); - - I4B_PREP_EVNT(evnt, I4B_MON_TEI_CODE); - I4B_PUT_4B(evnt, I4B_MON_TEI_TSTAMP, (long)now); - I4B_PUT_4B(evnt, I4B_MON_TEI_CTRL, controller); - I4B_PUT_4B(evnt, I4B_MON_TEI_TEI, tei); - - monitor_broadcast(I4B_CA_EVNT_I4B, evnt, sizeof evnt); -} - -/*--------------------------------------------------------------------------- - * Post an accounting event - *---------------------------------------------------------------------------*/ -void -monitor_evnt_acct(cfg_entry_t *cep) -{ - u_int8_t evnt[I4B_MON_ACCT_SIZE]; - time_t now; - - if(!anybody(I4B_CA_EVNT_I4B)) - return; - - time(&now); - - I4B_PREP_EVNT(evnt, I4B_MON_ACCT_CODE); - I4B_PUT_4B(evnt, I4B_MON_ACCT_TSTAMP, (long)now); - - I4B_PUT_4B(evnt, I4B_MON_ACCT_CTRL, cep->isdncontrollerused); - I4B_PUT_4B(evnt, I4B_MON_ACCT_CHAN, cep->isdnchannelused); - I4B_PUT_4B(evnt, I4B_MON_ACCT_OBYTES, cep->outbytes); - I4B_PUT_4B(evnt, I4B_MON_ACCT_OBPS, cep->outbps); - I4B_PUT_4B(evnt, I4B_MON_ACCT_IBYTES, cep->inbytes); - I4B_PUT_4B(evnt, I4B_MON_ACCT_IBPS, cep->inbps); - - monitor_broadcast(I4B_CA_EVNT_I4B, evnt, sizeof evnt); -} - -/*--------------------------------------------------------------------------- - * read from a socket - *---------------------------------------------------------------------------*/ -static ssize_t -sock_read(int fd, void *buf, size_t nbytes) -{ - size_t nleft; - ssize_t nread; - unsigned char *ptr; - - ptr = buf; - nleft = nbytes; - - while(nleft > 0) - { - if((nread = read(fd, ptr, nleft)) < 0) - { - if(errno == EINTR) - { - nread = 0; - } - else - { - return(-1); - } - } - else if(nread == 0) - { - break; /* EOF */ - } - - nleft -= nread; - ptr += nread; - } - return(nbytes - nleft); -} - -/*--------------------------------------------------------------------------- - * write to a socket - *---------------------------------------------------------------------------*/ -static ssize_t -sock_write(int fd, void *buf, size_t nbytes) -{ - size_t nleft; - ssize_t nwritten; - unsigned char *ptr; - - ptr = buf; - nleft = nbytes; - - while(nleft > 0) - { - if((nwritten = write(fd, ptr, nleft)) <= 0) - { - if(errno == EINTR) - { - nwritten = 0; - } - else - { - return(-1); - } - } - - nleft -= nwritten; - ptr += nwritten; - } - return(nbytes); -} - -struct monitor_rights * monitor_next_rights(const struct monitor_rights *r) -{ - if (r == NULL) - return TAILQ_FIRST(&rights); - else - return TAILQ_NEXT(r, list); -} - -#endif /* I4B_EXTERNAL_MONITOR */ diff --git a/usr.sbin/i4b/isdnd/msghdl.c b/usr.sbin/i4b/isdnd/msghdl.c deleted file mode 100644 index 4787a9540cee..000000000000 --- a/usr.sbin/i4b/isdnd/msghdl.c +++ /dev/null @@ -1,1350 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - message from kernel handling routines - * -------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:09:33 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -#include <sys/socket.h> -#include <net/if.h> -#include <net/if_types.h> - -#if defined(__FreeBSD__) -#include <net/if_var.h> -#endif - -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/in_var.h> -#include <netinet/ip.h> -#include <netinet/tcp.h> -#include <netinet/udp.h> -#include <netinet/ip_icmp.h> - -/*---------------------------------------------------------------------------* - * handle incoming CONNECT_IND (=SETUP) message - *---------------------------------------------------------------------------*/ -void -msg_connect_ind(msg_connect_ind_t *mp) -{ - cfg_entry_t *cep; - char *src_tela = "ERROR-src_tela"; - char *dst_tela = "ERROR-dst_tela"; - -#define SRC (aliasing == 0 ? mp->src_telno : src_tela) -#define DST (aliasing == 0 ? mp->dst_telno : dst_tela) - - /* Add prefixes. All preexisting alias files are useless - if this is on. */ - if(addprefix) - { - add_number_prefix(mp->src_telno, mp->src_ton); - add_number_prefix(mp->dst_telno, mp->dst_ton); - } - - if(aliasing) - { - src_tela = get_alias(mp->src_telno); - dst_tela = get_alias(mp->dst_telno); - } - - if((cep = find_matching_entry_incoming(mp)) == NULL) - { - /* log message generated in find_matching_entry_incoming() */ - sendm_connect_resp(NULL, mp->header.cdid, SETUP_RESP_DNTCRE, 0); - handle_scrprs(mp->header.cdid, mp->scr_ind, mp->prs_ind, SRC); - return; - } - - if(cep->cdid != CDID_UNUSED && cep->cdid != CDID_RESERVED) - { - /* - * This is an incoming call on a number we just dialed out. - * Stop our dial-out and accept the incoming call. - */ - if(cep->saved_call.cdid != CDID_UNUSED && - cep->saved_call.cdid != CDID_RESERVED) - { - int cdid; - - /* disconnect old, not new */ - - cdid = cep->cdid; - cep->cdid = cep->saved_call.cdid; - sendm_disconnect_req(cep, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - cep->cdid = cdid; - - /* - * Shortcut the state machine and mark this - * entry as free - */ -/* XXX */ cep->state = ST_IDLE; /* this is an invalid */ - /* transition, */ - /* so no next_state() */ - /* we have to wait here for an incoming */ - /* disconnect message !!! (-hm) */ - } - } - - if(cep->inout == DIR_OUTONLY) - { - llog(LL_CHD, "%05d %s incoming call from %s to %s not allowed by configuration!", - mp->header.cdid, cep->name, SRC, DST); - sendm_connect_resp(NULL, mp->header.cdid, SETUP_RESP_DNTCRE, 0); - handle_scrprs(mp->header.cdid, mp->scr_ind, mp->prs_ind, SRC); - return; - } - - cep->charge = 0; - cep->last_charge = 0; - - switch(cep->dialin_reaction) - { - case REACT_ACCEPT: - llog(LL_CHD, "%05d %s accepting: incoming call from %s to %s", - mp->header.cdid, cep->name, SRC, DST); - decr_free_channels(mp->controller); - next_state(cep, EV_MCI); - break; - - case REACT_REJECT: - llog(LL_CHD, "%05d %s rejecting: incoming call from %s to %s", - mp->header.cdid, cep->name, SRC, DST); - sendm_connect_resp(cep, mp->header.cdid, SETUP_RESP_REJECT, - (CAUSET_I4B << 8) | CAUSE_I4B_REJECT); - cep->cdid = CDID_UNUSED; - break; - - case REACT_IGNORE: - llog(LL_CHD, "%05d %s ignoring: incoming call from %s to %s", - mp->header.cdid, cep->name, SRC, DST); - sendm_connect_resp(NULL, mp->header.cdid, SETUP_RESP_DNTCRE, 0); - cep->cdid = CDID_UNUSED; - break; - - case REACT_ANSWER: - decr_free_channels(mp->controller); - if(cep->alert) - { - if(mp->display) - { - llog(LL_CHD, "%05d %s alerting: incoming call from %s to %s (%s)", - mp->header.cdid, cep->name, SRC, DST, mp->display); - } - else - { - llog(LL_CHD, "%05d %s alerting: incoming call from %s to %s", - mp->header.cdid, cep->name, SRC, DST); - } - next_state(cep, EV_ALRT); - } - else - { - if(mp->display) - { - llog(LL_CHD, "%05d %s answering: incoming call from %s to %s (%s)", - mp->header.cdid, cep->name, SRC, DST, mp->display); - } - else - { - llog(LL_CHD, "%05d %s answering: incoming call from %s to %s", - mp->header.cdid, cep->name, SRC, DST); - } - next_state(cep, EV_MCI); - } - break; - - case REACT_CALLBACK: - -#ifdef NOTDEF -/*XXX reserve channel ??? */ decr_free_channels(mp->controller); -#endif - if(cep->cdid == CDID_RESERVED) - { - llog(LL_CHD, "%05d %s reserved: incoming call from %s to %s", - mp->header.cdid, cep->name, SRC, DST); - sendm_connect_resp(cep, mp->header.cdid, SETUP_RESP_REJECT, -#if 0 - (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); -#else - (CAUSET_I4B << 8) | CAUSE_I4B_REJECT); -#endif - /* no state change */ - } - else - { - sendm_connect_resp(cep, mp->header.cdid, SETUP_RESP_REJECT, -#if 0 - (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); -#else - (CAUSET_I4B << 8) | CAUSE_I4B_REJECT); -#endif - if(cep->budget_callbackperiod && cep->budget_callbackncalls) - { - cep->budget_callback_req++; - cep->budget_calltype = 0; - if(cep->budget_callbackncalls_cnt == 0) - { - llog(LL_CHD, "%05d %s no budget: call from %s to %s", - mp->header.cdid, cep->name, SRC, DST); - cep->cdid = CDID_UNUSED; - cep->budget_callback_rej++; - break; - } - else - { - cep->budget_calltype = BUDGET_TYPE_CBACK; - } - } - - llog(LL_CHD, "%05d %s callback: incoming call from %s to %s", - mp->header.cdid, cep->name, SRC, DST); - - cep->last_release_time = time(NULL); - cep->cdid = CDID_RESERVED; - next_state(cep, EV_CBRQ); - } - break; - - default: - llog(LL_WRN, "msg_connect_ind: unknown response type, tx SETUP_RESP_DNTCRE"); - sendm_connect_resp(NULL, mp->header.cdid, SETUP_RESP_DNTCRE, 0); - break; - } - handle_scrprs(mp->header.cdid, mp->scr_ind, mp->prs_ind, SRC); -#undef SRC -#undef DST -} - -/*---------------------------------------------------------------------------* - * handle incoming CONNECT_ACTIVE_IND message - *---------------------------------------------------------------------------*/ -void -msg_connect_active_ind(msg_connect_active_ind_t *mp) -{ - cfg_entry_t *cep; - char *device; - - if((cep = get_cep_by_cdid(mp->header.cdid)) == NULL) - { - llog(LL_WRN, "msg_connect_active_ind: cdid not found!"); - return; - } - - cep->isdncontrollerused = mp->controller; - cep->isdnchannelused = mp->channel; - - cep->aoc_now = cep->connect_time = time(NULL); - cep->aoc_last = 0; - cep->aoc_diff = 0; - cep->aoc_valid = AOC_INVALID; - - cep->local_disconnect = DISCON_REM; - - cep->inbytes = INVALID; - cep->outbytes = INVALID; - cep->hangup = 0; - - device = bdrivername(cep->usrdevicename); - - /* set the B-channel to active */ - - if((set_channel_busy(cep->isdncontrollerused, cep->isdnchannelused)) == ERROR) - llog(LL_ERR, "msg_connect_active_ind: set_channel_busy failed!"); - - if(cep->direction == DIR_OUT) - { - llog(LL_CHD, "%05d %s outgoing call active (ctl %d, ch %d, %s%d)", - cep->cdid, cep->name, - cep->isdncontrollerused, cep->isdnchannelused, - bdrivername(cep->usrdevicename), cep->usrdeviceunit); - - if(cep->budget_calltype) - { - if(cep->budget_calltype == BUDGET_TYPE_CBACK) - { - cep->budget_callback_done++; - cep->budget_callbackncalls_cnt--; - DBGL(DL_BDGT, (llog(LL_DBG, "%s: new cback-budget = %d", - cep->name, cep->budget_callbackncalls_cnt))); - if(cep->budget_callbacks_file != NULL) - upd_callstat_file(cep->budget_callbacks_file, cep->budget_callbacksfile_rotate); - } - else if(cep->budget_calltype == BUDGET_TYPE_COUT) - { - cep->budget_callout_done++; - cep->budget_calloutncalls_cnt--; - DBGL(DL_BDGT, (llog(LL_DBG, "%s: new cout-budget = %d", - cep->name, cep->budget_calloutncalls_cnt))); - if(cep->budget_callouts_file != NULL) - upd_callstat_file(cep->budget_callouts_file, cep->budget_calloutsfile_rotate); - } - cep->budget_calltype = 0; - } - } - else - { - llog(LL_CHD, "%05d %s incoming call active (ctl %d, ch %d, %s%d)", - cep->cdid, cep->name, - cep->isdncontrollerused, cep->isdnchannelused, - bdrivername(cep->usrdevicename), cep->usrdeviceunit); - } - -#ifdef USE_CURSES - if(do_fullscreen) - display_connect(cep); -#endif -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor && accepted) - monitor_evnt_connect(cep); -#endif - - if(isdntime && (mp->datetime[0] != '\0')) - { - llog(LL_DMN, "date/time from exchange = %s", mp->datetime); - } - - next_state(cep, EV_MCAI); -} - -/*---------------------------------------------------------------------------* - * handle incoming PROCEEDING_IND message - *---------------------------------------------------------------------------*/ -void -msg_proceeding_ind(msg_proceeding_ind_t *mp) -{ - cfg_entry_t *cep; - - if((cep = get_cep_by_cdid(mp->header.cdid)) == NULL) - { - llog(LL_WRN, "msg_proceeding_ind: cdid not found!"); - return; - } - - cep->isdncontrollerused = mp->controller; - cep->isdnchannelused = mp->channel; - - /* set the B-channels active */ - - if((set_channel_busy(cep->isdncontrollerused, cep->isdnchannelused)) == ERROR) - llog(LL_ERR, "msg_proceeding_ind: set_channel_busy failed!"); - - llog(LL_CHD, "%05d %s outgoing call proceeding (ctl %d, ch %d)", - cep->cdid, cep->name, - cep->isdncontrollerused, cep->isdnchannelused); -} - -/*---------------------------------------------------------------------------* - * handle incoming ALERT_IND message - *---------------------------------------------------------------------------*/ -void -msg_alert_ind(msg_alert_ind_t *mp) -{ - cfg_entry_t *cep; - - if((cep = get_cep_by_cdid(mp->header.cdid)) == NULL) - { - llog(LL_WRN, "msg_alert_ind: cdid not found!"); - return; - } -#ifdef NOTDEF - llog(LL_CHD, "%05d %s incoming alert", cep->cdid, cep->name); -#endif -} - -/*---------------------------------------------------------------------------* - * handle incoming L12STAT_IND message - *---------------------------------------------------------------------------*/ -void -msg_l12stat_ind(msg_l12stat_ind_t *ml) -{ - if((ml->controller < 0) || (ml->controller >= ncontroller)) - { - llog(LL_ERR, "msg_l12stat_ind: invalid controller number [%d]!", ml->controller); - return; - } - -#ifdef USE_CURSES - if(do_fullscreen) - display_l12stat(ml->controller, ml->layer, ml->state); -#endif -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor && accepted) - monitor_evnt_l12stat(ml->controller, ml->layer, ml->state); -#endif - - DBGL(DL_CNST, (llog(LL_DBG, "msg_l12stat_ind: unit %d, layer %d, state %d", - ml->controller, ml->layer, ml->state))); - - if(ml->layer == LAYER_ONE) - { - if(ml->state == LAYER_IDLE) - isdn_ctrl_tab[ml->controller].l2stat = ml->state; - isdn_ctrl_tab[ml->controller].l1stat = ml->state; - } - else if(ml->layer == LAYER_TWO) - { - if(ml->state == LAYER_ACTIVE) - isdn_ctrl_tab[ml->controller].l1stat = ml->state; - isdn_ctrl_tab[ml->controller].l2stat = ml->state; - } - else - { - llog(LL_ERR, "msg_l12stat_ind: invalid layer number [%d]!", ml->layer); - } -} - -/*---------------------------------------------------------------------------* - * handle incoming TEIASG_IND message - *---------------------------------------------------------------------------*/ -void -msg_teiasg_ind(msg_teiasg_ind_t *mt) -{ - if((mt->controller < 0) || (mt->controller >= ncontroller)) - { - llog(LL_ERR, "msg_teiasg_ind: invalid controller number [%d]!", mt->controller); - return; - } - -#ifdef USE_CURSES - if(do_fullscreen) - display_tei(mt->controller, mt->tei); -#endif -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor && accepted) - monitor_evnt_tei(mt->controller, mt->tei); -#endif - - DBGL(DL_CNST, (llog(LL_DBG, "msg_teiasg_ind: unit %d, tei = %d", - mt->controller, mt->tei))); - - isdn_ctrl_tab[mt->controller].tei = mt->tei; -} - -/*---------------------------------------------------------------------------* - * handle incoming PDEACT_IND message - *---------------------------------------------------------------------------*/ -void -msg_pdeact_ind(msg_pdeact_ind_t *md) -{ - int i; - int ctrl = md->controller; - cfg_entry_t *cep; - -#ifdef USE_CURSES - if(do_fullscreen) - { - display_l12stat(ctrl, LAYER_ONE, LAYER_IDLE); - display_l12stat(ctrl, LAYER_TWO, LAYER_IDLE); - display_tei(ctrl, -1); - } -#endif -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor && accepted) - { - monitor_evnt_l12stat(ctrl, LAYER_ONE, LAYER_IDLE); - monitor_evnt_l12stat(ctrl, LAYER_TWO, LAYER_IDLE); - monitor_evnt_tei(ctrl, -1); - } -#endif - - DBGL(DL_CNST, (llog(LL_DBG, "msg_pdeact_ind: unit %d, persistent deactivation", ctrl))); - - isdn_ctrl_tab[ctrl].l1stat = LAYER_IDLE; - isdn_ctrl_tab[ctrl].l2stat = LAYER_IDLE; - isdn_ctrl_tab[ctrl].tei = -1; - - for(i=0; i < nentries; i++) - { - if((cfg_entry_tab[i].cdid != CDID_UNUSED) && - (cfg_entry_tab[i].isdncontrollerused == ctrl)) - { - cep = &cfg_entry_tab[i]; - - if(cep->cdid == CDID_RESERVED) - { - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - continue; - } - - cep->cdid = CDID_UNUSED; - - cep->last_release_time = time(NULL); - - SET_CAUSE_TYPE(cep->disc_cause, CAUSET_I4B); - SET_CAUSE_VAL(cep->disc_cause, CAUSE_I4B_L1ERROR); - - if(cep->direction == DIR_OUT) - { - llog(LL_CHD, "%05d %s outgoing call disconnected (local)", - cep->cdid, cep->name); - } - else - { - llog(LL_CHD, "%05d %s incoming call disconnected (local)", - cep->cdid, cep->name); - } - - llog(LL_CHD, "%05d %s cause %s", - cep->cdid, cep->name, print_i4b_cause(cep->disc_cause)); - -#ifdef USE_CURSES - if(do_fullscreen && (cep->connect_time > 0)) - display_disconnect(cep); -#endif -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor && accepted) - monitor_evnt_disconnect(cep); -#endif - - if(cep->disconnectprog) - exec_connect_prog(cep, cep->disconnectprog, 1); - - if(cep->connect_time > 0) - { - if(cep->direction == DIR_OUT) - { - llog(LL_CHD, "%05d %s charging: %d units, %d seconds", - cep->cdid, cep->name, cep->charge, - (int)difftime(time(NULL), cep->connect_time)); - } - else - { - llog(LL_CHD, "%05d %s connected %d seconds", - cep->cdid, cep->name, - (int)difftime(time(NULL), cep->connect_time)); - } - - if((cep->inbytes != INVALID) && (cep->outbytes != INVALID)) - { - if((cep->ioutbytes != cep->outbytes) || - (cep->iinbytes != cep->inbytes)) - { - llog(LL_CHD, "%05d %s accounting: in %d, out %d (in %d, out %d)", - cep->cdid, cep->name, - cep->inbytes, cep->outbytes, - cep->iinbytes, cep->ioutbytes); - } - else - { - llog(LL_CHD, "%05d %s accounting: in %d, out %d", - cep->cdid, cep->name, - cep->inbytes, cep->outbytes); - } - } - } - - if(useacctfile && (cep->connect_time > 0)) - { - int con_secs; - char logdatetime[41]; - struct tm *tp; - - con_secs = difftime(time(NULL), cep->connect_time); - - tp = localtime(&cep->connect_time); - - strftime(logdatetime,40,I4B_TIME_FORMAT,tp); - - if(cep->inbytes != INVALID && cep->outbytes != INVALID) - { - fprintf(acctfp, "%s - %s %s %d (%d) (%d/%d)\n", - logdatetime, getlogdatetime(), - cep->name, cep->charge, con_secs, - cep->inbytes, cep->outbytes); - } - else - { - fprintf(acctfp, "%s - %s %s %d (%d)\n", - logdatetime, getlogdatetime(), - cep->name, cep->charge, con_secs); - } - } - - /* set the B-channel inactive */ - - if((set_channel_idle(cep->isdncontrollerused, cep->isdnchannelused)) == ERROR) - llog(LL_ERR, "msg_pdeact_ind: set_channel_idle failed!"); - - incr_free_channels(cep->isdncontrollerused); - - cep->connect_time = 0; - - cep->state = ST_IDLE; - } - } -} - -/*---------------------------------------------------------------------------* - * handle incoming NEGCOMP_IND message - *---------------------------------------------------------------------------*/ -void -msg_negcomplete_ind(msg_negcomplete_ind_t *mp) -{ - cfg_entry_t *cep; - - if((cep = get_cep_by_cdid(mp->header.cdid)) == NULL) - { - llog(LL_WRN, "msg_negcomp_ind: cdid not found"); - return; - } - - if(cep->connectprog) - exec_connect_prog(cep, cep->connectprog, 0); -} - -/*---------------------------------------------------------------------------* - * handle incoming IFSTATE_CHANGED indication - *---------------------------------------------------------------------------*/ -void -msg_ifstatechg_ind(msg_ifstatechg_ind_t *mp) -{ - cfg_entry_t *cep; - char *device; - - if((cep = get_cep_by_cdid(mp->header.cdid)) == NULL) - { - llog(LL_WRN, "msg_negcomp_ind: cdid not found"); - return; - } - - device = bdrivername(cep->usrdevicename); - llog(LL_DBG, "%s%d: switched to state %d", device, cep->usrdeviceunit, mp->state); -} - -/*---------------------------------------------------------------------------* - * handle incoming DISCONNECT_IND message - *---------------------------------------------------------------------------*/ -void -msg_disconnect_ind(msg_disconnect_ind_t *mp) -{ - cfg_entry_t *cep; - - if((cep = get_cep_by_cdid(mp->header.cdid)) == NULL) - { - llog(LL_WRN, "msg_disconnect_ind: cdid not found"); - return; - } - - /* is this an aborted out-call prematurely called back? */ - if (cep->saved_call.cdid == mp->header.cdid) - { - DBGL(DL_CNST, (llog(LL_DBG, "aborted outcall %05d disconnected", - mp->header.cdid))); - cep->saved_call.cdid = CDID_UNUSED; - - set_channel_idle(cep->saved_call.controller, cep->saved_call.channel); - - incr_free_channels(cep->saved_call.controller); - return; - } - - cep->last_release_time = time(NULL); - cep->disc_cause = mp->cause; - - if(cep->direction == DIR_OUT) - { - llog(LL_CHD, "%05d %s outgoing call disconnected %s", - cep->cdid, cep->name, - cep->local_disconnect == DISCON_LOC ? - "(local)" : "(remote)"); - } - else - { - llog(LL_CHD, "%05d %s incoming call disconnected %s", - cep->cdid, cep->name, - cep->local_disconnect == DISCON_LOC ? - "(local)" : "(remote)"); - } - - llog(LL_CHD, "%05d %s cause %s", - cep->cdid, cep->name, print_i4b_cause(mp->cause)); - -#ifdef USE_CURSES - if(do_fullscreen && (cep->connect_time > 0)) - display_disconnect(cep); -#endif -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor && accepted) - monitor_evnt_disconnect(cep); -#endif - - if(cep->disconnectprog) - exec_connect_prog(cep, cep->disconnectprog, 1); - - if(cep->connect_time > 0) - { - if(cep->direction == DIR_OUT) - { - llog(LL_CHD, "%05d %s charging: %d units, %d seconds", - cep->cdid, cep->name, cep->charge, - (int)difftime(time(NULL), cep->connect_time)); - } - else - { - llog(LL_CHD, "%05d %s connected %d seconds", - cep->cdid, cep->name, - (int)difftime(time(NULL), cep->connect_time)); - } - - if((cep->inbytes != INVALID) && (cep->outbytes != INVALID)) - { - if((cep->ioutbytes != cep->outbytes) || - (cep->iinbytes != cep->inbytes)) - { - llog(LL_CHD, "%05d %s accounting: in %d, out %d (in %d, out %d)", - cep->cdid, cep->name, - cep->inbytes, cep->outbytes, - cep->iinbytes, cep->ioutbytes); - } - else - { - llog(LL_CHD, "%05d %s accounting: in %d, out %d", - cep->cdid, cep->name, - cep->inbytes, cep->outbytes); - } - } - } - - if(useacctfile && (cep->connect_time > 0)) - { - int con_secs; - char logdatetime[41]; - struct tm *tp; - - con_secs = difftime(time(NULL), cep->connect_time); - - tp = localtime(&cep->connect_time); - - strftime(logdatetime,40,I4B_TIME_FORMAT,tp); - - if(cep->inbytes != INVALID && cep->outbytes != INVALID) - { - fprintf(acctfp, "%s - %s %s %d (%d) (%d/%d)\n", - logdatetime, getlogdatetime(), - cep->name, cep->charge, con_secs, - cep->inbytes, cep->outbytes); - } - else - { - fprintf(acctfp, "%s - %s %s %d (%d)\n", - logdatetime, getlogdatetime(), - cep->name, cep->charge, con_secs); - } - } - - /* set the B-channel inactive */ - - set_channel_idle(cep->isdncontrollerused, cep->isdnchannelused); - - incr_free_channels(cep->isdncontrollerused); - - cep->connect_time = 0; - cep->cdid = CDID_UNUSED; - - next_state(cep, EV_MDI); -} - -/*---------------------------------------------------------------------------* - * handle incoming DIALOUT message - *---------------------------------------------------------------------------*/ -void -msg_dialout(msg_dialout_ind_t *mp) -{ - cfg_entry_t *cep; - - DBGL(DL_DRVR, (llog(LL_DBG, "msg_dialout: dial req from %s, unit %d", bdrivername(mp->driver), mp->driver_unit))); - - if((cep = find_by_device_for_dialout(mp->driver, mp->driver_unit)) == NULL) - { - DBGL(DL_DRVR, (llog(LL_DBG, "msg_dialout: config entry reserved or no match"))); - return; - } - - if(cep->inout == DIR_INONLY) - { - dialresponse(cep, DSTAT_INONLY); - return; - } - - if(cep->budget_calloutperiod && cep->budget_calloutncalls) - { - cep->budget_calltype = 0; - cep->budget_callout_req++; - - if(cep->budget_calloutncalls_cnt == 0) - { - llog(LL_CHD, "%05d %s no budget for calling out", 0, cep->name); - cep->budget_callout_rej++; - dialresponse(cep, DSTAT_TFAIL); - return; - } - else - { - cep->budget_calltype = BUDGET_TYPE_COUT; - } - } - - if((cep->cdid = get_cdid()) == 0) - { - DBGL(DL_DRVR, (llog(LL_DBG, "msg_dialout: get_cdid() returned 0!"))); - return; - } - - cep->charge = 0; - cep->last_charge = 0; - cep->hangup = 0; - - next_state(cep, EV_MDO); -} - -/*---------------------------------------------------------------------------* - * handle incoming DIALOUTNUMBER message - *---------------------------------------------------------------------------*/ -void -msg_dialoutnumber(msg_dialoutnumber_ind_t *mp) -{ - cfg_entry_t *cep; - - DBGL(DL_DRVR, (llog(LL_DBG, "msg_dialoutnumber: dial req from %s, unit %d", bdrivername(mp->driver), mp->driver_unit))); - - if((cep = find_by_device_for_dialoutnumber(mp)) == NULL) - { - DBGL(DL_DRVR, (llog(LL_DBG, "msg_dialoutnumber: config entry reserved or no match"))); - return; - } - - if(cep->inout == DIR_INONLY) - { - dialresponse(cep, DSTAT_INONLY); - return; - } - - if(cep->budget_calloutperiod && cep->budget_calloutncalls) - { - cep->budget_calltype = 0; - cep->budget_callout_req++; - - if(cep->budget_calloutncalls_cnt == 0) - { - llog(LL_CHD, "%05d %s no budget for calling out", 0, cep->name); - cep->budget_callout_rej++; - dialresponse(cep, DSTAT_TFAIL); - return; - } - else - { - cep->budget_calltype = BUDGET_TYPE_COUT; - } - } - - if((cep->cdid = get_cdid()) == 0) - { - DBGL(DL_DRVR, (llog(LL_DBG, "msg_dialoutnumber: get_cdid() returned 0!"))); - return; - } - - cep->keypad[0] = '\0'; - cep->charge = 0; - cep->last_charge = 0; - cep->hangup = 0; - - next_state(cep, EV_MDO); -} - -/*---------------------------------------------------------------------------* - * handle incoming KEYPAD message - *---------------------------------------------------------------------------*/ -void -msg_keypad(msg_keypad_ind_t *mp) -{ - cfg_entry_t *cep; - - DBGL(DL_DRVR, (llog(LL_DBG, "msg_keypad: dial req from %s, unit %d", bdrivername(mp->driver), mp->driver_unit))); - - if((cep = find_by_device_for_keypad(mp->driver, mp->driver_unit, mp->cmdlen, mp->cmd)) == NULL) - { - DBGL(DL_DRVR, (llog(LL_DBG, "msg_keypad: config entry reserved or no match"))); - return; - } - - if(cep->inout == DIR_INONLY) - { - dialresponse(cep, DSTAT_INONLY); - return; - } - - if(cep->budget_calloutperiod && cep->budget_calloutncalls) - { - cep->budget_calltype = 0; - cep->budget_callout_req++; - - if(cep->budget_calloutncalls_cnt == 0) - { - llog(LL_CHD, "%05d %s no budget for calling out", 0, cep->name); - cep->budget_callout_rej++; - dialresponse(cep, DSTAT_TFAIL); - return; - } - else - { - cep->budget_calltype = BUDGET_TYPE_COUT; - } - } - - if((cep->cdid = get_cdid()) == 0) - { - DBGL(DL_DRVR, (llog(LL_DBG, "msg_keypad: get_cdid() returned 0!"))); - return; - } - - cep->charge = 0; - cep->last_charge = 0; - cep->hangup = 0; - - next_state(cep, EV_MDO); -} - -/*---------------------------------------------------------------------------* - * handle incoming DRVRDISC_REQ message - *---------------------------------------------------------------------------*/ -void -msg_drvrdisc_req(msg_drvrdisc_req_t *mp) -{ - cfg_entry_t *cep; - - DBGL(DL_DRVR, (llog(LL_DBG, "msg_drvrdisc_req: req from %s, unit %d", bdrivername(mp->driver), mp->driver_unit))); - - if((cep = get_cep_by_driver(mp->driver, mp->driver_unit)) == NULL) - { - DBGL(DL_DRVR, (llog(LL_DBG, "msg_drvrdisc_req: config entry not found"))); - return; - } - next_state(cep, EV_DRQ); -} - -/*---------------------------------------------------------------------------* - * handle incoming ACCOUNTING message - *---------------------------------------------------------------------------*/ -void -msg_accounting(msg_accounting_ind_t *mp) -{ - cfg_entry_t *cep; - - if((cep = find_active_entry_by_driver(mp->driver, mp->driver_unit)) == NULL) - { - llog(LL_WRN, "msg_accounting: no config entry found!"); - return; - } - - cep->inbytes = mp->inbytes; - cep->iinbytes = mp->iinbytes; - cep->outbytes = mp->outbytes; - cep->ioutbytes = mp->ioutbytes; - cep->inbps = mp->inbps; - cep->outbps = mp->outbps; - - if(mp->accttype == ACCT_DURING) - { -#ifdef USE_CURSES - if(do_fullscreen) - display_acct(cep); -#endif -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor && accepted) - monitor_evnt_acct(cep); -#endif - } -} - -/*---------------------------------------------------------------------------* - * handle incoming CHARGING message - *---------------------------------------------------------------------------*/ -void -msg_charging_ind(msg_charging_ind_t *mp) -{ - static char *cttab[] = { - "invalid", - "AOCD", - "AOCE", - "estimated" }; - - cfg_entry_t *cep; - - if((cep = get_cep_by_cdid(mp->header.cdid)) == NULL) - { - llog(LL_WRN, "msg_charging_ind: cdid not found"); - return; - } - - if(mp->units_type < CHARGE_INVALID || mp->units_type > CHARGE_CALC) - { - llog(LL_ERR, "msg_charging: units_type %d out of range!", mp->units_type); - error_exit(1, "msg_charging: units_type %d out of range!", mp->units_type); - } - - DBGL(DL_DRVR, (llog(LL_DBG, "msg_charging: %d unit(s) (%s)", - mp->units, cttab[mp->units_type]))); - - cep->charge = mp->units; - - switch(mp->units_type) - { - case CHARGE_AOCD: - if((cep->unitlengthsrc == ULSRC_DYN) && - (cep->charge != cep->last_charge)) - { - cep->last_charge = cep->charge; - handle_charge(cep); - } - break; - - case CHARGE_CALC: -#ifdef USE_CURSES - if(do_fullscreen) - display_ccharge(cep, mp->units); -#endif -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor && accepted) - monitor_evnt_charge(cep, mp->units, 1); -#endif - break; - } -} - -/*---------------------------------------------------------------------------* - * handle incoming IDLE_TIMEOUT_IND message - *---------------------------------------------------------------------------*/ -void -msg_idle_timeout_ind(msg_idle_timeout_ind_t *mp) -{ - cfg_entry_t *cep; - - if((cep = get_cep_by_cdid(mp->header.cdid)) == NULL) - { - llog(LL_WRN, "msg_idle_timeout_ind: cdid not found!"); - return; - } - - cep->local_disconnect = DISCON_LOC; - - DBGL(DL_DRVR, (llog(LL_DBG, "msg_idle_timeout_ind: idletimeout, kernel sent disconnect!"))); - - check_and_kill(cep); -} - -/*---------------------------------------------------------------------------* - * handle incoming MSG_PACKET_IND message - *---------------------------------------------------------------------------*/ -static char * -strapp(char *buf, const char *txt) -{ - while(*txt) - *buf++ = *txt++; - *buf = '\0'; - return buf; -} - -/*---------------------------------------------------------------------------* - * handle incoming MSG_PACKET_IND message - *---------------------------------------------------------------------------*/ -static char * -ipapp(char *buf, unsigned long a ) -{ - unsigned long ma = ntohl( a ); - - buf += sprintf(buf, "%lu.%lu.%lu.%lu", - (ma>>24)&0xFF, - (ma>>16)&0xFF, - (ma>>8)&0xFF, - (ma)&0xFF); - return buf; -} - -/*---------------------------------------------------------------------------* - * handle incoming MSG_PACKET_IND message - *---------------------------------------------------------------------------*/ -void -msg_packet_ind(msg_packet_ind_t *mp) -{ - cfg_entry_t *cep; - struct ip *ip; - u_char *proto_hdr; - char tmp[80]; - char *cptr = tmp; - char *name = "???"; - int i; - - for(i=0; i < nentries; i++) - { - cep = &cfg_entry_tab[i]; /* ptr to config entry */ - - if(cep->usrdevicename == mp->driver && - cep->usrdeviceunit == mp->driver_unit) - { - name = cep->name; - break; - } - } - - ip = (struct ip*)mp->pktdata; - proto_hdr = mp->pktdata + ((ip->ip_hl)<<2); - - if( ip->ip_p == IPPROTO_TCP ) - { - struct tcphdr* tcp = (struct tcphdr*)proto_hdr; - - cptr = strapp( cptr, "TCP " ); - cptr = ipapp( cptr, ip->ip_src.s_addr ); - cptr += sprintf( cptr, ":%u -> ", ntohs( tcp->th_sport ) ); - cptr = ipapp( cptr, ip->ip_dst.s_addr ); - cptr += sprintf( cptr, ":%u", ntohs( tcp->th_dport ) ); - - if(tcp->th_flags & TH_FIN) cptr = strapp( cptr, " FIN" ); - if(tcp->th_flags & TH_SYN) cptr = strapp( cptr, " SYN" ); - if(tcp->th_flags & TH_RST) cptr = strapp( cptr, " RST" ); - if(tcp->th_flags & TH_PUSH) cptr = strapp( cptr, " PUSH" ); - if(tcp->th_flags & TH_ACK) cptr = strapp( cptr, " ACK" ); - if(tcp->th_flags & TH_URG) cptr = strapp( cptr, " URG" ); - } - else if( ip->ip_p == IPPROTO_UDP ) - { - struct udphdr* udp = (struct udphdr*)proto_hdr; - - cptr = strapp( cptr, "UDP " ); - cptr = ipapp( cptr, ip->ip_src.s_addr ); - cptr += sprintf( cptr, ":%u -> ", ntohs( udp->uh_sport ) ); - cptr = ipapp( cptr, ip->ip_dst.s_addr ); - cptr += sprintf( cptr, ":%u", ntohs( udp->uh_dport ) ); - } - else if( ip->ip_p == IPPROTO_ICMP ) - { - struct icmp* icmp = (struct icmp*)proto_hdr; - - cptr += sprintf( cptr, "ICMP:%u.%u", icmp->icmp_type, icmp->icmp_code); - cptr = ipapp( cptr, ip->ip_src.s_addr ); - cptr = strapp( cptr, " -> " ); - cptr = ipapp( cptr, ip->ip_dst.s_addr ); - } - else - { - cptr += sprintf( cptr, "PROTO=%u ", ip->ip_p); - cptr = ipapp( cptr, ip->ip_src.s_addr); - cptr = strapp( cptr, " -> " ); - cptr = ipapp( cptr, ip->ip_dst.s_addr); - } - - llog(LL_PKT, "%s %s %u %s", - name, mp->direction ? "send" : "recv", - ntohs( ip->ip_len ), tmp ); -} - -/*---------------------------------------------------------------------------* - * get a cdid from kernel - *---------------------------------------------------------------------------*/ -int -get_cdid(void) -{ - msg_cdid_req_t mcr; - - mcr.cdid = 0; - - if((ioctl(isdnfd, I4B_CDID_REQ, &mcr)) < 0) - { - llog(LL_ERR, "get_cdid: ioctl I4B_CDID_REQ failed: %s", strerror(errno)); - error_exit(1, "get_cdid: ioctl I4B_CDID_REQ failed: %s", strerror(errno)); - } - - return(mcr.cdid); -} - -/*---------------------------------------------------------------------------* - * send message "connect request" to kernel - *---------------------------------------------------------------------------*/ -int -sendm_connect_req(cfg_entry_t *cep) -{ - msg_connect_req_t mcr; - int ret; - - cep->local_disconnect = DISCON_REM; - - cep->unitlength = get_current_rate(cep, 1); - - mcr.cdid = cep->cdid; - - mcr.controller = cep->isdncontrollerused; - mcr.channel = cep->isdnchannelused; - mcr.txdelay = cep->isdntxdelout; - - mcr.bprot = cep->b1protocol; - mcr.bcap = cep->bcap; - - mcr.driver = cep->usrdevicename; - mcr.driver_unit = cep->usrdeviceunit; - - /* setup the shorthold data */ - mcr.shorthold_data.shorthold_algorithm = cep->shorthold_algorithm; - mcr.shorthold_data.unitlen_time = cep->unitlength; - mcr.shorthold_data.idle_time = cep->idle_time_out; - mcr.shorthold_data.earlyhup_time = cep->earlyhangup; - - if(cep->unitlengthsrc == ULSRC_DYN) - mcr.unitlen_method = ULEN_METHOD_DYNAMIC; - else - mcr.unitlen_method = ULEN_METHOD_STATIC; - - strcpy(mcr.dst_telno, cep->remote_phone_dialout.number); - if(cep->usesubaddr) - strcpy(mcr.dst_subaddr, cep->remote_phone_dialout.subaddr); - strcpy(mcr.src_telno, cep->local_phone_dialout.number); - if(cep->usesubaddr) - strcpy(mcr.src_subaddr, cep->local_phone_dialout.subaddr); - strcpy(mcr.keypad, cep->keypad); - - cep->last_dial_time = time(NULL); - cep->direction = DIR_OUT; - - DBGL(DL_CNST, (llog(LL_DBG, "sendm_connect_req: ctrl = %d, chan = %d", cep->isdncontrollerused, cep->isdnchannelused))); - - if((ret = ioctl(isdnfd, I4B_CONNECT_REQ, &mcr)) < 0) - { - llog(LL_ERR, "sendm_connect_req: ioctl I4B_CONNECT_REQ failed: %s", strerror(errno)); - error_exit(1, "sendm_connect_req: ioctl I4B_CONNECT_REQ failed: %s", strerror(errno)); - } - - decr_free_channels(cep->isdncontrollerused); - - llog(LL_CHD, "%05d %s dialing out from %s to %s", - cep->cdid, - cep->name, - aliasing ? get_alias(cep->local_phone_dialout.number) : cep->local_phone_dialout.number, - aliasing ? get_alias(cep->remote_phone_dialout.number) : cep->remote_phone_dialout.number); - - return(ret); -} - -/*---------------------------------------------------------------------------* - * send message "connect response" to kernel - *---------------------------------------------------------------------------*/ -int -sendm_connect_resp(cfg_entry_t *cep, int cdid, int response, cause_t cause) -{ - msg_connect_resp_t mcr; - int ret; - - mcr.cdid = cdid; - - mcr.response = response; - - if(response == SETUP_RESP_REJECT) - { - mcr.cause = cause; - DBGL(DL_DRVR, (llog(LL_DBG, "sendm_connect_resp: reject, cause=0x%x", cause))); - } - else if(response == SETUP_RESP_ACCEPT) - { - cep->direction = DIR_IN; - - mcr.txdelay = cep->isdntxdelin; - - mcr.bprot = cep->b1protocol; - mcr.bcap = cep->bcap; - - mcr.driver = cep->usrdevicename; - mcr.driver_unit = cep->usrdeviceunit; - - mcr.max_idle_time = cep->idle_time_in; - - DBGL(DL_DRVR, (llog(LL_DBG, "sendm_connect_resp: accept"))); - } - - if((ret = ioctl(isdnfd, I4B_CONNECT_RESP, &mcr)) < 0) - { - llog(LL_ERR, "sendm_connect_resp: ioctl I4B_CONNECT_RESP failed: %s", strerror(errno)); - error_exit(1, "sendm_connect_resp: ioctl I4B_CONNECT_RESP failed: %s", strerror(errno)); - } - return(ret); -} - -/*---------------------------------------------------------------------------* - * send message "disconnect request" to kernel - *---------------------------------------------------------------------------*/ -int -sendm_disconnect_req(cfg_entry_t *cep, cause_t cause) -{ - msg_discon_req_t mcr; - int ret = 0; - - mcr.cdid = cep->cdid; - - mcr.cause = cause; - - cep->local_disconnect = DISCON_LOC; - - if((ret = ioctl(isdnfd, I4B_DISCONNECT_REQ, &mcr)) < 0) - { - llog(LL_ERR, "sendm_disconnect_req: ioctl I4B_DISCONNECT_REQ failed: %s", strerror(errno)); - } - else - { - DBGL(DL_DRVR, (llog(LL_DBG, "sendm_disconnect_req: sent DISCONNECT_REQ"))); - } - return(ret); -} - -/*---------------------------------------------------------------------------* - * send message "alert request" to kernel - *---------------------------------------------------------------------------*/ -int -sendm_alert_req(cfg_entry_t *cep) -{ - msg_alert_req_t mar; - int ret; - - mar.cdid = cep->cdid; - - if((ret = ioctl(isdnfd, I4B_ALERT_REQ, &mar)) < 0) - { - llog(LL_ERR, "sendm_alert_req: ioctl I4B_ALERT_REQ failed: %s", strerror(errno)); - error_exit(1, "sendm_alert_req: ioctl I4B_ALERT_REQ failed: %s", strerror(errno)); - } - else - { - DBGL(DL_DRVR, (llog(LL_DBG, "sendm_alert_req: sent ALERT_REQ"))); - } - return(ret); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/pathnames.h b/usr.sbin/i4b/isdnd/pathnames.h deleted file mode 100644 index 44f9c6d9ca41..000000000000 --- a/usr.sbin/i4b/isdnd/pathnames.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - location of files - * ------------------------------ - * - * $Id: pathnames.h,v 1.11 2000/10/09 11:17:07 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Oct 2 22:55:28 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _PATHNAMES_H_ -#define _PATHNAMES_H_ - -#define I4BDEVICE "/dev/i4b" - -#define ETCPATH "/etc/isdn" - -#define CONFIG_FILE_DEF "/etc/isdn/isdnd.rc" - -#define RATES_FILE_DEF "/etc/isdn/isdnd.rates" - -#define HOLIDAY_FILE_DEF "/etc/isdn/holidays" - -#define TINA_FILE_DEF "/etc/isdn/tinainitprog" - -#define LOG_FILE_DEF "/var/log/isdnd.log" - -#define ACCT_FILE_DEF "/var/log/isdnd.acct" - -#define PIDFILE "/var/run/isdnd.pid" - -#endif /* _PATHNAMES_H_ */ - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/pcause.c b/usr.sbin/i4b/isdnd/pcause.c deleted file mode 100644 index 99aa089846be..000000000000 --- a/usr.sbin/i4b/isdnd/pcause.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * printing cause values - * --------------------- - * - * $Id: pcause.c,v 1.13 2000/10/09 12:53:29 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:48:07 1999] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -static char *cause_i4b_tab[CAUSE_I4B_MAX+1]; -static char *cause_q850_tab[CAUSE_Q850_MAX]; - -char * -print_i4b_cause(cause_t code) -{ - static char error_message[128]; - - snprintf(error_message, sizeof(error_message), "%d: ", GET_CAUSE_VAL(code)); - - switch(GET_CAUSE_TYPE(code)) - { - case CAUSET_Q850: - strcat(error_message, cause_q850_tab[GET_CAUSE_VAL(code)]); - strcat(error_message, " (Q.850)"); - break; - - case CAUSET_I4B: - if((GET_CAUSE_VAL(code) < CAUSE_I4B_NORMAL) || - (GET_CAUSE_VAL(code) >= CAUSE_I4B_MAX)) - { - SET_CAUSE_VAL(code, CAUSE_I4B_MAX); - } - strcat(error_message, cause_i4b_tab[GET_CAUSE_VAL(code)]); - strcat(error_message, " (I4B)"); - break; - - default: - strcat(error_message, "ERROR: unknown cause type!"); - break; - } - return(error_message); -} - -static char *cause_i4b_tab[CAUSE_I4B_MAX+1] = { - "normal call clearing", - "user busy", - "channel not available", - "incompatible source or destination", - "call rejected", - "destination out of order", - "temporary failure", - "layer 1 error / persistent deactivation", - "dialing impossible on leased line", - "ERROR, invalid I4B cause value!" -}; - -static char *cause_q850_tab[CAUSE_Q850_MAX] = { - "Normal D-channel shutdown", - "Unallocated (unassigned) number", - "No route to specified transit network (national use)", - "No route to destination", - "Send special information tone", - "Misdialled trunk prefix (national use)", - "Channel unacceptable", - "Call awarded and being delivered in an established channel", - "Preemption", - "Preemption - circuit reserved for reuse", - -/*10*/ "cause code 10: error, unassigned in Q.850 (03/93)", - "cause code 11: error, unassigned in Q.850 (03/93)", - "cause code 12: error, unassigned in Q.850 (03/93)", - "cause code 13: error, unassigned in Q.850 (03/93)", - "cause code 14: error, unassigned in Q.850 (03/93)", - "cause code 15: error, unassigned in Q.850 (03/93)", - "Normal call clearing", - "User busy", - "No user responding", - "No answer from user (user alerted)", - -/*20*/ "Subscriber absent", - "Call rejected", - "Number changed", - "cause code 23: error, unassigned in Q.850 (03/93)", - "cause code 24: error, unassigned in Q.850 (03/93)", - "cause code 25: error, unassigned in Q.850 (03/93)", - "Non-selected user clearing", - "Destination out of order", - "Invalid number format", - "Facility rejected", - -/*30*/ "Response to STATUS ENQUIRY", - "Normal, unspecified", - "cause code 32: error, unassigned in Q.850 (03/93)", - "cause code 33: error, unassigned in Q.850 (03/93)", - "No circuit / channel available", - "cause code 35: error, unassigned in Q.850 (03/93)", - "cause code 36: error, unassigned in Q.850 (03/93)", - "cause code 37: error, unassigned in Q.850 (03/93)", - "Network out of order", - "Permanent frame mode connection out of service", - -/*40*/ "Permanent frame mode connection operational", - "Temporary failure", - "Switching equipment congestion", - "Access information discarded", - "Requested circuit/channel not available", - "cause code 45: error, unassigned in Q.850 (03/93)", - "Precedence call blocked", - "Resources unavailable, unspecified", - "cause code 48: error, unassigned in Q.850 (03/93)", - "Quality of service unavailable", - -/*50*/ "Requested facility not subscribed", - "cause code 51: error, unassigned in Q.850 (03/93)", - "cause code 52: error, unassigned in Q.850 (03/93)", - "Outgoing calls barred within CUG", - "cause code 54: error, unassigned in Q.850 (03/93)", - "Incoming calls barred within CUG", - "cause code 56: error, unassigned in Q.850 (03/93)", - "Bearer capability not authorized", - "Bearer capability not presently available", - "cause code 59: error, unassigned in Q.850 (03/93)", - -/*60*/ "cause code 60: error, unassigned in Q.850 (03/93)", - "cause code 61: error, unassigned in Q.850 (03/93)", - "Inconsistenciy in designated outg. access info and subscriber class", - "Service or option not available, unspecified", - "cause code 64: error, unassigned in Q.850 (03/93)", - "Bearer capability not implemented", - "Channel type not implemented", - "cause code 67: error, unassigned in Q.850 (03/93)", - "cause code 68: error, unassigned in Q.850 (03/93)", - "Requested facility not implemented", - -/*70*/ "Only restricted digital information bearer capability is available", - "cause code 71: error, unassigned in Q.850 (03/93)", - "cause code 72: error, unassigned in Q.850 (03/93)", - "cause code 73: error, unassigned in Q.850 (03/93)", - "cause code 74: error, unassigned in Q.850 (03/93)", - "cause code 75: error, unassigned in Q.850 (03/93)", - "cause code 76: error, unassigned in Q.850 (03/93)", - "cause code 77: error, unassigned in Q.850 (03/93)", - "cause code 78: error, unassigned in Q.850 (03/93)", - "Service or option not implemented, unspecified", - -/*80*/ "cause code 80: error, unassigned in Q.850 (03/93)", - "Invalid call reference value", - "Identified channel does not exist", - "A suspended call exists, but this call identity does not", - "Call identity in use", - "No call suspended", - "Call having the requested call identity has been cleared", - "User not member of CUG", - "Incompatible destination", - "cause code 89: error, unassigned in Q.850 (03/93)", - -/*90*/ "Non-existent CUG", - "Invalid transit network selection", - "cause code 92: error, unassigned in Q.850 (03/93)", - "cause code 93: error, unassigned in Q.850 (03/93)", - "cause code 94: error, unassigned in Q.850 (03/93)", - "Invalid message, unspecified", - "Mandatory information element is missing", - "Message type non-existent or not implemented", - "Message not compatible with call state or message type non-existent or not implemented", - "Information element/parameter non-existent or not implemented", - -/*100*/ "Invalid information element contents", - "Message not compatible with call state", - "Recovery on timer expiry", - "Parameter non-existent or not implemented, passed on", - "cause code 104: error, unassigned in Q.850 (03/93)", - "cause code 105: error, unassigned in Q.850 (03/93)", - "cause code 106: error, unassigned in Q.850 (03/93)", - "cause code 107: error, unassigned in Q.850 (03/93)", - "cause code 108: error, unassigned in Q.850 (03/93)", - "cause code 109: error, unassigned in Q.850 (03/93)", - -/*110*/ "Message with unrecognized parameter, discarded", - "Protocol error, unspecified", - "cause code 112: error, unassigned in Q.850 (03/93)", - "cause code 113: error, unassigned in Q.850 (03/93)", - "cause code 114: error, unassigned in Q.850 (03/93)", - "cause code 115: error, unassigned in Q.850 (03/93)", - "cause code 116: error, unassigned in Q.850 (03/93)", - "cause code 117: error, unassigned in Q.850 (03/93)", - "cause code 118: error, unassigned in Q.850 (03/93)", - "cause code 119: error, unassigned in Q.850 (03/93)", - -/*120*/ "cause code 120: error, unassigned in Q.850 (03/93)", - "cause code 121: error, unassigned in Q.850 (03/93)", - "cause code 122: error, unassigned in Q.850 (03/93)", - "cause code 123: error, unassigned in Q.850 (03/93)", - "cause code 124: error, unassigned in Q.850 (03/93)", - "cause code 125: error, unassigned in Q.850 (03/93)", - "cause code 126: error, unassigned in Q.850 (03/93)", - "Interworking, unspecified" -}; - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/process.c b/usr.sbin/i4b/isdnd/process.c deleted file mode 100644 index a71048f44a77..000000000000 --- a/usr.sbin/i4b/isdnd/process.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - process handling routines - * -------------------------------------- - * - * $Id: process.c,v 1.8 1999/12/13 21:25:25 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:09:55 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -/*---------------------------------------------------------------------------* - * check if another instance of us is already running - *---------------------------------------------------------------------------*/ -void -check_pid(void) -{ - FILE *fp; - - /* check if another lock-file already exists */ - - if((fp = fopen(PIDFILE, "r")) != NULL) - { - /* lockfile found, check */ - - int oldpid; - - /* read pid from file */ - - if((fscanf(fp, "%d", &oldpid)) != 1) - { - llog(LL_ERR, "ERROR, reading pid from lockfile failed, terminating!"); - exit(1); - } - - /* check if process got from file is still alive */ - - if((kill(oldpid, 0)) != 0) - { - /* process does not exist */ - - /* close file */ - - fclose(fp); - - DBGL(DL_PROC, (llog(LL_DBG, "removing old lock-file %s", PIDFILE))); - - /* remove file */ - - unlink(PIDFILE); - } - else - { - /* process is still alive */ - - llog(LL_ERR, "ERROR, another daemon is already running, pid = %d, terminating!", oldpid); - exit(1); - } - } -} - -/*---------------------------------------------------------------------------* - * establish and init process lock file - *---------------------------------------------------------------------------*/ -void -write_pid(void) -{ - FILE *fp; - - /* write my pid into lock-file */ - - if((fp = fopen(PIDFILE, "w")) == NULL) - { - llog(LL_ERR, "ERROR, can't open lockfile for writing, terminating"); - do_exit(1); - } - - if((fprintf(fp, "%d", (int)getpid())) == EOF) - { - llog(LL_ERR, "ERROR, can't write pid to lockfile, terminating"); - do_exit(1); - } - - fsync(fileno(fp)); - - fclose(fp); -} - -/*---------------------------------------------------------------------------* - * become a daemon - *---------------------------------------------------------------------------*/ -void -daemonize(void) -{ - int fd; - - switch (fork()) - { - case -1: /* error */ - llog(LL_ERR, "ERROR, daemonize/fork: %s", strerror(errno)); - exit(1); - case 0: /* child */ - break; - default: /* parent */ - exit(0); - } - - /* new session / no control tty */ - - if(setsid() == -1) - { - llog(LL_ERR, "ERROR, setsid returns: %s", strerror(errno)); - exit(1); - } - - /* go away from mounted dir */ - - chdir("/"); - - /* move i/o to another device ? */ - - if(do_fullscreen && do_rdev) - { - char *tp; - - if((fd = open(rdev, O_RDWR, 0)) != -1) - { - if(!isatty(fd)) - { - llog(LL_ERR, "ERROR, device %s is not a tty!", rdev); - exit(1); - } - if((dup2(fd, STDIN_FILENO)) == -1) - { - llog(LL_ERR, "ERROR, dup2 stdin: %s", strerror(errno)); - exit(1); - } - if((dup2(fd, STDOUT_FILENO)) == -1) - { - llog(LL_ERR, "ERROR, dup2 stdout: %s", strerror(errno)); - exit(1); - } - if((dup2(fd, STDERR_FILENO)) == -1) - { - llog(LL_ERR, "ERROR, dup2 stderr: %s", strerror(errno)); - exit(1); - } - } - else - { - llog(LL_ERR, "ERROR, cannot open redirected device: %s", strerror(errno)); - exit(1); - } - - if(fd > 2) - { - if((close(fd)) == -1) - { - llog(LL_ERR, "ERROR, close in daemonize: %s", strerror(errno)); - exit(1); - } - } - - /* curses output && fork NEEDS controlling tty */ - - if((ioctl(STDIN_FILENO, TIOCSCTTY, (char *)NULL)) < 0) - { - llog(LL_ERR, "ERROR, cannot setup tty as controlling terminal: %s", strerror(errno)); - exit(1); - } - - /* in case there is no environment ... */ - - if(((tp = getenv("TERM")) == NULL) || (*tp == '\0')) - { - if(do_ttytype == 0) - { - llog(LL_ERR, "ERROR, no environment variable TERM found and -t not specified!"); - exit(1); - } - - if((setenv("TERM", ttype, 1)) != 0) - { - llog(LL_ERR, "ERROR, setenv TERM=%s failed: %s", ttype, strerror(errno)); - exit(1); - } - } - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/rates.c b/usr.sbin/i4b/isdnd/rates.c deleted file mode 100644 index 5843f2ca1070..000000000000 --- a/usr.sbin/i4b/isdnd/rates.c +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (c) 1997 Gary Jennejohn. All rights reserved. - * - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - charging rates description file handling - * ----------------------------------------------------- - * - * $Id: rates.c,v 1.11 2000/10/09 12:53:29 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:10:09 2006] - * - *---------------------------------------------------------------------------*/ - -static char error[256]; - -static int getrate(int rate_type); - -#ifdef PARSE_DEBUG_MAIN - -#include <stdio.h> - -#define MAIN - -#define ERROR (-1) - -extern int got_rate; - -int main( int argc, char **argv ) -{ - int ret; - ret = readrates("/etc/isdn/isdnd.rates"); - if(ret == ERROR) - fprintf(stderr, "readrates returns [%d], [%s]\n", ret, error); - else - { - int type = 0; - - got_rate = 1; - - fprintf(stderr, "readrates returns [%d]\n", ret); - - for( type=0; type<4; type++ ) - { - int unit = getrate( type ); - fprintf(stderr, "getrate(%d) => %d\n", type, unit ); - } - } - - return(ret); -} - -#endif - -#include "isdnd.h" - -/*---------------------------------------------------------------------------* - * parse rates file - *---------------------------------------------------------------------------*/ -int -readrates(char *filename) -{ - char buffer[MAXPATHLEN]; - register char *bp; - struct rates *rt, *ort; - int rateindx; - int indx; - int line = 0; - FILE *fp; - int first; -#if DEBUG - int i, j; -#endif - - indx = 0; - rt = ort = NULL; - - if((fp = fopen(filename, "r")) == NULL) - { - snprintf(error, sizeof(error), "error open %s: %s", filename, sys_errlist[errno]); - rate_error = error; - return(WARNING); - } - - while((fgets(buffer, MAXPATHLEN, fp)) != NULL) - { - line++; - -/* comments */ - if(buffer[0] == '#' || buffer[0] == ' ' || - buffer[0] == '\t' || buffer[0] == '\n') - { - continue; - } - - bp = &buffer[0]; - - /* rate type */ - - if (*bp == 'r' && *(bp+1) == 'a' && isdigit(*(bp+2))) - { - rateindx = *(bp+2) - '0'; - bp += 3; - - /* eat space delimiter */ - - while(isspace(*bp)) - bp++; - } - else - { - snprintf(error, sizeof(error), "rates: invalid rate type %c%c%c in line %d", *bp, *(bp+1), *(bp+2), line); - goto rate_error; - } - if (rateindx >= NRATES) - { - snprintf(error, sizeof(error), "rates: invalid rate index %d in line %d", rateindx, line); - goto rate_error; - } - - /* day */ - - if(isdigit(*bp) && *bp >= '0' && *bp <= '6') - { - indx = *bp - '0'; - - DBGL(DL_RATES, (llog(LL_DBG, "rates: index = %d", indx))); - } - else - { - snprintf(error, sizeof(error), "rates: invalid day digit %c in line %d", *bp, line); - goto rate_error; - } - - if(rates[rateindx][indx] == NULL) - { - rt = (struct rates *)malloc(sizeof (struct rates)); - if (rt == NULL) - { - snprintf(error, sizeof(error), "rates: cannot malloc space for rate structure"); - goto rate_error; - } - rt->next = NULL; - rates[rateindx][indx] = rt; - } - - bp++; - - /* eat space delimiter */ - - while(isspace(*bp)) - bp++; - - /* now loop to get the rates entries */ - - first = 1; - - while(*bp && isdigit(*bp)) - { - int hour = 0; - int min = 0; - - if(first) - { - first = 0; - } - else - { - ort = rt; - - rt = (struct rates *)malloc(sizeof (struct rates)); - if (rt == NULL) - { - snprintf(error, sizeof(error), "rates: cannot malloc space2 for rate structure"); - goto rate_error; - } - ort->next = rt; - rt->next = NULL; - } - - /* start hour */ - - if(isdigit(*bp) && isdigit(*(bp+1))) - { - hour = atoi(bp); - bp += 2; - } - else - { - snprintf(error, sizeof(error), "rates: start_hr error in line %d", line); - goto rate_error; - } - - /* point */ - - if(*bp == '.') - { - bp++; - } - else - { - snprintf(error, sizeof(error), "rates: no '.' after start_hr in line %d", line); - goto rate_error; - } - - /* start minute */ - - if(isdigit(*bp) && isdigit(*(bp+1))) - { - min = atoi(bp); - bp += 2; - } - else - { - snprintf(error, sizeof(error), "rates: start_min error in line %d", line); - goto rate_error; - } - - rt->start_time = hour*60 + min; - - /* minus */ - - if(*bp == '-') - { - bp++; - } - else - { - snprintf(error, sizeof(error), "rates: no '-' after start_min in line %d", line); - goto rate_error; - } - - /* end hour */ - - if(isdigit(*bp) && isdigit(*(bp+1))) - { - hour = atoi(bp); - bp += 2; - } - else - { - snprintf(error, sizeof(error), "rates: end_hr error in line %d", line); - goto rate_error; - } - - /* point */ - - if(*bp == '.') - { - bp++; - } - else - { - snprintf(error, sizeof(error), "rates: no '.' after end_hr in line %d", line); - goto rate_error; - } - - /* end minute */ - - if(isdigit(*bp) && isdigit(*(bp+1))) - { - min = atoi(bp); - bp += 2; - } - else - { - snprintf(error, sizeof(error), "rates: end_min error in line %d", line); - goto rate_error; - } - - /* if hour is 0 assume it means midnight */ - if( hour == 0 ) - hour = 24; - rt->end_time = hour * 60 + min; - - if( rt->end_time <= rt->start_time ) - { - snprintf(error, sizeof(error), "rates: end_time must be greater then start_time %d", line); - goto rate_error; - } - - /* colon */ - - if(*bp == ':') - { - bp++; - } - else - { - snprintf(error, sizeof(error), "rates: no ':' after end_min in line %d", line); - goto rate_error; - } - - /* time */ - - if(isdigit(*bp)) - { - rt->rate = atoi(bp); - while(!isspace(*bp)) - bp++; - } - else - { - snprintf(error, sizeof(error), "rates: first rate digit error in line %d", line); - goto rate_error; - } - - /* eat space delimiter */ - - while(isspace(*bp)) - bp++; - } - } - -#if DEBUG - if(debug_flags & DL_RATES) - { - for (j = 0; j < NRATES; j++) - { - for (i = 0; i < NDAYS; i++) - { - if (rates [j][i] != NULL) - { - rt = rates [j][i]; - for (; rt; rt = rt->next) - { - llog(LL_DBG, "rates: index %d day %d = %d.%2.2d-%d.%2.2d:%d", - j, i, rt->start_time/60, rt->start_time%60, - rt->end_time/60,rt->end_time%60,rt->rate); - } - } - else - { - llog(LL_DBG, "rates: NO entry for day %d !!\n", i); - } - } - } - } -#endif - fclose(fp); - return(GOOD); - -rate_error: - fclose(fp); - rate_error = error; - return(ERROR); -} - -#ifndef PARSE_DEBUG_MAIN - -/*---------------------------------------------------------------------------* - * get unit length time from configured source - *---------------------------------------------------------------------------*/ -int -get_current_rate(cfg_entry_t *cep, int logit) -{ - int rt; - - switch(cep->unitlengthsrc) - { - case ULSRC_CMDL: /* specified on commandline */ - if(logit) - llog(LL_CHD, "%05d %s rate %d sec/unit (cmdl)", - cep->cdid, cep->name, unit_length); - return(unit_length); - break; - - case ULSRC_CONF: /* get it from config file */ - if(logit) - llog(LL_CHD, "%05d %s rate %d sec/unit (conf)", - cep->cdid, cep->name, cep->unitlength); - return(cep->unitlength); - - case ULSRC_RATE: /* get it dynamic from ratesfile*/ - if(!got_rate) /* got valid rates struct ?? */ - { - if(logit) - llog(LL_CHD, "%05d %s rate %d sec/unit (no ratefile)", - cep->cdid, cep->name, UNITLENGTH_DEFAULT); - return(UNITLENGTH_DEFAULT); - } - if((cep->ratetype >= NRATES) || - (cep->ratetype == INVALID_RATE)) - { - if(logit) - llog(LL_CHD, "%05d %s rate %d sec/unit (rate out of range)", - cep->cdid, cep->name, UNITLENGTH_DEFAULT); - return(UNITLENGTH_DEFAULT); - } - - if((rt = getrate(cep->ratetype)) != -1) - { - if(logit) - llog(LL_CHD, "%05d %s rate %d sec/unit (rate)", - cep->cdid, cep->name, rt); - return(rt); - } - - if(logit) - llog(LL_CHD, "%05d %s rate %d sec/unit (ratescan fail)", - cep->cdid, cep->name, UNITLENGTH_DEFAULT); - - return(UNITLENGTH_DEFAULT); - break; - - case ULSRC_DYN: /* dynamically calculated from AOC */ - if((rt = getrate(cep->ratetype)) != -1) - { - if(logit) - llog(LL_CHD, "%05d %s rate %d sec/unit (aocd, rate)", - cep->cdid, cep->name, rt); - return(rt); - } - if(logit) - llog(LL_CHD, "%05d %s rate %d sec/unit (aocd, default)", - cep->cdid, cep->name, UNITLENGTH_DEFAULT); - - return(UNITLENGTH_DEFAULT); - break; - - default: - if(logit) - llog(LL_CHD, "%05d %s rate %d sec/unit (unitlen unknown)", - cep->cdid, cep->name, UNITLENGTH_DEFAULT); - - return(UNITLENGTH_DEFAULT); - break; - } -} -#endif /* PARSE_DEBUG_MAIN */ - - -/*---------------------------------------------------------------------------* - * get the currently active rate - *---------------------------------------------------------------------------*/ -static int -getrate(int rate_type ) -{ - struct tm *ptr; - time_t now; - register struct rates *hd; - int time_now; - - if((!got_rate) || - (rate_type >= NRATES) || - (rate_type == INVALID_RATE)) - { - return -1; - } - - time(&now); /* get current time */ - - ptr = localtime(&now); - - time_now = ptr->tm_hour*60 + ptr->tm_min; - - /* walk thru the rates for weekday until rate for current time found */ - - for (hd = rates[rate_type][ptr->tm_wday]; hd; hd = hd->next) - { - /* current time within window ? */ - if((time_now >= hd->start_time ) && - (time_now < hd->end_time )) - { - DBGL(DL_RATES, (llog(LL_DBG, "rate=%d sec/unit (day=%d, beg=%d:%2.2d, end=%d:2.2d, current=%d:%2.2d)", - hd->rate, - ptr->tm_wday, - hd->start_time/60, hd->start_time%60, - hd->end_time/60, hd->end_time%60, - time_now/60, time_now%60))); - - return hd->rate; - } - } - return -1; -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/rc_config.c b/usr.sbin/i4b/isdnd/rc_config.c deleted file mode 100644 index 6f84e21c10f4..000000000000 --- a/usr.sbin/i4b/isdnd/rc_config.c +++ /dev/null @@ -1,1865 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - config file processing - * ----------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:11:48 2006] - * - *---------------------------------------------------------------------------*/ - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -#include <sys/ioctl.h> - -#include <net/if.h> - -#include "isdnd.h" -#include "y.tab.h" - -#include "monitor.h" - -extern int entrycount; -extern int controllercount; -extern int lineno; -extern char *yytext; - -extern FILE *yyin; -extern int yyparse(); - -static void set_config_defaults(void); -static void check_config(void); -static void print_config(void); -static void parse_valid(int entrycount, char *dt); - -static int nregexpr = 0; -static int nregprog = 0; - -/*---------------------------------------------------------------------------* - * called from main to read and process config file - *---------------------------------------------------------------------------*/ -void -configure(char *filename, int reread) -{ - extern void reset_scanner(FILE *inputfile); - - set_config_defaults(); - - yyin = fopen(filename, "r"); - - if(yyin == NULL) - { - llog(LL_ERR, "cannot fopen file [%s]", filename); - exit(1); - } - - if(reread) - { - reset_scanner(yyin); - } - - yyparse(); - - monitor_fixup_rights(); - - check_config(); /* validation and consistency check */ - - fclose(yyin); - - if(do_print) - { - if(config_error_flag) - { - llog(LL_ERR, "there were %d error(s) in the configuration file, terminating!", config_error_flag); - exit(1); - } - print_config(); - do_exit(0); - } -} - -/*---------------------------------------------------------------------------* - * yacc error routine - *---------------------------------------------------------------------------*/ -void -yyerror(const char *msg) -{ - llog(LL_ERR, "configuration error: %s at line %d, token \"%s\"", msg, lineno+1, yytext); - config_error_flag++; -} - -/*---------------------------------------------------------------------------* - * fill all config entries with default values - *---------------------------------------------------------------------------*/ -static void -set_config_defaults(void) -{ - cfg_entry_t *cep = &cfg_entry_tab[0]; /* ptr to config entry */ - int i; - - /* system section cleanup */ - - nregprog = nregexpr = 0; - - rt_prio = RTPRIO_NOTUSED; - - mailer[0] = '\0'; - mailto[0] = '\0'; - - /* clean regular expression table */ - - for(i=0; i < MAX_RE; i++) - { - if(rarr[i].re_expr) - free(rarr[i].re_expr); - rarr[i].re_expr = NULL; - - if(rarr[i].re_prog) - free(rarr[i].re_prog); - rarr[i].re_prog = NULL; - - rarr[i].re_flg = 0; - } - - strcpy(rotatesuffix, ""); - - /* - * controller table cleanup, beware: has already - * been setup in main, init_controller() ! - */ - - for(i=0; i < ncontroller; i++) - { - isdn_ctrl_tab[i].protocol = PROTOCOL_DSS1; - isdn_ctrl_tab[i].firmware = NULL; - } - - /* entry section cleanup */ - - for(i=0; i < CFG_ENTRY_MAX; i++, cep++) - { - bzero(cep, sizeof(cfg_entry_t)); - - /* ====== filled in at startup configuration, then static */ - - sprintf(cep->name, "ENTRY%d", i); - - cep->isdncontroller = INVALID; - cep->isdnchannel = CHAN_ANY; - - cep->usrdevicename = INVALID; - cep->usrdeviceunit = INVALID; - - cep->remote_numbers_handling = RNH_LAST; - - cep->dialin_reaction = REACT_IGNORE; - - cep->b1protocol = BPROT_NONE; - - cep->unitlength = UNITLENGTH_DEFAULT; - - cep->earlyhangup = EARLYHANGUP_DEFAULT; - - cep->ratetype = INVALID_RATE; - - cep->unitlengthsrc = ULSRC_NONE; - - cep->answerprog = ANSWERPROG_DEF; - - cep->callbackwait = CALLBACKWAIT_MIN; - - cep->calledbackwait = CALLEDBACKWAIT_MIN; - - cep->dialretries = DIALRETRIES_DEF; - - cep->recoverytime = RECOVERYTIME_MIN; - - cep->dialouttype = DIALOUT_NORMAL; - - cep->inout = DIR_INOUT; - - cep->ppp_expect_auth = AUTH_UNDEF; - - cep->ppp_send_auth = AUTH_UNDEF; - - cep->ppp_auth_flags = AUTH_RECHALLENGE | AUTH_REQUIRED; - - /* ======== filled in after start, then dynamic */ - - cep->cdid = CDID_UNUSED; - - cep->state = ST_IDLE; - - cep->aoc_valid = AOC_INVALID; - - cep->usesubaddr = 0; - } -} - -/*---------------------------------------------------------------------------* - * internaly set values for ommitted controler sectin - *---------------------------------------------------------------------------*/ -void -cfg_set_controller_default() -{ - controllercount = 0; - DBGL(DL_RCCF, (llog(LL_DBG, "[defaults, no controller section] controller %d: protocol = dss1", controllercount))); - isdn_ctrl_tab[controllercount].protocol = PROTOCOL_DSS1; -} - -#define PPP_PAP 0xc023 -#define PPP_CHAP 0xc223 - -static void -set_isppp_auth(int entry) -{ - cfg_entry_t *cep = &cfg_entry_tab[entry]; /* ptr to config entry */ - - struct ifreq ifr; - struct spppreq spr; - int s; - int doioctl = 0; - - if(cep->usrdevicename != BDRV_ISPPP) - return; - - if(cep->ppp_expect_auth == AUTH_UNDEF - && cep->ppp_send_auth == AUTH_UNDEF) - return; - - if(cep->ppp_expect_auth == AUTH_NONE - || cep->ppp_send_auth == AUTH_NONE) - doioctl = 1; - - if ((cep->ppp_expect_auth == AUTH_CHAP - || cep->ppp_expect_auth == AUTH_PAP) - && cep->ppp_expect_name[0] != 0 - && cep->ppp_expect_password[0] != 0) - doioctl = 1; - - if ((cep->ppp_send_auth == AUTH_CHAP || cep->ppp_send_auth == AUTH_PAP) - && cep->ppp_send_name[0] != 0 - && cep->ppp_send_password[0] != 0) - doioctl = 1; - - if(!doioctl) - return; - - snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "isp%d", cep->usrdeviceunit); - - /* use a random AF to create the socket */ - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - llog(LL_ERR, "ERROR opening control socket at line %d!", lineno); - config_error_flag++; - return; - } - spr.cmd = (int)SPPPIOGDEFS; - ifr.ifr_data = (caddr_t)&spr; - - if (ioctl(s, SIOCGIFGENERIC, &ifr) == -1) { - llog(LL_ERR, "ERROR fetching active PPP authentication info for %s at line %d!", ifr.ifr_name, lineno); - close(s); - config_error_flag++; - return; - } - if (cep->ppp_expect_auth != AUTH_UNDEF) - { - if(cep->ppp_expect_auth == AUTH_NONE) - { - spr.defs.hisauth.proto = 0; - } - else if ((cep->ppp_expect_auth == AUTH_CHAP - || cep->ppp_expect_auth == AUTH_PAP) - && cep->ppp_expect_name[0] != 0 - && cep->ppp_expect_password[0] != 0) - { - spr.defs.hisauth.proto = cep->ppp_expect_auth == AUTH_PAP ? PPP_PAP : PPP_CHAP; - strncpy(spr.defs.hisauth.name, cep->ppp_expect_name, AUTHNAMELEN); - strncpy(spr.defs.hisauth.secret, cep->ppp_expect_password, AUTHKEYLEN); - } - } - if (cep->ppp_send_auth != AUTH_UNDEF) - { - if(cep->ppp_send_auth == AUTH_NONE) - { - spr.defs.myauth.proto = 0; - } - else if ((cep->ppp_send_auth == AUTH_CHAP - || cep->ppp_send_auth == AUTH_PAP) - && cep->ppp_send_name[0] != 0 - && cep->ppp_send_password[0] != 0) - { - spr.defs.myauth.proto = cep->ppp_send_auth == AUTH_PAP ? PPP_PAP : PPP_CHAP; - strncpy(spr.defs.myauth.name, cep->ppp_send_name, AUTHNAMELEN); - strncpy(spr.defs.myauth.secret, cep->ppp_send_password, AUTHKEYLEN); - - if(cep->ppp_auth_flags & AUTH_REQUIRED) - spr.defs.hisauth.flags &= ~AUTHFLAG_NOCALLOUT; - else - spr.defs.hisauth.flags |= AUTHFLAG_NOCALLOUT; - - if(cep->ppp_auth_flags & AUTH_RECHALLENGE) - spr.defs.hisauth.flags &= ~AUTHFLAG_NORECHALLENGE; - else - spr.defs.hisauth.flags |= AUTHFLAG_NORECHALLENGE; - } - } - - spr.cmd = (int)SPPPIOSDEFS; - - if (ioctl(s, SIOCSIFGENERIC, &ifr) == -1) { - llog(LL_ERR, "ERROR setting new PPP authentication parameters for %s at line %d!", ifr.ifr_name, lineno); - config_error_flag++; - } - close(s); -} - -/*---------------------------------------------------------------------------* - * extract values from config and fill table - *---------------------------------------------------------------------------*/ -void -cfg_setval(int keyword) -{ - int i; - - switch(keyword) - { - case ACCTALL: - acct_all = yylval.booln; - DBGL(DL_RCCF, (llog(LL_DBG, "system: acctall = %d", yylval.booln))); - break; - - case ACCTFILE: - strcpy(acctfile, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "system: acctfile = %s", yylval.str))); - break; - - case ADDPREFIX: - addprefix = yylval.booln; - DBGL(DL_RCCF, (llog(LL_DBG, "system: add-prefix = %d", yylval.booln))); - break; - - case ALERT: - if(yylval.num < MINALERT) - { - yylval.num = MINALERT; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: alert < %d, min = %d", entrycount, MINALERT, yylval.num))); - } - else if(yylval.num > MAXALERT) - { - yylval.num = MAXALERT; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: alert > %d, min = %d", entrycount, MAXALERT, yylval.num))); - } - - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: alert = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].alert = yylval.num; - break; - - case ALIASING: - DBGL(DL_RCCF, (llog(LL_DBG, "system: aliasing = %d", yylval.booln))); - aliasing = yylval.booln; - break; - - case ALIASFNAME: - strcpy(aliasfile, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "system: aliasfile = %s", yylval.str))); - break; - - case ANSWERPROG: - if((cfg_entry_tab[entrycount].answerprog = malloc(strlen(yylval.str)+1)) == NULL) - { - llog(LL_ERR, "entry %d: answerstring, malloc failed!", entrycount); - do_exit(1); - } - strcpy(cfg_entry_tab[entrycount].answerprog, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: answerprog = %s", entrycount, yylval.str))); - break; - - case B1PROTOCOL: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: b1protocol = %s", entrycount, yylval.str))); - if(!(strcmp(yylval.str, "raw"))) - cfg_entry_tab[entrycount].b1protocol = BPROT_NONE; - else if(!(strcmp(yylval.str, "hdlc"))) - cfg_entry_tab[entrycount].b1protocol = BPROT_RHDLC; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"b1protocol\" at line %d!", lineno); - config_error_flag++; - } - break; - - case BCAP: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: bcap = %s", entrycount, yylval.str))); - cfg_entry_tab[entrycount].bcap = BCAP_NONE; - if(!(strcmp(yylval.str, "dov"))) - cfg_entry_tab[entrycount].bcap = BCAP_DOV; - break; - - case BEEPCONNECT: - do_bell = yylval.booln; - DBGL(DL_RCCF, (llog(LL_DBG, "system: beepconnect = %d", yylval.booln))); - break; - - case BUDGETCALLBACKPERIOD: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: budget-callbackperiod = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].budget_callbackperiod = yylval.num; - break; - - case BUDGETCALLBACKNCALLS: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: budget-callbackncalls = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].budget_callbackncalls = yylval.num; - break; - - case BUDGETCALLOUTPERIOD: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: budget-calloutperiod = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].budget_calloutperiod = yylval.num; - break; - - case BUDGETCALLOUTNCALLS: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: budget-calloutncalls = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].budget_calloutncalls = yylval.num; - break; - - case BUDGETCALLBACKSFILEROTATE: - cfg_entry_tab[entrycount].budget_callbacksfile_rotate = yylval.booln; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: budget-callbacksfile-rotate = %d", entrycount, yylval.booln))); - break; - - case BUDGETCALLBACKSFILE: - { - FILE *fp; - int s, l; - int n; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: budget-callbacksfile = %s", entrycount, yylval.str))); - fp = fopen(yylval.str, "r"); - if(fp != NULL) - { - if((fscanf(fp, "%d %d %d", (int *)&s, (int *)&l, &n)) != 3) - { - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: initializing budget-callbacksfile %s", entrycount, yylval.str))); - fclose(fp); - fp = fopen(yylval.str, "w"); - if(fp != NULL) - { - fprintf(fp, "%d %d %d", (int)time(NULL), (int)time(NULL), 0); - fclose(fp); - } - } - } - else - { - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: creating budget-callbacksfile %s", entrycount, yylval.str))); - fp = fopen(yylval.str, "w"); - if(fp != NULL) - { - fprintf(fp, "%d %d %d", (int)time(NULL), (int)time(NULL), 0); - fclose(fp); - } - } - - fp = fopen(yylval.str, "r"); - if(fp != NULL) - { - if((fscanf(fp, "%d %d %d", (int *)&s, (int *)&l, &n)) == 3) - { - if((cfg_entry_tab[entrycount].budget_callbacks_file = malloc(strlen(yylval.str)+1)) == NULL) - { - llog(LL_ERR, "entry %d: budget-callbacksfile, malloc failed!", entrycount); - do_exit(1); - } - strcpy(cfg_entry_tab[entrycount].budget_callbacks_file, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: using callbacksfile %s", entrycount, yylval.str))); - } - fclose(fp); - } - } - break; - - case BUDGETCALLOUTSFILEROTATE: - cfg_entry_tab[entrycount].budget_calloutsfile_rotate = yylval.booln; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: budget-calloutsfile-rotate = %d", entrycount, yylval.booln))); - break; - - case BUDGETCALLOUTSFILE: - { - FILE *fp; - int s, l; - int n; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: budget-calloutsfile = %s", entrycount, yylval.str))); - fp = fopen(yylval.str, "r"); - if(fp != NULL) - { - if((fscanf(fp, "%d %d %d", (int *)&s, (int *)&l, &n)) != 3) - { - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: initializing budget-calloutsfile %s", entrycount, yylval.str))); - fclose(fp); - fp = fopen(yylval.str, "w"); - if(fp != NULL) - { - fprintf(fp, "%d %d %d", (int)time(NULL), (int)time(NULL), 0); - fclose(fp); - } - } - } - else - { - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: creating budget-calloutsfile %s", entrycount, yylval.str))); - fp = fopen(yylval.str, "w"); - if(fp != NULL) - { - fprintf(fp, "%d %d %d", (int)time(NULL), (int)time(NULL), 0); - fclose(fp); - } - } - - fp = fopen(yylval.str, "r"); - if(fp != NULL) - { - if((fscanf(fp, "%d %d %d", (int *)&s, (int *)&l, &n)) == 3) - { - if((cfg_entry_tab[entrycount].budget_callouts_file = malloc(strlen(yylval.str)+1)) == NULL) - { - llog(LL_ERR, "entry %d: budget-calloutsfile, malloc failed!", entrycount); - do_exit(1); - } - strcpy(cfg_entry_tab[entrycount].budget_callouts_file, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: using calloutsfile %s", entrycount, yylval.str))); - } - fclose(fp); - } - } - break; - - case CALLBACKWAIT: - if(yylval.num < CALLBACKWAIT_MIN) - { - yylval.num = CALLBACKWAIT_MIN; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: callbackwait < %d, min = %d", entrycount, CALLBACKWAIT_MIN, yylval.num))); - } - - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: callbackwait = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].callbackwait = yylval.num; - break; - - case CALLEDBACKWAIT: - if(yylval.num < CALLEDBACKWAIT_MIN) - { - yylval.num = CALLEDBACKWAIT_MIN; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: calledbackwait < %d, min = %d", entrycount, CALLEDBACKWAIT_MIN, yylval.num))); - } - - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: calledbackwait = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].calledbackwait = yylval.num; - break; - - case CLONE: - /* - * clone = <entryname> - * Loads the entry from the named, existing one. - * Fields such as name and usrdeviceunit should - * always be specified after clone as they must be - * unique. - * - * NOTE: all malloc()'d fields must be dup()'d here, - * we can't have multiple references to same storage. - */ - for (i = 0; i < entrycount; i++) - if (!strcmp(cfg_entry_tab[i].name, yylval.str)) - break; - if (i == entrycount) { - llog(LL_ERR, "entry %d: clone, unknown entry %s!", entrycount, yylval.str); - do_exit(1); - } - - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: clone = %s", entrycount, yylval.str))); - - memcpy(&cfg_entry_tab[entrycount], &cfg_entry_tab[i], - sizeof(cfg_entry_tab[0])); - - if (cfg_entry_tab[entrycount].answerprog) - cfg_entry_tab[entrycount].answerprog = strdup(cfg_entry_tab[entrycount].answerprog); - if (cfg_entry_tab[entrycount].budget_callbacks_file) - cfg_entry_tab[entrycount].budget_callbacks_file = strdup(cfg_entry_tab[entrycount].budget_callbacks_file); - if (cfg_entry_tab[entrycount].budget_callouts_file) - cfg_entry_tab[entrycount].budget_callouts_file = strdup(cfg_entry_tab[entrycount].budget_callouts_file); - if (cfg_entry_tab[entrycount].connectprog) - cfg_entry_tab[entrycount].connectprog = strdup(cfg_entry_tab[entrycount].connectprog); - if (cfg_entry_tab[entrycount].disconnectprog) - cfg_entry_tab[entrycount].disconnectprog = strdup(cfg_entry_tab[entrycount].disconnectprog); - break; - - case CONNECTPROG: - if((cfg_entry_tab[entrycount].connectprog = malloc(strlen(yylval.str)+1)) == NULL) - { - llog(LL_ERR, "entry %d: connectprog, malloc failed!", entrycount); - do_exit(1); - } - strcpy(cfg_entry_tab[entrycount].connectprog, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: connectprog = %s", entrycount, yylval.str))); - break; - - case DIALOUTTYPE: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: dialouttype = %s", entrycount, yylval.str))); - if(!(strcmp(yylval.str, "normal"))) - cfg_entry_tab[entrycount].dialouttype = DIALOUT_NORMAL; - else if(!(strcmp(yylval.str, "calledback"))) - cfg_entry_tab[entrycount].dialouttype = DIALOUT_CALLEDBACK; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"dialout-type\" at line %d!", lineno); - config_error_flag++; - } - break; - - case DIALRETRIES: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: dialretries = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].dialretries = yylval.num; - break; - - case DIALRANDINCR: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: dialrandincr = %d", entrycount, yylval.booln))); - cfg_entry_tab[entrycount].dialrandincr = yylval.booln; - break; - - case DIRECTION: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: direction = %s", entrycount, yylval.str))); - - if(!(strcmp(yylval.str, "inout"))) - cfg_entry_tab[entrycount].inout = DIR_INOUT; - else if(!(strcmp(yylval.str, "in"))) - cfg_entry_tab[entrycount].inout = DIR_INONLY; - else if(!(strcmp(yylval.str, "out"))) - cfg_entry_tab[entrycount].inout = DIR_OUTONLY; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"direction\" at line %d!", lineno); - config_error_flag++; - } - break; - - case DISCONNECTPROG: - if((cfg_entry_tab[entrycount].disconnectprog = malloc(strlen(yylval.str)+1)) == NULL) - { - llog(LL_ERR, "entry %d: disconnectprog, malloc failed!", entrycount); - do_exit(1); - } - strcpy(cfg_entry_tab[entrycount].disconnectprog, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: disconnectprog = %s", entrycount, yylval.str))); - break; - - case DOWNTRIES: - if(yylval.num > DOWN_TRIES_MAX) - yylval.num = DOWN_TRIES_MAX; - else if(yylval.num < DOWN_TRIES_MIN) - yylval.num = DOWN_TRIES_MIN; - - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: downtries = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].downtries = yylval.num; - break; - - case DOWNTIME: - if(yylval.num > DOWN_TIME_MAX) - yylval.num = DOWN_TIME_MAX; - else if(yylval.num < DOWN_TIME_MIN) - yylval.num = DOWN_TIME_MIN; - - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: downtime = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].downtime = yylval.num; - break; - - case EARLYHANGUP: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: earlyhangup = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].earlyhangup = yylval.num; - break; - - case EXTCALLATTR: - DBGL(DL_RCCF, (llog(LL_DBG, "system: extcallattr = %d", yylval.booln))); - extcallattr = yylval.booln; - break; - - case FIRMWARE: - DBGL(DL_RCCF, (llog(LL_DBG, "controller %d: firmware = %s", controllercount, yylval.str))); - isdn_ctrl_tab[controllercount].firmware = strdup(yylval.str); - break; - - case HOLIDAYFILE: - strcpy(holidayfile, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "system: holidayfile = %s", yylval.str))); - break; - - case IDLE_ALG_OUT: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: idle-algorithm-outgoing = %s", entrycount, yylval.str))); - - if(!(strcmp(yylval.str, "fix-unit-size"))) - { - cfg_entry_tab[entrycount].shorthold_algorithm = SHA_FIXU; - } - else if(!(strcmp(yylval.str, "var-unit-size"))) - { - cfg_entry_tab[entrycount].shorthold_algorithm = SHA_VARU; - } - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"idle-algorithm-outgoing\" at line %d!", lineno); - config_error_flag++; - } - break; - - case IDLETIME_IN: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: idle_time_in = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].idle_time_in = yylval.num; - break; - - case IDLETIME_OUT: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: idle_time_out = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].idle_time_out = yylval.num; - break; - - case ISDNCONTROLLER: - cfg_entry_tab[entrycount].isdncontroller = yylval.num; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: isdncontroller = %d", entrycount, yylval.num))); - break; - - case ISDNCHANNEL: - if (yylval.num == 0 || yylval.num == -1) - { - cfg_entry_tab[entrycount].isdnchannel = CHAN_ANY; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: isdnchannel = any", entrycount))); - } - else if (yylval.num > MAX_BCHAN) - { - llog(LL_DBG, "entry %d: isdnchannel value out of range", entrycount); - config_error_flag++; - } - else - { - cfg_entry_tab[entrycount].isdnchannel = yylval.num-1; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: isdnchannel = B%d", entrycount, yylval.num))); - } - break; - - case ISDNTIME: - DBGL(DL_RCCF, (llog(LL_DBG, "system: isdntime = %d", yylval.booln))); - isdntime = yylval.booln; - break; - - case ISDNTXDELIN: - cfg_entry_tab[entrycount].isdntxdelin = yylval.num; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: isdntxdel-incoming = %d", entrycount, yylval.num))); - break; - - case ISDNTXDELOUT: - cfg_entry_tab[entrycount].isdntxdelout = yylval.num; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: isdntxdel-outgoing = %d", entrycount, yylval.num))); - break; - - case LOCAL_PHONE_DIALOUT: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: local_phone_dialout = %s", entrycount, yylval.str))); - strcpy(cfg_entry_tab[entrycount].local_phone_dialout.number, yylval.str); - break; - - case LOCAL_SUBADDR_DIALOUT: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: local_subaddr_dialout = %s", entrycount, yylval.str))); - strcpy(cfg_entry_tab[entrycount].local_phone_dialout.subaddr, yylval.str); - break; - - case LOCAL_PHONE_INCOMING: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: local_phone_incoming = %s", entrycount, yylval.str))); - strcpy(cfg_entry_tab[entrycount].local_phone_incoming.number, yylval.str); - break; - - case LOCAL_SUBADDR_INCOMING: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: local_subaddr_incoming = %s", entrycount, yylval.str))); - strcpy(cfg_entry_tab[entrycount].local_phone_incoming.subaddr, yylval.str); - break; - - case MAILER: - strcpy(mailer, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "system: mailer = %s", yylval.str))); - break; - - case MAILTO: - strcpy(mailto, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "system: mailto = %s", yylval.str))); - break; - - case MAXCONNECTTIME: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: maxconnecttime = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].maxconnecttime = yylval.num; - break; - - case MONITORPORT: - monitorport = yylval.num; - DBGL(DL_RCCF, (llog(LL_DBG, "system: monitorport = %d", yylval.num))); - break; - - case MONITORSW: - if (yylval.booln && inhibit_monitor) - { - do_monitor = 0; - DBGL(DL_RCCF, (llog(LL_DBG, "system: monitor-enable overriden by command line flag"))); - } - else - { - do_monitor = yylval.booln; - DBGL(DL_RCCF, (llog(LL_DBG, "system: monitor-enable = %d", yylval.booln))); - } - break; - - case NAME: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: name = %s", entrycount, yylval.str))); - strcpy(cfg_entry_tab[entrycount].name, yylval.str); - break; - - case PPP_AUTH_RECHALLENGE: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: ppp-auth-rechallenge = %d", entrycount, yylval.booln))); - if(yylval.booln) - cfg_entry_tab[entrycount].ppp_auth_flags |= AUTH_RECHALLENGE; - else - cfg_entry_tab[entrycount].ppp_auth_flags &= ~AUTH_RECHALLENGE; - set_isppp_auth(entrycount); - break; - - case PPP_AUTH_PARANOID: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: ppp-auth-paranoid = %d", entrycount, yylval.booln))); - if(yylval.booln) - cfg_entry_tab[entrycount].ppp_auth_flags |= AUTH_REQUIRED; - else - cfg_entry_tab[entrycount].ppp_auth_flags &= ~AUTH_REQUIRED; - set_isppp_auth(entrycount); - break; - - case PPP_EXPECT_AUTH: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: ppp-expect-auth = %s", entrycount, yylval.str))); - if(!(strcmp(yylval.str, "none"))) - cfg_entry_tab[entrycount].ppp_expect_auth = AUTH_NONE; - else if(!(strcmp(yylval.str, "pap"))) - cfg_entry_tab[entrycount].ppp_expect_auth = AUTH_PAP; - else if(!(strcmp(yylval.str, "chap"))) - cfg_entry_tab[entrycount].ppp_expect_auth = AUTH_CHAP; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"ppp-expect-auth\" at line %d!", lineno); - config_error_flag++; - break; - } - set_isppp_auth(entrycount); - break; - - case PPP_EXPECT_NAME: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: ppp-expect-name = %s", entrycount, yylval.str))); - strncpy(cfg_entry_tab[entrycount].ppp_expect_name, yylval.str, sizeof(cfg_entry_tab[entrycount].ppp_expect_name) -1); - set_isppp_auth(entrycount); - break; - - case PPP_EXPECT_PASSWORD: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: ppp-expect-password = %s", entrycount, yylval.str))); - strncpy(cfg_entry_tab[entrycount].ppp_expect_password, yylval.str, sizeof(cfg_entry_tab[entrycount].ppp_expect_password) -1); - set_isppp_auth(entrycount); - break; - - case PPP_SEND_AUTH: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: ppp-send-auth = %s", entrycount, yylval.str))); - if(!(strcmp(yylval.str, "none"))) - cfg_entry_tab[entrycount].ppp_send_auth = AUTH_NONE; - else if(!(strcmp(yylval.str, "pap"))) - cfg_entry_tab[entrycount].ppp_send_auth = AUTH_PAP; - else if(!(strcmp(yylval.str, "chap"))) - cfg_entry_tab[entrycount].ppp_send_auth = AUTH_CHAP; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"ppp-send-auth\" at line %d!", lineno); - config_error_flag++; - break; - } - set_isppp_auth(entrycount); - break; - - case PPP_SEND_NAME: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: ppp-send-name = %s", entrycount, yylval.str))); - strncpy(cfg_entry_tab[entrycount].ppp_send_name, yylval.str, sizeof(cfg_entry_tab[entrycount].ppp_send_name) -1); - set_isppp_auth(entrycount); - break; - - case PPP_SEND_PASSWORD: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: ppp-send-password = %s", entrycount, yylval.str))); - strncpy(cfg_entry_tab[entrycount].ppp_send_password, yylval.str, sizeof(cfg_entry_tab[entrycount].ppp_send_password) -1); - set_isppp_auth(entrycount); - break; - - case PREFIXINTERNATIONAL: - strncpy(prefixinternational, yylval.str, sizeof(prefixinternational)-1); - DBGL(DL_RCCF, (llog(LL_DBG, "system: prefix-international = %s", prefixinternational))); - break; - - case PREFIXNATIONAL: - strncpy(prefixnational, yylval.str, sizeof(prefixnational)-1); - DBGL(DL_RCCF, (llog(LL_DBG, "system: prefix-national = %s", prefixnational))); - break; - - case PROTOCOL: - DBGL(DL_RCCF, (llog(LL_DBG, "controller %d: protocol = %s", controllercount, yylval.str))); - if(!(strcmp(yylval.str, "dss1"))) - isdn_ctrl_tab[controllercount].protocol = PROTOCOL_DSS1; - else if(!(strcmp(yylval.str, "d64s"))) - isdn_ctrl_tab[controllercount].protocol = PROTOCOL_D64S; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"protocol\" at line %d!", lineno); - config_error_flag++; - } - break; - - case REACTION: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: dialin_reaction = %s", entrycount, yylval.str))); - if(!(strcmp(yylval.str, "accept"))) - cfg_entry_tab[entrycount].dialin_reaction = REACT_ACCEPT; - else if(!(strcmp(yylval.str, "reject"))) - cfg_entry_tab[entrycount].dialin_reaction = REACT_REJECT; - else if(!(strcmp(yylval.str, "ignore"))) - cfg_entry_tab[entrycount].dialin_reaction = REACT_IGNORE; - else if(!(strcmp(yylval.str, "answer"))) - cfg_entry_tab[entrycount].dialin_reaction = REACT_ANSWER; - else if(!(strcmp(yylval.str, "callback"))) - cfg_entry_tab[entrycount].dialin_reaction = REACT_CALLBACK; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"dialin_reaction\" at line %d!", lineno); - config_error_flag++; - } - break; - - case REMOTE_PHONE_DIALOUT: - if(cfg_entry_tab[entrycount].remote_numbers_count >= MAXRNUMBERS) - { - llog(LL_ERR, "ERROR parsing config file: too many remote numbers at line %d!", lineno); - config_error_flag++; - break; - } - - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: remote_phone_dialout #%d = %s", - entrycount, cfg_entry_tab[entrycount].remote_numbers_count, yylval.str))); - - strcpy(cfg_entry_tab[entrycount].remote_numbers[cfg_entry_tab[entrycount].remote_numbers_count].number, yylval.str); - cfg_entry_tab[entrycount].remote_numbers[cfg_entry_tab[entrycount].remote_numbers_count].flag = 0; - - cfg_entry_tab[entrycount].remote_numbers_count++; - - break; - - case REMOTE_SUBADDR_DIALOUT: - if(cfg_entry_tab[entrycount].remote_subaddr_count >= MAXRNUMBERS) - { - llog(LL_ERR, "ERROR parsing config file: too many remote subaddresses at line %d!", lineno); - config_error_flag++; - break; - } - - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: remote_subaddr_dialout #%d = %s", - entrycount, cfg_entry_tab[entrycount].remote_numbers_count, yylval.str))); - - strcpy(cfg_entry_tab[entrycount].remote_numbers[cfg_entry_tab[entrycount].remote_numbers_count].subaddr, yylval.str); - - break; - - case REMOTE_NUMBERS_HANDLING: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: remdial_handling = %s", entrycount, yylval.str))); - if(!(strcmp(yylval.str, "next"))) - cfg_entry_tab[entrycount].remote_numbers_handling = RNH_NEXT; - else if(!(strcmp(yylval.str, "last"))) - cfg_entry_tab[entrycount].remote_numbers_handling = RNH_LAST; - else if(!(strcmp(yylval.str, "first"))) - cfg_entry_tab[entrycount].remote_numbers_handling = RNH_FIRST; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"remdial_handling\" at line %d!", lineno); - config_error_flag++; - } - break; - - case REMOTE_PHONE_INCOMING: - { - int n; - n = cfg_entry_tab[entrycount].incoming_numbers_count; - if (n >= MAX_INCOMING) - { - llog(LL_ERR, "ERROR parsing config file: too many \"remote_phone_incoming\" entries at line %d!", lineno); - config_error_flag++; - break; - } - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: remote_phone_incoming #%d = %s", entrycount, n, yylval.str))); - strcpy(cfg_entry_tab[entrycount].remote_phone_incoming[n].number, yylval.str); - cfg_entry_tab[entrycount].incoming_numbers_count++; - } - break; - - case REMOTE_SUBADDR_INCOMING: - { - int n; - n = cfg_entry_tab[entrycount].incoming_numbers_count; - if (n >= MAX_INCOMING) - { - llog(LL_ERR, "ERROR parsing config file: too many \"remote_subaddr_incoming\" entries at line %d!", lineno); - config_error_flag++; - break; - } - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: remote_subaddr_incoming #%d = %s", entrycount, n, yylval.str))); - strcpy(cfg_entry_tab[entrycount].remote_phone_incoming[n].subaddr, yylval.str); - } - break; - - case RATESFILE: - strcpy(ratesfile, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "system: ratesfile = %s", yylval.str))); - break; - - case RATETYPE: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: ratetype = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].ratetype = yylval.num; - break; - - case RECOVERYTIME: - if(yylval.num < RECOVERYTIME_MIN) - { - yylval.num = RECOVERYTIME_MIN; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: recoverytime < %d, min = %d", entrycount, RECOVERYTIME_MIN, yylval.num))); - } - - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: recoverytime = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].recoverytime = yylval.num; - break; - - case REGEXPR: - if(nregexpr >= MAX_RE) - { - llog(LL_ERR, "system: regexpr #%d >= MAX_RE", nregexpr); - config_error_flag++; - break; - } - - if((i = regcomp(&(rarr[nregexpr].re), yylval.str, REG_EXTENDED|REG_NOSUB)) != 0) - { - char buf[256]; - regerror(i, &(rarr[nregexpr].re), buf, sizeof(buf)); - llog(LL_ERR, "system: regcomp error for %s: [%s]", yylval.str, buf); - config_error_flag++; - break; - } - else - { - if((rarr[nregexpr].re_expr = malloc(strlen(yylval.str)+1)) == NULL) - { - llog(LL_ERR, "system: regexpr malloc error error for %s", yylval.str); - config_error_flag++; - break; - } - strcpy(rarr[nregexpr].re_expr, yylval.str); - - DBGL(DL_RCCF, (llog(LL_DBG, "system: regexpr %s stored into slot %d", yylval.str, nregexpr))); - - if(rarr[nregexpr].re_prog != NULL) - rarr[nregexpr].re_flg = 1; - - nregexpr++; - - } - break; - - case REGPROG: - if(nregprog >= MAX_RE) - { - llog(LL_ERR, "system: regprog #%d >= MAX_RE", nregprog); - config_error_flag++; - break; - } - if((rarr[nregprog].re_prog = malloc(strlen(yylval.str)+1)) == NULL) - { - llog(LL_ERR, "system: regprog malloc error error for %s", yylval.str); - config_error_flag++; - break; - } - strcpy(rarr[nregprog].re_prog, yylval.str); - - DBGL(DL_RCCF, (llog(LL_DBG, "system: regprog %s stored into slot %d", yylval.str, nregprog))); - - if(rarr[nregprog].re_expr != NULL) - rarr[nregprog].re_flg = 1; - - nregprog++; - break; - - case ROTATESUFFIX: - strcpy(rotatesuffix, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "system: rotatesuffix = %s", yylval.str))); - break; - - case RTPRIO: -#ifdef USE_RTPRIO - rt_prio = yylval.num; - if(rt_prio < RTP_PRIO_MIN || rt_prio > RTP_PRIO_MAX) - { - config_error_flag++; - llog(LL_ERR, "system: error, rtprio (%d) out of range!", yylval.num); - } - else - { - DBGL(DL_RCCF, (llog(LL_DBG, "system: rtprio = %d", yylval.num))); - } -#else - rt_prio = RTPRIO_NOTUSED; -#endif - break; - - case TINAINITPROG: - strcpy(tinainitprog, yylval.str); - DBGL(DL_RCCF, (llog(LL_DBG, "system: tinainitprog = %s", yylval.str))); - break; - - case UNITLENGTH: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: unitlength = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].unitlength = yylval.num; - break; - - case UNITLENGTHSRC: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: unitlengthsrc = %s", entrycount, yylval.str))); - if(!(strcmp(yylval.str, "none"))) - cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_NONE; - else if(!(strcmp(yylval.str, "cmdl"))) - cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_CMDL; - else if(!(strcmp(yylval.str, "conf"))) - cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_CONF; - else if(!(strcmp(yylval.str, "rate"))) - cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_RATE; - else if(!(strcmp(yylval.str, "aocd"))) - cfg_entry_tab[entrycount].unitlengthsrc = ULSRC_DYN; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"unitlengthsrc\" at line %d!", lineno); - config_error_flag++; - } - break; - - case USRDEVICENAME: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: usrdevicename = %s", entrycount, yylval.str))); - if(!strcmp(yylval.str, "rbch")) - cfg_entry_tab[entrycount].usrdevicename = BDRV_RBCH; - else if(!strcmp(yylval.str, "tel")) - cfg_entry_tab[entrycount].usrdevicename = BDRV_TEL; - else if(!strcmp(yylval.str, "ipr")) - cfg_entry_tab[entrycount].usrdevicename = BDRV_IPR; - else if(!strcmp(yylval.str, "isp")) - cfg_entry_tab[entrycount].usrdevicename = BDRV_ISPPP; -#ifdef __bsdi__ - else if(!strcmp(yylval.str, "ibc")) - cfg_entry_tab[entrycount].usrdevicename = BDRV_IBC; -#endif - else if(!strcmp(yylval.str, "ing")) - cfg_entry_tab[entrycount].usrdevicename = BDRV_ING; - else - { - llog(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"usrdevicename\" at line %d!", lineno); - config_error_flag++; - } - break; - - case USRDEVICEUNIT: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: usrdeviceunit = %d", entrycount, yylval.num))); - cfg_entry_tab[entrycount].usrdeviceunit = yylval.num; - break; - - case USEACCTFILE: - useacctfile = yylval.booln; - DBGL(DL_RCCF, (llog(LL_DBG, "system: useacctfile = %d", yylval.booln))); - break; - - case USESUBADDR: - cfg_entry_tab[entrycount].usesubaddr = yylval.booln; - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: usesubaddr = %d", entrycount, yylval.booln))); - break; - - case USEDOWN: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: usedown = %d", entrycount, yylval.booln))); - cfg_entry_tab[entrycount].usedown = yylval.booln; - break; - - case VALID: - DBGL(DL_RCCF, (llog(LL_DBG, "entry %d: valid = %s", entrycount, yylval.str))); - parse_valid(entrycount, yylval.str); - break; - - default: - llog(LL_ERR, "ERROR parsing config file: unknown keyword at line %d!", lineno); - config_error_flag++; - break; - } -} - -/*---------------------------------------------------------------------------* - * parse a date/time range - *---------------------------------------------------------------------------*/ -static void -parse_valid(int entrycount, char *dt) -{ - /* a valid string consists of some days of week separated by - * commas, where 0=sunday, 1=monday .. 6=saturday and a special - * value of 7 which is a holiday from the holiday file. - * after the days comes an optional (!) time range in the form - * aa:bb-cc:dd, this format is fixed to be parsable by sscanf. - * Valid specifications looks like this: - * 1,2,3,4,5,09:00-18:00 Monday-Friday 9-18h - * 1,2,3,4,5,18:00-09:00 Monday-Friday 18-9h - * 6 Saturday (whole day) - * 0,7 Sunday and Holidays - */ - - int day = 0; - int fromhr = 0; - int frommin = 0; - int tohr = 0; - int tomin = 0; - int ret; - - for(;;) - { - if( ( ((*dt >= '0') && (*dt <= '9')) && (*(dt+1) == ':') ) || - ( ((*dt >= '0') && (*dt <= '2')) && ((*(dt+1) >= '0') && (*(dt+1) <= '9')) && (*(dt+2) == ':') ) ) - { - /* dt points to time spec */ - ret = sscanf(dt, "%d:%d-%d:%d", &fromhr, &frommin, &tohr, &tomin); - if(ret !=4) - { - llog(LL_ERR, "ERROR parsing config file: timespec [%s] error at line %d!", *dt, lineno); - config_error_flag++; - return; - } - - if(fromhr < 0 || fromhr > 24 || tohr < 0 || tohr > 24 || - frommin < 0 || frommin > 59 || tomin < 0 || tomin > 59) - { - llog(LL_ERR, "ERROR parsing config file: invalid time [%s] at line %d!", *dt, lineno); - config_error_flag++; - return; - } - break; - } - else if ((*dt >= '0') && (*dt <= '7')) - { - /* dt points to day spec */ - day |= 1 << (*dt - '0'); - dt++; - continue; - } - else if (*dt == ',') - { - /* dt points to delimiter */ - dt++; - continue; - } - else if (*dt == '\0') - { - /* dt points to end of string */ - break; - } - else - { - /* dt points to illegal character */ - llog(LL_ERR, "ERROR parsing config file: illegal character [%c=0x%x] in date/time spec at line %d!", *dt, *dt, lineno); - config_error_flag++; - return; - } - } - cfg_entry_tab[entrycount].day = day; - cfg_entry_tab[entrycount].fromhr = fromhr; - cfg_entry_tab[entrycount].frommin = frommin; - cfg_entry_tab[entrycount].tohr = tohr; - cfg_entry_tab[entrycount].tomin = tomin; -} - -/*---------------------------------------------------------------------------* - * configuration validation and consistency check - *---------------------------------------------------------------------------*/ -static void -check_config(void) -{ - cfg_entry_t *cep = &cfg_entry_tab[0]; /* ptr to config entry */ - int i; - int error = 0; - - /* regular expression table */ - - for(i=0; i < MAX_RE; i++) - { - if((rarr[i].re_expr != NULL) && (rarr[i].re_prog == NULL)) - { - llog(LL_ERR, "check_config: regular expression %d without program!", i); - error++; - } - if((rarr[i].re_prog != NULL) && (rarr[i].re_expr == NULL)) - { - llog(LL_ERR, "check_config: regular expression program %d without expression!", i); - error++; - } - } - - /* entry sections */ - - for(i=0; i <= entrycount; i++, cep++) - { - /* isdn controller number */ - - if((cep->isdncontroller < -1) || (cep->isdncontroller > (ncontroller-1))) - { - llog(LL_ERR, "check_config: WARNING, isdncontroller out of range in entry %d!", i); - } - - /* numbers used for dialout */ - - if((cep->inout != DIR_INONLY) && (cep->dialin_reaction != REACT_ANSWER)) - { - if(cep->remote_numbers_count == 0) - { - llog(LL_ERR, "check_config: remote-phone-dialout not set in entry %d!", i); - error++; - } - if(strlen(cep->local_phone_dialout.number) == 0) - { - llog(LL_ERR, "check_config: local-phone-dialout not set in entry %d!", i); - error++; - } - } - - /* numbers used for incoming calls */ - - if(cep->inout != DIR_OUTONLY) - { - if(strlen(cep->local_phone_incoming.number) == 0) - { - llog(LL_ERR, "check_config: local-phone-incoming not set in entry %d!", i); - error++; - } - if(cep->incoming_numbers_count == 0) - { - llog(LL_ERR, "check_config: remote-phone-incoming not set in entry %d!", i); - error++; - } - } - - if((cep->dialin_reaction == REACT_ANSWER) && (cep->b1protocol != BPROT_NONE)) - { - llog(LL_ERR, "check_config: b1protocol not raw for telephony in entry %d!", i); - error++; - } - - if((cep->ppp_send_auth == AUTH_PAP) || (cep->ppp_send_auth == AUTH_CHAP)) - { - if(cep->ppp_send_name[0] == 0) - { - llog(LL_ERR, "check_config: no remote authentification name in entry %d!", i); - error++; - } - if(cep->ppp_send_password[0] == 0) - { - llog(LL_ERR, "check_config: no remote authentification password in entry %d!", i); - error++; - } - } - if((cep->ppp_expect_auth == AUTH_PAP) || (cep->ppp_expect_auth == AUTH_CHAP)) - { - if(cep->ppp_expect_name[0] == 0) - { - llog(LL_ERR, "check_config: no local authentification name in entry %d!", i); - error++; - } - if(cep->ppp_expect_password[0] == 0) - { - llog(LL_ERR, "check_config: no local authentification secret in entry %d!", i); - error++; - } - } - } - if(error) - { - llog(LL_ERR, "check_config: %d error(s) in configuration file, exit!", error); - do_exit(1); - } -} - -/*---------------------------------------------------------------------------* - * print the configuration - *---------------------------------------------------------------------------*/ -static void -print_config(void) -{ -#define PFILE stdout - -#ifdef I4B_EXTERNAL_MONITOR - extern struct monitor_rights * monitor_next_rights(const struct monitor_rights *r); - struct monitor_rights *m_rights; -#endif - cfg_entry_t *cep = &cfg_entry_tab[0]; /* ptr to config entry */ - int i, j; - time_t clock; - char mytime[64]; - - time(&clock); - strcpy(mytime, ctime(&clock)); - mytime[strlen(mytime)-1] = '\0'; - - fprintf(PFILE, "#---------------------------------------------------------------------------\n"); - fprintf(PFILE, "# system section (generated %s)\n", mytime); - fprintf(PFILE, "#---------------------------------------------------------------------------\n"); - fprintf(PFILE, "system\n"); - fprintf(PFILE, "useacctfile = %s\n", useacctfile ? "on\t\t\t\t# update accounting information file" : "off\t\t\t\t# don't update accounting information file"); - fprintf(PFILE, "acctall = %s\n", acct_all ? "on\t\t\t\t# put all events into accounting file" : "off\t\t\t\t# put only charged events into accounting file"); - fprintf(PFILE, "acctfile = %s\t\t# accounting information file\n", acctfile); - fprintf(PFILE, "ratesfile = %s\t\t# charging rates database file\n", ratesfile); - -#ifdef USE_RTPRIO - if(rt_prio == RTPRIO_NOTUSED) - fprintf(PFILE, "# rtprio is unused\n"); - else - fprintf(PFILE, "rtprio = %d\t\t\t\t# isdnd runs at realtime priority\n", rt_prio); -#endif - - /* regular expression table */ - - for(i=0; i < MAX_RE; i++) - { - if(rarr[i].re_expr != NULL) - { - fprintf(PFILE, "regexpr = \"%s\"\t\t# scan logfile for this expression\n", rarr[i].re_expr); - } - if(rarr[i].re_prog != NULL) - { - fprintf(PFILE, "regprog = %s\t\t# program to run when expression is matched\n", rarr[i].re_prog); - } - } - -#ifdef I4B_EXTERNAL_MONITOR - - fprintf(PFILE, "monitor-allowed = %s\n", do_monitor ? "on\t\t\t\t# remote isdnd monitoring allowed" : "off\t\t\t\t# remote isdnd monitoring disabled"); - fprintf(PFILE, "monitor-port = %d\t\t\t\t# TCP/IP port number used for remote monitoring\n", monitorport); - - m_rights = monitor_next_rights(NULL); - if(m_rights != NULL) - { - char *s = "error\n"; - char b[512]; - - for ( ; m_rights != NULL; m_rights = monitor_next_rights(m_rights)) - { - if(m_rights->local) - { - fprintf(PFILE, "monitor = \"%s\"\t\t# local socket name for monitoring\n", m_rights->name); - } - else - { - struct in_addr ia; - ia.s_addr = ntohl(m_rights->net); - - switch(m_rights->mask) - { - case 0xffffffff: - s = "32"; - break; - case 0xfffffffe: - s = "31"; - break; - case 0xfffffffc: - s = "30"; - break; - case 0xfffffff8: - s = "29"; - break; - case 0xfffffff0: - s = "28"; - break; - case 0xffffffe0: - s = "27"; - break; - case 0xffffffc0: - s = "26"; - break; - case 0xffffff80: - s = "25"; - break; - case 0xffffff00: - s = "24"; - break; - case 0xfffffe00: - s = "23"; - break; - case 0xfffffc00: - s = "22"; - break; - case 0xfffff800: - s = "21"; - break; - case 0xfffff000: - s = "20"; - break; - case 0xffffe000: - s = "19"; - break; - case 0xffffc000: - s = "18"; - break; - case 0xffff8000: - s = "17"; - break; - case 0xffff0000: - s = "16"; - break; - case 0xfffe0000: - s = "15"; - break; - case 0xfffc0000: - s = "14"; - break; - case 0xfff80000: - s = "13"; - break; - case 0xfff00000: - s = "12"; - break; - case 0xffe00000: - s = "11"; - break; - case 0xffc00000: - s = "10"; - break; - case 0xff800000: - s = "9"; - break; - case 0xff000000: - s = "8"; - break; - case 0xfe000000: - s = "7"; - break; - case 0xfc000000: - s = "6"; - break; - case 0xf8000000: - s = "5"; - break; - case 0xf0000000: - s = "4"; - break; - case 0xe0000000: - s = "3"; - break; - case 0xc0000000: - s = "2"; - break; - case 0x80000000: - s = "1"; - break; - case 0x00000000: - s = "0"; - break; - } - fprintf(PFILE, "monitor = \"%s/%s\"\t\t# host (net/mask) allowed to connect for monitoring\n", inet_ntoa(ia), s); - } - b[0] = '\0'; - - if((m_rights->rights) & I4B_CA_COMMAND_FULL) - strcat(b, "fullcmd,"); - if((m_rights->rights) & I4B_CA_COMMAND_RESTRICTED) - strcat(b, "restrictedcmd,"); - if((m_rights->rights) & I4B_CA_EVNT_CHANSTATE) - strcat(b, "channelstate,"); - if((m_rights->rights) & I4B_CA_EVNT_CALLIN) - strcat(b, "callin,"); - if((m_rights->rights) & I4B_CA_EVNT_CALLOUT) - strcat(b, "callout,"); - if((m_rights->rights) & I4B_CA_EVNT_I4B) - strcat(b, "logevents,"); - - if(b[strlen(b)-1] == ',') - b[strlen(b)-1] = '\0'; - - fprintf(PFILE, "monitor-access = %s\t\t# monitor access rights\n", b); - } - } - -#endif - /* entry sections */ - - for(i=0; i <= entrycount; i++, cep++) - { - fprintf(PFILE, "\n"); - fprintf(PFILE, "#---------------------------------------------------------------------------\n"); - fprintf(PFILE, "# entry section %d\n", i); - fprintf(PFILE, "#---------------------------------------------------------------------------\n"); - fprintf(PFILE, "entry\n"); - - fprintf(PFILE, "name = %s\t\t# name for this entry section\n", cep->name); - - fprintf(PFILE, "isdncontroller = %d\t\t# ISDN card number used for this entry\n", cep->isdncontroller); - fprintf(PFILE, "isdnchannel = "); - switch(cep->isdnchannel) - { - case CHAN_ANY: - fprintf(PFILE, "-1\t\t# any ISDN B-channel may be used\n"); - break; - default: - fprintf(PFILE, "%d\t\t# only ISDN B-channel %d may be used\n", cep->isdnchannel+1, cep->isdnchannel+1); - break; - } - - fprintf(PFILE, "usrdevicename = %s\t\t# name of userland ISDN B-channel device\n", bdrivername(cep->usrdevicename)); - fprintf(PFILE, "usrdeviceunit = %d\t\t# unit number of userland ISDN B-channel device\n", cep->usrdeviceunit); - - fprintf(PFILE, "b1protocol = %s\n", cep->b1protocol ? "hdlc\t\t# B-channel layer 1 protocol is HDLC" : "raw\t\t# No B-channel layer 1 protocol used"); - - if(!(cep->usrdevicename == BDRV_TEL)) - { - fprintf(PFILE, "direction = "); - switch(cep->inout) - { - case DIR_INONLY: - fprintf(PFILE, "in\t\t# only incoming connections allowed\n"); - break; - case DIR_OUTONLY: - fprintf(PFILE, "out\t\t# only outgoing connections allowed\n"); - break; - case DIR_INOUT: - fprintf(PFILE, "inout\t\t# incoming and outgoing connections allowed\n"); - break; - } - } - - if(!((cep->usrdevicename == BDRV_TEL) || (cep->inout == DIR_INONLY))) - { - if(cep->remote_numbers_count > 1) - { - for(j=0; j<cep->remote_numbers_count; j++) - fprintf(PFILE, "remote-phone-dialout = %s\t\t# telephone number %d for dialing out to remote\n", cep->remote_numbers[j].number, j+1); - - fprintf(PFILE, "remdial-handling = "); - - switch(cep->remote_numbers_handling) - { - case RNH_NEXT: - fprintf(PFILE, "next\t\t# use next number after last successfull for new dial\n"); - break; - case RNH_LAST: - fprintf(PFILE, "last\t\t# use last successfull number for new dial\n"); - break; - case RNH_FIRST: - fprintf(PFILE, "first\t\t# always start with first number for new dial\n"); - break; - } - } - else - { - fprintf(PFILE, "remote-phone-dialout = %s\t\t# telephone number for dialing out to remote\n", cep->remote_numbers[0].number); - } - - fprintf(PFILE, "local-phone-dialout = %s\t\t# show this number to remote when dialling out\n", cep->local_phone_dialout.number); - fprintf(PFILE, "dialout-type = %s\n", cep->dialouttype ? "calledback\t\t# i am called back by remote" : "normal\t\t# i am not called back by remote"); - } - - if(!(cep->inout == DIR_OUTONLY)) - { - int n; - - fprintf(PFILE, "local-phone-incoming = %s\t\t# incoming calls must match this (mine) telephone number\n", cep->local_phone_incoming.number); - for (n = 0; n < cep->incoming_numbers_count; n++) - fprintf(PFILE, "remote-phone-incoming = %s\t\t# this is a valid remote number to call me\n", - cep->remote_phone_incoming[n].number); - - fprintf(PFILE, "dialin-reaction = "); - switch(cep->dialin_reaction) - { - case REACT_ACCEPT: - fprintf(PFILE, "accept\t\t# i accept a call from remote and connect\n"); - break; - case REACT_REJECT: - fprintf(PFILE, "reject\t\t# i reject the call from remote\n"); - break; - case REACT_IGNORE: - fprintf(PFILE, "ignore\t\t# i ignore the call from remote\n"); - break; - case REACT_ANSWER: - fprintf(PFILE, "answer\t\t# i will start telephone answering when remote calls in\n"); - break; - case REACT_CALLBACK: - fprintf(PFILE, "callback\t\t# when remote calls in, i will hangup and call back\n"); - break; - } - } - - if(cep->usrdevicename == BDRV_ISPPP) - { - char *s; - switch(cep->ppp_expect_auth) - { - case AUTH_NONE: - s = "none"; - break; - case AUTH_PAP: - s = "pap"; - break; - case AUTH_CHAP: - s = "chap"; - break; - default: - s = NULL; - break; - } - if(s != NULL) - { - fprintf(PFILE, "ppp-expect-auth = %s\t\t# the auth protocol we expect to receive on dial-in (none,pap,chap)\n", s); - if(cep->ppp_expect_auth != AUTH_NONE) - { - fprintf(PFILE, "ppp-expect-name = %s\t\t# the user name allowed in\n", cep->ppp_expect_name); - fprintf(PFILE, "ppp-expect-password = %s\t\t# the key expected from the other side\n", cep->ppp_expect_password); - fprintf(PFILE, "ppp-auth-paranoid = %s\t\t# do we require remote to authenticate even if we dial out\n", cep->ppp_auth_flags & AUTH_REQUIRED ? "yes" : "no"); - } - } - switch(cep->ppp_send_auth) - { - case AUTH_NONE: - s = "none"; - break; - case AUTH_PAP: - s = "pap"; - break; - case AUTH_CHAP: - s = "chap"; - break; - default: - s = NULL; - break; - } - if(s != NULL) - { - fprintf(PFILE, "ppp-send-auth = %s\t\t# the auth protocol we use when dialing out (none,pap,chap)\n", s); - if(cep->ppp_send_auth != AUTH_NONE) - { - fprintf(PFILE, "ppp-send-name = %s\t\t# our PPP account used for dial-out\n", cep->ppp_send_name); - fprintf(PFILE, "ppp-send-password = %s\t\t# the key sent to the other side\n", cep->ppp_send_password); - } - } - if(cep->ppp_send_auth == AUTH_CHAP || - cep->ppp_expect_auth == AUTH_CHAP) { - fprintf(PFILE, "ppp-auth-rechallenge = %s\t\t# rechallenge CHAP connections once in a while\n", cep->ppp_auth_flags & AUTH_RECHALLENGE ? "yes" : "no"); - } - } - - if(!((cep->inout == DIR_INONLY) || (cep->usrdevicename == BDRV_TEL))) - { - char *s; - fprintf(PFILE, "idletime-outgoing = %d\t\t# outgoing call idle timeout\n", cep->idle_time_out); - - switch( cep->shorthold_algorithm ) - { - case SHA_FIXU: - s = "fix-unit-size"; - break; - case SHA_VARU: - s = "var-unit-size"; - break; - default: - s = "error!!!"; - break; - } - - fprintf(PFILE, "idle-algorithm-outgoing = %s\t\t# outgoing call idle algorithm\n", s); - } - - if(!(cep->inout == DIR_OUTONLY)) - fprintf(PFILE, "idletime-incoming = %d\t\t# incoming call idle timeout\n", cep->idle_time_in); - - if(!(cep->usrdevicename == BDRV_TEL)) - { - fprintf(PFILE, "unitlengthsrc = "); - switch(cep->unitlengthsrc) - { - case ULSRC_NONE: - fprintf(PFILE, "none\t\t# no unit length specified, using default\n"); - break; - case ULSRC_CMDL: - fprintf(PFILE, "cmdl\t\t# using unit length specified on commandline\n"); - break; - case ULSRC_CONF: - fprintf(PFILE, "conf\t\t# using unitlength specified by unitlength-keyword\n"); - fprintf(PFILE, "unitlength = %d\t\t# fixed unitlength\n", cep->unitlength); - break; - case ULSRC_RATE: - fprintf(PFILE, "rate\t\t# using unitlength specified in rate database\n"); - fprintf(PFILE, "ratetype = %d\t\t# type of rate from rate database\n", cep->ratetype); - break; - case ULSRC_DYN: - fprintf(PFILE, "aocd\t\t# using dynamically calculated unitlength based on AOCD subscription\n"); - fprintf(PFILE, "ratetype = %d\t\t# type of rate from rate database\n", cep->ratetype); - break; - } - - fprintf(PFILE, "earlyhangup = %d\t\t# early hangup safety time\n", cep->earlyhangup); - - } - - if(cep->usrdevicename == BDRV_TEL) - { - fprintf(PFILE, "answerprog = %s\t\t# program used to answer incoming telephone calls\n", cep->answerprog); - fprintf(PFILE, "alert = %d\t\t# number of seconds to wait before accepting a call\n", cep->alert); - } - - if(!(cep->usrdevicename == BDRV_TEL)) - { - if(cep->dialin_reaction == REACT_CALLBACK) - fprintf(PFILE, "callbackwait = %d\t\t# i am waiting this time before calling back remote\n", cep->callbackwait); - - if(cep->dialouttype == DIALOUT_CALLEDBACK) - fprintf(PFILE, "calledbackwait = %d\t\t# i am waiting this time for a call back from remote\n", cep->calledbackwait); - - if(!(cep->inout == DIR_INONLY)) - { - fprintf(PFILE, "dialretries = %d\t\t# number of dialing retries\n", cep->dialretries); - fprintf(PFILE, "recoverytime = %d\t\t# time to wait between dialling retries\n", cep->recoverytime); - fprintf(PFILE, "dialrandincr = %s\t\t# use random dialing time addon\n", cep->dialrandincr ? "on" : "off"); - - fprintf(PFILE, "usedown = %s\n", cep->usedown ? "on\t\t# ISDN device switched off on excessive dial failures" : "off\t\t# no device switchoff on excessive dial failures"); - if(cep->usedown) - { - fprintf(PFILE, "downtries = %d\t\t# number of dialretries failures before switching off\n", cep->downtries); - fprintf(PFILE, "downtime = %d\t\t# time device is switched off\n", cep->downtime); - } - } - } - } - fprintf(PFILE, "\n"); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/rc_parse.y b/usr.sbin/i4b/isdnd/rc_parse.y deleted file mode 100644 index 6427500f9075..000000000000 --- a/usr.sbin/i4b/isdnd/rc_parse.y +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright (c) 1997 Joerg Wunsch. All rights reserved. - * - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - runtime configuration parser - * ----------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Aug 11 12:27:28 2002] - * - *---------------------------------------------------------------------------*/ - -%{ - -/* #define YYDEBUG 1 */ - -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> - -#include "monitor.h" /* monitor access rights bit definitions */ -#include "isdnd.h" - -#ifndef FALSE -# define FALSE 0 -#endif - -#ifndef TRUE -# define TRUE 1 -#endif - -extern void cfg_setval(int keyword); -extern void cfg_set_controller_default(); -extern void reset_scanner(FILE *infile); -extern void yyerror(const char *msg); -extern int yylex(); - -extern int lineno; -extern char *yytext; -extern int nentries; - -int saw_system = 0; -int entrycount = -1; -int controllercount = -1; - -%} - -%token ACCTALL -%token ACCTFILE -%token ADDPREFIX -%token ALERT -%token ALIASFNAME -%token ALIASING -%token ANSWERPROG -%token B1PROTOCOL -%token BEEPCONNECT -%token BCAP -%token BUDGETCALLOUTPERIOD -%token BUDGETCALLOUTNCALLS -%token BUDGETCALLOUTSFILE -%token BUDGETCALLOUTSFILEROTATE -%token BUDGETCALLBACKPERIOD -%token BUDGETCALLBACKNCALLS -%token BUDGETCALLBACKSFILE -%token BUDGETCALLBACKSFILEROTATE -%token CALLBACKWAIT -%token CALLEDBACKWAIT -%token CALLIN -%token CALLOUT -%token CHANNELSTATE -%token CLONE -%token CONNECTPROG -%token CONTROLLER -%token DIALOUTTYPE -%token DIALRANDINCR -%token DIALRETRIES -%token DIRECTION -%token DISCONNECTPROG -%token DOWNTIME -%token DOWNTRIES -%token EARLYHANGUP -%token ENTRY -%token EXTCALLATTR -%token FIRMWARE -%token FULLCMD -%token HOLIDAYFILE -%token IDLETIME_IN -%token IDLETIME_OUT -%token IDLE_ALG_OUT -%token ISDNCHANNEL -%token ISDNCONTROLLER -%token ISDNTIME -%token ISDNTXDELIN -%token ISDNTXDELOUT -%token LOCAL_PHONE_DIALOUT -%token LOCAL_SUBADDR_DIALOUT -%token LOCAL_PHONE_INCOMING -%token LOCAL_SUBADDR_INCOMING -%token LOGEVENTS -%token MAILER -%token MAILTO -%token MAXCONNECTTIME -%token MONITOR -%token MONITORACCESS -%token MONITORPORT -%token MONITORSW -%token NAME -%token NO -%token OFF -%token ON -%token PPP_AUTH_RECHALLENGE -%token PPP_AUTH_PARANOID -%token PPP_EXPECT_AUTH -%token PPP_EXPECT_NAME -%token PPP_EXPECT_PASSWORD -%token PPP_SEND_AUTH -%token PPP_SEND_NAME -%token PPP_SEND_PASSWORD -%token PREFIXNATIONAL -%token PREFIXINTERNATIONAL -%token PROTOCOL -%token RATESFILE -%token RATETYPE -%token REACTION -%token RECOVERYTIME -%token REGEXPR -%token REGPROG -%token REMOTE_NUMBERS_HANDLING -%token REMOTE_PHONE_DIALOUT -%token REMOTE_SUBADDR_DIALOUT -%token REMOTE_PHONE_INCOMING -%token REMOTE_SUBADDR_INCOMING -%token RESTRICTEDCMD -%token ROTATESUFFIX -%token RTPRIO -%token SYSTEM -%token TINAINITPROG -%token UNITLENGTH -%token UNITLENGTHSRC -%token USEACCTFILE -%token USESUBADDR -%token USEDOWN -%token USRDEVICENAME -%token USRDEVICEUNIT -%token VALID -%token YES - - -%token <str> NUMBERSTR - -%token <str> STRING - -%type <booln> boolean - -%type <num> sysfilekeyword sysnumkeyword sysstrkeyword sysboolkeyword -%type <num> filekeyword numkeyword strkeyword boolkeyword monrights monright -%type <num> cstrkeyword cfilekeyword -%type <str> filename - -%union { - int booln; - int num; - char *str; -} - -%% - -config: sections - ; - -sections: possible_nullentries - syssect - optcontrollersects - entrysects - ; - -possible_nullentries: - /* lambda */ - | possible_nullentries error '\n' - | possible_nullentries nullentry - ; - -nullentry: '\n' - ; - -entrysects: entrysect - | entrysects entrysect - ; - -optcontrollersects: - controllersects - | - { - cfg_set_controller_default(); - } - ; - -controllersects: controllersect - | controllersects controllersect - ; - -/* ============== */ -/* system section */ -/* ============== */ - -syssect: SYSTEM sysentries - ; - -sysentries: sysentry - { - saw_system = 1; - monitor_clear_rights(); - } - | sysentries sysentry - ; - -sysentry: sysfileentry - | sysboolentry - | sysnumentry - | sysstrentry - | sysmonitorstart - | sysmonitorrights - | nullentry - | error '\n' - ; - - -sysmonitorstart: - MONITOR '=' STRING '\n' - { - char *err = NULL; - switch (monitor_start_rights($3)) { - case I4BMAR_OK: - break; - case I4BMAR_LENGTH: - err = "local socket name too long: %s"; - break; - case I4BMAR_DUP: - err = "duplicate entry: %s"; - break; - case I4BMAR_CIDR: - err = "invalid CIDR specification: %s"; - break; - case I4BMAR_NOIP: - err = "could not resolve host or net specification: %s"; - break; - } - if (err) { - char msg[1024]; - snprintf(msg, sizeof msg, err, $3); - yyerror(msg); - } - } - ; - -sysmonitorrights: - MONITORACCESS '=' monrights '\n' - { monitor_add_rights($3); } - ; - -monrights: monrights ',' monright { $$ = $1 | $3; } - | monright { $$ = $1; } - ; - -monright: FULLCMD { $$ = I4B_CA_COMMAND_FULL; } - | RESTRICTEDCMD { $$ = I4B_CA_COMMAND_RESTRICTED; } - | CHANNELSTATE { $$ = I4B_CA_EVNT_CHANSTATE; } - | CALLIN { $$ = I4B_CA_EVNT_CALLIN; } - | CALLOUT { $$ = I4B_CA_EVNT_CALLOUT; } - | LOGEVENTS { $$ = I4B_CA_EVNT_I4B; } - ; - -sysfileentry: sysfilekeyword '=' filename '\n' - { - cfg_setval($1); - } - ; - -sysboolentry: sysboolkeyword '=' boolean '\n' - { - yylval.booln = $3; - cfg_setval($1); - } - ; - -sysnumentry: sysnumkeyword '=' NUMBERSTR '\n' - { - yylval.num = atoi($3); - cfg_setval($1); - } - ; - -sysstrentry: sysstrkeyword '=' STRING '\n' - { - cfg_setval($1); - } - | sysstrkeyword '=' NUMBERSTR '\n' - { - cfg_setval($1); - } - ; - -filename: STRING { - if ($1[0] != '/') - { - yyerror("filename doesn't start with a slash"); - YYERROR; - } - $$ = $1; - } - ; - -boolean: NO { $$ = FALSE; } - | OFF { $$ = FALSE; } - | ON { $$ = TRUE; } - | YES { $$ = TRUE; } - ; - -sysfilekeyword: RATESFILE { $$ = RATESFILE; } - | ACCTFILE { $$ = ACCTFILE; } - | ALIASFNAME { $$ = ALIASFNAME; } - | HOLIDAYFILE { $$ = HOLIDAYFILE; } - | TINAINITPROG { $$ = TINAINITPROG; } - ; - -sysboolkeyword: USEACCTFILE { $$ = USEACCTFILE; } - | ALIASING { $$ = ALIASING; } - | ACCTALL { $$ = ACCTALL; } - | ADDPREFIX { $$ = ADDPREFIX; } - | BEEPCONNECT { $$ = BEEPCONNECT; } - | EXTCALLATTR { $$ = EXTCALLATTR; } - | ISDNTIME { $$ = ISDNTIME; } - | MONITORSW { $$ = MONITORSW; } - ; - -sysnumkeyword: MONITORPORT { $$ = MONITORPORT; } - | RTPRIO { $$ = RTPRIO; } - ; - -sysstrkeyword: MAILER { $$ = MAILER; } - | MAILTO { $$ = MAILTO; } - | PREFIXNATIONAL { $$ = PREFIXNATIONAL; } - | PREFIXINTERNATIONAL { $$ = PREFIXINTERNATIONAL; } - | ROTATESUFFIX { $$ = ROTATESUFFIX; } - | REGEXPR { $$ = REGEXPR; } - | REGPROG { $$ = REGPROG; } - ; - -/* ============= */ -/* entry section */ -/* ============= */ - -entrysect: ENTRY - { - entrycount++; - nentries++; - } - entries - ; - -entries: entry - | entries entry - ; - -entry: fileentry - | strentry - | numentry - | boolentry - | nullentry - | error '\n' - ; - -fileentry: filekeyword '=' filename '\n' - { - cfg_setval($1); - } - ; - - -strentry: strkeyword '=' STRING '\n' - { - cfg_setval($1); - } - | strkeyword '=' NUMBERSTR '\n' - { - cfg_setval($1); - } - ; - -boolentry: boolkeyword '=' boolean '\n' - { - yylval.booln = $3; - cfg_setval($1); - } - ; - -numentry: numkeyword '=' NUMBERSTR '\n' - { - yylval.num = atoi($3); - cfg_setval($1); - } - ; - -filekeyword: BUDGETCALLBACKSFILE { $$ = BUDGETCALLBACKSFILE; } - | BUDGETCALLOUTSFILE { $$ = BUDGETCALLOUTSFILE; } - ; - -strkeyword: ANSWERPROG { $$ = ANSWERPROG; } - | B1PROTOCOL { $$ = B1PROTOCOL; } - | BCAP { $$ = BCAP; } - | CONNECTPROG { $$ = CONNECTPROG; } - | DIALOUTTYPE { $$ = DIALOUTTYPE; } - | DIRECTION { $$ = DIRECTION; } - | DISCONNECTPROG { $$ = DISCONNECTPROG; } - | IDLE_ALG_OUT { $$ = IDLE_ALG_OUT; } - | LOCAL_PHONE_INCOMING { $$ = LOCAL_PHONE_INCOMING; } - | LOCAL_SUBADDR_INCOMING { $$ = LOCAL_SUBADDR_INCOMING; } - | LOCAL_PHONE_DIALOUT { $$ = LOCAL_PHONE_DIALOUT; } - | LOCAL_SUBADDR_DIALOUT { $$ = LOCAL_SUBADDR_DIALOUT; } - | NAME { $$ = NAME; } - | PPP_EXPECT_AUTH { $$ = PPP_EXPECT_AUTH; } - | PPP_EXPECT_NAME { $$ = PPP_EXPECT_NAME; } - | PPP_EXPECT_PASSWORD { $$ = PPP_EXPECT_PASSWORD; } - | PPP_SEND_AUTH { $$ = PPP_SEND_AUTH; } - | PPP_SEND_NAME { $$ = PPP_SEND_NAME; } - | PPP_SEND_PASSWORD { $$ = PPP_SEND_PASSWORD; } - | REACTION { $$ = REACTION; } - | REMOTE_NUMBERS_HANDLING { $$ = REMOTE_NUMBERS_HANDLING; } - | REMOTE_PHONE_INCOMING { $$ = REMOTE_PHONE_INCOMING; } - | REMOTE_SUBADDR_INCOMING { $$ = REMOTE_SUBADDR_INCOMING; } - | REMOTE_PHONE_DIALOUT { $$ = REMOTE_PHONE_DIALOUT; } - | REMOTE_SUBADDR_DIALOUT { $$ = REMOTE_SUBADDR_DIALOUT; } - | UNITLENGTHSRC { $$ = UNITLENGTHSRC; } - | USRDEVICENAME { $$ = USRDEVICENAME; } - | VALID { $$ = VALID; } - | CLONE { $$ = CLONE; } - ; - -numkeyword: ALERT { $$ = ALERT; } - | BUDGETCALLBACKPERIOD { $$ = BUDGETCALLBACKPERIOD; } - | BUDGETCALLBACKNCALLS { $$ = BUDGETCALLBACKNCALLS; } - | BUDGETCALLOUTPERIOD { $$ = BUDGETCALLOUTPERIOD; } - | BUDGETCALLOUTNCALLS { $$ = BUDGETCALLOUTNCALLS; } - | CALLBACKWAIT { $$ = CALLBACKWAIT; } - | CALLEDBACKWAIT { $$ = CALLEDBACKWAIT; } - | DIALRETRIES { $$ = DIALRETRIES; } - | EARLYHANGUP { $$ = EARLYHANGUP; } - | IDLETIME_IN { $$ = IDLETIME_IN; } - | IDLETIME_OUT { $$ = IDLETIME_OUT; } - | ISDNCONTROLLER { $$ = ISDNCONTROLLER; } - | ISDNCHANNEL { $$ = ISDNCHANNEL; } - | ISDNTXDELIN { $$ = ISDNTXDELIN; } - | ISDNTXDELOUT { $$ = ISDNTXDELOUT; } - | RATETYPE { $$ = RATETYPE; } - | RECOVERYTIME { $$ = RECOVERYTIME; } - | UNITLENGTH { $$ = UNITLENGTH; } - | USRDEVICEUNIT { $$ = USRDEVICEUNIT; } - | DOWNTIME { $$ = DOWNTIME; } - | DOWNTRIES { $$ = DOWNTRIES; } - | MAXCONNECTTIME { $$ = MAXCONNECTTIME; } - ; - -boolkeyword: BUDGETCALLBACKSFILEROTATE { $$ = BUDGETCALLBACKSFILEROTATE; } - | BUDGETCALLOUTSFILEROTATE { $$ = BUDGETCALLOUTSFILEROTATE; } - | DIALRANDINCR { $$ = DIALRANDINCR; } - | PPP_AUTH_RECHALLENGE { $$ = PPP_AUTH_RECHALLENGE; } - | PPP_AUTH_PARANOID { $$ = PPP_AUTH_PARANOID; } - | USEDOWN { $$ = USEDOWN; } - | USESUBADDR { $$ = USESUBADDR; } - ; - -/* ================== */ -/* controller section */ -/* ================== */ - -controllersect: CONTROLLER - { - controllercount++; - } - controllers - ; - -controllers: controller - | controllers controller - ; - -controller: strcontroller - | nullentry - | error '\n' - ; - -strcontroller: cstrkeyword '=' STRING '\n' - { - cfg_setval($1); - } - | cstrkeyword '=' NUMBERSTR '\n' - { - cfg_setval($1); - } - | cfilekeyword '=' filename '\n' - { - cfg_setval($1); - } - ; - -cstrkeyword: PROTOCOL { $$ = PROTOCOL; } - ; - -cfilekeyword: FIRMWARE { $$ = FIRMWARE; } - ; - - -%% diff --git a/usr.sbin/i4b/isdnd/rc_scan.l b/usr.sbin/i4b/isdnd/rc_scan.l deleted file mode 100644 index 988a4fb7c42b..000000000000 --- a/usr.sbin/i4b/isdnd/rc_scan.l +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 1997 Joerg Wunsch. All rights reserved. - * - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - runtime configuration lexical analyzer - * --------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sun Aug 11 12:27:50 2002] - * - *---------------------------------------------------------------------------*/ - -%{ - -#include <err.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#include <sysexits.h> - -#include "y.tab.h" - -int lineno; - -%} - -%option noyywrap -%option nounput - -%% - -#.*$ { /* - * Drop comment. NB: this prevents a hash - * sign from appearing inside a quoted string. - */ - } - -["][^"]*["] { - char *str; - if ((str = malloc(yyleng - 1)) == 0) - errx(EX_OSERR, "Out of virtual memory"); - memcpy(str, yytext + 1, yyleng - 2); - str[yyleng - 2] = 0; - yylval.str = str; - return STRING; - } - -(-*[0-9]+)|\* { - char *str; - char *p = yytext; - int i = 0; - if ((str = malloc(128)) == 0) - errx(EX_OSERR, "Out of virtual memory"); - while(*p == '-' || isdigit(*p) || *p == '*') - str[i++] = *p++; - str[i] = '\0'; - yylval.str = str; - return NUMBERSTR; - } - -acctall { return ACCTALL; } -acctfile { return ACCTFILE; } -add-prefix { return ADDPREFIX; } -alert { return ALERT; } -aliasing { return ALIASING; } -aliasfile { return ALIASFNAME; } -answerprog { return ANSWERPROG; } -b1protocol { return B1PROTOCOL; } -bcap { return BCAP; } -beepconnect { return BEEPCONNECT; } -budget-callbackperiod { return BUDGETCALLBACKPERIOD; } -budget-callbackncalls { return BUDGETCALLBACKNCALLS; } -budget-callbacksfile { return BUDGETCALLBACKSFILE; } -budget-callbacksfile-rotate { return BUDGETCALLBACKSFILEROTATE; } -budget-calloutperiod { return BUDGETCALLOUTPERIOD; } -budget-calloutncalls { return BUDGETCALLOUTNCALLS; } -budget-calloutsfile { return BUDGETCALLOUTSFILE; } -budget-calloutsfile-rotate { return BUDGETCALLOUTSFILEROTATE; } -callbackwait { return CALLBACKWAIT; } -calledbackwait { return CALLEDBACKWAIT; } -clone { return CLONE; } -connectprog { return CONNECTPROG; } -controller { return CONTROLLER; } -dialin-reaction { return REACTION; } -dialout-type { return DIALOUTTYPE; } -dialrandincr { return DIALRANDINCR; } -dialretries { return DIALRETRIES; } -direction { return DIRECTION; } -disconnectprog { return DISCONNECTPROG; } -downtries { return DOWNTRIES; } -downtime { return DOWNTIME; } -earlyhangup { return EARLYHANGUP; } -entry { return ENTRY; } -extcallattr { return EXTCALLATTR; } -firmware { return FIRMWARE; } -holidayfile { return HOLIDAYFILE; } -idletime-incoming { return IDLETIME_IN; } -idletime-outgoing { return IDLETIME_OUT; } -idle-algorithm-outgoing { return IDLE_ALG_OUT; } -isdncontroller { return ISDNCONTROLLER; } -isdnchannel { return ISDNCHANNEL; } -isdntime { return ISDNTIME; } -isdntxdel-incoming { return ISDNTXDELIN; } -isdntxdel-outgoing { return ISDNTXDELOUT; } -local-phone-dialout { return LOCAL_PHONE_DIALOUT; } -local-subaddr-dialout { return LOCAL_SUBADDR_DIALOUT; } -local-phone-incoming { return LOCAL_PHONE_INCOMING; } -local-subaddr-incoming { return LOCAL_SUBADDR_INCOMING; } -mailer { return MAILER; } -mailto { return MAILTO; } -maxconnecttime { return MAXCONNECTTIME; } -monitor-allowed { return MONITORSW; } -monitor-port { return MONITORPORT; } -monitor { return MONITOR; } -monitor-access { return MONITORACCESS; } -fullcmd { return FULLCMD; } -restrictedcmd { return RESTRICTEDCMD; } -channelstate { return CHANNELSTATE; } -callin { return CALLIN; } -callout { return CALLOUT; } -logevents { return LOGEVENTS; } -name { return NAME; } -no { return NO; } -off { return OFF; } -on { return ON; } -ppp-auth-rechallenge { return PPP_AUTH_RECHALLENGE; } -ppp-auth-paranoid { return PPP_AUTH_PARANOID; } -ppp-expect-auth { return PPP_EXPECT_AUTH; } -ppp-expect-name { return PPP_EXPECT_NAME; } -ppp-expect-password { return PPP_EXPECT_PASSWORD; } -ppp-send-auth { return PPP_SEND_AUTH; } -ppp-send-name { return PPP_SEND_NAME; } -ppp-send-password { return PPP_SEND_PASSWORD; } -prefix-international { return PREFIXINTERNATIONAL; } -prefix-national { return PREFIXNATIONAL; } -protocol { return PROTOCOL; } -ratesfile { return RATESFILE; } -ratetype { return RATETYPE; } -recoverytime { return RECOVERYTIME; } -regexpr { return REGEXPR; } -regprog { return REGPROG; } -remdial-handling { return REMOTE_NUMBERS_HANDLING; } -remote-phone-dialout { return REMOTE_PHONE_DIALOUT; } -remote-subaddr-dialout { return REMOTE_SUBADDR_DIALOUT; } -remote-phone-incoming { return REMOTE_PHONE_INCOMING; } -remote-subaddr-incoming { return REMOTE_SUBADDR_INCOMING; } -rotatesuffix { return ROTATESUFFIX; } -rtprio { return RTPRIO; } -system { return SYSTEM; } -tinainitprog { return TINAINITPROG; } -unitlength { return UNITLENGTH; } -unitlengthsrc { return UNITLENGTHSRC; } -useacctfile { return USEACCTFILE; } -usesubaddr { return USESUBADDR; } -usrdevicename { return USRDEVICENAME; } -usrdeviceunit { return USRDEVICEUNIT; } -usedown { return USEDOWN; } -valid { return VALID; } -yes { return YES; } - -\n { lineno++; return '\n'; } - -[A-Za-z/.][-A-Za-z0-9_/.]* { - char *str; - if ((str = strdup(yytext)) == 0) - err(EX_OSERR, "Out of virtual memory"); - yylval.str = str; - return STRING; - } - -[ \t] { /* drop white space */ } - -. { return yytext[0]; } - -%% - -void -reset_scanner(FILE *infile) -{ - yyrestart(infile); - lineno = 1; -} diff --git a/usr.sbin/i4b/isdnd/support.c b/usr.sbin/i4b/isdnd/support.c deleted file mode 100644 index 156ed29b80ee..000000000000 --- a/usr.sbin/i4b/isdnd/support.c +++ /dev/null @@ -1,1169 +0,0 @@ -/* - * Copyright (c) 1997, 2003 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - misc support routines - * ---------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:19:23 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -static int isvalidtime(cfg_entry_t *cep); - -/*---------------------------------------------------------------------------* - * find an active entry by driver type and driver unit - *---------------------------------------------------------------------------*/ -cfg_entry_t * -find_active_entry_by_driver(int drivertype, int driverunit) -{ - cfg_entry_t *cep = NULL; - int i; - - for(i=0; i < nentries; i++) - { - cep = &cfg_entry_tab[i]; /* ptr to config entry */ - - if(!((cep->usrdevicename == drivertype) && - (cep->usrdeviceunit == driverunit))) - { - continue; - } - - /* check time interval */ - - if(isvalidtime(cep) == 0) - { - DBGL(DL_VALID, (llog(LL_DBG, "find_active_entry_by_driver: entry %d, time not valid!", i))); - continue; - } - - /* found */ - - if(cep->cdid == CDID_UNUSED) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_active_entry_by_driver: entry %d [%s%d], cdid=CDID_UNUSED !", - i, bdrivername(drivertype), driverunit))); - return(NULL); - } - else if(cep->cdid == CDID_RESERVED) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_active_entry_by_driver: entry %d [%s%d], cdid=CDID_RESERVED!", - i, bdrivername(drivertype), driverunit))); - return(NULL); - } - return(cep); - } - return(NULL); -} - -/*---------------------------------------------------------------------------* - * find entry by drivertype and driverunit and setup for dialing out - *---------------------------------------------------------------------------*/ -cfg_entry_t * -find_by_device_for_dialout(int drivertype, int driverunit) -{ - cfg_entry_t *cep = NULL; - int i; - - for(i=0; i < nentries; i++) - { - cep = &cfg_entry_tab[i]; /* ptr to config entry */ - - /* compare driver type and unit */ - - if(!((cep->usrdevicename == drivertype) && - (cep->usrdeviceunit == driverunit))) - { - continue; - } - - /* check time interval */ - - if(isvalidtime(cep) == 0) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialout: entry %d, time not valid!", i))); - continue; - } - - /* found, check if already reserved */ - - if(cep->cdid == CDID_RESERVED) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialout: entry %d, cdid reserved!", i))); - return(NULL); - } - - /* check if this entry is already in use ? */ - - if(cep->cdid != CDID_UNUSED) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialout: entry %d, cdid in use", i))); - return(NULL); - } - - if((setup_dialout(cep)) == GOOD) - { - /* found an entry to be used for calling out */ - - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialout: found entry %d!", i))); - return(cep); - } - else - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialout: entry %d, setup_dialout() failed!", i))); - return(NULL); - } - } - - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialout: no entry found!"))); - return(NULL); -} - -/*---------------------------------------------------------------------------* - * find entry by drivertype and driverunit and setup for dialing out - *---------------------------------------------------------------------------*/ -cfg_entry_t * -find_by_device_for_dialoutnumber(msg_dialoutnumber_ind_t *mp) -{ - cfg_entry_t *cep = NULL; - int i, j; - - for(i=0; i < nentries; i++) - { - cep = &cfg_entry_tab[i]; /* ptr to config entry */ - - /* compare driver type and unit */ - - if(!((cep->usrdevicename == mp->driver) && - (cep->usrdeviceunit == mp->driver_unit))) - { - continue; - } - - /* check time interval */ - - if(isvalidtime(cep) == 0) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, time not valid!", i))); - continue; - } - - /* found, check if already reserved */ - - if(cep->cdid == CDID_RESERVED) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, cdid reserved!", i))); - return(NULL); - } - - /* check if this entry is already in use ? */ - - if(cep->cdid != CDID_UNUSED) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, cdid in use", i))); - return(NULL); - } - - cep->keypad[0] = '\0'; - - /* check number and copy to cep->remote_numbers[] */ - - for(j = 0; j < mp->cmdlen; j++) - { - if(!(isdigit(*(mp->cmd+j)))) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, dial string contains non-digit at pos %d", i, j))); - return(NULL); - } - /* fill in number to dial */ - cep->remote_numbers[0].number[j] = *(mp->cmd+j); - } - cep->remote_numbers[0].number[j] = '\0'; - -/* XXX subaddr does not have to be a digit! isgraph() would be a better idea */ - for(j = 0; j < mp->subaddrlen; j++) - { - if(!(isdigit(*(mp->subaddr+j)))) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, subaddr string contains non-digit at pos %d", i, j))); - return(NULL); - } - /* fill in number to dial */ - cep->remote_numbers[0].subaddr[j] = *(mp->subaddr+j); - } - cep->remote_numbers[0].subaddr[j] = '\0'; - - cep->remote_numbers_count = 1; - - if((setup_dialout(cep)) == GOOD) - { - /* found an entry to be used for calling out */ - - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialoutnumber: found entry %d!", i))); - return(cep); - } - else - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, setup_dialout() failed!", i))); - return(NULL); - } - } - - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_dialoutnumber: no entry found!"))); - return(NULL); -} - -/*---------------------------------------------------------------------------* - * find entry by drivertype and driverunit and setup for send keypad - *---------------------------------------------------------------------------*/ -cfg_entry_t * -find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd) -{ - cfg_entry_t *cep = NULL; - int i; - - for(i=0; i < nentries; i++) - { - cep = &cfg_entry_tab[i]; /* ptr to config entry */ - - /* compare driver type and unit */ - - if(!((cep->usrdevicename == drivertype) && - (cep->usrdeviceunit == driverunit))) - { - continue; - } - - /* check time interval */ - - if(isvalidtime(cep) == 0) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_keypad: entry %d, time not valid!", i))); - continue; - } - - /* found, check if already reserved */ - - if(cep->cdid == CDID_RESERVED) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_keypad: entry %d, cdid reserved!", i))); - return(NULL); - } - - /* check if this entry is already in use ? */ - - if(cep->cdid != CDID_UNUSED) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_keypad: entry %d, cdid in use", i))); - return(NULL); - } - - cep->remote_numbers[0].number[0] = '\0'; - cep->remote_numbers_count = 0; - cep->remote_phone_dialout.number[0] = '\0'; - - bzero(cep->keypad, KEYPAD_MAX); - strncpy(cep->keypad, cmd, cmdlen); - - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_keypad: entry %d, keypad string is %s", i, cep->keypad))); - - if((setup_dialout(cep)) == GOOD) - { - /* found an entry to be used for calling out */ - - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_keypad: found entry %d!", i))); - return(cep); - } - else - { - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_keypad: entry %d, setup_dialout() failed!", i))); - return(NULL); - } - } - - DBGL(DL_MSG, (llog(LL_DBG, "find_by_device_for_keypad: no entry found!"))); - return(NULL); -} - -/*---------------------------------------------------------------------------* - * find entry by drivertype and driverunit and setup for dialing out - *---------------------------------------------------------------------------*/ -int -setup_dialout(cfg_entry_t *cep) -{ - int i; - - /* check controller operational */ - - if((get_controller_state(cep->isdncontroller)) != CTRL_UP) - { - DBGL(DL_MSG, (llog(LL_DBG, "setup_dialout: entry %s, controller is down", cep->name))); - return(ERROR); - } - - cep->isdncontrollerused = cep->isdncontroller; - - /* check channel available */ - - switch(cep->isdnchannel) - { - case CHAN_ANY: - for (i = 0; i < isdn_ctrl_tab[cep->isdncontroller].nbch; i++) - { - if(ret_channel_state(cep->isdncontroller, i) == CHAN_IDLE) - break; - } - - if (i == isdn_ctrl_tab[cep->isdncontroller].nbch) - { - DBGL(DL_MSG, (llog(LL_DBG, "setup_dialout: entry %s, no channel free", cep->name))); - return(ERROR); - } - cep->isdnchannelused = CHAN_ANY; - break; - - default: - if((ret_channel_state(cep->isdncontroller, cep->isdnchannel)) != CHAN_IDLE) - { - DBGL(DL_MSG, (llog(LL_DBG, "setup_dialout: entry %s, channel not free", cep->name))); - return(ERROR); - } - cep->isdnchannelused = cep->isdnchannel; - break; - } - - DBGL(DL_MSG, (llog(LL_DBG, "setup_dialout: entry %s ok!", cep->name))); - - /* preset disconnect cause */ - - SET_CAUSE_TYPE(cep->disc_cause, CAUSET_I4B); - SET_CAUSE_VAL(cep->disc_cause, CAUSE_I4B_NORMAL); - - return(GOOD); -} - -/*---------------------------------------------------------------------------* - * find entry by drivertype and driverunit - *---------------------------------------------------------------------------*/ -cfg_entry_t * -get_cep_by_driver(int drivertype, int driverunit) -{ - cfg_entry_t *cep = NULL; - int i; - - for(i=0; i < nentries; i++) - { - cep = &cfg_entry_tab[i]; /* ptr to config entry */ - - if(!((cep->usrdevicename == drivertype) && - (cep->usrdeviceunit == driverunit))) - { - continue; - } - - /* check time interval */ - - if(isvalidtime(cep) == 0) - { - DBGL(DL_MSG, (llog(LL_DBG, "get_cep_by_driver: entry %d, time not valid!", i))); - continue; - } - - DBGL(DL_MSG, (llog(LL_DBG, "get_cep_by_driver: found entry %d!", i))); - return(cep); - } - return(NULL); -} - -/*---------------------------------------------------------------------------* - * find a matching entry for an incoming call - * - * - not found/no match: log output with LL_CHD and return NULL - * - found/match: make entry in free cep, return address - *---------------------------------------------------------------------------*/ -cfg_entry_t * -find_matching_entry_incoming(msg_connect_ind_t *mp) -{ - cfg_entry_t *cep = NULL; - int i; - - /* check for CW (call waiting) early */ - - if(mp->channel == CHAN_NO) - { - if(aliasing) - { - char *src_tela = "ERROR-src_tela"; - char *dst_tela = "ERROR-dst_tela"; - - src_tela = get_alias(mp->src_telno); - dst_tela = get_alias(mp->dst_telno); - - llog(LL_CHD, "%05d <unknown> CW from %s to %s (no channel free)", - mp->header.cdid, src_tela, dst_tela); - } - else - { - llog(LL_CHD, "%05d <unknown> call waiting from %s to %s (no channel free)", - mp->header.cdid, mp->src_telno, mp->dst_telno); - } - return(NULL); - } - - for(i=0; i < nentries; i++) - { - int n; - cep = &cfg_entry_tab[i]; /* ptr to config entry */ - - /* check my number */ - - if(strncmp(cep->local_phone_incoming.number, mp->dst_telno, strlen(cep->local_phone_incoming.number))) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, myno %s != incomingno %s", i, - cep->local_phone_incoming.number, mp->dst_telno))); - continue; - } - - if (cep->usesubaddr && strncmp(cep->local_phone_incoming.subaddr, mp->dst_subaddr, strlen(cep->local_phone_incoming.subaddr))) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, mysubno %s != incomingsubno %s", i, - cep->local_phone_incoming.subaddr, mp->dst_subaddr))); - continue; - } - - /* check all allowed remote numbers for this entry */ - - for (n = 0; n < cep->incoming_numbers_count; n++) - { - incoming_number_t *in = &cep->remote_phone_incoming[n]; - - /* - * An incoming number matches whenever the main - * phone number either matches or is a wildcard AND - * subaddresses are either not in use or match as - * well (or the required subaddress is a wildcard). - * This means that if subaddresses are in use and - * the main phone number is a wildcard, the - * subaddress is still required to match. - * - * At first glance, this does not seem logical, - * but since subaddress usage can be configured per - * entry, disregarding the subaddress if the main - * number matches would needlessly limit the user's - * flexibility. - */ - - if ((in->number[0] == '*') || (!strncmp(in->number, mp->src_telno, strlen(in->number)))) - { - if ((!cep->usesubaddr) || (in->subaddr[0] == '*') || (!strncmp(in->subaddr, mp->src_subaddr, strlen(in->subaddr)))) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, match: remno %s = incomingfromno %s", i, - in->number, mp->src_telno))); - break; - } - } - else - { - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, remno %s != incomingfromno %s", i, - in->number, mp->src_telno))); - } - } - - /* If all configured remote numbers have been tested without success, proceed to the next entry. */ - if (n >= cep->incoming_numbers_count) - continue; - - /* check b protocol */ - - if(cep->b1protocol != mp->bprot) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, bprot %d != incomingprot %d", i, - cep->b1protocol, mp->bprot))); - continue; - } - - /* is this entry currently in use ? */ - - if(cep->cdid != CDID_UNUSED) - { - if(cep->cdid == CDID_RESERVED) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, cdid is reserved", i))); - } - else if (cep->dialin_reaction == REACT_ACCEPT - && cep->dialouttype == DIALOUT_CALLEDBACK) - { - /* - * We might consider doing this even if this is - * not a calledback config entry - BUT: there are - * severe race conditions and timinig problems - * ex. if both sides run I4B with no callback - * delay - both may shutdown the outgoing call - * and never be able to establish a connection. - * In the called-back case this should not happen. - */ - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, incoming call for callback in progress (cdid %05d)", i, cep->cdid))); - - /* save the current call state, we're going to overwrite it with the - * new incoming state below... */ - cep->saved_call.cdid = cep->cdid; - cep->saved_call.controller = cep->isdncontrollerused; - cep->saved_call.channel = cep->isdnchannelused; - } - else - { - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, cdid in use", i))); - continue; /* yes, next */ - } - } - - /* check controller value ok */ - - if(mp->controller > ncontroller) - { - llog(LL_CHD, "%05d %s incoming call with invalid controller %d", - mp->header.cdid, cep->name, mp->controller); - return(NULL); - } - - /* check controller marked up */ - - if((get_controller_state(mp->controller)) != CTRL_UP) - { - llog(LL_CHD, "%05d %s incoming call, controller %d DOWN!", - mp->header.cdid, cep->name, mp->controller); - return(NULL); - } - - /* - * check controller he wants, check for any - * controller or specific controller - */ - - if( (mp->controller != -1) && - (mp->controller != cep->isdncontroller) ) - { - llog(LL_CHD, "%05d %s incoming call, controller %d != incoming %d", - mp->header.cdid, cep->name, - cep->isdncontroller, mp->controller); - continue; - } - - /* check channel he wants */ - - switch(mp->channel) - { - case CHAN_ANY: - for (i = 0; i < isdn_ctrl_tab[mp->controller].nbch; i++) - { - if(ret_channel_state(mp->controller, i) == CHAN_IDLE) - break; - } - - if (i == isdn_ctrl_tab[mp->controller].nbch) - { - llog(LL_CHD, "%05d %s incoming call, no channel free!", - mp->header.cdid, cep->name); - return(NULL); - } - break; - - case CHAN_NO: - llog(LL_CHD, "%05d %s incoming call, call waiting (no channel available)!", - mp->header.cdid, cep->name); - return(NULL); - break; - - default: - if((ret_channel_state(mp->controller, mp->channel)) != CHAN_IDLE) - { - llog(LL_CHD, "%05d %s incoming call, channel B%d not free!", - mp->header.cdid, cep->name, mp->channel+1); - return(NULL); - } - break; - } - - /* check time interval */ - - if(isvalidtime(cep) == 0) - { - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, time not valid!", i))); - continue; - } - - /* found a matching entry */ - - cep->cdid = mp->header.cdid; - cep->isdncontrollerused = mp->controller; - cep->isdnchannelused = mp->channel; -/*XXX*/ cep->disc_cause = 0; - - /* cp number to real one used */ - - strcpy(cep->real_phone_incoming.number, mp->src_telno); - - /* copy display string */ - - strcpy(cep->display, mp->display); - - /* entry currently down ? */ - - if(cep->state == ST_DOWN) - { - msg_updown_ind_t mui; - - /* set interface up */ - - DBGL(DL_MSG, (llog(LL_DBG, "find_matching_entry_incoming: entry %d, ", i))); - - mui.driver = cep->usrdevicename; - mui.driver_unit = cep->usrdeviceunit; - mui.updown = SOFT_ENA; - - if((ioctl(isdnfd, I4B_UPDOWN_IND, &mui)) < 0) - { - llog(LL_ERR, "find_matching_entry_incoming: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); - error_exit(1, "find_matching_entry_incoming: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); - } - - cep->down_retry_count = 0; - cep->state = ST_IDLE; - } - return(cep); - } - - if(aliasing) - { - char *src_tela = "ERROR-src_tela"; - char *dst_tela = "ERROR-dst_tela"; - - src_tela = get_alias(mp->src_telno); - dst_tela = get_alias(mp->dst_telno); - - llog(LL_CHD, "%05d Call from %s to %s", - mp->header.cdid, src_tela, dst_tela); - } - else - { - llog(LL_CHD, "%05d <unknown> incoming call from %s to %s ctrl %d", - mp->header.cdid, mp->src_telno, mp->dst_telno, mp->controller); - } - return(NULL); -} - -/*---------------------------------------------------------------------------* - * return address of ACTIVE config entry by controller and channel - *---------------------------------------------------------------------------*/ -cfg_entry_t * -get_cep_by_cc(int ctrlr, int chan) -{ - int i; - - if((chan < 0) || (chan >= isdn_ctrl_tab[ctrlr].nbch)) - return(NULL); - - for(i=0; i < nentries; i++) - { - if((cfg_entry_tab[i].cdid != CDID_UNUSED) && - (cfg_entry_tab[i].cdid != CDID_RESERVED) && - (cfg_entry_tab[i].isdnchannelused == chan) && - (cfg_entry_tab[i].isdncontrollerused == ctrlr) && - ((ret_channel_state(ctrlr, chan)) == CHAN_RUN)) - { - return(&cfg_entry_tab[i]); - } - } - return(NULL); -} - -/*---------------------------------------------------------------------------* - * return address of config entry identified by cdid - *---------------------------------------------------------------------------*/ -cfg_entry_t * -get_cep_by_cdid(int cdid) -{ - int i; - - for(i=0; i < nentries; i++) - { - if(cfg_entry_tab[i].cdid == cdid - || cfg_entry_tab[i].saved_call.cdid == cdid) - return(&cfg_entry_tab[i]); - } - return(NULL); -} - -/*---------------------------------------------------------------------------* - * return b channel driver type name string - *---------------------------------------------------------------------------*/ -char * -bdrivername(int drivertype) -{ - static char *bdtab[] = { - "rbch", - "tel", - "ipr", - "isp", - "ibc", - "ing" - }; - - if(drivertype >= BDRV_RBCH && drivertype <= BDRV_ING) - return(bdtab[drivertype]); - else - return("unknown"); -} - -/*---------------------------------------------------------------------------* - * process AOCD charging messages - *---------------------------------------------------------------------------*/ -void -handle_charge(cfg_entry_t *cep) -{ - time_t now = time(NULL); - - if(cep->aoc_last == 0) /* no last timestamp yet ? */ - { - cep->aoc_last = now; /* add time stamp */ - } - else if(cep->aoc_now == 0) /* no current timestamp yet ? */ - { - cep->aoc_now = now; /* current timestamp */ - } - else - { - cep->aoc_last = cep->aoc_now; - cep->aoc_now = now; - cep->aoc_diff = cep->aoc_now - cep->aoc_last; - cep->aoc_valid = AOC_VALID; - } - -#ifdef USE_CURSES - if(do_fullscreen) - display_charge(cep); -#endif - -#ifdef I4B_EXTERNAL_MONITOR - if(do_monitor && accepted) - monitor_evnt_charge(cep, cep->charge, 0); -#endif - - if(cep->aoc_valid == AOC_VALID) - { - if(cep->aoc_diff != cep->unitlength) - { - DBGL(DL_MSG, (llog(LL_DBG, "handle_charge: AOCD unit length updated %d -> %d secs", cep->unitlength, cep->aoc_diff))); - - cep->unitlength = cep->aoc_diff; - - unitlen_chkupd(cep); - } - else - { -#ifdef NOTDEF - DBGL(DL_MSG, (llog(LL_DBG, "handle_charge: AOCD unit length still %d secs", cep->unitlength))); -#endif - } - } -} - -/*---------------------------------------------------------------------------* - * update kernel idle_time, earlyhup_time and unitlen_time - *---------------------------------------------------------------------------*/ -void -unitlen_chkupd(cfg_entry_t *cep) -{ - msg_timeout_upd_t tupd; - - tupd.cdid = cep->cdid; - - /* init the short hold data based on the shorthold algorithm type */ - - switch(cep->shorthold_algorithm) - { - case SHA_FIXU: - tupd.shorthold_data.shorthold_algorithm = SHA_FIXU; - tupd.shorthold_data.unitlen_time = cep->unitlength; - tupd.shorthold_data.idle_time = cep->idle_time_out; - tupd.shorthold_data.earlyhup_time = cep->earlyhangup; - break; - - case SHA_VARU: - tupd.shorthold_data.shorthold_algorithm = SHA_VARU; - tupd.shorthold_data.unitlen_time = cep->unitlength; - tupd.shorthold_data.idle_time = cep->idle_time_out; - tupd.shorthold_data.earlyhup_time = 0; - break; - default: - llog(LL_ERR, "unitlen_chkupd bad shorthold_algorithm %d", cep->shorthold_algorithm ); - return; - break; - } - - if((ioctl(isdnfd, I4B_TIMEOUT_UPD, &tupd)) < 0) - { - llog(LL_ERR, "ioctl I4B_TIMEOUT_UPD failed: %s", strerror(errno)); - error_exit(1, "ioctl I4B_TIMEOUT_UPD failed: %s", strerror(errno)); - } -} - -/*--------------------------------------------------------------------------* - * this is intended to be called by do_exit and closes down all - * active connections before the daemon exits or is reconfigured. - *--------------------------------------------------------------------------*/ -void -close_allactive(void) -{ - int i, j, k; - cfg_entry_t *cep = NULL; - - j = 0; - - for (i = 0; i < ncontroller; i++) - { - if((get_controller_state(i)) != CTRL_UP) - continue; - - for (k = 0; k < isdn_ctrl_tab[i].nbch; k++) - { - if((ret_channel_state(i, k)) == CHAN_RUN) - { - if((cep = get_cep_by_cc(i, k)) != NULL) - { -#ifdef USE_CURSES - if(do_fullscreen) - display_disconnect(cep); -#endif -#ifdef I4B_EXTERNAL_MONITOR - monitor_evnt_disconnect(cep); -#endif - next_state(cep, EV_DRQ); - j++; - } - } - } - } - - if(j) - { - llog(LL_DMN, "close_allactive: waiting for all connections terminated"); - sleep(5); - } -} - -/*--------------------------------------------------------------------------* - * set an interface up - *--------------------------------------------------------------------------*/ -void -if_up(cfg_entry_t *cep) -{ - msg_updown_ind_t mui; - - /* set interface up */ - - DBGL(DL_MSG, (llog(LL_DBG, "if_up: taking %s%d up", bdrivername(cep->usrdevicename), cep->usrdeviceunit))); - - mui.driver = cep->usrdevicename; - mui.driver_unit = cep->usrdeviceunit; - mui.updown = SOFT_ENA; - - if((ioctl(isdnfd, I4B_UPDOWN_IND, &mui)) < 0) - { - llog(LL_ERR, "if_up: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); - error_exit(1, "if_up: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); - } - cep->down_retry_count = 0; - -#ifdef USE_CURSES - if(do_fullscreen) - display_updown(cep, 1); -#endif -#ifdef I4B_EXTERNAL_MONITOR - monitor_evnt_updown(cep, 1); -#endif - -} - -/*--------------------------------------------------------------------------* - * set an interface down - *--------------------------------------------------------------------------*/ -void -if_down(cfg_entry_t *cep) -{ - msg_updown_ind_t mui; - - /* set interface up */ - - DBGL(DL_MSG, (llog(LL_DBG, "if_down: taking %s%d down", bdrivername(cep->usrdevicename), cep->usrdeviceunit))); - - mui.driver = cep->usrdevicename; - mui.driver_unit = cep->usrdeviceunit; - mui.updown = SOFT_DIS; - - if((ioctl(isdnfd, I4B_UPDOWN_IND, &mui)) < 0) - { - llog(LL_ERR, "if_down: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); - error_exit(1, "if_down: ioctl I4B_UPDOWN_IND failed: %s", strerror(errno)); - } - cep->went_down_time = time(NULL); - cep->down_retry_count = 0; - -#ifdef USE_CURSES - if(do_fullscreen) - display_updown(cep, 0); -#endif -#ifdef I4B_EXTERNAL_MONITOR - monitor_evnt_updown(cep, 0); -#endif - -} - -/*--------------------------------------------------------------------------* - * send a dial response to (an interface in) the kernel - *--------------------------------------------------------------------------*/ -void -dialresponse(cfg_entry_t *cep, int dstat) -{ - msg_dialout_resp_t mdr; - - static char *stattab[] = { - "normal condition", - "temporary failure", - "permanent failure", - "dialout not allowed" - }; - - if(dstat < DSTAT_NONE || dstat > DSTAT_INONLY) - { - llog(LL_ERR, "dialresponse: dstat out of range %d!", dstat); - return; - } - - mdr.driver = cep->usrdevicename; - mdr.driver_unit = cep->usrdeviceunit; - mdr.stat = dstat; - mdr.cause = cep->disc_cause; - - if((ioctl(isdnfd, I4B_DIALOUT_RESP, &mdr)) < 0) - { - llog(LL_ERR, "dialresponse: ioctl I4B_DIALOUT_RESP failed: %s", strerror(errno)); - error_exit(1, "dialresponse: ioctl I4B_DIALOUT_RESP failed: %s", strerror(errno)); - } - - DBGL(DL_DRVR, (llog(LL_DBG, "dialresponse: sent [%s]", stattab[dstat]))); -} - -/*--------------------------------------------------------------------------* - * screening/presentation indicator - *--------------------------------------------------------------------------*/ -void -handle_scrprs(int cdid, int scr, int prs, char *caller) -{ - /* screening indicator */ - - if(scr < SCR_NONE || scr > SCR_NET) - { - llog(LL_ERR, "msg_connect_ind: invalid screening indicator value %d!", scr); - } - else - { - static char *scrtab[] = { - "no screening indicator", - "sreening user provided, not screened", - "screening user provided, verified & passed", - "screening user provided, verified & failed", - "screening network provided", }; - - if(extcallattr) - { - llog(LL_CHD, "%05d %s %s", cdid, caller, scrtab[scr]); - } - else - { - DBGL(DL_MSG, (llog(LL_DBG, "%s - %s", caller, scrtab[scr]))); - } - } - - /* presentation indicator */ - - if(prs < PRS_NONE || prs > PRS_RESERVED) - { - llog(LL_ERR, "msg_connect_ind: invalid presentation indicator value %d!", prs); - } - else - { - static char *prstab[] = { - "no presentation indicator", - "presentation allowed", - "presentation restricted", - "number not available due to interworking", - "reserved presentation value" }; - - if(extcallattr) - { - llog(LL_CHD, "%05d %s %s", cdid, caller, prstab[prs]); - } - else - { - DBGL(DL_MSG, (llog(LL_DBG, "%s - %s", caller, prstab[prs]))); - } - } -} - -/*--------------------------------------------------------------------------* - * check if the time is valid for an entry - *--------------------------------------------------------------------------*/ -static int -isvalidtime(cfg_entry_t *cep) -{ - time_t t; - struct tm *tp; - - if(cep->day == 0) - return(1); - - t = time(NULL); - tp = localtime(&t); - - if(cep->day & HD) - { - if(isholiday(tp->tm_mday, (tp->tm_mon)+1, (tp->tm_year)+1900)) - { - DBGL(DL_VALID, (llog(LL_DBG, "isvalidtime: holiday %d.%d.%d", tp->tm_mday, (tp->tm_mon)+1, (tp->tm_year)+1900))); - goto dayok; - } - } - - if(cep->day & (1 << tp->tm_wday)) - { - DBGL(DL_VALID, (llog(LL_DBG, "isvalidtime: day match"))); - goto dayok; - } - - return(0); - -dayok: - if(cep->fromhr==0 && cep->frommin==0 && cep->tohr==0 && cep->tomin==0) - { - DBGL(DL_VALID, (llog(LL_DBG, "isvalidtime: no time specified, match!"))); - return(1); - } - - if(cep->tohr < cep->fromhr) - { - /* before 00:00 */ - - if( (tp->tm_hour > cep->fromhr) || - (tp->tm_hour == cep->fromhr && tp->tm_min > cep->frommin) ) - { - DBGL(DL_VALID, (llog(LL_DBG, "isvalidtime: t<f-1, spec=%02d:%02d-%02d:%02d, curr=%02d:%02d, match!", - cep->fromhr, cep->frommin, - cep->tohr, cep->tomin, - tp->tm_hour, tp->tm_min))); - - return(1); - } - - /* after 00:00 */ - - if( (tp->tm_hour < cep->tohr) || - (tp->tm_hour == cep->tohr && tp->tm_min < cep->tomin) ) - { - DBGL(DL_VALID, (llog(LL_DBG, "isvalidtime: t<f-2, spec=%02d:%02d-%02d:%02d, curr=%02d:%02d, match!", - cep->fromhr, cep->frommin, - cep->tohr, cep->tomin, - tp->tm_hour, tp->tm_min))); - - return(1); - } - } - else if(cep->fromhr == cep->tohr) - { - if(tp->tm_min >= cep->frommin && tp->tm_min < cep->tomin) - { - DBGL(DL_VALID, (llog(LL_DBG, "isvalidtime: f=t, spec=%02d:%02d-%02d:%02d, curr=%02d:%02d, match!", - cep->fromhr, cep->frommin, - cep->tohr, cep->tomin, - tp->tm_hour, tp->tm_min))); - - return(1); - } - } - else - { - if((tp->tm_hour > cep->fromhr && tp->tm_hour < cep->tohr) || - (tp->tm_hour == cep->fromhr && tp->tm_min >= cep->frommin) || - (tp->tm_hour == cep->tohr && tp->tm_min < cep->tomin) ) - { - DBGL(DL_VALID, (llog(LL_DBG, "isvalidtime: t>f, spec=%02d:%02d-%02d:%02d, curr=%02d:%02d, match!", - cep->fromhr, cep->frommin, - cep->tohr, cep->tomin, - tp->tm_hour, tp->tm_min))); - return(1); - } - } - DBGL(DL_VALID, (llog(LL_DBG, "isvalidtime: spec=%02d:%02d-%02d:%02d, curr=%02d:%02d, no match!", - cep->fromhr, cep->frommin, - cep->tohr, cep->tomin, - tp->tm_hour, tp->tm_min))); - - return(0); -} - -/*--------------------------------------------------------------------------* - * prepend national or international prefix to a number - *--------------------------------------------------------------------------*/ -int add_number_prefix(char *number, int type_of_number) -{ - char tmp[TELNO_MAX]; - char *prefix; - int result = 0; - - if (type_of_number == TON_NATIONAL || type_of_number == TON_INTERNAT) - { - if (type_of_number == TON_NATIONAL) - prefix = prefixnational; - else - prefix = prefixinternational; - - /* Add prefix only if not already there */ - if (strncmp(number, prefix, strlen(prefix)) != 0) - { - snprintf(tmp, sizeof(tmp)-1, "%s%s", prefix, number); - strncpy(number, tmp, TELNO_MAX-1); - result = 1; - } - } - - return result; -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnd/timer.c b/usr.sbin/i4b/isdnd/timer.c deleted file mode 100644 index 90bee198cad1..000000000000 --- a/usr.sbin/i4b/isdnd/timer.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - timer/timing support routines - * ------------------------------------------ - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 13:13:13 2006] - * - *---------------------------------------------------------------------------*/ - -#include "isdnd.h" - -static int hr_callgate(void); -static void handle_reserved(cfg_entry_t *cep, time_t now); -static void handle_active(cfg_entry_t *cep, time_t now); -static void recover_illegal(cfg_entry_t *cep); - -/*---------------------------------------------------------------------------* - * recover from illegal state - *---------------------------------------------------------------------------*/ -static void -recover_illegal(cfg_entry_t *cep) -{ - llog(LL_ERR, "recover_illegal: ERROR, entry %s attempting disconnect!", cep->name); - sendm_disconnect_req(cep, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL); - llog(LL_ERR, "recover_illegal: ERROR, entry %s - reset state/cdid!", cep->name); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; -} - -/*---------------------------------------------------------------------------* - * start the timer - *---------------------------------------------------------------------------*/ -void -start_timer(cfg_entry_t *cep, int seconds) -{ - cep->timerval = cep->timerremain = seconds; -} - -/*---------------------------------------------------------------------------* - * stop the timer - *---------------------------------------------------------------------------*/ -void -stop_timer(cfg_entry_t *cep) -{ - cep->timerval = cep->timerremain = 0; -} - -/*---------------------------------------------------------------------------* - * callgate for handle_recovery() - *---------------------------------------------------------------------------*/ -static int -hr_callgate(void) -{ - static int tv_first = 1; - static struct timeval tv_last; - struct timeval tv_now; - - /* there must be 1 sec minimum between calls to this section */ - - if(tv_first) - { - gettimeofday(&tv_last, NULL); - tv_first = 0; - } - - gettimeofday(&tv_now, NULL); - - if((tv_now.tv_sec - tv_last.tv_sec) < 1) - { - - DBGL(DL_TIME, (llog(LL_DBG, "time < 1 - last %ld:%ld now %ld:%ld", - tv_last.tv_sec, tv_last.tv_usec, - tv_now.tv_sec, tv_now.tv_usec))); - return(1); - } - else if((tv_now.tv_sec - tv_last.tv_sec) == 1) - { - if(((1000000 - tv_last.tv_usec) + tv_now.tv_usec) < 900000) - { - DBGL(DL_TIME, (llog(LL_DBG, "time < 900000us - last %ld:%ld now %ld:%ld", - tv_last.tv_sec, tv_last.tv_usec, - tv_now.tv_sec, tv_now.tv_usec))); - return(1); - } - } - - DBGL(DL_TIME, (llog(LL_DBG, "time OK! - last %ld:%ld now %ld:%ld", - tv_last.tv_sec, tv_last.tv_usec, - tv_now.tv_sec, tv_now.tv_usec))); - - gettimeofday(&tv_last, NULL); - - return(0); -} - -/*---------------------------------------------------------------------------* - * timeout, recovery and retry handling - *---------------------------------------------------------------------------*/ -void -handle_recovery(void) -{ - cfg_entry_t *cep = NULL; - int i; - time_t now; - - if(hr_callgate()) /* last call to handle_recovery < 1 sec ? */ - return; /* yes, exit */ - - now = time(NULL); /* get current time */ - - /* walk thru all entries, look for work to do */ - - for(i=0; i < nentries; i++) - { - cep = &cfg_entry_tab[i]; /* ptr to config entry */ - - if(cep->budget_callbackperiod && cep->budget_callbackncalls) - { - if(cep->budget_callbackperiod_time <= now) - { - DBGL(DL_BDGT, (llog(LL_DBG, "%s: new cback-budget-period (%d s, %d left)", - cep->name, cep->budget_callbackperiod, cep->budget_callbackncalls_cnt))); - cep->budget_callbackperiod_time = now + cep->budget_callbackperiod; - cep->budget_callbackncalls_cnt = cep->budget_callbackncalls; - } - } - - if(cep->budget_calloutperiod && cep->budget_calloutncalls) - { - if(cep->budget_calloutperiod_time <= now) - { - DBGL(DL_BDGT, (llog(LL_DBG, "%s: new cout-budget-period (%d s, %d left)", - cep->name, cep->budget_calloutperiod, cep->budget_calloutncalls_cnt))); - cep->budget_calloutperiod_time = now + cep->budget_calloutperiod; - cep->budget_calloutncalls_cnt = cep->budget_calloutncalls; - } - } - - switch(cep->cdid) - { - case CDID_UNUSED: /* entry unused */ - continue; - break; - - case CDID_RESERVED: /* entry reserved */ - handle_reserved(cep, now); - break; - - default: /* entry in use */ - handle_active(cep, now); - break; - } - } -} - -/*---------------------------------------------------------------------------* - * timeout, recovery and retry handling for active entry - *---------------------------------------------------------------------------*/ -static void -handle_active(cfg_entry_t *cep, time_t now) -{ - switch(cep->state) - { - case ST_ACCEPTED: - if(cep->timerval && (--(cep->timerremain)) <= 0) - { - DBGL(DL_RCVRY, (llog(LL_DBG, "handle_active: entry %s, TIMEOUT !!!", cep->name))); - cep->timerval = cep->timerremain = 0; - next_state(cep, EV_TIMO); - } - break; - - case ST_ALERT: - if(cep->alert_time > 0) - { - cep->alert_time--; - } - else - { - llog(LL_CHD, "%05d %s answering: incoming call from %s to %s", - cep->cdid, cep->name, - cep->real_phone_incoming.number, - cep->local_phone_incoming.number); - next_state(cep, EV_MCI); - } - break; - - case ST_ILL: - recover_illegal(cep); - break; - - default: - /* check hangup flag: if active, close connection */ - - if(cep->hangup) - { - DBGL(DL_RCVRY, (llog(LL_DBG, "handle_active: entry %s, hangup request!", cep->name))); - cep->hangup = 0; - next_state(cep, EV_DRQ); - } - - /* check maximum connect time reached */ - - if(cep->maxconnecttime > 0 && cep->connect_time > 0) - { - int connecttime = (int)difftime(now, cep->connect_time); - if(connecttime > cep->maxconnecttime) - { - DBGL(DL_RCVRY, (llog(LL_DBG, - "handle_active: entry %s, maxconnecttime %d reached!", - cep->name, cep->maxconnecttime))); - next_state(cep, EV_DRQ); - } - } - - /* - * if shorthold mode is rates based, check if - * we entered a time with a new unit length - */ - - if(cep->unitlengthsrc == ULSRC_RATE) - { - int connecttime = (int)difftime(now, cep->connect_time); - - if((connecttime > 1) && - (connecttime % 60)) - { - int newrate = get_current_rate(cep, 0); - - if(newrate != cep->unitlength) - { - DBGL(DL_MSG, (llog(LL_DBG, "handle_active: rates unit length updated %d -> %d", cep->unitlength, newrate))); - - cep->unitlength = newrate; - - unitlen_chkupd(cep); - } - } - } - break; - } -} - -/*---------------------------------------------------------------------------* - * timeout, recovery and retry handling for reserved entry - *---------------------------------------------------------------------------*/ -static void -handle_reserved(cfg_entry_t *cep, time_t now) -{ - time_t waittime; - - switch(cep->state) - { - case ST_DIALRTMRCHD: /* wait for dial retry time reached */ - - if(cep->dialrandincr) - waittime = cep->randomtime; - else - waittime = cep->recoverytime; - - - if(now > (cep->last_dial_time + waittime)) - { - DBGL(DL_RCVRY, (llog(LL_DBG, "handle_reserved: entry %s, dial retry request!", cep->name))); - cep->state = ST_DIALRETRY; - - if((cep->cdid = get_cdid()) == 0) - { - llog(LL_ERR, "handle_reserved: dialretry get_cdid() returned 0!"); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - return; - } - - if((setup_dialout(cep)) == GOOD) - { - sendm_connect_req(cep); - } - else - { - llog(LL_ERR, "handle_reserved: dialretry setup_dialout returned ERROR!"); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - return; - } - } - break; - - - case ST_ACB_WAITDIAL: /* active callback wait for time between disconnect and dial */ - - if(now > (cep->last_release_time + cep->callbackwait)) - { - DBGL(DL_RCVRY, (llog(LL_DBG, "handle_reserved: entry %s, callback dial!", cep->name))); - cep->state = ST_ACB_DIAL; - - if((cep->cdid = get_cdid()) == 0) - { - llog(LL_ERR, "handle_reserved: callback get_cdid() returned 0!"); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - return; - } - - select_first_dialno(cep); - - if((setup_dialout(cep)) == GOOD) - { - sendm_connect_req(cep); - } - else - { - llog(LL_ERR, "handle_reserved: callback setup_dialout returned ERROR!"); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - return; - } - } - break; - - case ST_ACB_DIALFAIL: /* callback to remote failed */ - - if(cep->dialrandincr) - waittime = cep->randomtime + cep->recoverytime; - else - waittime = cep->recoverytime; - - if(now > (cep->last_release_time + waittime)) - { - DBGL(DL_RCVRY, (llog(LL_DBG, "handle_reserved: entry %s, callback dial retry request!", cep->name))); - cep->state = ST_ACB_DIAL; - - if((cep->cdid = get_cdid()) == 0) - { - llog(LL_ERR, "handle_reserved: callback dialretry get_cdid() returned 0!"); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - return; - } - - if((setup_dialout(cep)) == GOOD) - { - sendm_connect_req(cep); - } - else - { - llog(LL_ERR, "handle_reserved: callback dialretry setup_dialout returned ERROR!"); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - return; - } - } - break; - - case ST_PCB_WAITCALL: /* wait for remote calling back */ - - if(now > (cep->last_release_time + cep->calledbackwait)) - { - cep->dial_count++; - - if(cep->dial_count < cep->dialretries) - { - /* inside normal retry cycle */ - - DBGL(DL_RCVRY, (llog(LL_DBG, "handle_reserved: entry %s, retry calledback dial #%d!", - cep->name, cep->dial_count))); - cep->state = ST_PCB_DIAL; - - if((cep->cdid = get_cdid()) == 0) - { - llog(LL_ERR, "handle_reserved: calledback get_cdid() returned 0!"); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - return; - } - select_next_dialno(cep); - - if((setup_dialout(cep)) == GOOD) - { - sendm_connect_req(cep); - } - else - { - llog(LL_ERR, "handle_reserved: calledback setup_dialout returned ERROR!"); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - return; - } - } - else - { - /* retries exhausted */ - - DBGL(DL_RCVRY, (llog(LL_DBG, "handle_reserved: calledback dial retries exhausted"))); - dialresponse(cep, DSTAT_TFAIL); - cep->cdid = CDID_UNUSED; - cep->dial_count = 0; - cep->state = ST_IDLE; - } - } - break; - - case ST_DOWN: /* interface was taken down */ - - if(now > (cep->went_down_time + cep->downtime)) - { - DBGL(DL_RCVRY, (llog(LL_DBG, "handle_reserved: taking %s%d up", bdrivername(cep->usrdevicename), cep->usrdeviceunit))); - if_up(cep); - cep->state = ST_IDLE; - cep->cdid = CDID_UNUSED; - } - break; - - case ST_ILL: /* illegal state reached, recover ! */ - - recover_illegal(cep); - break; - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdndebug/Makefile b/usr.sbin/i4b/isdndebug/Makefile deleted file mode 100644 index 5a31de955365..000000000000 --- a/usr.sbin/i4b/isdndebug/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ - -PROG= isdndebug -MAN= isdndebug.8 -SRCS= main.c - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/isdndebug/isdndebug.8 b/usr.sbin/i4b/isdndebug/isdndebug.8 deleted file mode 100644 index 0a9f24ca2398..000000000000 --- a/usr.sbin/i4b/isdndebug/isdndebug.8 +++ /dev/null @@ -1,111 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdndebug.8,v 1.11 2000/05/31 08:15:29 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Wed May 31 10:15:07 2000] -.\" -.Dd May 31, 2000 -.Dt ISDNDEBUG 8 -.Os -.Sh NAME -.Nm isdndebug -.Nd display and control isdn4bsd kernel variables and statistics -.Sh SYNOPSIS -.Nm -.Op Fl c -.Op Fl e -.Op Fl g -.Op Fl l Ar layer -.Op Fl m -.Op Fl q -.Op Fl r -.Op Fl s Ar value -.Op Fl u Ar unit -.Op Fl z -.Op Fl C -.Op Fl Q -.Sh DESCRIPTION -The -.Nm -utility is part of the isdn4bsd package and is used to control the level of -debugging output of the isdn4bsd kernel part. -Every layer of the isdn4bsd kernel uses a debugging mask which can be -manipulated using this utility. -.Pp -A second usage of -.Nm -is to display and reset chipset specific statistics and/or error counters -and to display and reset the D-channel layer 2 -(Q.921 LAPD protocol) statistics and error counters. -.Pp -The following options are available: -.Bl -tag -width Ds -.It Fl c -Display chipset specific statistics and/or error counters. -.It Fl e -Set debugging mask for the selected layer(s) to display errors only. -.It Fl g -Get the debugging mask for the selected layer(s). -.It Fl l -Specify the layer for which a command applies. -Default is all layers. -.It Fl m -Set debugging mask for the selected layer(s) to display all possible -debugging messages (maximum output). -.It Fl q -Display the Q.921 (D-channel layer 2) frame receive/transmit statistics. -.It Fl r -Set debugging mask for the selected layer(s) to the compiled in default -(reset). -.It Fl s -Set debugging mask for the selected layer(s) to value. -Value can be -specified in any number base supported by -.Xr sscanf 3 . -.It Fl u -Set the unit numbers for the -c, -q, -C and -Q flags. -.It Fl z -Set debugging mask for the selected layer(s) to no output at all (zero). -.It Fl H -Reset the chipset specific statistics and/or error counters to zero. -.It Fl Q -Reset the Q.921 (D-channel layer 2) frame receive/transmit statistics to zero. -.El -.Sh FILES -/dev/i4bctl -.Sh EXAMPLES -The command: -.Bd -literal -offset indent -isdndebug -g -.Ed -.Pp -displays the current debugging level for all ISDN layers -.Sh AUTHORS -The -.Nm -utility and this manpage were written by -.An Hellmuth Michaelis Aq hm@kts.org . diff --git a/usr.sbin/i4b/isdndebug/main.c b/usr.sbin/i4b/isdndebug/main.c deleted file mode 100644 index 3586173b6255..000000000000 --- a/usr.sbin/i4b/isdndebug/main.c +++ /dev/null @@ -1,633 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * main.c - i4b set debug options - * ------------------------------ - * - * $FreeBSD$ - * - * last edit-date: [Mon May 21 10:09:23 2001] - * - *---------------------------------------------------------------------------*/ - -#include <stdio.h> -#include <signal.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <ctype.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/time.h> - -#include <i4b/i4b_debug.h> -#include <i4b/i4b_ioctl.h> - -char *bin_str(unsigned long val, int length); - -static void usage ( void ); -void printl1(unsigned long val); -void printl2(unsigned long val); -void printl3(unsigned long val); -void printl4(unsigned long val); - -static int isdnfd; - -#define I4BCTLDEVICE "/dev/i4bctl" - -int opt_get = 0; -int opt_layer = -1; -int opt_set = 0; -int opt_setval; -int opt_reset = 0; -int opt_max = 0; -int opt_err = 0; -int opt_zero = 0; -int opt_unit = 0; -int opt_lapd = 0; -int opt_rlapd = 0; -int opt_chipstat = 0; - -/*---------------------------------------------------------------------------* - * usage display and exit - *---------------------------------------------------------------------------*/ -static void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "isdndebug - i4b set debug level, version %d.%d.%d\n", VERSION, REL, STEP); - fprintf(stderr, "usage: isdndebug -c -e -g -l <layer> -m -q -r -s <value> -u <unit> -z -C -Q\n"); - fprintf(stderr, " -c get chipset statistics\n"); - fprintf(stderr, " -e set error only debugging output\n"); - fprintf(stderr, " -g get current debugging values\n"); - fprintf(stderr, " -l layer specify layer (1...4)\n"); - fprintf(stderr, " -m set maximum debugging output\n"); - fprintf(stderr, " -q get Q.921 statistics\n"); - fprintf(stderr, " -r reset values(s) to compiled in default\n"); - fprintf(stderr, " -s value set new debugging value for layer\n"); - fprintf(stderr, " -u unit unit number for -c, -q, -C and -Q commands\n"); - fprintf(stderr, " -z set zero (=no) debugging output\n"); - fprintf(stderr, " -C reset chipset statistics\n"); - fprintf(stderr, " -Q reset Q.921 statistics\n"); - fprintf(stderr, "\n"); - exit(1); -} - -/*---------------------------------------------------------------------------* - * program entry - *---------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - int c; - ctl_debug_t cdbg; - int ret; - - while ((c = getopt(argc, argv, "ceghl:mqrs:u:zCHQ")) != -1) - { - switch(c) - { - case 'c': - opt_chipstat = 1; - break; - - case 'e': - opt_err = 1; - break; - - case 'g': - opt_get = 1; - break; - - case 'q': - opt_lapd = 1; - break; - - case 'r': - opt_reset = 1; - break; - - case 'm': - opt_max = 1; - break; - - case 'l': - opt_layer = atoi(optarg); - if(opt_layer < 1 || opt_layer > 4) - usage(); - break; - - case 's': - if((sscanf(optarg, "%i", &opt_setval)) != 1) - usage(); - opt_set = 1; - break; - - case 'u': - opt_unit = atoi(optarg); - if(opt_unit < 0 || opt_unit > 9) - usage(); - break; - - case 'z': - opt_zero = 1; - break; - - case 'Q': - opt_rlapd = 1; - break; - - case '?': - default: - usage(); - break; - } - } - - if(opt_get == 0 && opt_set == 0 && opt_reset == 0 && opt_max == 0 && - opt_err == 0 && opt_zero == 0 && opt_lapd == 0 && opt_rlapd == 0 && - opt_chipstat == 0) - { - usage(); - } - - if((opt_get + opt_set + opt_reset + opt_max + opt_err + opt_zero + - opt_lapd + opt_rlapd + opt_chipstat) > 1) - { - usage(); - } - - if((isdnfd = open(I4BCTLDEVICE, O_RDWR)) < 0) - { - fprintf(stderr, "i4bctl: cannot open %s: %s\n", I4BCTLDEVICE, strerror(errno)); - exit(1); - } - - if(opt_chipstat) - { - struct chipstat cst; - u_char *name; - - cst.driver_unit = opt_unit; - cst.driver_bchannel = 0; - - if((ret = ioctl(isdnfd, I4B_CTL_GET_CHIPSTAT, &cst)) < 0) - { - fprintf(stderr, "ioctl I4B_CTL_GET_CHIPSTAT failed: %s", strerror(errno)); - exit(1); - } - - switch(cst.driver_type) - { - case L1DRVR_ISIC: - name = "isic"; - printf("\nisic-driver\nHSCX events: VFR RDO CRC RAB XDU RFO\n"); - - printf("unit %d chan %d: %6d %6d %6d %6d %6d %6d\n", - cst.stats.hscxstat.unit, - cst.stats.hscxstat.chan, - cst.stats.hscxstat.vfr, - cst.stats.hscxstat.rdo, - cst.stats.hscxstat.crc, - cst.stats.hscxstat.rab, - cst.stats.hscxstat.xdu, - cst.stats.hscxstat.rfo); - - cst.driver_unit = opt_unit; - cst.driver_bchannel = 1; - - if((ret = ioctl(isdnfd, I4B_CTL_GET_CHIPSTAT, &cst)) < 0) - { - fprintf(stderr, "ioctl I4B_CTL_GET_CHIPSTAT failed: %s", strerror(errno)); - exit(1); - } - - printf("HSCX events: VFR RDO CRC RAB XDU RFO\n"); - - printf("unit %d chan %d: %6d %6d %6d %6d %6d %6d\n", - cst.stats.hscxstat.unit, - cst.stats.hscxstat.chan, - cst.stats.hscxstat.vfr, - cst.stats.hscxstat.rdo, - cst.stats.hscxstat.crc, - cst.stats.hscxstat.rab, - cst.stats.hscxstat.xdu, - cst.stats.hscxstat.rfo); - - break; - - case L1DRVR_IWIC: - name = "iwic"; - break; - - case L1DRVR_IFPI: - name = "ifpi"; - break; - - case L1DRVR_IHFC: - name = "ihfc"; - break; - - case L1DRVR_IFPNP: - name = "ifpnp"; - break; - - default: - fprintf(stderr, "ioctl I4B_CTL_GET_CHIPSTAT, unknown driver %d\n",cst.driver_type); - exit(1); - break; - } - exit(0); - } - - if(opt_lapd) - { - l2stat_t l2s; - - l2s.unit = opt_unit; - - if((ret = ioctl(isdnfd, I4B_CTL_GET_LAPDSTAT, &l2s)) < 0) - { - fprintf(stderr, "ioctl I4B_CTL_GET_LAPDSTAT failed: %s", strerror(errno)); - exit(1); - } - - printf("unit %d Q.921 statistics: receive transmit\n", opt_unit); - printf("---------------------------------------------\n"); - printf("# of I-frames %12lu %12lu\n", l2s.lapdstat.rx_i, l2s.lapdstat.tx_i); - printf("# of RR-frames %12lu %12lu\n", l2s.lapdstat.rx_rr, l2s.lapdstat.tx_rr); - printf("# of RNR-frames %12lu %12lu\n", l2s.lapdstat.rx_rnr, l2s.lapdstat.tx_rnr); - printf("# of REJ-frames %12lu %12lu\n", l2s.lapdstat.rx_rej, l2s.lapdstat.tx_rej); - printf("# of SABME-frames %12lu %12lu\n", l2s.lapdstat.rx_sabme, l2s.lapdstat.tx_sabme); - printf("# of DM-frames %12lu %12lu\n", l2s.lapdstat.rx_dm, l2s.lapdstat.tx_dm); - printf("# of DISC-frames %12lu %12lu\n", l2s.lapdstat.rx_disc, l2s.lapdstat.tx_disc); - printf("# of UA-frames %12lu %12lu\n", l2s.lapdstat.rx_ua, l2s.lapdstat.tx_ua); - printf("# of FRMR-frames %12lu %12lu\n", l2s.lapdstat.rx_frmr, l2s.lapdstat.tx_frmr); - printf("# of TEI-frames %12lu %12lu\n", l2s.lapdstat.rx_tei, l2s.lapdstat.tx_tei); - printf("# of UI-frames %12lu \n", l2s.lapdstat.rx_ui); - printf("# of XID-frames %12lu \n", l2s.lapdstat.rx_xid); - printf(" errors\n"); - printf("---------------------------------------------\n"); - printf("# of frames with incorrect length%12lu\n", l2s.lapdstat.err_rx_len); - printf("# of frames with bad frame type %12lu\n", l2s.lapdstat.err_rx_badf); - printf("# of bad S frames %12lu\n", l2s.lapdstat.err_rx_bads); - printf("# of bad U frames %12lu\n", l2s.lapdstat.err_rx_badu); - printf("# of bad UI frames %12lu\n", l2s.lapdstat.err_rx_badui); - - exit(0); - } - - if(opt_rlapd) - { - int unit; - - unit = opt_unit; - - if((ret = ioctl(isdnfd, I4B_CTL_CLR_LAPDSTAT, &unit)) < 0) - { - fprintf(stderr, "ioctl I4B_CTL_CLR_LAPDSTAT failed: %s", strerror(errno)); - exit(1); - } - - printf("Q.921 statistics counters unit %d reset to zero!\n", unit); - exit(0); - } - - if((ret = ioctl(isdnfd, I4B_CTL_GET_DEBUG, &cdbg)) < 0) - { - fprintf(stderr, "ioctl I4B_CTL_GET_DEBUG failed: %s", strerror(errno)); - exit(1); - } - - if(opt_get) - { - switch(opt_layer) - { - case -1: - printl1(cdbg.l1); - printl2(cdbg.l2); - printl3(cdbg.l3); - printl4(cdbg.l4); - break; - - case 1: - printl1(cdbg.l1); - break; - - case 2: - printl2(cdbg.l2); - break; - - case 3: - printl3(cdbg.l3); - break; - - case 4: - printl4(cdbg.l4); - break; - } - printf("\n"); - return(0); - } - else if(opt_set) - { - switch(opt_layer) - { - case -1: - usage(); - break; - - case 1: - cdbg.l1 = opt_setval; - break; - - case 2: - cdbg.l2 = opt_setval; - break; - - case 3: - cdbg.l3 = opt_setval; - break; - - case 4: - cdbg.l4 = opt_setval; - break; - } - } - else if(opt_reset) - { - switch(opt_layer) - { - case -1: - cdbg.l1 = L1_DEBUG_DEFAULT; - cdbg.l2 = L2_DEBUG_DEFAULT; - cdbg.l3 = L3_DEBUG_DEFAULT; - cdbg.l4 = L4_DEBUG_DEFAULT; - break; - - case 1: - cdbg.l1 = L1_DEBUG_DEFAULT; - break; - - case 2: - cdbg.l2 = L2_DEBUG_DEFAULT; - break; - - case 3: - cdbg.l3 = L3_DEBUG_DEFAULT; - break; - - case 4: - cdbg.l4 = L4_DEBUG_DEFAULT; - break; - } - } - else if(opt_max) - { - switch(opt_layer) - { - case -1: - cdbg.l1 = L1_DEBUG_MAX; - cdbg.l2 = L2_DEBUG_MAX; - cdbg.l3 = L3_DEBUG_MAX; - cdbg.l4 = L4_DEBUG_MAX; - break; - - case 1: - cdbg.l1 = L1_DEBUG_MAX; - break; - - case 2: - cdbg.l2 = L2_DEBUG_MAX; - break; - - case 3: - cdbg.l3 = L3_DEBUG_MAX; - break; - - case 4: - cdbg.l4 = L4_DEBUG_MAX; - break; - } - } - else if(opt_err) - { - switch(opt_layer) - { - case -1: - cdbg.l1 = L1_DEBUG_ERR; - cdbg.l2 = L2_DEBUG_ERR; - cdbg.l3 = L3_DEBUG_ERR; - cdbg.l4 = L4_DEBUG_ERR; - break; - - case 1: - cdbg.l1 = L1_DEBUG_ERR; - break; - - case 2: - cdbg.l2 = L2_DEBUG_ERR; - break; - - case 3: - cdbg.l3 = L3_DEBUG_ERR; - break; - - case 4: - cdbg.l4 = L4_DEBUG_ERR; - break; - } - } - else if(opt_zero) - { - switch(opt_layer) - { - case -1: - cdbg.l1 = 0; - cdbg.l2 = 0; - cdbg.l3 = 0; - cdbg.l4 = 0; - break; - - case 1: - cdbg.l1 = 0; - break; - - case 2: - cdbg.l2 = 0; - break; - - case 3: - cdbg.l3 = 0; - break; - - case 4: - cdbg.l4 = 0; - break; - } - } - else - { - exit(1); - } - - if((ret = ioctl(isdnfd, I4B_CTL_SET_DEBUG, &cdbg)) < 0) - { - fprintf(stderr, "ioctl I4B_CTL_SET_DEBUG failed: %s", strerror(errno)); - exit(1); - } - return(0); -} - -/*---------------------------------------------------------------------------* - * return ptr to string of 1's and 0's for value - *---------------------------------------------------------------------------*/ -char * -bin_str(unsigned long val, int length) -{ - static char buffer[80]; - int i = 0; - - if (length > 32) - length = 32; - - val = val << (32 - length); - - while (length--) - { - if (val & 0x80000000) - buffer[i++] = '1'; - else - buffer[i++] = '0'; - if ((length % 4) == 0 && length) - buffer[i++] = '.'; - val = val << 1; - } - return (buffer); -} - -/*---------------------------------------------------------------------------* - * print l1 info - *---------------------------------------------------------------------------*/ -void -printl1(unsigned long val) -{ - printf("\nLayer 1: %s = 0x%lX\n", bin_str(val, 32), val); - printf(" | |||| |||| |||| ||||\n"), - printf(" | |||| |||| |||| |||+- general error messages\n"); - printf(" | |||| |||| |||| ||+-- PH primitives exchanged\n"); - printf(" | |||| |||| |||| |+--- B channel actions\n"); - printf(" | |||| |||| |||| +---- HSCX error messages\n"); - printf(" | |||| |||| |||+------ HSCX IRQ messages\n"); - printf(" | |||| |||| ||+------- ISAC error messages\n"); - printf(" | |||| |||| |+-------- ISAC messages\n"); - printf(" | |||| |||| +--------- ISAC setup messages\n"); - printf(" | |||| |||+----------- FSM general messages\n"); - printf(" | |||| ||+------------ FSM error messages\n"); - printf(" | |||| |+------------- timer general messages\n"); - printf(" | |||| +-------------- timer error messages\n"); - printf(" | |||+---------------- HSCX data xfer errors msgs\n"); - printf(" | ||+----------------- ISAC CICO messages\n"); - printf(" | |+------------------ silent messages (soft-HDLC)\n"); - printf(" | +------------------- error messages (soft-HDLC)\n"); - printf(" +--------------------- HFC-S PCI debug messages\n"); - printf(" ++++-++++-++++-+++---------------------- unassigned\n"); -} - -/*---------------------------------------------------------------------------* - * print l2 info - *---------------------------------------------------------------------------*/ -void -printl2(unsigned long val) -{ - printf("\nLayer 2: %s = 0x%lX\n", bin_str(val, 32), val); - printf(" || |||| |||| ||||\n"), - printf(" || |||| |||| |||+- general error messages\n"); - printf(" || |||| |||| ||+-- DL primitives exchanged\n"); - printf(" || |||| |||| |+--- U frame messages\n"); - printf(" || |||| |||| +---- U frame error messages\n"); - printf(" || |||| |||+------ S frame messages\n"); - printf(" || |||| ||+------- S frame error messages\n"); - printf(" || |||| |+-------- I frame messages\n"); - printf(" || |||| +--------- I frame error messages\n"); - printf(" || |||+----------- FSM general messages\n"); - printf(" || ||+------------ FSM error messages\n"); - printf(" || |+------------- timer general messages\n"); - printf(" || +-------------- timer error messages\n"); - printf(" |+---------------- TEI general messages\n"); - printf(" +----------------- TEI error messages\n"); - printf(" ++++-++++-++++-++++-++------------------ unassigned\n"); -} - -/*---------------------------------------------------------------------------* - * print l3 info - *---------------------------------------------------------------------------*/ -void -printl3(unsigned long val) -{ - printf("\nLayer 3: %s = 0x%lX\n", bin_str(val, 32), val); - printf(" ||| |||| ||||\n"), - printf(" ||| |||| |||+- general error messages\n"); - printf(" ||| |||| ||+-- general messages\n"); - printf(" ||| |||| |+--- FSM messages\n"); - printf(" ||| |||| +---- FSM error messages\n"); - printf(" ||| |||+------ timer messages\n"); - printf(" ||| ||+------- timer error messages\n"); - printf(" ||| |+-------- protocol messages\n"); - printf(" ||| +--------- protocol error messages\n"); - printf(" ||+----------- facility messages\n"); - printf(" |+------------ facility error messages\n"); - printf(" +------------- Q.931 messages exchanged\n"); - printf(" ++++-++++-++++-++++-++++-+-------------- unassigned\n"); -} - -/*---------------------------------------------------------------------------* - * print l4 info - *---------------------------------------------------------------------------*/ -void -printl4(unsigned long val) -{ - printf("\nLayer 4: %s = 0x%lX\n", bin_str(val, 32), val); - printf(" ||| |||| ||||\n"), - printf(" ||| |||| |||+- general error messages\n"); - printf(" ||| |||| ||+-- general messages\n"); - printf(" ||| |||| |+--- B-ch timeout messages\n"); - printf(" ||| |||| +---- network driver dial state\n"); - printf(" ||| |||+------ ipr driver debug messages\n"); - printf(" ||| ||+------- rbch driver debug messages\n"); - printf(" ||| |+-------- isp driver debug messages\n"); - printf(" ||| +--------- tel driver debug messages\n"); - printf(" ||+----------- ing driver debug messages\n"); - printf(" |+------------ iavc driver debug messages\n"); - printf(" +------------- capi driver debug messages\n"); - printf(" ++++-++++-++++-++++-++++---------------- unassigned\n"); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdndecode/Makefile b/usr.sbin/i4b/isdndecode/Makefile deleted file mode 100644 index 9dbd971b83cb..000000000000 --- a/usr.sbin/i4b/isdndecode/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ - -PROG= isdndecode -MAN= isdndecode.8 -SRCS= main.c layer1.c layer2.c layer3.c layer3_subr.c facility.c pcause.c - -.include <bsd.prog.mk> - diff --git a/usr.sbin/i4b/isdndecode/decode.h b/usr.sbin/i4b/isdndecode/decode.h deleted file mode 100644 index 7eb544b8bbcc..000000000000 --- a/usr.sbin/i4b/isdndecode/decode.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * decode.h - isdndecode header file - * --------------------------------- - * - * $Id: decode.h,v 1.6 1999/12/13 21:25:25 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:49:50 1999] - * - *---------------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <signal.h> -#include <fcntl.h> -#include <ctype.h> -#include <string.h> -#include <time.h> -#include <unistd.h> -#include <sys/uio.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/file.h> - -#include <i4b/i4b_ioctl.h> -#include <i4b/i4b_trace.h> - -#include "pcause.h" - -#define I4BTRC_DEVICE "/dev/i4btrc" /* trace device file */ -#define DECODE_FILE_NAME "isdndecode" /* default output filename */ -#define DECODE_FILE_NAME_BAK ".last" /* backup filename trailer */ -#define BIN_FILE_NAME "isdntracebin" /* default binary filename */ - -#define BSIZE 4096 /* read buffer size */ -#define NCOLS 80 /* screen width */ - -#define RxUDEF 0 /* analyze mode, default unit for receiver side */ -#define TxUDEF 1 /* analyze mode, default unit for transmitter side */ - -void layer1(char *pbuf, unsigned char *buf); -int layer2(char *pbuf, unsigned char *buf, int is_te, int printit); -void layer3(char *pbuf, int n, int off, unsigned char *buf); -int q932_facility(char *pbuf, unsigned char *buf); -void sprintline(int, char *, int, int, int, const char *, ...); -void extension(int, char *, int, unsigned char, unsigned char); - -/* EOF */ diff --git a/usr.sbin/i4b/isdndecode/facility.c b/usr.sbin/i4b/isdndecode/facility.c deleted file mode 100644 index c4502a8daf2b..000000000000 --- a/usr.sbin/i4b/isdndecode/facility.c +++ /dev/null @@ -1,1111 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * facility.c - decode Q.932 facilities - * ------------------------------------ - * - * $Id: facility.c,v 1.5 2000/02/21 15:17:17 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Feb 21 16:15:43 2000] - * - *--------------------------------------------------------------------------- - * - * - Q.932 (03/93) Generic Procedures for the Control of - * ISDN Supplementaty Services - * - Q.950 (03/93) Supplementary Services Protocols, Structure and - * General Principles - * - ETS 300 179 (10/92) Advice Of Charge: charging information during - * the call (AOC-D) supplementary service Service description - * - ETS 300 180 (10/92) Advice Of Charge: charging information at the - * end of call (AOC-E) supplementary service Service description - * - ETS 300 181 (04/93) Advice Of Charge (AOC) supplementary service - * Functional capabilities and information flows - * - ETS 300 182 (04/93) Advice Of Charge (AOC) supplementary service - * Digital Subscriber Signalling System No. one (DSS1) protocol - * - X.208 Specification of Abstract Syntax Notation One (ASN.1) - * - X.209 Specification of Basic Encoding Rules for - * Abstract Syntax Notation One (ASN.1) - * - "ASN.1 Abstract Syntax Notation One", Walter Gora, DATACOM-Verlag - * 1992, 3rd Edition (ISBN 3-89238-062-7) (german !) - * - *---------------------------------------------------------------------------*/ - -#include "decode.h" -#include "facility.h" - -static int do_component(int length, char *pbuf); -static char *uni_str(int code); -static char *opval_str(int val); -static char *bid_str(int val); -static void next_state(char *pbuf, int class, int form, int code, int val); - -static int byte_len; -static unsigned char *byte_buf; -static int state; - -/*---------------------------------------------------------------------------* - * decode Q.931/Q.932 facility info element - *---------------------------------------------------------------------------*/ -int -q932_facility(char *pbuf, unsigned char *buf) -{ - int len; - - sprintf((pbuf+strlen(pbuf)), "[facility (Q.932): "); - - buf++; /* length */ - - len = *buf; - - buf++; /* protocol profile */ - - sprintf((pbuf+strlen(pbuf)), "Protocol="); - - switch(*buf & 0x1f) - { - case FAC_PROTO_ROP: - sprintf((pbuf+strlen(pbuf)), "Remote Operations Protocol\n"); - break; - - case FAC_PROTO_CMIP: - sprintf((pbuf+strlen(pbuf)), "CMIP Protocol (Q.941), UNSUPPORTED!\n"); - return(len+2); - break; - - case FAC_PROTO_ACSE: - sprintf((pbuf+strlen(pbuf)), "ACSE Protocol (X.217/X.227), UNSUPPORTED!\n"); - return(len+2); - break; - - default: - sprintf((pbuf+strlen(pbuf)), "Unknown Protocol (val = 0x%x), UNSUPPORTED!\n", *buf & 0x1f); - return(len+2); - break; - } - - /* next byte */ - - buf++; - len--; - - /* initialize variables for do_component */ - - byte_len = 0; - byte_buf = buf; - state = ST_EXP_COMP_TYP; - - /* decode facility */ - - do_component(len, pbuf); - - sprintf((pbuf+(strlen(pbuf)-1)), "]"); /* XXX replace last newline */ - - return(len+3); -} - -/*---------------------------------------------------------------------------* - * handle a component recursively - *---------------------------------------------------------------------------*/ -static int -do_component(int length, char *pbuf) -{ - int comp_tag_class; /* component tag class */ - int comp_tag_form; /* component form: constructor or primitive */ - int comp_tag_code; /* component code depending on class */ - int comp_length = 0; /* component length */ - -#ifdef FAC_DEBUG - sprintf((pbuf+strlen(pbuf)), "ENTER - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length); -#endif - -again: - -#ifdef FAC_DEBUG - sprintf((pbuf+strlen(pbuf)), "AGAIN - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length); -#endif - - /*----------------------------------------*/ - /* first component element: component tag */ - /*----------------------------------------*/ - - /* tag class bits */ - - sprintf((pbuf+strlen(pbuf)), "\t0x%02x Tag: ", *byte_buf); - - comp_tag_class = (*byte_buf & 0xc0) >> 6; - - switch(comp_tag_class) - { - case FAC_TAGCLASS_UNI: - sprintf((pbuf+strlen(pbuf)), "Universal"); - break; - case FAC_TAGCLASS_APW: - sprintf((pbuf+strlen(pbuf)), "Applic-wide"); - break; - case FAC_TAGCLASS_COS: - sprintf((pbuf+strlen(pbuf)), "Context-spec"); - break; - case FAC_TAGCLASS_PRU: - sprintf((pbuf+strlen(pbuf)), "Private"); - break; - } - - /* tag form bit */ - - comp_tag_form = (*byte_buf & 0x20) > 5; - - sprintf((pbuf+strlen(pbuf)), ", "); - - if(comp_tag_form == FAC_TAGFORM_CON) - { - sprintf((pbuf+strlen(pbuf)), "Constructor"); - } - else - { - sprintf((pbuf+strlen(pbuf)), "Primitive"); - } - - /* tag code bits */ - - comp_tag_code = *byte_buf & 0x1f; - - sprintf((pbuf+strlen(pbuf)), ", "); - - if(comp_tag_code == 0x1f) - { - comp_tag_code = 0; - - byte_buf++; - byte_len++; - - while(*byte_buf & 0x80) - { - comp_tag_code += (*byte_buf & 0x7f); - byte_buf++; - byte_len++; - } - comp_tag_code += (*byte_buf & 0x7f); - sprintf((pbuf+strlen(pbuf)), "%d (ext)\n", comp_tag_code); - } - else - { - comp_tag_code = (*byte_buf & 0x1f); - - if(comp_tag_class == FAC_TAGCLASS_UNI) - { - sprintf((pbuf+strlen(pbuf)), "%s (%d)\n", uni_str(comp_tag_code), comp_tag_code); - } - else - { - sprintf((pbuf+strlen(pbuf)), "code = %d\n", comp_tag_code); - } - } - - byte_buf++; - byte_len++; - - /*--------------------------------------------*/ - /* second component element: component length */ - /*--------------------------------------------*/ - - sprintf((pbuf+strlen(pbuf)), "\t0x%02x Len: ", *byte_buf); - - comp_length = 0; - - if(*byte_buf & 0x80) - { - int i = *byte_buf & 0x7f; - - byte_len += i; - - for(;i > 0;i++) - { - byte_buf++; - comp_length += (*byte_buf * (i*256)); - } - sprintf((pbuf+strlen(pbuf)), "%d (long form)\n", comp_length); - } - else - { - comp_length = *byte_buf & 0x7f; - sprintf((pbuf+strlen(pbuf)), "%d (short form)\n", comp_length); - } - - next_state(pbuf, comp_tag_class, comp_tag_form, comp_tag_code, -1); - - byte_len++; - byte_buf++; - - if(comp_length) - { - - /*---------------------------------------------*/ - /* third component element: component contents */ - /*---------------------------------------------*/ - - if(comp_tag_form) /* == constructor */ - { - do_component(comp_length, pbuf); - } - else - { - int val = 0; - if(comp_tag_class == FAC_TAGCLASS_UNI) - { - switch(comp_tag_code) - { - case FAC_CODEUNI_INT: - case FAC_CODEUNI_ENUM: - case FAC_CODEUNI_BOOL: - if(comp_length) - { - int i; - - sprintf((pbuf+strlen(pbuf)), "\t"); - - for(i = comp_length-1; i >= 0; i--) - { - sprintf((pbuf+strlen(pbuf)), "0x%02x ", *byte_buf); - val += (*byte_buf + (i*255)); - byte_buf++; - byte_len++; - if(i) - sprintf((pbuf+strlen(pbuf)), "\n\t"); - } - sprintf((pbuf+strlen(pbuf)), "Val: %d\n", val); - } - break; - default: - if(comp_length) - { - int i; - - sprintf((pbuf+strlen(pbuf)), "\t"); - - for(i = comp_length-1; i >= 0; i--) - { - sprintf((pbuf+strlen(pbuf)), "0x%02x = %d", *byte_buf, *byte_buf); - if(isprint(*byte_buf)) - sprintf((pbuf+strlen(pbuf)), " = '%c'", *byte_buf); - byte_buf++; - byte_len++; - if(i) - sprintf((pbuf+strlen(pbuf)), "\n\t"); - } - } - break; - } - } - - else /* comp_tag_class != FAC_TAGCLASS_UNI */ - { - if(comp_length) - { - int i; - - sprintf((pbuf+strlen(pbuf)), "\t"); - - for(i = comp_length-1; i >= 0; i--) - { - sprintf((pbuf+strlen(pbuf)), "0x%02x", *byte_buf); - val += (*byte_buf + (i*255)); - byte_buf++; - byte_len++; - if(i) - sprintf((pbuf+strlen(pbuf)), "\n\t"); - } - sprintf((pbuf+strlen(pbuf)), "\n"); - } - } - next_state(pbuf, comp_tag_class, comp_tag_form, comp_tag_code, val); - } - } - -#ifdef FAC_DEBUG - sprintf((pbuf+strlen(pbuf)), "PREGOTO - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length); -#endif - if(byte_len < length) - goto again; -#ifdef FAC_DEBUG - sprintf((pbuf+strlen(pbuf)), "RETURN - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length); -#endif - return(byte_len); -} - -/*---------------------------------------------------------------------------* - * print universal id type - *---------------------------------------------------------------------------*/ -static char *uni_str(int code) -{ - static char *tbl[] = { - "BOOLEAN", - "INTEGER", - "BIT STRING", - "OCTET STRING", - "NULL", - "OBJECT IDENTIFIER", - "OBJECT DESCRIPTOR", - "EXTERNAL", - "REAL", - "ENUMERATED", - "RESERVED11", - "RESERVED12", - "RESERVED13", - "RESERVED14", - "RESERVED15", - "SEQUENCE", - "SET", - "NUMERIC STRING", - "PRINTABLE STRING", - "TELETEX STRING", - "ISO646 STRING", - "IA5 STRING", - "GRAPHIC STRING", - "GENERAL STRING" - }; - - if(code >= 1 && code <= FAC_CODEUNI_GNSTR) - return(tbl[code-1]); - else - return("ERROR, Value out of Range!"); -} - -/*---------------------------------------------------------------------------* - * print operation value - *---------------------------------------------------------------------------*/ -static char *opval_str(int val) -{ - static char buffer[80]; - char *r; - - switch(val) - { - case FAC_OPVAL_UUS: - r = "uUs"; - break; - case FAC_OPVAL_CUG: - r = "cUGCall"; - break; - case FAC_OPVAL_MCID: - r = "mCIDRequest"; - break; - case FAC_OPVAL_BTPY: - r = "beginTPY"; - break; - case FAC_OPVAL_ETPY: - r = "endTPY"; - break; - case FAC_OPVAL_ECT: - r = "eCTRequest"; - break; - case FAC_OPVAL_DIV_ACT: - r = "activationDiversion"; - break; - case FAC_OPVAL_DIV_DEACT: - r = "deactivationDiversion"; - break; - case FAC_OPVAL_DIV_ACTSN: - r = "activationStatusNotificationDiv"; - break; - case FAC_OPVAL_DIV_DEACTSN: - r = "deactivationStatusNotificationDiv"; - break; - case FAC_OPVAL_DIV_INTER: - r = "interrogationDiversion"; - break; - case FAC_OPVAL_DIV_INFO: - r = "diversionInformation"; - break; - case FAC_OPVAL_DIV_CALLDEF: - r = "callDeflection"; - break; - case FAC_OPVAL_DIV_CALLRER: - r = "callRerouting"; - break; - case FAC_OPVAL_DIV_LINF2: - r = "divertingLegInformation2"; - break; - case FAC_OPVAL_DIV_INVS: - r = "invokeStatus"; - break; - case FAC_OPVAL_DIV_INTER1: - r = "interrogationDiversion1"; - break; - case FAC_OPVAL_DIV_LINF1: - r = "divertingLegInformation1"; - break; - case FAC_OPVAL_DIV_LINF3: - r = "divertingLegInformation3"; - break; - case FAC_OPVAL_ER_CRCO: - r = "explicitReservationCreationControl"; - break; - case FAC_OPVAL_ER_MGMT: - r = "explicitReservationManagement"; - break; - case FAC_OPVAL_ER_CANC: - r = "explicitReservationCancel"; - break; - case FAC_OPVAL_MLPP_QUERY: - r = "mLPP lfb Query"; - break; - case FAC_OPVAL_MLPP_CALLR: - r = "mLPP Call Request"; - break; - case FAC_OPVAL_MLPP_CALLP: - r = "mLPP Call Preemption"; - break; - case FAC_OPVAL_AOC_REQ: - r = "chargingRequest"; - break; - case FAC_OPVAL_AOC_S_CUR: - r = "aOCSCurrency"; - break; - case FAC_OPVAL_AOC_S_SPC: - r = "aOCSSpecialArrangement"; - break; - case FAC_OPVAL_AOC_D_CUR: - r = "aOCDCurrency"; - break; - case FAC_OPVAL_AOC_D_UNIT: - r = "aOCDChargingUnit"; - break; - case FAC_OPVAL_AOC_E_CUR: - r = "aOCECurrency"; - break; - case FAC_OPVAL_AOC_E_UNIT: - r = "aOCEChargingUnit"; - break; - case FAC_OPVAL_AOC_IDOFCRG: - r = "identificationOfCharge"; - break; - case FAC_OPVAL_CONF_BEG: - r = "beginConf"; - break; - case FAC_OPVAL_CONF_ADD: - r = "addConf"; - break; - case FAC_OPVAL_CONF_SPLIT: - r = "splitConf"; - break; - case FAC_OPVAL_CONF_DROP: - r = "dropConf"; - break; - case FAC_OPVAL_CONF_ISOLATE: - r = "isolateConf"; - break; - case FAC_OPVAL_CONF_REATT: - r = "reattachConf"; - break; - case FAC_OPVAL_CONF_PDISC: - r = "partyDISC"; - break; - case FAC_OPVAL_CONF_FCONF: - r = "floatConf"; - break; - case FAC_OPVAL_CONF_END: - r = "endConf"; - break; - case FAC_OPVAL_CONF_IDCFE: - r = "indentifyConferee"; - break; - case FAC_OPVAL_REVC_REQ: - r = "requestREV"; - break; - default: - sprintf(buffer, "unknown operation value %d!", val); - r = buffer; - } - return(r); -} - -/*---------------------------------------------------------------------------* - * billing id string - *---------------------------------------------------------------------------*/ -static char *bid_str(int val) -{ - static char buffer[80]; - char *r; - - switch(val) - { - case 0: - r = "normalCharging"; - break; - case 1: - r = "reverseCharging"; - break; - case 2: - r = "creditCardCharging"; - break; - case 3: - r = "callForwardingUnconditional"; - break; - case 4: - r = "callForwardingBusy"; - break; - case 5: - r = "callForwardingNoReply"; - break; - case 6: - r = "callDeflection"; - break; - case 7: - r = "callTransfer"; - break; - default: - sprintf(buffer, "unknown billing-id value %d!", val); - r = buffer; - } - return(r); -} - -/*---------------------------------------------------------------------------* - * invoke component - *---------------------------------------------------------------------------*/ -static void -F_1_1(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_1, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t invokeComponent\n"); - state = ST_EXP_INV_ID; - } -} - -/*---------------------------------------------------------------------------* - * return result - *---------------------------------------------------------------------------*/ -static void -F_1_2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_2, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t returnResult\n"); - state = ST_EXP_RR_INV_ID; - } -} -/*---------------------------------------------------------------------------* - * return error - *---------------------------------------------------------------------------*/ -static void -F_1_3(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_3, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t returnError\n"); - state = ST_EXP_NIX; - } -} -/*---------------------------------------------------------------------------* - * reject - *---------------------------------------------------------------------------*/ -static void -F_1_4(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_4, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t reject\n"); - state = ST_EXP_REJ_INV_ID; - } -} - -/*---------------------------------------------------------------------------* - * return result: invoke id - *---------------------------------------------------------------------------*/ -static void -F_RJ2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ2, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val); - state = ST_EXP_REJ_OP_VAL; - } -} - -/*---------------------------------------------------------------------------* - * reject, general problem - *---------------------------------------------------------------------------*/ -static void -F_RJ30(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ30, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t General problem\n"); - } - else - { - switch(val) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized component\n"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped component\n"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "\t problem = badly structured component\n"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val); - break; - } - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * reject, invoke problem - *---------------------------------------------------------------------------*/ -static void -F_RJ31(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ31, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Invoke problem\n"); - } - else - { - switch(val) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "\t problem = duplicate invocation\n"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized operation\n"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped argument\n"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "\t problem = resource limitation\n"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "\t problem = initiator releasing\n"); - break; - case 5: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized linked identifier\n"); - break; - case 6: - sprintf((pbuf+strlen(pbuf)), "\t problem = linked resonse unexpected\n"); - break; - case 7: - sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected child operation\n"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val); - break; - } - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * reject, return result problem - *---------------------------------------------------------------------------*/ -static void -F_RJ32(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ32, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Return result problem\n"); - } - else - { - switch(val) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "\t problem = return response unexpected\n"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped result\n"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val); - break; - } - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * reject, return error problem - *---------------------------------------------------------------------------*/ -static void -F_RJ33(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ33, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Return error problem\n"); - } - else - { - switch(val) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "\t problem = error response unexpected\n"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized error\n"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected error\n"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped parameter\n"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val); - break; - } - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * invoke component: invoke id - *---------------------------------------------------------------------------*/ -static void -F_2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_2, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val); - state = ST_EXP_OP_VAL; - } -} - -/*---------------------------------------------------------------------------* - * return result: invoke id - *---------------------------------------------------------------------------*/ -static void -F_RR2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR2, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val); - state = ST_EXP_RR_OP_VAL; - } -} - -/*---------------------------------------------------------------------------* - * invoke component: operation value - *---------------------------------------------------------------------------*/ -static void -F_3(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_3, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val); - state = ST_EXP_INFO; - } -} - -/*---------------------------------------------------------------------------* - * return result: operation value - *---------------------------------------------------------------------------*/ -static void -F_RR3(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR3, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val); - state = ST_EXP_RR_RESULT; - } -} - -/*---------------------------------------------------------------------------* - * return result: RESULT - *---------------------------------------------------------------------------*/ -static void -F_RRR(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RRR, val = %d\n", val); -#endif - state = ST_EXP_NIX; -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_4(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t specificChargingUnits\n"); - state = ST_EXP_RUL; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_4_1(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_1, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t freeOfCharge\n"); - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_4_2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_2, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t chargeNotAvailable\n"); - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_5(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_5, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t recordedUnitsList [1]\n"); - state = ST_EXP_RU; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_6(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_6, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t RecordedUnits\n"); - state = ST_EXP_RNOU; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_7(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_7, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t NumberOfUnits = %d\n", val); - state = ST_EXP_TOCI; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_8(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_8, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t typeOfChargingInfo = %s\n", val == 0 ? "subTotal" : "total"); - state = ST_EXP_DBID; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_9(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_9, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t AOCDBillingId = %s (%d)\n", bid_str(val), val); - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * state table - *---------------------------------------------------------------------------*/ -static struct statetab { - int currstate; /* input: current state we are in */ - int form; /* input: current tag form */ - int class; /* input: current tag class */ - int code; /* input: current tag code */ - void (*func)(char *,int); /* output: func to exec */ -} statetab[] = { - -/* current state tag form tag class tag code function */ -/* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/ - -/* invoke */ - - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_1_1 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 2, F_1_2 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 3, F_1_3 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 4, F_1_4 }, - {ST_EXP_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_2 }, - {ST_EXP_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_3 }, - {ST_EXP_INFO, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_4 }, - {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_NULL, F_4_1 }, - {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_4_2 }, - {ST_EXP_RUL, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_5 }, - {ST_EXP_RU, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_6 }, - {ST_EXP_RNOU, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_7 }, - {ST_EXP_TOCI, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_8 }, - {ST_EXP_DBID, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_9 }, - -/* return result */ - - {ST_EXP_RR_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR2 }, - {ST_EXP_RR_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR3 }, - {ST_EXP_RR_RESULT, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SET, F_RRR }, - -/* current state tag form tag class tag code function */ -/* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/ -/* reject */ - - {ST_EXP_REJ_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RJ2 }, - {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 0, F_RJ30 }, - {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_RJ31 }, - {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_RJ32 }, - {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_RJ33 }, - -/* end */ - - {-1, -1, -1, -1, NULL } -}; - -/*---------------------------------------------------------------------------* - * state decode for do_component - *---------------------------------------------------------------------------*/ -static void -next_state(char *pbuf, int class, int form, int code, int val) -{ - int i; - -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: class=%d, form=%d, code=%d, val=%d\n", class, form, code, val); -#endif - - for(i=0; ; i++) - { - if((statetab[i].currstate > state) || - (statetab[i].currstate == -1)) - { - break; - } - - if((statetab[i].currstate == state) && - (statetab[i].form == form) && - (statetab[i].class == class) && - (statetab[i].code == code)) - { - (*statetab[i].func)(pbuf, val); - break; - } - } -} - -/* EOF */ - diff --git a/usr.sbin/i4b/isdndecode/facility.h b/usr.sbin/i4b/isdndecode/facility.h deleted file mode 100644 index f4cfe10e2520..000000000000 --- a/usr.sbin/i4b/isdndecode/facility.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * facility.h - facility header file - * --------------------------------- - * - * $Id: facility.h,v 1.5 2000/02/21 15:17:17 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Feb 21 16:16:04 2000] - * - *--------------------------------------------------------------------------- - * - * - Q.932 (03/93) Generic Procedures for the Control of - * ISDN Supplementaty Services - * - Q.950 (03/93) Supplementary Services Protocols, Structure and - * General Principles - * - ETS 300 179 (10/92) Advice Of Charge: charging information during - * the call (AOC-D) supplementary service Service description - * - ETS 300 180 (10/92) Advice Of Charge: charging information at the - * end of call (AOC-E) supplementary service Service description - * - ETS 300 181 (04/93) Advice Of Charge (AOC) supplementary service - * Functional capabilities and information flows - * - ETS 300 182 (04/93) Advice Of Charge (AOC) supplementary service - * Digital Subscriber Signalling System No. one (DSS1) protocol - * - X.208 Specification of Abstract Syntax Notation One (ASN.1) - * - X.209 Specification of Basic Encoding Rules for - * Abstract Syntax Notation One (ASN.1) - * - "ASN.1 Abstract Syntax Notation One", Walter Gora, DATACOM-Verlag - * 1992, 3rd Edition (ISBN 3-89238-062-7) (german !) - * - *---------------------------------------------------------------------------*/ - -/* #define FAC_DEBUG */ -/* #define ST_DEBUG */ - -/* protocols */ -#define FAC_PROTO_ROP 0x11 -#define FAC_PROTO_CMIP 0x12 -#define FAC_PROTO_ACSE 0x13 - -/* tag classes */ -#define FAC_TAGCLASS_UNI 0x00 -#define FAC_TAGCLASS_APW 0x01 -#define FAC_TAGCLASS_COS 0x02 -#define FAC_TAGCLASS_PRU 0x03 - -/* tag forms */ -#define FAC_TAGFORM_PRI 0x00 -#define FAC_TAGFORM_CON 0x01 - -/* class UNIVERSAL values */ -#define FAC_CODEUNI_BOOL 1 -#define FAC_CODEUNI_INT 2 -#define FAC_CODEUNI_BITS 3 -#define FAC_CODEUNI_OCTS 4 -#define FAC_CODEUNI_NULL 5 -#define FAC_CODEUNI_OBJI 6 -#define FAC_CODEUNI_OBJD 7 -#define FAC_CODEUNI_EXT 8 -#define FAC_CODEUNI_REAL 9 -#define FAC_CODEUNI_ENUM 10 -#define FAC_CODEUNI_R11 11 -#define FAC_CODEUNI_R12 12 -#define FAC_CODEUNI_R13 13 -#define FAC_CODEUNI_R14 14 -#define FAC_CODEUNI_R15 15 -#define FAC_CODEUNI_SEQ 16 -#define FAC_CODEUNI_SET 17 -#define FAC_CODEUNI_NSTR 18 -#define FAC_CODEUNI_PSTR 19 -#define FAC_CODEUNI_TSTR 20 -#define FAC_CODEUNI_VSTR 21 -#define FAC_CODEUNI_ISTR 22 -#define FAC_CODEUNI_UTIME 23 -#define FAC_CODEUNI_GTIME 24 -#define FAC_CODEUNI_GSTR 25 -#define FAC_CODEUNI_VISTR 26 -#define FAC_CODEUNI_GNSTR 27 - -/* operation values */ -#define FAC_OPVAL_UUS 1 -#define FAC_OPVAL_CUG 2 -#define FAC_OPVAL_MCID 3 -#define FAC_OPVAL_BTPY 4 -#define FAC_OPVAL_ETPY 5 -#define FAC_OPVAL_ECT 6 - -#define FAC_OPVAL_DIV_ACT 7 -#define FAC_OPVAL_DIV_DEACT 8 -#define FAC_OPVAL_DIV_ACTSN 9 -#define FAC_OPVAL_DIV_DEACTSN 10 -#define FAC_OPVAL_DIV_INTER 11 -#define FAC_OPVAL_DIV_INFO 12 -#define FAC_OPVAL_DIV_CALLDEF 13 -#define FAC_OPVAL_DIV_CALLRER 14 -#define FAC_OPVAL_DIV_LINF2 15 -#define FAC_OPVAL_DIV_INVS 16 -#define FAC_OPVAL_DIV_INTER1 17 -#define FAC_OPVAL_DIV_LINF1 18 -#define FAC_OPVAL_DIV_LINF3 19 - -#define FAC_OPVAL_ER_CRCO 20 -#define FAC_OPVAL_ER_MGMT 21 -#define FAC_OPVAL_ER_CANC 22 - -#define FAC_OPVAL_MLPP_QUERY 24 -#define FAC_OPVAL_MLPP_CALLR 25 -#define FAC_OPVAL_MLPP_CALLP 26 - -#define FAC_OPVAL_AOC_REQ 30 -#define FAC_OPVAL_AOC_S_CUR 31 -#define FAC_OPVAL_AOC_S_SPC 32 -#define FAC_OPVAL_AOC_D_CUR 33 -#define FAC_OPVAL_AOC_D_UNIT 34 -#define FAC_OPVAL_AOC_E_CUR 35 -#define FAC_OPVAL_AOC_E_UNIT 36 -#define FAC_OPVAL_AOC_IDOFCRG 37 - -#define FAC_OPVAL_CONF_BEG 40 -#define FAC_OPVAL_CONF_ADD 41 -#define FAC_OPVAL_CONF_SPLIT 42 -#define FAC_OPVAL_CONF_DROP 43 -#define FAC_OPVAL_CONF_ISOLATE 44 -#define FAC_OPVAL_CONF_REATT 45 -#define FAC_OPVAL_CONF_PDISC 46 -#define FAC_OPVAL_CONF_FCONF 47 -#define FAC_OPVAL_CONF_END 48 -#define FAC_OPVAL_CONF_IDCFE 49 - -#define FAC_OPVAL_REVC_REQ 60 - -enum states { - ST_EXP_COMP_TYP, - ST_EXP_INV_ID, - ST_EXP_OP_VAL, - ST_EXP_INFO, - ST_EXP_RUL, - ST_EXP_RU, - ST_EXP_RNOU, - ST_EXP_TOCI, - ST_EXP_DBID, - - ST_EXP_RR_INV_ID, - ST_EXP_RR_OP_VAL, - ST_EXP_RR_RESULT, - - ST_EXP_REJ_INV_ID, - ST_EXP_REJ_OP_VAL, - ST_EXP_REJ_RESULT, - - ST_EXP_NIX -}; - -/* EOF */ - diff --git a/usr.sbin/i4b/isdndecode/isdndecode.8 b/usr.sbin/i4b/isdndecode/isdndecode.8 deleted file mode 100644 index 628bcbe38bb5..000000000000 --- a/usr.sbin/i4b/isdndecode/isdndecode.8 +++ /dev/null @@ -1,176 +0,0 @@ -.\" -.\" Copyright (c) 1998, 2000 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdndecode.8,v 1.9 2000/02/21 15:17:17 hm Exp $ -.\" -.\" last edit-date: [Mon Feb 21 16:15:09 2000] -.\" -.\" $FreeBSD$ -.\" -.Dd February 21, 2000 -.Dt ISDNDECODE 8 -.Os -.Sh NAME -.Nm isdndecode -.Nd isdn4bsd ISDN protocol decode utility -.Sh SYNOPSIS -.Nm -.Op Fl a -.Op Fl b -.Op Fl d -.Op Fl f Ar filename -.Op Fl h -.Op Fl i -.Op Fl l -.Op Fl o -.Op Fl p Ar filename -.Op Fl u Ar number -.Op Fl x -.Op Fl B -.Op Fl P -.Op Fl R Ar unit -.Op Fl T Ar unit -.Sh DESCRIPTION -The -.Nm -utility is part of the isdn4bsd package and is used to provide the user with a -detailed mnemonic display of the layers 1, 2 and 3 protocol activities on -the D channel and hex dump of the B channel(s) activities. -.Pp -Together with two passive supported cards and an easy to build cable it can -also be used to monitor the complete traffic on a S0 bus providing S0 bus -analyzer features. -.Pp -The -.Nm -utility is only available for passive supported cards. -.Pp -The following options can be used: -.Bl -tag -width Ds -.It Fl a -Run -.Nm -in analyzer mode by using two passive cards and a custom cable which can -be build as described in the file -.Em cable.txt -in the isdn4bsd source distribution. -One card acts as a receiver for the -transmitting direction on the S0 bus while the other card acts as a receiver -for the receiving direction on the S0 bus. -Complete traffic monitoring is -possible using this setup. -.It Fl b -switch B channel tracing on (default off). -.It Fl d -switch D channel tracing off (default on). -.It Fl f -Use -.Ar filename -as the name of a file into which to write tracing output (default filename is -isdndecode<n> where n is the number of the unit to decode). -.It Fl h -switch display of header off (default on). -.It Fl i -print layer 1 (I.430) INFO signals to monitor layer 1 activity (default off). -.It Fl l -switch displaying of Layer 2 (Q.921) frames off (default on). -.It Fl o -switch off writing decode output to a file (default on). -.It Fl p -Use -.Ar filename -as the name of a file used for the -B and -P options (default filename -is isdntracebin<n> where n is the number of the unit to decode). -.It Fl u -Use -.Ar number -as the unit number of the controller card to decode (default 0). -.It Fl x -Decode Layer 3 packets with an unknown protocol discriminator. -.It Fl B -Write undecoded binary decode data to a file for later or remote -analyzing (default off). -.It Fl P -Read undecoded binary decode data from file instead from device (default off). -.It Fl R -Use -.Ar unit -as the receiving interface unit number in analyze mode. -.It Fl T -Use -.Ar unit -as the transmitting interface unit number in analyze mode. -.El -.Pp -When the USR1 signal is sent to a -.Nm -process, the currently used logfiles are reopened, so that logfile -rotation becomes possible. -.Pp -The decode output should be obvious. -It is very handy to have the following -standard texts available when tracing ISDN protocols: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar I.430 -ISDN BRI layer 1 protocol description. -.It Ar Q.921 -ISDN D-channel layer 2 protocol description. -.It Ar Q.931 -ISDN D-channel layer 3 protocol description. -.El -.Sh FILES -.Bl -tag -width daddeldi -compact -.It Pa /dev/i4btrc<n> -The devicefile(s) used to get the decode messages for ISDN card unit <n> -out of the kernel. -.El -.Sh EXAMPLES -The command: -.Bd -literal -offset indent -isdndecode -f /var/tmp/isdn.decode -.Ed -.Pp -will start D channel tracing on passive controller 0 with all except B -channel tracing enabled and logs everything into the output file -/var/tmp/isdn.decode. -.Sh SEE ALSO -.Xr isdnd 8 -.Sh STANDARDS -ITU Recommendations I.430, Q.920, Q.921, Q.930, Q.931 -.Pp -ITU Recommendation Q.932 (03/93), Q.950 (03/93) -.Pp -ETSI Recommendation ETS 300 179 (10/92), ETS 300 180 (10/92) -.Pp -ETSI Recommendation ETS 300 181 (04/93), ETS 300 182 (04/93) -.Pp -ITU Recommendation X.208, X.209 -.Sh AUTHORS -The -.Nm -utility and this manual page were written by -.An Hellmuth Michaelis Aq hm@kts.org . -.Sh BUGS -Still one left. diff --git a/usr.sbin/i4b/isdndecode/layer1.c b/usr.sbin/i4b/isdndecode/layer1.c deleted file mode 100644 index c08b628e9a45..000000000000 --- a/usr.sbin/i4b/isdndecode/layer1.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * layer1.c - isdndecode, decode and print layer 1 information - * ----------------------------------------------------------- - * - * $Id: layer1.c,v 1.4 1999/12/13 21:25:25 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:50:34 1999] - * - *---------------------------------------------------------------------------*/ - -#include "decode.h" - -/*---------------------------------------------------------------------------* - * decode layer 1 information - *---------------------------------------------------------------------------*/ -void -layer1(char *buffer, unsigned char *buf) -{ - switch(*buf) - { - case INFO0: - strcpy(buffer,"L1 INFO0 (No Signal)\n"); - break; - - case INFO1_8: - strcpy(buffer,"L1 INFO1 (Activation Request, Priority = 8)\n"); - break; - - case INFO1_10: - strcpy(buffer,"L1 INFO1 (Activation Request, Priority = 10)\n"); - break; - - case INFO2: - strcpy(buffer,"L1 INFO2 (Pending Activation)\n"); - break; - - case INFO3: - strcpy(buffer,"L1 INFO3 (Synchronized)\n"); - break; - - case INFO4_8: - strcpy(buffer,"L1 INFO4 (Activated, Priority = 8/9)\n"); - break; - - case INFO4_10: - strcpy(buffer,"L1 INFO4 (Activated, Priority = 10/11)\n"); - break; - - default: - sprintf(buffer,"L1 ERROR, invalid INFO value 0x%x!\n", *buf); - break; - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdndecode/layer2.c b/usr.sbin/i4b/isdndecode/layer2.c deleted file mode 100644 index 1e5398680188..000000000000 --- a/usr.sbin/i4b/isdndecode/layer2.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * layer2.c - decode and print layer 2 (Q.921) information - * ------------------------------------------------------- - * - * $Id: layer2.c,v 1.5 1999/12/13 21:25:25 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:50:41 1999] - * - *---------------------------------------------------------------------------*/ - -#include "decode.h" - -/*---------------------------------------------------------------------------* - * decode poll bit - *---------------------------------------------------------------------------*/ -static void -poll(int layer, char *buffer, int cnt, unsigned char value, unsigned char mask) -{ - sprintline(layer, buffer, cnt, value, mask, "P/F, Poll = %s", (value & mask) ? "Immediate Response Required" : "No Immediate Response Required"); -} - -/*---------------------------------------------------------------------------* - * decode final bit - *---------------------------------------------------------------------------*/ -static void -final(int layer, char *buffer, int cnt, unsigned char value, unsigned char mask) -{ - sprintline(layer, buffer, cnt, value, mask, "P/F, Final = %s", (value & mask) ? "Result of Poll" : "No Result of Poll"); -} - -/*---------------------------------------------------------------------------* - * decode protocol specified in Q.921 - *---------------------------------------------------------------------------*/ -int -layer2(char *pbuf, unsigned char *buf, int dir, int printit) -{ - int sap, tei, cmd; - int cnt = 0; - char locbuf[32000]; - char *lbufp = &locbuf[0]; - char buffer[80]; - - *lbufp = '\0'; - *pbuf = '\0'; - - /* address high */ - - sap = (buf[0] >> 2) & 0x3f; - - if(sap == 0) - strcpy(buffer, "Call Control"); - else if((sap >= 1) && (sap <= 15)) - strcpy(buffer, "Reserved"); - else if(sap == 16) - strcpy(buffer, "X.25"); - else if((sap >= 17) && (sap <= 31)) - strcpy(buffer, "Reserved"); - else if(sap == 63) - strcpy(buffer, "Layer 2 Management"); - else - strcpy(buffer, "Not available for Q.921"); - sprintline(2, lbufp+strlen(lbufp), cnt, buf[0], 0xfc, "SAPI = %d (%s)", sap, buffer); - - if(dir == FROM_TE) - cmd = !(buf[0] & 0x02); - else - cmd = buf[0] & 0x02; - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[0], 0x02, "C/R = %s", cmd ? "Command" : "Response"); - extension(2, lbufp+strlen(lbufp), cnt, buf[0], 0x01); - cnt++; - - /* address low */ - - tei = buf[1] >> 1; - - if((tei >= 0) && (tei <= 63)) - strcpy(buffer, "Non-automatic TEI"); - else if((tei >= 64) && (tei <= 126)) - strcpy(buffer, "Automatic TEI"); - if(tei == 127) - strcpy(buffer, "Group TEI"); - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[1], 0xfe, "TEI = %d (%s)", tei, buffer); - extension(2, lbufp+strlen(lbufp), cnt, buf[1], 0x01); - cnt++; - - /* control 1 */ - - if((buf[2] & 0x03) == 0x03) - { - /* U-frame */ - - if((buf[2] & 0xef) == 0x6f) - { - /* SABME */ - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0xef, "U-Frame: SABME (Set Asynchonous Balanced Mode)"); - poll(2, lbufp+strlen(lbufp), cnt, buf[2], 0x10); - cnt++; - } - else if((buf[2] & 0xef) == 0x0f) - { - /* DM */ - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0xef, "U-Frame: DM (Disconnected Mode)"); - final(2, lbufp+strlen(lbufp), cnt, buf[2], 0x10); - cnt++; - } - else if((buf[2] & 0xef) == 0x03) - { - /* UI */ - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0xef, "U-Frame: UI (Unnumbered Information)"); - poll(2, lbufp+strlen(lbufp), cnt, buf[2], 0x10); - cnt++; - - if(sap == 63 && (buf[3] == 0x0f)) /* TEI management */ - { - sprintline(2, lbufp+strlen(lbufp), cnt, buf[3], 0xff, "MEI (Management Entity Identifier)"); - cnt++; - sprintline(2, lbufp+strlen(lbufp), cnt, buf[4], 0xff, "Ri = 0x%04x (Reference number high)", (buf[4] << 8) | buf[5]); - cnt++; - sprintline(2, lbufp+strlen(lbufp), cnt, buf[5], 0xff, "Ri (Reference Number low)"); - cnt++; - - switch(buf[6]) - { - case 0x01: - strcpy(buffer, "Identity Request"); - break; - case 0x02: - strcpy(buffer, "Identity Assigned"); - break; - case 0x03: - strcpy(buffer, "Identity denied"); - break; - case 0x04: - strcpy(buffer, "Identity Check Request"); - break; - case 0x05: - strcpy(buffer, "Identity Check Response"); - break; - case 0x06: - strcpy(buffer, "Identity Remove"); - break; - case 0x07: - strcpy(buffer, "Identity Verify"); - break; - default: - strcpy(buffer, "undefined"); - break; - } - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[6], 0xff, "TEI %s (Message Type %d)", buffer, buf[6]); - cnt++; - - switch(buf[6]) - { - case 0x01: - strcpy(buffer, "Any TEI value acceptable"); - break; - case 0x02: - strcpy(buffer, ""); - break; - case 0x03: - strcpy(buffer, "No TEI Value available"); - break; - case 0x04: - strcpy(buffer, "Check all TEI values"); - break; - case 0x05: - strcpy(buffer, ""); - break; - case 0x06: - strcpy(buffer, "Request for removal of all TEI values"); - break; - case 0x07: - strcpy(buffer, ""); - break; - default: - strcpy(buffer, ""); - break; - } - if(((buf[7] >> 1) & 0x7f) == 127) - sprintline(2, lbufp+strlen(lbufp), cnt, buf[7], 0xfe, "Ai = %d (Action Indicator = %s)", (buf[7] >> 1) & 0x7f, buffer); - else - sprintline(2, lbufp+strlen(lbufp), cnt, buf[7], 0xfe, "Ai = %d (Action Indicator)", (buf[7] >> 1) & 0x7f); - extension(2, lbufp+strlen(lbufp), cnt, buf[7], 0x01); - cnt++; - } - } - else if((buf[2] & 0xef) == 0x43) - { - /* DISC */ - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0xef, "U-Frame: DISC (Disconnect)"); - poll(2, lbufp+strlen(lbufp), cnt, buf[2], 0x10); - cnt++; - } - else if((buf[2] & 0xef) == 0x63) - { - /* UA */ - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0xef, "U-Frame: UA (Unnumbered Acknowledge)"); - final(2, lbufp+strlen(lbufp), cnt, buf[2], 0x10); - cnt++; - } - else if((buf[2] & 0xef) == 0x87) - { - /* FRMR */ - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0xef, "U-Frame: FRMR (Frame Reject)"); - final(2, lbufp+strlen(lbufp), cnt, buf[2], 0x10); - cnt++; - } - else if((buf[2] & 0xef) == 0x9f) - { - /* XID */ - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0xef, "U-Frame: XID (Exchange Identification)"); - if(cmd) - poll(2, lbufp+strlen(lbufp), cnt, buf[2], 0x10); - else - final(2, lbufp+strlen(lbufp), cnt, buf[2], 0x10); - cnt++; - } - - } - else if((buf[2] & 0x03) == 0x01) - { - /* S-frame */ - - if(buf[2] == 0x01) - strcpy(buffer, "RR (Receiver Ready)"); - else if(buf[2] == 0x05) - strcpy(buffer, "RNR (Receiver Not Ready)"); - else if(buf[2] == 0x09) - strcpy(buffer, "REJ (Reject)"); - else - strcpy(buffer, "Unknown"); - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0xff, "S-Frame: %s", buffer); - cnt++; - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[3], 0xfe, "N(R) = %d (receive sequence number)", (buf[3] >> 1) & 0x7f); - if(cmd) - poll(2, lbufp+strlen(lbufp), cnt, buf[3], 0x01); - else - final(2, lbufp+strlen(lbufp), cnt, buf[3], 0x01); - cnt++; - - } - else if((buf[2] & 0x01) == 0x00) - { - /* I-frame */ - - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0xfe, "N(S) = %d (send sequence number)", (buf[2] >> 1) & 0x7f); - sprintline(2, lbufp+strlen(lbufp), cnt, buf[2], 0x01, "I-Frame: Information transfer"); - cnt++; - - sprintf(buffer, "N(R) = %d", (buf[3] >> 1) & 0x7f); - sprintline(2, lbufp+strlen(lbufp), cnt, buf[3], 0xfe, "N(R) = %d (receive sequence number)", (buf[3] >> 1) & 0x7f); - poll(2, lbufp+strlen(lbufp), cnt, buf[3], 0x01); - cnt++; - - } - - sprintf((pbuf+strlen(pbuf)),"%s", &locbuf[0]); - return (cnt); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdndecode/layer3.c b/usr.sbin/i4b/isdndecode/layer3.c deleted file mode 100644 index 12a763319565..000000000000 --- a/usr.sbin/i4b/isdndecode/layer3.c +++ /dev/null @@ -1,516 +0,0 @@ -/* - * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * layer3.c - decode and print layer 3 (Q.931) information - * ------------------------------------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Tue Mar 26 14:39:02 2002] - * - *---------------------------------------------------------------------------*/ - -#include "decode.h" - -char *mttab[] = { - -/* 0x00 */ /* call establishment group */ - - "ESCAPE", - "ALERTING", - "CALL PROCEEDING", - "PROGRESS", - "undefined (0x04)", - "SETUP", - "undefined (0x06)", - "CONNECT", - "undefined (0x08)", - "undefined (0x09)", - "undefined (0x0a)", - "undefined (0x0b)", - "undefined (0x0c)", - "SETUP ACKNOWLEDGE", - "undefined (0x0e)", - "CONNECT ACKNOWLEDGE", - -/* 0x10 */ - "undefined (0x10)", - "undefined (0x11)", - "undefined (0x12)", - "undefined (0x13)", - "undefined (0x14)", - "undefined (0x15)", - "undefined (0x16)", - "undefined (0x17)", - "undefined (0x18)", - "undefined (0x19)", - "undefined (0x1a)", - "undefined (0x1b)", - "undefined (0x1c)", - "undefined (0x1d)", - "undefined (0x1e)", - "undefined (0x1f)", - -/* 0x20 */ - - "USER INFORMATION", /* call information phase */ - "SUSPEND REJECT", - "RESUME REJECT", - "undefined (0x23)", - "HOLD", - "SUSPEND", - "RESUME", - "undefined (0x27)", - "HOLD ACKNOWLEDGE", - "undefined (0x29)", - "undefined (0x2a)", - "undefined (0x2b)", - "undefined (0x2c)", - "SUSPEND ACKNOWLEDGE", - "RESUME ACKNOWLEDGE", - "undefined (0x2f)", - -/* 0x30 */ - - "HOLD REJECT", - "RETRIEVE", - "undefined (0x32)", - "RETRIEVE ACKNOWLEDGE", - "undefined (0x34)", - "undefined (0x35)", - "undefined (0x36)", - "RETRIEVE REJECT", - "undefined (0x38)", - "undefined (0x39)", - "undefined (0x3a)", - "undefined (0x3b)", - "undefined (0x3c)", - "undefined (0x3d)", - "undefined (0x3e)", - "undefined (0x3f)", - -/* 0x40 */ - - "DETACH", /* call clearing */ - "undefined (0x41)", - "undefined (0x42)", - "undefined (0x43)", - "undefined (0x44)", - "DISCONNECT", - "RESTART", - "undefined (0x47)", - "DETACH ACKNOWLEDGE", - "undefined (0x49)", - "undefined (0x4a)", - "undefined (0x4b)", - "undefined (0x4c)", - "RELEASE", - "RESTART ACKNOWLEDGE", - "undefined (0x4f)", - -/* 0x50 */ - - "undefined (0x50)", - "undefined (0x51)", - "undefined (0x52)", - "undefined (0x53)", - "undefined (0x54)", - "undefined (0x55)", - "undefined (0x56)", - "undefined (0x57)", - "undefined (0x58)", - "undefined (0x59)", - "RELEASE COMPLETE", - "undefined (0x5b)", - "undefined (0x5c)", - "undefined (0x5d)", - "undefined (0x5e)", - "undefined (0x5f)", - -/* 0x60 */ - - "SEGMENT", /* misc messages */ - "undefined (0x61)", - "FACILITY", - "undefined (0x63)", - "REGISTER", - "undefined (0x65)", - "undefined (0x66)", - "undefined (0x67)", - "CANCEL ACKNOWLEDGE", - "undefined (0x69)", - "FACILITY ACKNOWLEDGE", - "undefined (0x6b)", - "REGISTER ACKNOWLEDGE", - "undefined (0x6d)", - "NOTIFY", - "undefined (0x6f)", - -/* 0x70 */ - - "CANCEL REJECT", - "undefined (0x71)", - "FACILITY REJECT", - "undefined (0x73)", - "REGISTER REJECT", - "STATUS ENQIRY", - "undefined (0x76)", - "undefined (0x77)", - "undefined (0x78)", - "CONGESTION CONTROL", - "undefined (0x7a)", - "INFORMATION", - "undefined (0x7c)", - "STATUS", - "undefined (0x7e)", - "undefined (0x7f)", -}; - -#define MTTAB_MAX 0x7f - -extern int f_null(char *pbuf, unsigned char *buf, int off); -extern int f_bc(char *pbuf, unsigned char *buf, int off); -extern int f_cause(char *pbuf, unsigned char *buf, int off); -extern int f_cstat(char *pbuf, unsigned char *buf, int off); -extern int f_chid(char *pbuf, unsigned char *buf, int off); -extern int f_fac(char *pbuf, unsigned char *buf, int off); -extern int f_progi(char *pbuf, unsigned char *buf, int off); -extern int f_displ(char *pbuf, unsigned char *buf, int off); -extern int f_date(char *pbuf, unsigned char *buf, int off); -extern int f_cnu(char *pbuf, unsigned char *buf, int off); -extern int f_cgpn(char *pbuf, unsigned char *buf, int off); -extern int f_cdpn(char *pbuf, unsigned char *buf, int off); -extern int f_hlc(char *pbuf, unsigned char *buf, int off); -extern int f_uu(char *pbuf, unsigned char *buf, int off); - -struct ie { - unsigned char code; /* information element identifier code */ - char *name; /* ie name */ - int (*func) (char *pbuf, unsigned char *buf, int off); /* decode function */ -} ietab[] = { - { 0x00, "segmented message", f_null }, - { 0x04, "bearer capability", f_bc }, - { 0x08, "cause", f_cause }, - { 0x0c, "connected address", f_null }, - { 0x0d, "extended facility", f_null }, - { 0x10, "call identity", f_null }, - { 0x14, "call state", f_cstat }, - { 0x18, "channel id", f_chid }, - { 0x19, "data link connection id", f_null }, - { 0x1c, "facility", f_fac }, - { 0x1e, "progress indicator", f_progi }, - { 0x20, "network specific facilities", f_null }, - { 0x24, "terminal capabilities", f_null }, - { 0x27, "notification indicator", f_null }, - { 0x28, "display", f_displ }, - { 0x29, "date/time", f_date }, - { 0x2c, "keypad", f_null }, - { 0x30, "keypad echo", f_null }, - { 0x32, "information request", f_null }, - { 0x34, "signal", f_null }, - { 0x36, "switchhook", f_null }, - { 0x38, "feature activation", f_null }, - { 0x39, "feature indication", f_null }, - { 0x3a, "service profile id", f_null }, - { 0x3b, "endpoint identifier", f_null }, - { 0x40, "information rate", f_null }, - { 0x41, "precedence level", f_null }, - { 0x42, "end-to-end transit delay", f_null }, - { 0x43, "transit delay detection", f_null }, - { 0x44, "packet layer binary parms", f_null }, - { 0x45, "packet layer window size", f_null }, - { 0x46, "packet size", f_null }, - { 0x47, "closed user group", f_null }, - { 0x48, "link layer core parameters", f_null }, - { 0x49, "link layer protocol parms", f_null }, - { 0x4a, "reverse charging information", f_null }, - { 0x4c, "connected number", f_cnu }, - { 0x4d, "connected subaddress", f_null }, - { 0x50, "X.213 priority", f_null }, - { 0x51, "report type", f_null }, - { 0x53, "link integrity verification", f_null }, - { 0x57, "PVC status", f_null }, - { 0x6c, "calling party number", f_cnu }, - { 0x6d, "calling party subaddress", f_null }, - { 0x70, "called party number", f_cnu }, - { 0x71, "called party subaddress", f_null }, - { 0x74, "redirecting number", f_null }, - { 0x78, "transit network selection", f_null }, - { 0x79, "restart indicator", f_null }, - { 0x7c, "low layer compatibility", f_null }, - { 0x7d, "high layer compatibility", f_hlc }, - { 0x7e, "user-user", f_uu }, - { 0x7f, "escape for extension", f_null }, - { 0xff, "unknown information element", f_null } -}; - -/*---------------------------------------------------------------------------* - * decode Q.931 protocol - *---------------------------------------------------------------------------*/ -void -layer3(char *pbuf, int n, int off, unsigned char *buf) -{ - char buffer[256]; - int codeset = 0; - int codelock = 0; - int oldcodeset = 0; - - int pd; - int len; - int j; - int i; - - if(n <= 0) - return; - - *pbuf = '\0'; - - i = 0; - - /* protocol discriminator */ - - pd = buf[i]; - - if(pd >= 0x00 && pd <= 0x07) - sprintf(buffer, "User-User IE (0x%02x)",pd); - else if(pd == 0x08) - sprintf(buffer, "Q.931/I.451"); - else if(pd >= 0x10 && pd <= 0x3f) - sprintf(buffer, "Other Layer 3 or X.25 (0x%02x)",pd); - else if(pd >= 0x40 && pd <= 0x4f) - sprintf(buffer, "National Use (0x%02x)",pd); - else if(pd >= 0x50 && pd <= 0xfe) - sprintf(buffer, "Other Layer 3 or X.25 (0x%02x)",pd); - else - sprintf(buffer, "Reserved (0x%02x)",pd); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, pd, 0xff, "Protocol discriminator = %s", buffer); - i++; - - if(pd != 0x08) - { - for (; i < n;i++) - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "-"); - return; - } - - /* call reference */ - - len = buf[i] & 0x0f; - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xf0, "Call Reference"); - - switch(len) - { - case 0: - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x0f, "Length of Call Reference = 0 (Dummy CR)"); - break; - case 1: - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x0f, "Length of Call Reference = 1"); - i++; - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x80, "Call Reference sent %s origination side", (buf[i] & 0x80) ? "to" : "from"); - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "Call Reference = %d = 0x%02x", (buf[i] & 0x7f), (buf[i] & 0x7f)); - break; - case 2: - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x0f, "Length of Call Reference = 2"); - i++; - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x80, "Call Reference sent %s origination side", (buf[i] & 0x80) ? "to" : "from"); - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "Call reference = %d = %02x", (buf[i] & 0x7f), (buf[i] & 0x7f)); - i++; - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "Call reference = %d = %02x", (buf[i]), (buf[i])); - break; - } - i++; - - /* message type */ - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x80, "Message type extension = %d", buf[i] & 0x80 ? 1 : 0); - - if(buf[i] <= MTTAB_MAX) - strcpy(buffer, mttab[buf[i]]); - else - sprintf(buffer, "unknown (0x%02x)", buf[i]); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "Message type = %s", buffer); - i++; - - /* information elements */ - - for (; i < n;) - { - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x80, "%s Information element", buf[i] & 0x80 ? "Single octet" : "Variable length"); - - if(buf[i] & 0x80) - { - /* single octett info element type 1 */ - - if((buf[i] & 0x70) == 0x00) - { - strcpy(buffer, "Reserved"); - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x70, "Reserved"); - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x0f, "Reserved, content of IE"); - } - else if((buf[i] & 0x70) == 0x10) - { - strcpy(buffer, "Shift"); - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x70, "Shift"); - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x08, "%s shift", buf[i] & 0x08 ? "Non-locking" : "Locking"); - - switch(buf[i] & 0x07) - { - case 0: - strcpy(buffer, "Not applicable"); - break; - case 1: - case 2: - case 3: - sprintf(buffer, "Reserved (%d)", buf[i] & 0x07); - break; - case 4: - strcpy(buffer, "Codeset 4 (ISO/IEC)"); - break; - case 5: - strcpy(buffer, "Codeset 5 (National use)"); - break; - case 6: - strcpy(buffer, "Codeset 6 (Local network specific)"); - break; - case 7: - strcpy(buffer, "Codeset 7 (User specific)"); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x07, "%s", buffer); - break; - } - else if((buf[i] & 0x70) == 0x30) - { - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x70, "Congestion Level"); - switch(buf[i] & 0x0f) - { - case 0x00: - strcpy(buffer, "receiver ready"); - break; - case 0x0f: - strcpy(buffer, "receiver not ready"); - break; - default: - sprintf(buffer, "reserved (0x%02x)", buf[i] & 0x0f); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x0f, "Congestion Level = ", buffer); - break; - } - else if((buf[i] & 0x70) == 0x50) - { - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x70, "Repeat Indicator"); - switch(buf[i] & 0x0f) - { - case 0x02: - strcpy(buffer, "Prioritized list for selecting one possibility"); - break; - default: - sprintf(buffer, "reserved (0x%02x)", buf[i] & 0x0f); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x0f, "Repeat indication = ", buffer); - break; - } - - /* single octett info element type 2 */ - - else if((buf[i] & 0x7f) == 0x20) - { - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "More data"); - } - else if((buf[i] & 0x7f) == 0x21) - { - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "Sending complete"); - } - else - { - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "UNKNOWN single octet IE = 0x%02x", buf[i]); - } - i++; /* next */ - } - else - { - if(codeset == 0) - { - struct ie *iep = &ietab[0]; - - for(;;) - { - if((iep->code == buf[i]) || - (iep->code == 0xff)) - break; - iep++; - } - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "IE = %s", iep->name); - sprintline(3, pbuf+strlen(pbuf), off+i+1, buf[i+1], 0xff, "IE Length = %d", buf[i+1]); - - if(iep->func == f_null) - { - } - else - { - i += (iep->func)(pbuf, &buf[i], off+i); - goto next; - } - } - else - { - sprintf((pbuf+strlen(pbuf)), "UNKNOWN CODESET=%d, IE=0x%02x", codeset, buf[i]); - } - - i++; /* index -> length */ - - len = buf[i]; - - sprintf((pbuf+strlen(pbuf)), "LEN=0x%02x, DATA=", len); - - i++; /* index -> 1st param */ - - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf)),"0x%02x ", buf[j+i]); - } - - sprintf((pbuf+strlen(pbuf)),"]\n"); - - i += len; - -next: - - if(!codelock && (codeset != oldcodeset)) - codeset = oldcodeset; - } - } -/* sprintf((pbuf+strlen(pbuf)),"\n"); */ -} - -/* EOF */ - diff --git a/usr.sbin/i4b/isdndecode/layer3_subr.c b/usr.sbin/i4b/isdndecode/layer3_subr.c deleted file mode 100644 index 6fcedd24439d..000000000000 --- a/usr.sbin/i4b/isdndecode/layer3_subr.c +++ /dev/null @@ -1,1122 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * layer3_subr.c - subroutines for IE decoding - * ------------------------------------------- - * - * $Id: layer3_subr.c,v 1.8 2000/02/21 15:17:17 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Feb 21 15:45:16 2000] - * - *---------------------------------------------------------------------------*/ - -#include "decode.h" - -/*---------------------------------------------------------------------------* - * dummy function - *---------------------------------------------------------------------------*/ -int -f_null(char *pbuf, unsigned char *buf, int off) -{ - return(0); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -f_cstat(char *pbuf, unsigned char *buf, int off) -{ - int i = 0; - int len = 0; - char buffer[256]; - - i++; - len = buf[i]; - i++; - sprintf((pbuf+strlen(pbuf)), "Std="); - switch((buf[i] & 0x60) >> 5) - { - case 0: - strcpy(buffer, "CCITT"); - break; - case 1: - strcpy(buffer, "ISO/IEC"); - break; - case 2: - strcpy(buffer, "National"); - break; - case 3: - strcpy(buffer, "Special"); - break; - } - sprintf((pbuf+strlen(pbuf)), ", State="); - - switch((buf[i] & 0x3f)) - { - case 0: - strcpy(buffer, "Null"); - break; - case 1: - strcpy(buffer, "Call initiated"); - break; - case 2: - strcpy(buffer, "Overlap sending"); - break; - case 3: - strcpy(buffer, "Outgoing call proceeding"); - break; - case 4: - strcpy(buffer, "Call delivered"); - break; - case 6: - strcpy(buffer, "Call present"); - break; - case 7: - strcpy(buffer, "Call received"); - break; - case 8: - strcpy(buffer, "Connect request"); - break; - case 9: - strcpy(buffer, "Incoming call proceeding"); - break; - case 10: - strcpy(buffer, "Active"); - break; - case 11: - strcpy(buffer, "Disconnect request"); - break; - case 12: - strcpy(buffer, "Disconnect indication"); - break; - case 15: - strcpy(buffer, "Suspend request"); - break; - case 17: - strcpy(buffer, "Resume request"); - break; - case 19: - strcpy(buffer, "Release request"); - break; - case 22: - strcpy(buffer, "Call abort"); - break; - case 25: - strcpy(buffer, "Overlap receiving"); - break; - case 0x3d: - strcpy(buffer, "Restart request"); - break; - case 0x3e: - strcpy(buffer, "Restart"); - break; - default: - strcpy(buffer, "ERROR: undefined/reserved"); - break; - } - sprintf((pbuf+strlen(pbuf)), "]"); - i++; - return(i); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -f_chid(char *pbuf, unsigned char *buf, int off) -{ - int i = 0; - int len = 0; - char buffer[256]; - - i++; - len = buf[i]; - i++; - - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x40, "Interface Id present = %s", buf[i] & 0x40 ? "Yes" : "No"); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x20, "Interface Type = %s", buf[i] & 0x20 ? "Other (PRI)" : "BRI"); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x10, "Spare"); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x08, "Channel = %s", buf[i] & 0x08 ? "exclusive" : "preferred"); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x04, "Channel is%s the D-Channel", buf[i] & 0x04 ? "" : " not"); - - switch(buf[i] & 0x03) - { - case 0: - strcpy(buffer, "no channel"); - break; - case 1: - strcpy(buffer, "B-1"); - break; - case 2: - strcpy(buffer, "B-2"); - break; - case 3: - strcpy(buffer, "any channel"); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x03, "Channel = %s", buffer); - - i++; - return(i); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -f_fac(char *pbuf, unsigned char *buf, int off) -{ - return(q932_facility(pbuf, buf)); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -f_progi(char *pbuf, unsigned char *buf, int off) -{ - int i = 0; - int len = 0; - char buffer[256]; - - i++; - len = buf[i]; - i++; - sprintf((pbuf+strlen(pbuf)), "Std="); - switch((buf[i] & 0x60) >> 5) - { - case 0: - strcpy(buffer, "CCITT"); - break; - case 1: - strcpy(buffer, "ISO/IEC"); - break; - case 2: - strcpy(buffer, "National"); - break; - case 3: - strcpy(buffer, "Local"); - break; - } - sprintf((pbuf+strlen(pbuf)), ", Loc="); - - switch((buf[i] & 0x0f)) - { - case 0: - strcpy(buffer, "User"); - break; - case 1: - strcpy(buffer, "Private network serving local user"); - break; - case 2: - strcpy(buffer, "Public network serving local user"); - break; - case 3: - strcpy(buffer, "Transit network"); - break; - case 4: - strcpy(buffer, "Public network serving remote user"); - break; - case 5: - strcpy(buffer, "Private network serving remote user"); - break; - case 6: - strcpy(buffer, "Network beyond interworking point"); - break; - default: - strcpy(buffer, "ERROR: undefined/reserved"); - break; - } - - i++; - - sprintf((pbuf+strlen(pbuf)), "\n Description"); - - switch((buf[i] & 0x7f)) - { - case 1: - strcpy(buffer, "Call is not end-to-end ISDN"); - break; - case 2: - strcpy(buffer, "Destination address is non-ISDN"); - break; - case 3: - strcpy(buffer, "Origination address is non-ISDN"); - break; - case 4: - strcpy(buffer, "Call has returned to the ISDN"); - break; - case 5: - strcpy(buffer, "Interworking occured, Service change"); - break; - case 8: - strcpy(buffer, "In-band info or appropriate pattern now available"); - break; - default: - strcpy(buffer, "ERROR: undefined/reserved"); - break; - } - sprintf((pbuf+strlen(pbuf)), "]"); - i++; - - return(i); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -f_displ(char *pbuf, unsigned char *buf, int off) -{ - int i = 0; - int j = 0; - int len = 0; - - i++; - len = buf[i]; - i++; - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]); - } - sprintf((pbuf+strlen(pbuf)),"]"); - i += j; - - return(i); -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -f_date(char *pbuf, unsigned char *buf, int off) -{ - int i = 0; - int j = 0; - int len = 0; - - i++; - len = buf[i]; - i++; - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "Year = %02d", buf[i]); - i++; - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "Month = %02d", buf[i]); - i++; - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "Day = %02d", buf[i]); - i++; - - j=3; - if(j < len) - { - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "Hour = %02d", buf[i]); - i++; - j++; - } - if(j < len) - { - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "Minute = %02d", buf[i]); - i++; - j++; - } - if(j < len) - { - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "Second = %02d", buf[i]); - i++; - j++; - } - i += len; - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and print the cause - *---------------------------------------------------------------------------*/ -int -f_cause(char *pbuf, unsigned char *buf, int off) -{ - int j; - int len; - int i = 0; - int ls; - char buffer[256]; - - i++; /* index -> length */ - - len = buf[i]; - - i++; /* coding/location */ - len--; - - ls = buf[i]; - - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - switch((ls & 0x60) >> 5) - { - case 0: - strcpy(buffer, "CCITT"); - break; - case 1: - strcpy(buffer, "ISO/IEC"); - break; - case 2: - strcpy(buffer, "National"); - break; - case 3: - strcpy(buffer, "Local"); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x60, "Coding Standard = %s", buffer); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x10, "Spare"); - - switch(ls & 0x0f) - { - case 0x00: - strcpy(buffer, "user"); - break; - case 0x01: - strcpy(buffer, "private network serving local user"); - break; - case 0x02: - strcpy(buffer, "public network serving local user"); - break; - case 0x03: - strcpy(buffer, "transit network"); - break; - case 0x04: - strcpy(buffer, "public network serving remote user"); - break; - case 0x05: - strcpy(buffer, "private network serving remote user"); - break; - case 0x07: - strcpy(buffer, "international network"); - break; - case 0x0a: - strcpy(buffer, "network beyond interworking point"); - break; - default: - sprintf(buffer, "reserved (0x%02x)", ls & 0x0f); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x0f, "Location = %s", buffer); - - i++; - len--; - - if(!(ls & 0x80)) - { - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - switch(buf[i] & 0x7f) - { - case 0: - strcpy(buffer, "Q.931"); - break; - case 3: - strcpy(buffer, "X.21"); - break; - case 4: - strcpy(buffer, "X.25"); - break; - case 5: - strcpy(buffer, "Q.1031/Q.1051"); - break; - default: - strcpy(buffer, "Reserved"); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "Recommendation = %s", buffer); - i++; - len--; - } - - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "Cause = %s", print_cause_q850(buf[i] & 0x7f)); - - i++; - len--; - - for(j = 0; j < len; j++) - sprintline(3, (pbuf+strlen(pbuf)), off+i+j, buf[i+j], 0xff, "Diagnostics = %02d %s", buf[i+j], buf[i+j]); - - i += (len+1); - - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and print the bearer capability - *---------------------------------------------------------------------------*/ -int -f_bc(char *pbuf, unsigned char *buf, int off) -{ - int len; - int i = 0; - int mr = 0; - char buffer[256]; - - i++; /* index -> length */ - - len = buf[i]; - i++; - - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - switch((buf[i] & 0x60) >> 5) - { - case 0: - strcpy(buffer, "CCITT"); - break; - case 1: - strcpy(buffer, "ISO/IEC"); - break; - case 2: - strcpy(buffer, "National"); - break; - case 3: - strcpy(buffer, "NSI Std"); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x60, "Coding standard = %s", buffer); - - switch(buf[i] & 0x1f) - { - case 0x00: - strcpy(buffer, "speech"); - break; - case 0x08: - strcpy(buffer, "unrestricted digital information"); - break; - case 0x09: - strcpy(buffer, "restricted digital information"); - break; - case 0x10: - strcpy(buffer, "3.1 kHz audio"); - break; - case 0x11: - strcpy(buffer, "unrestricted digital information with tones"); - break; - case 0x18: - strcpy(buffer, "video"); - break; - default: - sprintf(buffer, "reserved (0x%02x)", buf[i] & 0x0f); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x1f, "Capability = %s", buffer); - - i++; - len--; - - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - switch((buf[i] & 0x60) >> 5) - { - case 0: - strcpy(buffer, "circuit"); - break; - case 2: - strcpy(buffer, "packet"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)", ((buf[i] & 0x60) >> 5)); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x60, "Mode = %s", buffer); - - switch(buf[i] & 0x1f) - { - case 0x00: - strcpy(buffer, "packet mode"); - break; - case 0x10: - strcpy(buffer, "64 kbit/s"); - break; - case 0x11: - strcpy(buffer, "2 x 64 kbit/s"); - break; - case 0x13: - strcpy(buffer, "384 kbit/s"); - break; - case 0x15: - strcpy(buffer, "1536 kbit/s"); - break; - case 0x17: - strcpy(buffer, "1920 kbit/s"); - break; - case 0x18: - strcpy(buffer, "Multirate"); - mr = 1; - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)", buf[i] & 0x0f); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x1f, "Rate = %s", buffer); - - i++; - len--; - - if(!len) - goto exit; - - if(mr) - { - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x60, "Rate multiplier = %d", buf[i] & 0x7f); - i++; - len--; - } - - if(!len) - goto exit; - - switch(buf[i] & 0x1f) - { - case 0x01: - strcpy(buffer, "V.110/X.30"); - break; - case 0x02: - strcpy(buffer, "G.711 u-Law"); - break; - case 0x03: - strcpy(buffer, "G.711 a-Law"); - break; - case 0x04: - strcpy(buffer, "G.721 ADPCM/I.460"); - break; - case 0x05: - strcpy(buffer, "H.221/H.242"); - break; - case 0x07: - strcpy(buffer, "non-CCITT rate adaption"); - break; - case 0x08: - strcpy(buffer, "V.120"); - break; - case 0x09: - strcpy(buffer, "X.31"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)", buf[i] & 0x1f); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x1f, "Layer 1 Protocol = %s", buffer); - - i++; - len--; - - if(!len) - goto exit; - -/* work to do ahead !!! */ - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n user rate=0x%02x ", buf[i] & 0x1f); - - if(buf[i] & 0x40) - sprintf((pbuf+strlen(pbuf)), "(async,"); - else - sprintf((pbuf+strlen(pbuf)), "(sync,"); - - if(buf[i] & 0x20) - sprintf((pbuf+strlen(pbuf)), "in-band neg. possible)"); - else - sprintf((pbuf+strlen(pbuf)), "in-band neg not possible)"); - - i++; - len--; - } - - if(!len) - goto exit; - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n clk/flow=0x%02x", buf[i] & 0x1f); - - sprintf((pbuf+strlen(pbuf)), "\n intermediate rate="); - - switch((buf[i] & 0x60) >> 5) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "not used"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "8 kbit/s"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "16 kbit/s"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "32 kbit/s"); - break; - } - i++; - len--; - } - - if(!len) - goto exit; - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n hdr/mfrm/etc.=0x%02x", buf[i]); - i++; - len--; - } - - if(!len) - goto exit; - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n stop/data/parity=0x%02x", buf[i]); - i++; - len--; - } - - if(!len) - goto exit; - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n modemtype=0x%02x", buf[i]); - i++; - len--; - } - - if(!len) - goto exit; - - switch(buf[i] & 0x7f) - { - case 0x42: - sprintf((pbuf+strlen(pbuf)), "\n layer2=Q.921/I.441"); - break; - case 0x46: - sprintf((pbuf+strlen(pbuf)), "\n layer2=X.25 link"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\n layer2=0x%02x",(buf[i] & 0x7f)); - break; - } - i++; - len--; - - if(!len) - goto exit; - - switch(buf[i] & 0x7f) - { - case 0x62: - sprintf((pbuf+strlen(pbuf)), "\n layer3=Q.921/I.441"); - break; - case 0x66: - sprintf((pbuf+strlen(pbuf)), "\n layer3=X.25 packet"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\n layer3=0x%02x",(buf[i] & 0x7f)); - break; - } - i++; - len--; - -exit: - - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and print the ISDN (telephone) number - *---------------------------------------------------------------------------*/ -int -f_cnu(char *pbuf, unsigned char *buf, int off) -{ - int j; - int len; - int i = 0; - int tp; - int ind = 0; - char buffer[256]; - - i++; /* index -> length */ - len = buf[i]; - - i++; /* index -> type/plan */ - tp = buf[i]; - - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - switch((tp & 0x70) >> 4) - { - case 0: - strcpy(buffer, "Unknown"); - break; - case 1: - strcpy(buffer, "International number"); - break; - case 2: - strcpy(buffer, "National number"); - break; - case 3: - strcpy(buffer, "Network specific number"); - break; - case 4: - strcpy(buffer, "Subscriber number"); - break; - case 6: - strcpy(buffer, "Abbreviated number"); - break; - default: - sprintf(buffer, "Reserved (%d), ", ((tp & 0x70) >> 4)); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x60, "Type = %s", buffer); - - switch(tp & 0x0f) - { - case 0: - strcpy(buffer, "Unknown"); - break; - case 1: - strcpy(buffer, "ISDN (E.164)"); - break; - case 3: - strcpy(buffer, "Data (X.121)"); - break; - case 4: - strcpy(buffer, "Telex (F.69)"); - break; - case 8: - strcpy(buffer, "National"); - break; - case 9: - strcpy(buffer, "Private"); - break; - default: - sprintf(buffer, "Reserved (%d)", (tp & 0x0f)); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x0f, "Plan = %s", buffer); - - i++; - len--; - - if(!(tp & 0x80)) - { - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - switch((buf[i] & 0x60) >> 5) - { - case 0: - strcpy(buffer, "allowed"); - break; - case 1: - strcpy(buffer, "restricted"); - break; - case 2: - strcpy(buffer, "number not available"); - break; - case 3: - strcpy(buffer, "reserved"); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x60, "Presentation = %s", buffer); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x1c, "Spare"); - - switch(ind & 0x03) - { - case 0: - strcpy(buffer, "user provided, not screened"); - break; - case 1: - strcpy(buffer, "user provided, verified & passed"); - break; - case 2: - strcpy(buffer, "user provided, verified & failed"); - break; - case 3: - strcpy(buffer, "network provided"); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x03, "Screening = %s", buffer); - i++; - len--; - } - - for(j = 0; j < len; j++) - { - sprintline(3, (pbuf+strlen(pbuf)), off+i+j, buf[i+j], 0xff, "Number digit = %c", buf[i+j]); - } - - i += j; - - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and print HL comatibility - *---------------------------------------------------------------------------*/ -int -f_hlc(char *pbuf, unsigned char *buf, int off) -{ - int i = 0; - int len = 0; - char buffer[256]; - - i++; - len = buf[i]; - - i++; - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - switch((buf[i] >> 5) & 0x03) - { - case 0: strcpy(buffer, "CCITT"); - break; - case 1: strcpy(buffer, "ISO/IEC"); - break; - case 2: strcpy(buffer, "National"); - break; - case 3: strcpy(buffer, "Network"); - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x60, "Coding standard = %s", buffer); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x1c, "Interpretation = %s", ((buf[i] >> 2) & 0x07) == 0x04 ? "first" : "reserved"); - - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x03, "Presentation = %s", ((buf[i]) & 0x03) == 0x01 ? "High layer protocol profile" : "reserved"); - - i++; - len--; - - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - switch(buf[i] & 0x7f) - { - case 0x01: - strcpy(buffer, "Telephony"); - break; - case 0x04: - strcpy(buffer, "Fax Group 2/3 (F.182)"); - break; - case 0x21: - strcpy(buffer, "Fax Group 4 I (F.184)"); - break; - case 0x24: - strcpy(buffer, "Teletex (F.230) or Fax Group 4 II/III (F.184)"); - break; - case 0x28: - strcpy(buffer, "Teletex (F.220)"); - break; - case 0x31: - strcpy(buffer, "Teletex (F.200)"); - break; - case 0x32: - strcpy(buffer, "Videotex (F.300/T.102)"); - break; - case 0x33: - strcpy(buffer, "Videotex (F.300/T.101)"); - break; - case 0x35: - strcpy(buffer, "Telex (F.60)"); - break; - case 0x38: - strcpy(buffer, "MHS (X.400)"); - break; - case 0x41: - strcpy(buffer, "OSI (X.200)"); - break; - case 0x5e: - strcpy(buffer, "Maintenance"); - break; - case 0x5f: - strcpy(buffer, "Management"); - break; - case 0x60: - strcpy(buffer, "Audio visual (F.721)"); - break; - default: - sprintf(buffer, "Reserved (0x%02x)", buf[i] & 0x7f); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "Characteristics = %s", buffer); - i++; - len--; - - if(buf[i-1] & 0x80) - { - return(i); - } - - extension(3, pbuf+strlen(pbuf), off+i, buf[i], 0x80); - - switch(buf[i] & 0x7f) - { - case 0x01: - strcpy(buffer, "Telephony"); - break; - case 0x04: - strcpy(buffer, "Fax Group 2/3 (F.182)"); - break; - case 0x21: - strcpy(buffer, "Fax Group 4 I (F.184)"); - break; - case 0x24: - strcpy(buffer, "Teletex (F.230) or Fax Group 4 II/III (F.184)"); - break; - case 0x28: - strcpy(buffer, "Teletex (F.220)"); - break; - case 0x31: - strcpy(buffer, "Teletex (F.200)"); - break; - case 0x32: - strcpy(buffer, "Videotex (F.300/T.102)"); - break; - case 0x33: - strcpy(buffer, "Videotex (F.300/T.101)"); - break; - case 0x35: - strcpy(buffer, "Telex (F.60)"); - break; - case 0x38: - strcpy(buffer, "MHS (X.400)"); - break; - case 0x41: - strcpy(buffer, "OSI (X.200)"); - break; - case 0x5e: - strcpy(buffer, "Maintenance"); - break; - case 0x5f: - strcpy(buffer, "Management"); - break; - case 0x60: - strcpy(buffer, "Audio visual (F.721)"); - break; - default: - sprintf(buffer, "Reserved (0x%02x)", buf[i] & 0x7f); - break; - - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0x7f, "Ext. characteristics = %s", buffer); - i++; - return(i); -} - -/*---------------------------------------------------------------------------* - * user-user - *---------------------------------------------------------------------------*/ -int -f_uu(char *pbuf, unsigned char *buf, int off) -{ - int j; - int len; - int i = 0; - int pd; - char buffer[256]; - - i++; /* index -> length */ - len = buf[i]; - - i++; /* index -> PD */ - pd = buf[i]; - - switch(pd) - { - case 0: - strcpy(buffer, "user-specific"); - break; - case 1: - strcpy(buffer, "OSI high layer"); - break; - case 2: - strcpy(buffer, "X.244"); - break; - case 3: - strcpy(buffer, "reserved for sys mgmt"); - break; - case 4: - strcpy(buffer, "IA5 characters"); - break; - case 5: - strcpy(buffer, "X.208/X.209"); - break; - case 7: - strcpy(buffer, "V.120"); - break; - case 8: - strcpy(buffer, "Q.931/I.451"); - break; - default: - if(pd >= 0x10 && pd <= 0x3f) - sprintf(buffer, "reserved incl X.31 (0x%2x)", pd); - else if (pd >= 0x40 && pd <= 0x4f) - sprintf(buffer, "national use (0x%2x)", pd); - else if (pd >= 0x50 && pd <= 0xfe) - sprintf(buffer, "reserved incl X.31 (0x%2x)", pd); - else - sprintf(buffer, "reserved (0x%2x)", pd); - break; - } - sprintline(3, (pbuf+strlen(pbuf)), off+i, buf[i], 0xff, "protocol = %s", buffer); - - i++; - len--; - - for(j = 0; j < len; j++) - { - if(isprint(buf[i+j])) - sprintline(3, (pbuf+strlen(pbuf)), off+i+j, buf[i+j], 0xff, "user information = %c", buf[i+j]); - else - sprintline(3, (pbuf+strlen(pbuf)), off+i+j, buf[i+j], 0xff, "user information = 0x%2x", buf[i+j]); - } - - i += j; - - return(i); -} - -/* EOF */ - diff --git a/usr.sbin/i4b/isdndecode/main.c b/usr.sbin/i4b/isdndecode/main.c deleted file mode 100644 index 76afab109d47..000000000000 --- a/usr.sbin/i4b/isdndecode/main.c +++ /dev/null @@ -1,794 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * main.c - isdndecode main program file - * ------------------------------------- - * - * $Id: main.c,v 1.13 2000/02/21 15:17:17 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Feb 21 16:19:30 2000] - * - *---------------------------------------------------------------------------*/ - -#include "decode.h" -#include <unistd.h> - -unsigned char buf[BSIZE]; -FILE *Fout = NULL; -FILE *BP = NULL; -int outflag = 1; -int header = 1; -int print_q921 = 1; -int unit = 0; -int dchan = 0; -int bchan = 0; -int traceon = 0; -int analyze = 0; -int Rx = RxUDEF; -int Tx = TxUDEF; -int f; -int Bopt = 0; -int Popt = 0; -int bpopt = 0; -int info = 0; -int xflag = 0; - -int enable_trace = TRACE_D_RX | TRACE_D_TX; - -static char outfilename[1024]; -static char BPfilename[1024]; - -static void dumpbuf( int n, unsigned char *buf, i4b_trace_hdr_t *hdr); -static int switch_driver( int value, int rx, int tx ); -static void usage( void ); -static void exit_hdl( void ); -static void reopenfiles( int ); - - -/*---------------------------------------------------------------------------* - * usage intructions - *---------------------------------------------------------------------------*/ -void -usage(void) -{ - fprintf(stderr,"\n"); - fprintf(stderr,"isdndecode - isdn4bsd package ISDN decoder for passive cards (%d.%d.%d)\n", VERSION, REL, STEP); - fprintf(stderr,"usage: isdntrace -a -b -d -f <file> -h -i -l -n <val> -o -p <file> -r -u <unit>\n"); - fprintf(stderr," -x -B -P -R <unit> -T <unit>\n"); - fprintf(stderr," -a analyzer mode ................................... (default off)\n"); - fprintf(stderr," -b switch B channel trace on ....................... (default off)\n"); - fprintf(stderr," -d switch D channel trace off ....................... (default on)\n"); - fprintf(stderr," -f <file> write output to file filename ........... (default %s0)\n", DECODE_FILE_NAME); - fprintf(stderr," -h don't print header for each message ............. (default off)\n"); - fprintf(stderr," -i print I.430 (layer 1) INFO signals .............. (default off)\n"); - fprintf(stderr," -l don't decode low layer Q.921 messages ........... (default off)\n"); - fprintf(stderr," -o don't write output to a file .................... (default off)\n"); - fprintf(stderr," -p <file> specify filename for -B and -P ........ (default %s0)\n", BIN_FILE_NAME); - fprintf(stderr," -u <unit> specify controller unit number ............... (default unit 0)\n"); - fprintf(stderr," -x print packets with unknown protocoldiscriminator (default off)\n"); - fprintf(stderr," -B write binary trace data to file filename ........ (default off)\n"); - fprintf(stderr," -P playback from binary trace data file ............ (default off)\n"); - fprintf(stderr," -R <unit> analyze Rx controller unit number (for -a) ... (default unit %d)\n", RxUDEF); - fprintf(stderr," -T <unit> analyze Tx controller unit number (for -a) ... (default unit %d)\n", TxUDEF); - fprintf(stderr,"\n"); - exit(1); -} - -/*---------------------------------------------------------------------------* - * main - *---------------------------------------------------------------------------*/ -int -main(int argc, char *argv[]) -{ - char devicename[80]; - char headerbuf[256]; - - int n; - int c; - char *b; - - char *outfile = DECODE_FILE_NAME; - char *binfile = BIN_FILE_NAME; - int outfileset = 0; - time_t tm; - - i4b_trace_hdr_t *ithp = NULL; - int l; - - b = &buf[sizeof(i4b_trace_hdr_t)]; - - while( (c = getopt(argc, argv, "abdf:hiln:op:u:xBPR:T:")) != -1) - { - switch(c) - { - case 'a': - analyze = 1; - break; - - case 'b': - enable_trace |= (TRACE_B_RX | TRACE_B_TX); - break; - - case 'd': - enable_trace &= (~(TRACE_D_TX | TRACE_D_RX)); - break; - - case 'o': - outflag = 0; - break; - - case 'f': - outfile = optarg; - outfileset = 1; - break; - - case 'h': - header = 0; - break; - - case 'i': - enable_trace |= TRACE_I; - info = 1; - break; - - case 'l': - print_q921 = 0; - break; - - case 'p': - binfile = optarg; - bpopt = 1; - break; - - case 'u': - unit = atoi(optarg); - if(unit < 0 || unit >= MAX_CONTROLLERS) - usage(); - break; - - case 'x': - xflag = 1; - break; - - case 'B': - Bopt = 1; - break; - - case 'P': - Popt = 1; - break; - - case 'R': - Rx = atoi(optarg); - if(Rx < 0 || Rx >= MAX_CONTROLLERS) - usage(); - break; - - case 'T': - Tx = atoi(optarg); - if(Tx < 0 || Tx >= MAX_CONTROLLERS) - usage(); - break; - - case '?': - default: - usage(); - break; - } - } - - if(enable_trace == 0) - usage(); - - if(Bopt && Popt) - usage(); - - atexit(exit_hdl); - - if(Bopt) - { - if(bpopt) - sprintf(BPfilename, "%s", binfile); - else - sprintf(BPfilename, "%s%d", BIN_FILE_NAME, unit); - - if((BP = fopen(BPfilename, "r")) != NULL) - { - char buffer[1024]; - fclose(BP); - sprintf(buffer, "%s%s", BPfilename, DECODE_FILE_NAME_BAK); - rename(BPfilename, buffer); - } - if((BP = fopen(BPfilename, "w")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error opening file [%s]", BPfilename); - perror(buffer); - exit(1); - } - - if((setvbuf(BP, (char *)NULL, _IONBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error setting file [%s] to unbuffered", BPfilename); - perror(buffer); - exit(1); - } - } - - if(Popt) - { - if(bpopt) - sprintf(BPfilename, "%s", binfile); - else - sprintf(BPfilename, "%s%d", BIN_FILE_NAME, unit); - - if((BP = fopen(BPfilename, "r")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error opening file [%s]", BPfilename); - perror(buffer); - exit(1); - } - } - else - { - sprintf(devicename, "%s%d", I4BTRC_DEVICE, unit); - - if((f = open(devicename, O_RDWR)) < 0) - { - char buffer[80]; - - sprintf(buffer, "Error opening trace device [%s]", devicename); - perror(buffer); - exit(1); - } - } - - if(outflag) - { - if(outfileset == 0) - sprintf(outfilename, "%s%d", DECODE_FILE_NAME, unit); - else - strcpy(outfilename, outfile); - - - if((Fout = fopen(outfilename, "r")) != NULL) - { - char buffer[1024]; - fclose(Fout); - sprintf(buffer, "%s%s", outfilename, DECODE_FILE_NAME_BAK); - rename(outfilename, buffer); - } - - if((Fout = fopen(outfilename, "w")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error opening file [%s]", outfilename); - perror(buffer); - exit(1); - } - - if((setvbuf(Fout, (char *)NULL, _IONBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error setting file [%s] to unbuffered", outfile); - perror(buffer); - exit(1); - } - } - - if((setvbuf(stdout, (char *)NULL, _IOLBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error setting stdout to line-buffered"); - perror(buffer); - exit(1); - } - - if(!Popt) - { - if((switch_driver(enable_trace, Rx, Tx)) == -1) - exit(1); - else - traceon = 1; - } - - signal(SIGHUP, SIG_IGN); /* ignore hangup signal */ - signal(SIGUSR1, reopenfiles); /* rotate logfile(s) */ - - time(&tm); - - if(analyze) - { - sprintf(headerbuf, "\n==== isdnanalyze controller rx #%d - tx #%d ==== started %s", - Rx, Tx, ctime(&tm)); - } - else - { - sprintf(headerbuf, "\n=========== isdntrace controller #%d =========== started %s", - unit, ctime(&tm)); - } - - printf("%s", headerbuf); - - if(outflag) - fprintf(Fout, "%s", headerbuf); - - for (;;) - { - if(Popt == 0) - { - n = read(f, buf, BSIZE); - - if(Bopt) - { - if((fwrite(buf, 1, n, BP)) != n) - { - char buffer[80]; - sprintf(buffer, "Error writing file [%s]", BPfilename); - perror(buffer); - exit(1); - } - } - - n -= sizeof(i4b_trace_hdr_t); - } - else - { - if((fread(buf, 1, sizeof(i4b_trace_hdr_t), BP)) != sizeof(i4b_trace_hdr_t)) - { - if(feof(BP)) - { - printf("\nEnd of playback input file reached.\n"); - exit(0); - } - else - { - char buffer[80]; - sprintf(buffer, "Error reading hdr from file [%s]", BPfilename); - perror(buffer); - exit(1); - } - } - - ithp = (i4b_trace_hdr_t *)buf; - l = ithp->length - sizeof(i4b_trace_hdr_t); - - if((n = fread(buf+sizeof(i4b_trace_hdr_t), 1, l , BP)) != l) - { - char buffer[80]; - sprintf(buffer, "Error reading data from file [%s]", BPfilename); - perror(buffer); - exit(1); - } - - } - - if(n > 0) - { - dumpbuf(n, b, (i4b_trace_hdr_t *)buf); - } - } -} - -/*---------------------------------------------------------------------------* - * format header into static buffer, return buffer address - *---------------------------------------------------------------------------*/ -char * -fmt_hdr(i4b_trace_hdr_t *hdr, int frm_len) -{ - struct tm *s; - static char hbuf[256]; - int i = 0; - - s = localtime((time_t *)&(hdr->time.tv_sec)); - - if(hdr->type == TRC_CH_I) /* Layer 1 INFO's */ - { - sprintf(hbuf,"\n-- %s - unit:%d ---------------- time:%2.2d.%2.2d %2.2d:%2.2d:%2.2d.%06u ", - ((hdr->dir) ? "NT->TE" : "TE->NT"), - hdr->unit, - s->tm_mday, - s->tm_mon + 1, - s->tm_hour, - s->tm_min, - s->tm_sec, - (u_int32_t)hdr->time.tv_usec); - } - else - { - if(hdr->trunc > 0) - { - sprintf(hbuf,"\n-- %s - unit:%d - frame:%6.6u - time:%2.2d.%2.2d %2.2d:%2.2d:%2.2d.%06u - length:%d (%d) ", - ((hdr->dir) ? "NT->TE" : "TE->NT"), - hdr->unit, - hdr->count, - s->tm_mday, - s->tm_mon + 1, - s->tm_hour, - s->tm_min, - s->tm_sec, - (u_int32_t)hdr->time.tv_usec, - frm_len, - hdr->trunc); - } - else - { - sprintf(hbuf,"\n-- %s - unit:%d - frame:%6.6u - time:%2.2d.%2.2d %2.2d:%2.2d:%2.2d.%06u - length:%d ", - ((hdr->dir) ? "NT->TE" : "TE->NT"), - hdr->unit, - hdr->count, - s->tm_mday, - s->tm_mon + 1, - s->tm_hour, - s->tm_min, - s->tm_sec, - (u_int32_t)hdr->time.tv_usec, - frm_len); - } - } - - for(i=strlen(hbuf); i <= NCOLS;) - hbuf[i++] = '-'; - - hbuf[i++] = '\n'; - hbuf[i] = '\0'; - - return(hbuf); -} - -/*---------------------------------------------------------------------------* - * decode protocol and output to file(s) - *---------------------------------------------------------------------------*/ -static void -dumpbuf(int n, unsigned char *buf, i4b_trace_hdr_t *hdr) -{ - static char l1buf[128]; - static unsigned char l2buf[32000]; - static unsigned char l3buf[32000]; - int cnt; - int nsave = n; - char *pbuf; - int i, j; - - l1buf[0] = '\0'; - l2buf[0] = '\0'; - l3buf[0] = '\0'; - - switch(hdr->type) - { - case TRC_CH_I: /* Layer 1 INFO's */ - if(enable_trace & TRACE_I) - layer1(l1buf, buf); - break; - - case TRC_CH_D: /* D-channel data */ - cnt = layer2(l2buf, buf, hdr->dir, print_q921); - - if(print_q921 == 0) - l2buf[0] = '\0'; - - n -= cnt; - buf += cnt; - - if(n) - { - if((*buf != 0x08) && (xflag == 0)) - { - l2buf[0] = '\0'; - l3buf[0] = '\0'; - break; - } - layer3(l3buf, n, cnt, buf); - } - break; - - default: /* B-channel data */ - - pbuf = &l2buf[0]; - - for (i = 0; i < n; i += 16) - { - sprintf((pbuf+strlen(pbuf)),"B%d:%.3x ", hdr->type, i); - - for (j = 0; j < 16; j++) - if (i + j < n) - sprintf((pbuf+strlen(pbuf)),"%02x ", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf))," "); - - sprintf((pbuf+strlen(pbuf))," "); - - for (j = 0; j < 16 && i + j < n; j++) - if (isprint(buf[i + j])) - sprintf((pbuf+strlen(pbuf)),"%c", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf)),"."); - - sprintf((pbuf+strlen(pbuf)),"\n"); - } - break; - } - - if(header && ((l1buf[0] != '\0' || l2buf[0] != '\0') || (l3buf[0] != 0))) - { - char *p; - p = fmt_hdr(hdr, nsave); - printf("%s", p); - if(outflag) - fprintf(Fout, "%s", p); - } - - if(l1buf[0] != '\0') - { - printf("%s", l1buf); - if(outflag) - fprintf(Fout, "%s", l1buf); - } - - if(l2buf[0] != '\0') - { - printf("%s", l2buf); - if(outflag) - fprintf(Fout, "%s", l2buf); - } - - if(l3buf[0] != '\0') - { - printf("%s", l3buf); - if(outflag) - fprintf(Fout, "%s", l3buf); - } -} - -/*---------------------------------------------------------------------------* - * exit handler function to be called at program exit - *---------------------------------------------------------------------------*/ -void -exit_hdl() -{ - if(traceon) - switch_driver(TRACE_OFF, Rx, Tx); -} - -/*---------------------------------------------------------------------------* - * switch driver debugging output on/off - *---------------------------------------------------------------------------*/ -static int -switch_driver(int value, int rx, int tx) -{ - char buffer[80]; - int v = value; - - if(analyze == 0) - { - if(ioctl(f, I4B_TRC_SET, &v) < 0) - { - sprintf(buffer, "Error ioctl I4B_TRC_SET, val = %d", v); - perror(buffer); - return(-1); - } - } - else - { - if(value == TRACE_OFF) - { - if(ioctl(f, I4B_TRC_RESETA, &v) < 0) - { - sprintf(buffer, "Error ioctl I4B_TRC_RESETA - "); - perror(buffer); - return(-1); - } - } - else - { - i4b_trace_setupa_t tsa; - - tsa.rxunit = rx; - tsa.rxflags = value; - tsa.txunit = tx; - tsa.txflags = value; - - if(ioctl(f, I4B_TRC_SETA, &tsa) < 0) - { - sprintf(buffer, "Error ioctl I4B_TRC_SETA, val = %d", v); - perror(buffer); - return(-1); - } - } - } - return(0); -} - -/*---------------------------------------------------------------------------* - * reopen files to support rotating logfile(s) on SIGUSR1 - * - * based on an idea from Ripley (ripley@nostromo.in-berlin.de) - * - * close file and reopen it for append. this will be a nop - * if the previously opened file hasn't moved but will open - * a new one otherwise, thus enabling a rotation... - * - *---------------------------------------------------------------------------*/ -static void -reopenfiles(int dummy) -{ - if(outflag) - { - fclose(Fout); - - if((Fout = fopen(outfilename, "a")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error re-opening file [%s]", outfilename); - perror(buffer); - exit(1); - } - - if((setvbuf(Fout, (char *)NULL, _IONBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error re-setting file [%s] to unbuffered", outfilename); - perror(buffer); - exit(1); - } - } - - if(Bopt) - { - - fclose(BP); - - if((BP = fopen(BPfilename, "a")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error re-opening file [%s]", BPfilename); - perror(buffer); - exit(1); - } - - if((setvbuf(BP, (char *)NULL, _IONBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error re-setting file [%s] to unbuffered", BPfilename); - perror(buffer); - exit(1); - } - } -} - -/*---------------------------------------------------------------------------* - * decode extension bit - *---------------------------------------------------------------------------*/ -void -extension(int layer, char *buffer, int cnt, unsigned char value, unsigned char mask) -{ - sprintline(layer, buffer, cnt, value, mask, "Extension Bit = %c (%s)", - (value & mask) ? '1' : '0', - (value & mask) ? "no extension, final octet" : "with extension, octet follows"); -} - -/*---------------------------------------------------------------------------* - * print bits as 0/1 available for mask - *---------------------------------------------------------------------------*/ -static char * -print_bits(unsigned char val, unsigned char mask) -{ - static char buffer[10]; - int i = 0; - int length = 8; - - while(length--) - { - if(mask & 0x80) - { - if(val & 0x80) - buffer[i++] = '1'; - else - buffer[i++] = '0'; - } - else - { - buffer[i++] = '-'; - } - val = val << 1; - mask = mask << 1; - } - buffer[i] = '\0'; - return(buffer); -} - -/*---------------------------------------------------------------------------* - * print one decoded output line - *---------------------------------------------------------------------------*/ -void -sprintline(int layer, char *buffer, int oct_count, int oct_val, - int oct_mask, const char *fmt, ...) -{ - char lbuffer[256]; - static int lastcount = -1; - char *ptr; - va_list ap; - - va_start(ap, fmt); - - if(oct_count != lastcount) - { - lastcount = oct_count; - - sprintf(lbuffer, "L%d %2d %02X %s ", - layer, - oct_count, - oct_val, - print_bits(oct_val, oct_mask)); - } - else - { - sprintf(lbuffer, " %s ", - print_bits(oct_val, oct_mask)); - } - - vsprintf(lbuffer+strlen(lbuffer), fmt, ap); - - va_end(ap); - - sprintf(lbuffer+strlen(lbuffer), "\n"); - - if((ptr = rindex(lbuffer, '(')) != NULL) - { - char *s = lbuffer; - char *b = buffer; - int len = strlen(lbuffer); - int i; - - for(s = lbuffer; s < ptr; *b++ = *s++) - ; - for(i = 0;(i+len) <= NCOLS; *b++ = ' ', i++) - ; - for(; *s; *b++ = *s++) - ; - *b = '\0'; - } - else - { - strcpy(buffer, lbuffer); - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdndecode/pcause.c b/usr.sbin/i4b/isdndecode/pcause.c deleted file mode 100644 index 610a9609c179..000000000000 --- a/usr.sbin/i4b/isdndecode/pcause.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * pcause.c - printing cause values - * -------------------------------- - * - * $Id: pcause.c,v 1.5 1999/12/13 21:25:25 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:51:20 1999] - * - *---------------------------------------------------------------------------*/ - -#include "decode.h" -#include "pcause.h" - -char * -print_cause_q850(unsigned char code) -{ - static char error_message[120]; - char *e; - - switch(code) - { - case CAUSE_Q850_SHUTDN: - e = "normal D-channel shutdown"; - break; - - case CAUSE_Q850_NUNALLC: - e = "Unallocated (unassigned) number"; - break; - - case CAUSE_Q850_NRTTN: - e = "No route to specified transit network"; - break; - - case CAUSE_Q850_NRTDST: - e = "No route to destination"; - break; - - case CAUSE_Q850_SSINFTN: - e = "Send special information tone"; - break; - - case CAUSE_Q850_MDIALTP: - e = "Misdialled trunk prefix"; - break; - - case CAUSE_Q850_CHUNACC: - e = "Channel unacceptable"; - break; - - case CAUSE_Q850_CALLAWD: - e = "Call awarded and being delivered in an established channel"; - break; - - case CAUSE_Q850_PREEMPT: - e = "Preemption"; - break; - - case CAUSE_Q850_PREECRR: - e = "Preemption - circuit reserved for reuse"; - break; - - case CAUSE_Q850_NCCLR: - e = "Normal call clearing"; - break; - - case CAUSE_Q850_USRBSY: - e = "User busy"; - break; - - case CAUSE_Q850_NOUSRRSP: - e = "No user responding"; - break; - - case CAUSE_Q850_NOANSWR: - e = "No answer from user (user alerted)"; - break; - - case CAUSE_Q850_SUBSABS: - e = "Subscriber absent"; - break; - - case CAUSE_Q850_CALLREJ: - e = "Call rejected"; - break; - - case CAUSE_Q850_NUCHNG: - e = "Number changed"; - break; - - case CAUSE_Q850_NONSELUC: - e = "Non-selected user clearing"; - break; - - case CAUSE_Q850_DSTOOORDR: - e = "Destination out of order"; - break; - - case CAUSE_Q850_INVNUFMT: - e = "Invalid number format"; - break; - - case CAUSE_Q850_FACREJ: - e = "Facility rejected"; - break; - - case CAUSE_Q850_STENQRSP: - e = "Response to STATUS ENQUIRY"; - break; - - case CAUSE_Q850_NORMUNSP: - e = "Normal, unspecified"; - break; - - case CAUSE_Q850_NOCAVAIL: - e = "No circuit / channel available"; - break; - - case CAUSE_Q850_NETOOORDR: - e = "Network out of order"; - break; - - case CAUSE_Q850_PFMCDOOSERV: - e = "Permanent frame mode connection out of service"; - break; - - case CAUSE_Q850_PFMCOPER: - e = "Permanent frame mode connection operational"; - break; - - case CAUSE_Q850_TMPFAIL: - e = "Temporary failure"; - break; - - case CAUSE_Q850_SWEQCONG: - e = "Switching equipment congestion"; - break; - - case CAUSE_Q850_ACCINFDIS: - e = "Access information discarded"; - break; - - case CAUSE_Q850_REQCNOTAV: - e = "Requested circuit/channel not available"; - break; - - case CAUSE_Q850_PRECALBLK: - e = "Precedence call blocked"; - break; - - case CAUSE_Q850_RESUNAVAIL: - e = "Resources unavailable, unspecified"; - break; - - case CAUSE_Q850_QOSUNAVAIL: - e = "Quality of service unavailable"; - break; - - case CAUSE_Q850_REQSERVNS: - e = "Requested facility not subscribed"; - break; - - case CAUSE_Q850_OCBARRCUG: - e = "Outgoing calls barred within CUG"; - break; - - case CAUSE_Q850_ICBARRCUG: - e = "Incoming calls barred within CUG"; - break; - - case CAUSE_Q850_BCAPNAUTH: - e = "Bearer capability not authorized"; - break; - - case CAUSE_Q850_BCAPNAVAIL: - e = "Bearer capability not presently available"; - break; - - case CAUSE_Q850_INCSTOACISC: - e = "Inconsistenciy in designated outg. access info and subscriber class"; - break; - - case CAUSE_Q850_SOONOTAVAIL: - e = "Service or option not available, unspecified"; - break; - - case CAUSE_Q850_BCAPNOTIMPL: - e = "Bearer capability not implemented"; - break; - - case CAUSE_Q850_CHTYPNIMPL: - e = "Channel type not implemented"; - break; - - case CAUSE_Q850_REQFACNIMPL: - e = "Requested facility not implemented"; - break; - - case CAUSE_Q850_ORDINBCAVL: - e = "Only restricted digital information bearer capability is available"; - break; - - case CAUSE_Q850_SOONOTIMPL: - e = "Service or option not implemented, unspecified"; - break; - - case CAUSE_Q850_INVCLRFVAL: - e = "Invalid call reference value"; - break; - - case CAUSE_Q850_IDCHDNOEX: - e = "Identified channel does not exist"; - break; - - case CAUSE_Q850_SUSCAEXIN: - e = "A suspended call exists, but this call identity does not"; - break; - - case CAUSE_Q850_CLIDINUSE: - e = "Call identity in use"; - break; - - case CAUSE_Q850_NOCLSUSP: - e = "No call suspended"; - break; - - case CAUSE_Q850_CLIDCLRD: - e = "Call having the requested call identity has been cleared"; - break; - - case CAUSE_Q850_UNOTMEMCUG: - e = "User not member of CUG"; - break; - - case CAUSE_Q850_INCDEST: - e = "Incompatible destination"; - break; - - case CAUSE_Q850_NONEXCUG: - e = "Non-existent CUG"; - break; - - case CAUSE_Q850_INVNTWSEL: - e = "Invalid transit network selection"; - break; - - case CAUSE_Q850_INVMSG: - e = "Invalid message, unspecified"; - break; - - case CAUSE_Q850_MIEMISS: - e = "Mandatory information element is missing"; - break; - - case CAUSE_Q850_MSGTNI: - e = "Message type non-existent or not implemented"; - break; - - case CAUSE_Q850_MSGNCMPT: - e = "Msg incompatible with call state/message type non-existent/not implemented"; - break; - - case CAUSE_Q850_IENENI: - e = "Information element/parameter non-existent or not implemented"; - break; - - case CAUSE_Q850_INVIEC: - e = "Invalid information element contents"; - break; - - case CAUSE_Q850_MSGNCWCS: - e = "Message not compatible with call state"; - break; - - case CAUSE_Q850_RECOTIMEXP: - e = "Recovery on timer expiry"; - break; - - case CAUSE_Q850_PARMNENIPO: - e = "Parameter non-existent or not implemented, passed on"; - break; - - case CAUSE_Q850_MSGUNRDPRM: - e = "Message with unrecognized parameter, discarded"; - break; - - case CAUSE_Q850_PROTERR: - e = "Protocol error, unspecified"; - break; - - case CAUSE_Q850_INTWRKU: - e = "Interworking, unspecified"; - break; - - default: - e = "ERROR, unknown cause value!"; - break; - } - - sprintf(error_message, "%d: %s (Q.850)", code, e); - return(error_message); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdndecode/pcause.h b/usr.sbin/i4b/isdndecode/pcause.h deleted file mode 100644 index 2c1c7f403e5b..000000000000 --- a/usr.sbin/i4b/isdndecode/pcause.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * pcause.h - Q.850 causes definitions - * ----------------------------------- - * - * $Id: pcause.h,v 1.4 1999/12/13 21:25:25 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:51:32 1999] - * - *---------------------------------------------------------------------------*/ - -char *print_cause_q850(unsigned char code); - -/* Q.850 causes */ - -#define CAUSE_Q850_SHUTDN 0x00 /* normal D-channel shutdown */ -#define CAUSE_Q850_NUNALLC 0x01 /* Unallocated (unassigned) number */ -#define CAUSE_Q850_NRTTN 0x02 /* No route to specified transit network */ -#define CAUSE_Q850_NRTDST 0x03 /* No route to destination */ -#define CAUSE_Q850_SSINFTN 0x04 /* Send special information tone */ -#define CAUSE_Q850_MDIALTP 0x05 /* Misdialled trunk prefix */ -#define CAUSE_Q850_CHUNACC 0x06 /* Channel unacceptable */ -#define CAUSE_Q850_CALLAWD 0x07 /* Call awarded and being delivered in an established channel */ -#define CAUSE_Q850_PREEMPT 0x08 /* Preemption */ -#define CAUSE_Q850_PREECRR 0x09 /* Preemption - circuit reserved for reuse */ -#define CAUSE_Q850_NCCLR 0x10 /* Normal call clearing */ -#define CAUSE_Q850_USRBSY 0x11 /* User busy */ -#define CAUSE_Q850_NOUSRRSP 0x12 /* No user responding */ -#define CAUSE_Q850_NOANSWR 0x13 /* No answer from user (user alerted) */ -#define CAUSE_Q850_SUBSABS 0x14 /* Subscriber absent */ -#define CAUSE_Q850_CALLREJ 0x15 /* Call rejected */ -#define CAUSE_Q850_NUCHNG 0x16 /* Number changed */ -#define CAUSE_Q850_NONSELUC 0x1A /* Non-selected user clearing */ -#define CAUSE_Q850_DSTOOORDR 0x1B /* Destination out of order */ -#define CAUSE_Q850_INVNUFMT 0x1C /* Invalid number format */ -#define CAUSE_Q850_FACREJ 0x1D /* Facility rejected */ -#define CAUSE_Q850_STENQRSP 0x1E /* Response to STATUS ENQUIRY */ -#define CAUSE_Q850_NORMUNSP 0x1F /* Normal, unspecified */ -#define CAUSE_Q850_NOCAVAIL 0x22 /* No circuit / channel available */ -#define CAUSE_Q850_NETOOORDR 0x26 /* Network out of order */ -#define CAUSE_Q850_PFMCDOOSERV 0x27 /* Permanent frame mode connection out of service */ -#define CAUSE_Q850_PFMCOPER 0x28 /* Permanent frame mode connection operational */ -#define CAUSE_Q850_TMPFAIL 0x29 /* Temporary failure */ -#define CAUSE_Q850_SWEQCONG 0x2A /* Switching equipment congestion */ -#define CAUSE_Q850_ACCINFDIS 0x2B /* Access information discarded */ -#define CAUSE_Q850_REQCNOTAV 0x2C /* Requested circuit/channel not available */ -#define CAUSE_Q850_PRECALBLK 0x2E /* Precedence call blocked */ -#define CAUSE_Q850_RESUNAVAIL 0x2F /* Resources unavailable, unspecified */ -#define CAUSE_Q850_QOSUNAVAIL 0x31 /* Quality of service unavailable */ -#define CAUSE_Q850_REQSERVNS 0x32 /* Requested facility not subscribed */ -#define CAUSE_Q850_OCBARRCUG 0x35 /* Outgoing calls barred within CUG */ -#define CAUSE_Q850_ICBARRCUG 0x36 /* Incoming calls barred within CUG */ -#define CAUSE_Q850_BCAPNAUTH 0x39 /* Bearer capability not authorized */ -#define CAUSE_Q850_BCAPNAVAIL 0x3A /* Bearer capability not presently available */ -#define CAUSE_Q850_INCSTOACISC 0x3E /* Inconsistenciy in designated outgoing access information and subscriber class */ -#define CAUSE_Q850_SOONOTAVAIL 0x3F /* Service or option not available, unspecified */ -#define CAUSE_Q850_BCAPNOTIMPL 0x41 /* Bearer capability not implemented */ -#define CAUSE_Q850_CHTYPNIMPL 0x42 /* Channel type not implemented */ -#define CAUSE_Q850_REQFACNIMPL 0x45 /* Requested facility not implemented */ -#define CAUSE_Q850_ORDINBCAVL 0x46 /* Only restricted digital information bearer capability is available */ -#define CAUSE_Q850_SOONOTIMPL 0x4F /* Service or option not implemented, unspecified */ -#define CAUSE_Q850_INVCLRFVAL 0x51 /* Invalid call reference value */ -#define CAUSE_Q850_IDCHDNOEX 0x52 /* Identified channel does not exist */ -#define CAUSE_Q850_SUSCAEXIN 0x53 /* A suspended call exists, but this call identity does not */ -#define CAUSE_Q850_CLIDINUSE 0x54 /* Call identity in use */ -#define CAUSE_Q850_NOCLSUSP 0x55 /* No call suspended */ -#define CAUSE_Q850_CLIDCLRD 0x56 /* Call having the requested call identity has been cleared */ -#define CAUSE_Q850_UNOTMEMCUG 0x57 /* User not member of CUG */ -#define CAUSE_Q850_INCDEST 0x58 /* Incompatible destination */ -#define CAUSE_Q850_NONEXCUG 0x5A /* Non-existent CUG */ -#define CAUSE_Q850_INVNTWSEL 0x5B /* Invalid transit network selection */ -#define CAUSE_Q850_INVMSG 0x5F /* Invalid message, unspecified */ -#define CAUSE_Q850_MIEMISS 0x60 /* Mandatory information element is missing */ -#define CAUSE_Q850_MSGTNI 0x61 /* Message type non-existent or not implemented */ -#define CAUSE_Q850_MSGNCMPT 0x62 /* Message not compatible with call state or message type non-existent or not implemented */ -#define CAUSE_Q850_IENENI 0x63 /* Information element/parameter non-existent or not implemented */ -#define CAUSE_Q850_INVIEC 0x64 /* Invalid information element contents */ -#define CAUSE_Q850_MSGNCWCS 0x65 /* Message not compatible with call state */ -#define CAUSE_Q850_RECOTIMEXP 0x66 /* Recovery on timer expiry */ -#define CAUSE_Q850_PARMNENIPO 0x67 /* Parameter non-existent or not implemented, passed on */ -#define CAUSE_Q850_MSGUNRDPRM 0x6E /* Message with unrecognized parameter, discarded */ -#define CAUSE_Q850_PROTERR 0x6F /* Protocol error, unspecified */ -#define CAUSE_Q850_INTWRKU 0x7F /* Interworking, unspecified */ - -/* EOF */ diff --git a/usr.sbin/i4b/isdnmonitor/Makefile b/usr.sbin/i4b/isdnmonitor/Makefile deleted file mode 100644 index ed241c16afb4..000000000000 --- a/usr.sbin/i4b/isdnmonitor/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD$ - -PROG= isdnmonitor -MAN= isdnmonitor.8 -SRCS= main.c curses.c - -# compile debug support -CFLAGS+= -DDEBUG - -# avoid wacky merging of string constants from -# source code with compile-time timestamp -CFLAGS+= -fno-merge-constants - -DPADD= ${LIBCURSES} -LDADD= -lcurses - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/isdnmonitor/curses.c b/usr.sbin/i4b/isdnmonitor/curses.c deleted file mode 100644 index 1e7eec15b68d..000000000000 --- a/usr.sbin/i4b/isdnmonitor/curses.c +++ /dev/null @@ -1,624 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - curses fullscreen output - * ------------------------------------- - * - * $Id: curses.c,v 1.10 1999/12/13 21:25:25 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:51:47 1999] - * - *---------------------------------------------------------------------------*/ - -#include "monprivate.h" - -#ifndef WIN32 - -static void display_bell(void); -static void display_chans(void); - -/*---------------------------------------------------------------------------* - * program exit - *---------------------------------------------------------------------------*/ -void -do_exit(int exitval) -{ - if(curses_ready) - endwin(); - exit(exitval); -} - -/*---------------------------------------------------------------------------* - * init curses fullscreen display - *---------------------------------------------------------------------------*/ -void -init_screen(void) -{ - char buffer[512]; - int uheight, lheight; - int i, j; - - initscr(); /* curses init */ - - if((COLS < 80) || (LINES < 24)) - { - endwin(); - fprintf(stderr, "ERROR, minimal screensize must be 80x24, is %dx%d, terminating!",COLS, LINES); - exit(1); - } - - noecho(); - raw(); - - uheight = nctrl * 2; /* cards * b-channels */ - lheight = LINES - uheight - 6 + 1; /* rest of display */ - - if((upper_w = newwin(uheight, COLS, UPPER_B, 0)) == NULL) - { - endwin(); - fprintf(stderr, "ERROR, curses init upper window, terminating!"); - exit(1); - } - - if((mid_w = newwin(1, COLS, UPPER_B+uheight+1, 0)) == NULL) - { - endwin(); - fprintf(stderr, "ERROR, curses init mid window, terminating!"); - exit(1); - } - - if((lower_w = newwin(lheight, COLS, UPPER_B+uheight+3, 0)) == NULL) - { - endwin(); - fprintf(stderr, "ERROR, curses init lower window, LINES = %d, lheight = %d, uheight = %d, terminating!", LINES, lheight, uheight); - exit(1); - } - - scrollok(lower_w, 1); - - sprintf(buffer, "----- isdn controller channel state ------------- isdnmonitor %02d.%02d.%d -", VERSION, REL, STEP); - - while(strlen(buffer) < COLS) - strcat(buffer, "-"); - - move(0, 0); - standout(); - addstr(buffer); - standend(); - - move(1, 0); - /* 01234567890123456789012345678901234567890123456789012345678901234567890123456789 */ - addstr("c tei b remote iface dir outbytes obps inbytes ibps units"); - - if(hostname) - sprintf(buffer, "----- isdn userland interface state ------------- %s:%d -", hostname, portno); - else - sprintf(buffer, "----- isdn userland interface state ------------- %s -", sockpath); - - while(strlen(buffer) < COLS) - strcat(buffer, "-"); - - move(uheight+2, 0); - standout(); - addstr(buffer); - standend(); - - sprintf(buffer, "----- isdnd logfile display --------------------------------------------------"); - while(strlen(buffer) < COLS) - strcat(buffer, "-"); - - move(uheight+4, 0); - standout(); - addstr(buffer); - standend(); - - refresh(); - - for(i=0, j=0; i <= nctrl; i++, j+=2) - { - mvwprintw(upper_w, j, H_CNTL, "%d --- 1 ", i); /*TEI*/ - mvwprintw(upper_w, j+1, H_CNTL, " L12 2 "); - } - wrefresh(upper_w); - -#ifdef NOTDEF - for(i=0, j=0; i < nentries; i++) /* walk thru all entries */ - { - p = &cfg_entry_tab[i]; /* get ptr to enry */ - - mvwprintw(mid_w, 0, j, "%s%d ", bdrivername(p->usrdevicename), p->usrdeviceunit); - - p->fs_position = j; - - j += ((strlen(bdrivername(p->usrdevicename)) + (p->usrdeviceunit > 9 ? 2 : 1) + 1)); - } -#else - mvwprintw(mid_w, 0, 0, "%s", devbuf); -#endif - wrefresh(mid_w); - - wmove(lower_w, 0, 0); - wrefresh(lower_w); - - curses_ready = 1; -} - -/*---------------------------------------------------------------------------* - * display the charge in units - *---------------------------------------------------------------------------*/ -void -display_charge(int pos, int charge) -{ - mvwprintw(upper_w, pos, H_UNITS, "%d", charge); - wclrtoeol(upper_w); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display the calculated charge in units - *---------------------------------------------------------------------------*/ -void -display_ccharge(int pos, int units) -{ - mvwprintw(upper_w, pos, H_UNITS, "(%d)", units); - wclrtoeol(upper_w); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display accounting information - *---------------------------------------------------------------------------*/ -void -display_acct(int pos, int obyte, int obps, int ibyte, int ibps) -{ - mvwprintw(upper_w, pos, H_OUT, "%-10d", obyte); - mvwprintw(upper_w, pos, H_OUTBPS, "%-4d", obps); - mvwprintw(upper_w, pos, H_IN, "%-10d", ibyte); - mvwprintw(upper_w, pos, H_INBPS, "%-4d", ibps); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * erase line at disconnect time - *---------------------------------------------------------------------------*/ -void -display_disconnect(int pos) -{ - wmove(upper_w, pos, H_TELN); - wclrtoeol(upper_w); - wrefresh(upper_w); - - if(do_bell) - display_bell(); -} - -/*---------------------------------------------------------------------------* - * display interface up/down information - *---------------------------------------------------------------------------*/ -void -display_updown(int pos, int updown, char *device) -{ - if(updown) - wstandend(mid_w); - else - wstandout(mid_w); - - mvwprintw(mid_w, 0, pos, "%s ", device); - - wstandend(mid_w); - wrefresh(mid_w); -} - -/*---------------------------------------------------------------------------* - * display interface up/down information - *---------------------------------------------------------------------------*/ -void -display_l12stat(int controller, int layer, int state) -{ - if(controller > nctrl) - return; - - if(!(layer == 1 || layer == 2)) - return; - - if(state) - wstandout(upper_w); - else - wstandend(upper_w); - - if(layer == 1) - { - mvwprintw(upper_w, (controller*2)+1, H_TEI+1, "1"); - - if(!state) - mvwprintw(upper_w, (controller*2)+1, H_TEI+2, "2"); - } - else if(layer == 2) - { - mvwprintw(upper_w, (controller*2)+1, H_TEI+2, "2"); - if(state) - mvwprintw(upper_w, (controller*2)+1, H_TEI+1, "1"); - } - - wstandend(upper_w); - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display TEI - *---------------------------------------------------------------------------*/ -void -display_tei(int controller, int tei) -{ - if(controller > nctrl) - return; - - if(tei == -1) - mvwprintw(upper_w, controller*2, H_TEI, "---"); - else - mvwprintw(upper_w, controller*2, H_TEI, "%3d", tei); - - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display bell :-) - *---------------------------------------------------------------------------*/ -static void -display_bell(void) -{ - static char bell[1] = { 0x07 }; - write(STDOUT_FILENO, &bell[0], 1); -} - -/*---------------------------------------------------------------------------* - * curses menu for fullscreen command mode - *---------------------------------------------------------------------------*/ -void -do_menu(void) -{ - static char *menu[WMITEMS] = - { - "1 - (D)isplay refresh", - "2 - (H)angup (choose a channel)", - "3 - (R)eread config file", - "4 - (Q)uit the program", - }; - - WINDOW *menu_w; - int c; - int mpos; - fd_set set; - struct timeval timeout; - - /* create a new window in the lower screen area */ - - if((menu_w = newwin(WMENU_HGT, WMENU_LEN, WMENU_POSLN, WMENU_POSCO )) == NULL) - { - return; - } - - /* create a border around the window */ - - box(menu_w, '|', '-'); - - /* add a title */ - - wstandout(menu_w); - mvwaddstr(menu_w, 0, (WMENU_LEN / 2) - (strlen(WMENU_TITLE) / 2), WMENU_TITLE); - wstandend(menu_w); - - /* fill the window with the menu options */ - - for(mpos=0; mpos <= (WMITEMS-1); mpos++) - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - - /* highlight the first menu option */ - - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - - /* input loop */ - - for(;;) - { - wrefresh(menu_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT; - timeout.tv_usec = 0; - - /* if no char is available within timeout, exit menu*/ - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - goto mexit; - - c = wgetch(menu_w); - - switch(c) - { - case ' ': - case '\t': /* hilite next option */ - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - mpos++; - if(mpos >= WMITEMS) - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - break; - - case ('0'+WREFRESH+1): /* display refresh */ - case 'D': - case 'd': - wrefresh(curscr); - goto mexit; - - case ('0'+WQUIT+1): /* quit program */ - case 'Q': - case 'q': - do_exit(0); - goto mexit; - - - case ('0'+WHANGUP+1): /* hangup connection */ - case 'H': - case 'h': - display_chans(); - goto mexit; - - case ('0'+WREREAD+1): /* reread config file */ - case 'R': - case 'r': - reread(); - goto mexit; - - case '\n': - case '\r': /* exec highlighted option */ - switch(mpos) - { - case WREFRESH: - wrefresh(curscr); - break; - - case WQUIT: - do_exit(0); - break; - - case WHANGUP: - display_chans(); - break; - - case WREREAD: - reread(); - break; - } - goto mexit; - break; - - default: - goto mexit; - break; - } - } - -mexit: - /* delete the menu window */ - - delwin(menu_w); - - /* re-display the original lower window contents */ - - touchwin(lower_w); - wrefresh(lower_w); -} - -/*---------------------------------------------------------------------------* - * display connect information - *---------------------------------------------------------------------------*/ -void -display_connect(int pos, int dir, char *name, char *remtel, char *dev) -{ - char buffer[256]; - - /* remote telephone number */ - - sprintf(buffer, "%s/%s", name, remtel); - - buffer[H_IFN - H_TELN - 1] = '\0'; - - mvwprintw(upper_w, pos, H_TELN, "%s", buffer); - - /* interface */ - - mvwprintw(upper_w, pos, H_IFN, "%s ", dev); - - mvwprintw(upper_w, pos, H_IO, dir ? "out" : "in"); - - mvwprintw(upper_w, pos, H_OUT, "-"); - mvwprintw(upper_w, pos, H_OUTBPS, "-"); - mvwprintw(upper_w, pos, H_IN, "-"); - mvwprintw(upper_w, pos, H_INBPS, "-"); - - if(do_bell) - display_bell(); - - wrefresh(upper_w); -} - -/*---------------------------------------------------------------------------* - * display channel information for shutdown - *---------------------------------------------------------------------------*/ -static void -display_chans(void) -{ - char buffer[80]; - int i; - int cnt = 0; - WINDOW *chan_w; - int nlines, ncols, pos_x, pos_y; - fd_set set; - struct timeval timeout; - - /* need this later to close the connection */ - struct ctlr_chan { - int cntl; - int chn; - } *cc = NULL; - - for(i = 0; i < nctrl; i++) - { - if(remstate[i].ch1state) - cnt++; - if(remstate[i].ch2state) - cnt++; - } - - if(cnt > 0) - { - if ((cc = (struct ctlr_chan *)malloc (cnt * - sizeof (struct ctlr_chan))) == NULL) - { - return; - } - nlines = cnt + 4; - ncols = 60; - } - else - { - nlines = 5; - ncols = 22; - } - - pos_y = WMENU_POSLN + 4; - pos_x = WMENU_POSCO + 10; - - /* create a new window in the lower screen area */ - - if((chan_w = newwin(nlines, ncols, pos_y, pos_x )) == NULL) - { - if (cnt > 0) - free(cc); - return; - } - - /* create a border around the window */ - - box(chan_w, '|', '-'); - - /* add a title */ - - wstandout(chan_w); - mvwaddstr(chan_w, 0, (ncols / 2) - (strlen("Channels") / 2), "Channels"); - wstandend(chan_w); - - /* no active channels */ - if (cnt == 0) - { - mvwaddstr(chan_w, 2, 2, "No active channels"); - wrefresh(chan_w); - sleep(1); - - /* delete the channels window */ - - delwin(chan_w); - return; - } - - nlines = 2; - ncols = 1; - - for (i = 0; i < nctrl; i++) - { - if(remstate[i].ch1state) - { - sprintf(buffer, "%d - Controller %d channel %s", ncols, i, "B1"); - mvwaddstr(chan_w, nlines, 2, buffer); - cc[ncols - 1].cntl = i; - cc[ncols - 1].chn = CHAN_B1; - nlines++; - ncols++; - } - if(remstate[i].ch2state) - { - sprintf(buffer, "%d - Controller %d channel %s", ncols, i, "B2"); - mvwaddstr(chan_w, nlines, 2, buffer); - cc[ncols - 1].cntl = i; - cc[ncols - 1].chn = CHAN_B2; - nlines++; - ncols++; - } - } - - for(;;) - { - wrefresh(chan_w); - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = WMTIMEOUT; - timeout.tv_usec = 0; - - /* if no char is available within timeout, exit menu*/ - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - break; - - ncols = wgetch(chan_w); - - if (!(isdigit(ncols))) - { - display_bell(); - continue; - } - - nlines = ncols - '0'; - - if ((nlines == 0) || (nlines > cnt)) - { - display_bell(); - continue; - } - - hangup(cc[nlines-1].cntl, cc[nlines-1].chn); - break; - } - - free(cc); - - /* delete the channels window */ - - delwin(chan_w); -} - -#endif /* !WIN32*/ - -/* EOF */ diff --git a/usr.sbin/i4b/isdnmonitor/isdnmonitor.8 b/usr.sbin/i4b/isdnmonitor/isdnmonitor.8 deleted file mode 100644 index 46e1a377f92a..000000000000 --- a/usr.sbin/i4b/isdnmonitor/isdnmonitor.8 +++ /dev/null @@ -1,178 +0,0 @@ -.\" -.\" Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdnmonitor.8,v 1.8 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 23:04:25 1999] -.\" -.Dd September 25, 1999 -.Dt ISDNMONITOR 8 -.Os -.Sh NAME -.Nm isdnmonitor -.Nd isdn4bsd / isdnd remote monitoring tool -.Sh SYNOPSIS -.Nm -.Op Fl c -.Op Fl d Ar debuglevel -.Op Fl f Ar filename -.Op Fl h Ar hostspec -.Op Fl l Ar pathname -.Op Fl p Ar portspec -.Sh DESCRIPTION -The -.Nm -utility is used to remotely monitor the operation of the isdn daemon, -.Xr isdnd 8 , -which manages all ISDN related connection and disconnection of ISDN -devices supported by the isdn4bsd package. -.Pp -The options are as follows: -.Bl -tag -width Ds -.It Fl c -Switch to (curses-) fullscreen mode of operation. -In this mode, -.Nm -behaves nearly exactly as -.Xr isdnd 8 -in fullscreen mode. -In fullscreen mode, entering the control character -.Em Control-L -causes the display to be refreshed and entering -.Em Carriage-Return -or -.Em Enter -will pop-up a command window. -Because -.Nm -will not listen to messages while the command window is active, -this command window will disappear automatically after 5 seconds without -any command key press. -.Pp -While the command window is active, -.Em Tab -or -.Em Space -advances to the next menu item. -To execute a command, press -.Em Return -or -.Em Enter -for the highlighted menu item, or enter the number corresponding to the -item to be executed or enter the capitalized character in the menu item -description. -.It Fl d -If debugging support is compiled into -.Nm -this option is used to specify the debugging level. -.\" The debugging level is the sum of the -.\" following values: -.\" .Pp -.\" .Bl -tag -width Ds -compact -offset indent -.\" .It Ar 0x001 -.\" general debugging. -.\" .It Ar 0x002 -.\" rates calculation. -.\" .It Ar 0x004 -.\" timing calculations. -.\" .It Ar 0x008 -.\" state transitions. -.\" .It Ar 0x010 -.\" retry handling. -.\" .It Ar 0x020 -.\" dialing. -.\" .It Ar 0x040 -.\" process handling. -.\" .It Ar 0x080 -.\" isdn4bsd kernel i/o calls. -.\" .It Ar 0x100 -.\" controller and channel busy/free messages. -.\" .It Ar 0x200 -.\" isdnmonitor.rc configuration file processing. -.\" .El -.\" .Pp -.\" The value can be specified in any number base supported by the -.\" .Xr sscanf 3 -.\" library routine. -.Pp -In addition, this option accepts also the character 'n' as an argument to -disable displaying debug messages on the full-screen display. -.Pp -.It Fl f -Specifying this option causes -.Nm -to write its normal output and - if enabled - debugging output to a file -which name is specified as the argument. -.It Fl l -is used to specify a Unix local domain socket name to be used for communication -between -.Xr isdnd 8 -and -.Nm . -.It Fl h -is used to specify a hostname or a dotted-quad IP address of a machine -where an -.Xr isdnd 8 -is running which should be monitored. -.It Fl p -This option may be used to specify a remote port number in conjunction -with the -.Fl h -option. -.El -.Sh ENVIRONMENT -The following environment variables affect the execution of -.Nm : -.Bl -tag -width Ds -.It Ev TERM -The terminal type when running in full-screen display mode. -See -.Xr environ 7 -for more information. -.El -.Sh EXIT STATUS -Exit status is 0 on success, 1 on error. -.Sh EXAMPLES -For a first try, the following command should be used to start -.Nm -to monitor a locally running isdnd: -.Bd -literal -offset indent -isdnmonitor -h localhost -.Ed -.Sh SEE ALSO -.Xr isdnd 8 -.Sh AUTHORS -.An -nosplit -The -.Nm -utility was written by -.An Martin Husemann -and -.An Hellmuth Michaelis Aq hm@kts.org . -This manual page was written by -.An Hellmuth Michaelis . -.Sh BUGS -Still one (or) more left. diff --git a/usr.sbin/i4b/isdnmonitor/main.c b/usr.sbin/i4b/isdnmonitor/main.c deleted file mode 100644 index 65ddb5b9c10e..000000000000 --- a/usr.sbin/i4b/isdnmonitor/main.c +++ /dev/null @@ -1,1196 +0,0 @@ -/* - * Copyright (c) 1998,1999 Martin Husemann. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - network monitor client - * ----------------------------------- - * - * $Id: main.c,v 1.35 2000/08/24 11:48:57 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:52:11 1999] - * - *---------------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <signal.h> -#include <time.h> -#include <errno.h> -#ifndef WIN32 -#include <unistd.h> -#include <netdb.h> -#endif -#include <sys/types.h> -#ifndef WIN32 -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <sys/un.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#else -#include <stdarg.h> -#include <windows.h> -extern char *optarg; -int getopt(int nargc, char * const nargv[], const char *ostr); -#define close(f) closesocket(f) -#define sleep(s) Sleep(s*1000) -#define vsnprintf _vsnprintf -#define ssize_t long -#endif -#ifdef ERROR -#undef ERROR -#endif -#ifdef __FreeBSD__ -#include <osreldate.h> -#endif - -#define MAIN -#include "monprivate.h" -#undef MAIN - -#ifndef AF_LOCAL -#define AF_LOCAL AF_UNIX -#endif - -#ifdef DEBUG -#include <ctype.h> -#endif - -#include "monitor.h" - -/* - * Local function prototypes - */ -static int connect_local(char *sockpath); -static int connect_remote(char *host, int portno); -static void usage(); -static void mloop(); -static void handle_input(); -static void print_menu(); -static void print_logevent(time_t tstamp, int prio, char * what, char * msg); -static void print_charge(time_t tstamp, int controller, int channel, int units, int estimated); -static void print_connect(time_t tstamp, int dir, int controller, int channel, char * cfgname, char * devname, char * remphone, char * locphone); -static void print_disconnect(time_t tstamp, int controller, int channel); -static void print_updown(time_t tstamp, int contoller, int channel, int isup); -static void handle_event(u_int8_t *msg, int len); -#ifdef DEBUG -static void dump_event(u_int8_t *msg, int len, int readflag); -#endif - -static ssize_t sock_read(int fd, void *buf, size_t nbytes); -static ssize_t sock_write(int fd, void *buf, size_t nbytes); - -static void mprintf(char *fmt, ...); - -/* - * Global variables - */ -static int debug = 0; -#define DBG_DUMPALL 0x01 -#define DBG_PSEND 0x02 - -static int monsock = -1; -static int state = ST_INIT; -static int sub_state = 0; -static int sub_state_count = 0; - -static int isdn_major = 0; -static int isdn_minor = 0; -static u_int32_t rights = 0; - -static char *logfilename = NULL; -static FILE *lfp = NULL; - -/*--------------------------------------------------------------------------- - * Display usage and exit - *---------------------------------------------------------------------------*/ -static void -usage() -{ - fprintf(stderr, "\n"); - fprintf(stderr, "isdnmonitor - version %02d.%02d.%d, (protocol %02d.%02d)\n", VERSION, REL, STEP, MPROT_VERSION, MPROT_REL); -#ifdef FOREIGN - fprintf(stderr, " usage: isdnmonitor [-c] [-d val] [-f name] [-h host] [-p port]\n"); -#else - fprintf(stderr, " usage: isdnmonitor [-c] [-d val] [-f name] [-h host] [-l path] [-p port]\n"); -#endif - fprintf(stderr, " -c switch to curses fullscreen output\n"); - fprintf(stderr, " -d <val> debug flags (see source ...)\n"); - fprintf(stderr, " -dn no debug output on fullscreen display\n"); - fprintf(stderr, " -f <name> filename to log output to\n"); - fprintf(stderr, " -h <host> hostname/address to connect to\n"); -#ifndef FOREIGN - fprintf(stderr, " -l <path> pathname to local domain socket to connect to\n"); -#endif - fprintf(stderr, " -p <port> portnumber to use to connect to remote host\n"); - exit(1); -} - -/*--------------------------------------------------------------------------- - * Parse command line, startup monitor client - *---------------------------------------------------------------------------*/ -int main(int argc, char **argv) -{ - int i; - -#ifdef WIN32 - WSADATA wsCaps; - WSAStartup(MAKEWORD(2, 0), &wsCaps); -#endif - - portno = DEF_MONPORT; - devbuf[0] = '\0'; - -#ifndef FOREIGN - while((i = getopt(argc, argv, "cd:f:h:p:l:")) != -1) -#else - while((i = getopt(argc, argv, "cd:f:h:p:")) != -1) -#endif - { - switch(i) - { - case 'c': - fullscreen = 1; - break; - case 'd': - if(*optarg == 'n') - { - debug_noscreen = 1; - } - else - { - if((sscanf(optarg, "%i", &debug)) != 1) - usage(); - } - break; - case 'f': - logfilename = optarg; - break; - case 'h': - hostname = optarg; - break; -#ifndef FOREIGN - case 'l': - sockpath = optarg; - break; -#endif - case 'p': - if((sscanf(optarg, "%i", &portno)) != 1) - usage(); - break; - default: - usage(); - break; - } - } - -#ifndef FOREIGN - if(hostname && sockpath) - { - fprintf(stderr, "Error: can not use local socket path on remote machine\n" - "conflicting options -h and -l!\n"); - return 1; - } - - if(sockpath) - { - monsock = connect_local(sockpath); - } - else if(hostname) -#else - if(hostname) -#endif - - { - monsock = connect_remote(hostname, portno); - } - else - { - usage(); - } - - if(monsock == -1) - { - fprintf(stderr, "Could not connect to i4b isdn daemon.\n"); - return 1; - } - - if(logfilename != NULL) - { - if((lfp = fopen(logfilename, "w")) == NULL) - { - fprintf(stderr, "could not open logfile [%s], %s\n", logfilename, strerror(errno)); - exit(1); - } - } - -#ifndef WIN32 - signal(SIGPIPE, SIG_IGN); -#endif - - mloop(); - - close(monsock); - - return 0; -} - -/*--------------------------------------------------------------------------- - * Connect via tcp/ip. - * Return socket if successfull, -1 on error. - ---------------------------------------------------------------------------*/ -static int -connect_remote(char *host, int portno) -{ - struct sockaddr_in sa; - struct hostent *h; - int remotesockfd; - - h = gethostbyname(host); - - if(!h) - { - fprintf(stderr, "could not resolve hostname '%s'\n", host); - exit(1); - } - - remotesockfd = socket(AF_INET, SOCK_STREAM, 0); - - if(remotesockfd == -1) - { - fprintf(stderr, "could not create remote monitor socket: %s\n", strerror(errno)); - exit(1); - } - - memset(&sa, 0, sizeof(sa)); - -#ifdef BSD4_4 - sa.sin_len = sizeof(sa); -#endif - sa.sin_family = AF_INET; - sa.sin_port = htons(portno); - - memcpy(&sa.sin_addr.s_addr, h->h_addr_list[0], sizeof(sa.sin_addr.s_addr)); - - if(connect(remotesockfd, (struct sockaddr *)&sa, sizeof(sa)) == -1) - { - fprintf(stderr, "could not connect remote monitor: %s\n", strerror(errno)); - exit(1); - } - - return remotesockfd; -} - -#ifndef FOREIGN -/*--------------------------------------------------------------------------- - * Connect local. - * Return socket on success, -1 on failure. - *---------------------------------------------------------------------------*/ -static int -connect_local(char *sockpath) -{ - int s; - struct sockaddr_un sa; - - /* check path length */ - if(strlen(sockpath) >= sizeof(sa.sun_path)) - { - fprintf(stderr, "pathname to long for local socket: %s\n", - sockpath); - exit(1); - } - - /* create and setup socket */ - s = socket(AF_LOCAL, SOCK_STREAM, 0); - - if(s == -1) - { - fprintf(stderr, "could not create local monitor socket:%s\n", strerror(errno)); - exit(1); - } - - memset(&sa, 0, sizeof(sa)); - - sa.sun_len = sizeof(sa); - sa.sun_family = AF_LOCAL; - strcpy(sa.sun_path, sockpath); - - if(connect(s, (struct sockaddr *)&sa, sizeof(sa))) - { - fprintf(stderr, "could not connect local monitor socket [%s]: %s\n", sockpath, strerror(errno)); - } - - return s; -} -#endif - -/*---------------------------------------------------------------------------* - * data from keyboard available, read and process it - *---------------------------------------------------------------------------*/ -#ifndef WIN32 -static void -kbdrdhdl(void) -{ - int ch = getch(); - - switch(ch) - { - case 0x0c: /* control L */ - wrefresh(curscr); - break; - - case '\n': - case '\r': - do_menu(); - break; - } -} -#endif - -/*--------------------------------------------------------------------------- - * main event loop - *---------------------------------------------------------------------------*/ -static void -mloop() -{ - for(;;) - { - fd_set rd, wr, ex; - - FD_ZERO(&rd); - FD_ZERO(&wr); - FD_ZERO(&ex); - FD_SET(fileno(stdin), &rd); - FD_SET(monsock, &rd); - - select(monsock+1, &rd, &wr, &ex, NULL); - - if(FD_ISSET(fileno(stdin), &rd)) - { -#ifndef WIN32 - if(fullscreen && curses_ready) - kbdrdhdl(); - else -#endif - if(!fullscreen) - handle_input(); - else - getchar(); - } - - if(FD_ISSET(monsock, &rd)) - { - u_int8_t buf[8192]; - int bytes, ret; - - /* Network transfer may deliver two or more packets concatenated. - * Peek at the header and read only one event at a time... */ - - bytes = recv(monsock, buf, I4B_MON_EVNT_HDR, MSG_PEEK); - - if(bytes == 0) - { - close(monsock); - -#ifndef WIN32 - if(curses_ready) - { - endwin(); - curses_ready = 0; - } -#endif - - mprintf("remote isdnd has closed our connection\n"); - exit(0); - } - else if(bytes < 0) - { - fprintf(stderr, "recv error: %s\n", strerror(errno)); - close(monsock); - exit(1); - } - - if (bytes < I4B_MON_EVNT_HDR) - continue; /* errh? something must be wrong... */ - - bytes = I4B_GET_2B(buf, I4B_MON_EVNT_LEN); - - if(bytes >= sizeof(buf)) - { - fprintf(stderr, "mloop: socket recv buffer overflow %d!\n", bytes); - break; - } - - /* now we know the size, it fits, so lets read it! */ - - ret = sock_read(monsock, buf, bytes); - - if(ret == 0) - { - close(monsock); -#ifndef WIN32 - if(curses_ready) - endwin(); -#endif - mprintf("remote isdnd has closed our connection\n"); - exit(0); - } - else if(ret < 0) - { - mprintf("error reading from isdnd: %s", strerror(errno)); - break; - } -#ifdef DEBUG - if(debug & DBG_DUMPALL) - dump_event(buf, ret, 1); -#endif - handle_event(buf, ret); - } - } -} - -#ifdef DEBUG -/* - * Dump a complete event packet. - */ -static void dump_event(u_int8_t *msg, int len, int read) -{ - int i; - - if(read) - mprintf("read from socket:"); - else - mprintf("write to socket:"); - - for(i = 0; i < len; i++) - { - if(i % 8 == 0) - mprintf("\n%02d: ", i); - mprintf("0x%02x %c ", msg[i], isprint(msg[i]) ? msg[i] : '.'); - } - mprintf("\n"); -} -#endif - -static void -print_logevent(time_t tstamp, int prio, char * what, char * msg) -{ - char buf[256]; - strftime(buf, sizeof(buf), I4B_TIME_FORMAT, localtime(&tstamp)); - mprintf("log: %s prio %d what=%s msg=%s\n", buf, prio, what, msg); - -#ifndef WIN32 - if(fullscreen) - { - if((!debug_noscreen) || (debug_noscreen && (((strcmp(what, "DBG"))) != 0))) - { -/* - * FreeBSD-current integrated ncurses. Since then it is no longer possible - * to write to the last column in the logfilewindow without causing an - * automatic newline to occur resulting in a blank line in that window. - */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 400009 -#warning "FreeBSD ncurses is buggy: write to last column = auto newline!" - wprintw(lower_w, "%s %s %-.*s\n", buf, what, - COLS-((strlen(buf))+(strlen(what))+3), msg); -#else - wprintw(lower_w, "%s %s %-.*s\n", buf, what, - (int)(COLS-((strlen(buf))+(strlen(what))+2)), msg); -#endif - wrefresh(lower_w); - } - } -#endif -} - -static void -print_charge(time_t tstamp, int controller, int channel, int units, int estimated) -{ - char buf[256]; - strftime(buf, sizeof(buf), I4B_TIME_FORMAT, localtime(&tstamp)); - mprintf("%s: controller %d, channel %d, charge = %d%s\n", - buf, controller, channel, units, estimated ? " (estimated)" : ""); -#ifndef WIN32 - if(fullscreen) - { - if(estimated) - display_ccharge(CHPOS(controller, channel), units); - else - display_charge(CHPOS(controller, channel), units); - } -#endif -} - -/* - * Print a connect event. - * A real monitor would allocate state info for "channel" on this - * event. - */ -static void print_connect( - time_t tstamp, /* server time of event */ - int outgoing, /* 0 = incoming, 1 = outgoing */ - int controller, /* controller number */ - int channel, /* channel no, used to identify this connection until disconnect */ - char * cfgname, /* name of config entry/connection */ - char * devname, /* device used (e.g. isp0) */ - char * remphone, /* phone no of remote side */ - char * locphone) /* local phone no */ -{ - char buf[256]; - - if(channel == 0) - remstate[controller].ch1state = 1; - else - remstate[controller].ch2state = 1; - - strftime(buf, sizeof(buf), I4B_TIME_FORMAT, localtime(&tstamp)); - - if(outgoing) - mprintf("%s: calling out to '%s' [from msn: '%s']", - buf, remphone, locphone); - else - mprintf("%s: incoming call from '%s' [to msn: '%s']", - buf, remphone, locphone); - mprintf(", controller %d, channel %d, config '%s' on device '%s'\n", - controller, channel, cfgname, devname); - -#ifndef WIN32 - if(fullscreen) - display_connect(CHPOS(controller, channel), outgoing, cfgname, remphone, devname); -#endif -} - -/* - * Print a disconnect event. - * A real monitor could free the "per connection" state - * for this channel now - */ -static void -print_disconnect(time_t tstamp, int controller, int channel) -{ - char buf[256]; - - if(channel == 0) - remstate[controller].ch1state = 0; - else - remstate[controller].ch2state = 0; - - strftime(buf, sizeof(buf), I4B_TIME_FORMAT, localtime(&tstamp)); - - mprintf("%s: controller %d, channel %d disconnected\n", - buf, controller, channel); - -#ifndef WIN32 - if(fullscreen) - display_disconnect(CHPOS(controller, channel)); -#endif -} - -/* - * Print an up- or down event - */ -static void -print_updown(time_t tstamp, int controller, int channel, int isup) -{ - char buf[256]; - strftime(buf, sizeof(buf), I4B_TIME_FORMAT, localtime(&tstamp)); - mprintf("%s: channel %d is %s\n", - buf, channel, isup ? "up" : "down"); -} - -/* - * Print l1 / l2 status - */ -static void -print_l12stat(time_t tstamp, int controller, int layer, int state) -{ - char buf[256]; - strftime(buf, sizeof(buf), I4B_TIME_FORMAT, localtime(&tstamp)); - - mprintf("%s: layer %d change on controller %d: %s\n", - buf, layer, controller, state ? "up" : "down"); -#ifndef WIN32 - if(fullscreen) - display_l12stat(controller, layer, state); -#endif -} - -/* - * Print TEI - */ -static void -print_tei(time_t tstamp, int controller, int tei) -{ - char buf[256]; - strftime(buf, sizeof(buf), I4B_TIME_FORMAT, localtime(&tstamp)); - - mprintf("%s: controller %d, TEI is %d\n", - buf, controller, tei); - -#ifndef WIN32 - if(fullscreen) - display_tei(controller, tei); -#endif -} - -/* - * Print accounting information - */ -static void -print_acct(time_t tstamp, int controller, int channel, int obytes, int obps, - int ibytes, int ibps) -{ - char buf[256]; - strftime(buf, sizeof(buf), I4B_TIME_FORMAT, localtime(&tstamp)); - - mprintf("%s: controller %d, channel %d: %d obytes, %d obps, %d ibytes, %d ibps\n", - buf, controller, channel, obytes, obps, ibytes, ibps); -#ifndef WIN32 - if(fullscreen) - display_acct(CHPOS(controller, channel), obytes, obps, ibytes, ibps); -#endif -} - -static void -print_initialization(void) -{ -#ifndef WIN32 - if(fullscreen) - { - if(curses_ready == 0) - init_screen(); - } - else -#endif - { - print_menu(); - } -} - -/* - * Dispatch one message received from the daemon. - */ -static void -handle_event(u_int8_t *msg, int len) -{ - u_int8_t cmd[I4B_MON_ICLIENT_SIZE]; - int local; - u_int32_t net; - u_int32_t mask; - u_int32_t who; - static int first = 1; - - switch(state) - { - case ST_INIT: /* initial data */ - - isdn_major = I4B_GET_2B(msg, I4B_MON_IDATA_VERSMAJOR); - isdn_minor = I4B_GET_2B(msg, I4B_MON_IDATA_VERSMINOR); - nctrl = I4B_GET_2B(msg, I4B_MON_IDATA_NUMCTRL); - nentries = I4B_GET_2B(msg, I4B_MON_IDATA_NUMENTR); - rights = I4B_GET_4B(msg, I4B_MON_IDATA_CLACCESS); - - mprintf("remote protocol version is %02d.%02d\n", isdn_major, isdn_minor); - - if(isdn_major != MPROT_VERSION || isdn_minor != MPROT_REL) - { - fprintf(stderr, "ERROR, remote protocol version mismatch:\n"); - fprintf(stderr, "\tremote major version is %02d, local major version is %02d\n", isdn_major, MPROT_VERSION); - fprintf(stderr, "\tremote minor version is %02d, local minor version is %02d\n", isdn_minor, MPROT_REL); - exit(1); - } - - mprintf("our rights = 0x%x\n", rights); - - sub_state = 0; - first = 1; - - if(nctrl > 0) - { - state = ST_ICTRL; - } - else if(nentries > 0) - { - state = ST_IDEV; - } - else - { - state = ST_ANYEV; - sleep(2); - print_initialization(); - } - - /* set maximum event mask */ - I4B_PREP_CMD(cmd, I4B_MON_CCMD_SETMASK); - I4B_PUT_2B(cmd, I4B_MON_ICLIENT_VERMAJOR, MPROT_VERSION); - I4B_PUT_2B(cmd, I4B_MON_ICLIENT_VERMINOR, MPROT_REL); - I4B_PUT_4B(cmd, I4B_MON_ICLIENT_EVENTS, ~0U); - -#ifdef DEBUG - if(debug & DBG_DUMPALL) - dump_event(cmd, sizeof(cmd), 0); -#endif - - if((sock_write(monsock, cmd, sizeof(cmd))) == -1) - { - fprintf(stderr, "sock_write failed: %s\n", strerror(errno)); - exit(1); - } - break; - - case ST_ICTRL: /* initial controller list */ - if(first) - { - first = 0; - mprintf("%d controller(s) found:\n", nctrl); - } - mprintf("\tcontroller %d: %s\n", sub_state++, msg+I4B_MON_ICTRL_NAME); - - if(sub_state >= nctrl) - { - sub_state = 0; - first = 1; - if(nentries > 0) - { - state = ST_IDEV; /* end of list reached */ - } - else - { - state = ST_ANYEV; - sleep(2); - print_initialization(); - } - } - break; - - case ST_IDEV: /* initial entry devicename list */ - if(first) - { - first = 0; - mprintf("%d entries found:\n", nentries); - } - - mprintf("\tentry %d: device %s\n", sub_state++, msg+I4B_MON_IDEV_NAME); - - strcat(devbuf, msg+I4B_MON_IDEV_NAME); - /* strcat(devbuf, " "); */ - - if(sub_state >= nentries) - { - first = 1; - state = ST_ANYEV; /* end of list reached */ - sub_state = 0; - sleep(2); - print_initialization(); - } - break; - - case ST_ANYEV: /* any event */ - switch(I4B_GET_2B(msg, I4B_MON_EVNT)) - { - case I4B_MON_DRINI_CODE: - state = ST_RIGHT; /* list of rights entries will follow */ - sub_state = 0; - sub_state_count = I4B_GET_2B(msg, I4B_MON_DRINI_COUNT); - mprintf("monitor rights:\n"); - break; - - case I4B_MON_DCINI_CODE: - state = ST_CONNS; - sub_state = 0; - sub_state_count = I4B_GET_2B(msg, I4B_MON_DCINI_COUNT); - mprintf("monitor connections:\n"); - break; - - case I4B_MON_LOGEVNT_CODE: - print_logevent(I4B_GET_4B(msg, I4B_MON_LOGEVNT_TSTAMP), - I4B_GET_4B(msg, I4B_MON_LOGEVNT_PRIO), - msg+I4B_MON_LOGEVNT_WHAT, - msg+I4B_MON_LOGEVNT_MSG); - break; - - case I4B_MON_CHRG_CODE: - print_charge(I4B_GET_4B(msg, I4B_MON_CHRG_TSTAMP), - I4B_GET_4B(msg, I4B_MON_CHRG_CTRL), - I4B_GET_4B(msg, I4B_MON_CHRG_CHANNEL), - I4B_GET_4B(msg, I4B_MON_CHRG_UNITS), - I4B_GET_4B(msg, I4B_MON_CHRG_ESTIMATED)); - break; - - case I4B_MON_CONNECT_CODE: - print_connect( - I4B_GET_4B(msg, I4B_MON_CONNECT_TSTAMP), - I4B_GET_4B(msg, I4B_MON_CONNECT_DIR), - I4B_GET_4B(msg, I4B_MON_CONNECT_CTRL), - I4B_GET_4B(msg, I4B_MON_CONNECT_CHANNEL), - msg+I4B_MON_CONNECT_CFGNAME, - msg+I4B_MON_CONNECT_DEVNAME, - msg+I4B_MON_CONNECT_REMPHONE, - msg+I4B_MON_CONNECT_LOCPHONE); - break; - - case I4B_MON_DISCONNECT_CODE: - print_disconnect( - I4B_GET_4B(msg, I4B_MON_DISCONNECT_TSTAMP), - I4B_GET_4B(msg, I4B_MON_DISCONNECT_CTRL), - I4B_GET_4B(msg, I4B_MON_DISCONNECT_CHANNEL)); - break; - - case I4B_MON_UPDOWN_CODE: - print_updown( - I4B_GET_4B(msg, I4B_MON_UPDOWN_TSTAMP), - I4B_GET_4B(msg, I4B_MON_UPDOWN_CTRL), - I4B_GET_4B(msg, I4B_MON_UPDOWN_CHANNEL), - I4B_GET_4B(msg, I4B_MON_UPDOWN_ISUP)); - break; - case I4B_MON_L12STAT_CODE: - print_l12stat( - I4B_GET_4B(msg, I4B_MON_L12STAT_TSTAMP), - I4B_GET_4B(msg, I4B_MON_L12STAT_CTRL), - I4B_GET_4B(msg, I4B_MON_L12STAT_LAYER), - I4B_GET_4B(msg, I4B_MON_L12STAT_STATE)); - break; - case I4B_MON_TEI_CODE: - print_tei( - I4B_GET_4B(msg, I4B_MON_TEI_TSTAMP), - I4B_GET_4B(msg, I4B_MON_TEI_CTRL), - I4B_GET_4B(msg, I4B_MON_TEI_TEI)); - break; - case I4B_MON_ACCT_CODE: - print_acct( - I4B_GET_4B(msg, I4B_MON_ACCT_TSTAMP), - I4B_GET_4B(msg, I4B_MON_ACCT_CTRL), - I4B_GET_4B(msg, I4B_MON_ACCT_CHAN), - I4B_GET_4B(msg, I4B_MON_ACCT_OBYTES), - I4B_GET_4B(msg, I4B_MON_ACCT_OBPS), - I4B_GET_4B(msg, I4B_MON_ACCT_IBYTES), - I4B_GET_4B(msg, I4B_MON_ACCT_IBPS)); - break; - default: - mprintf("unknown event code: %d\n", I4B_GET_2B(msg, I4B_MON_EVNT)); - } - break; - - case ST_RIGHT: /* one record in a list of monitor rights */ - rights = I4B_GET_4B(msg, I4B_MON_DR_RIGHTS); - net = I4B_GET_4B(msg, I4B_MON_DR_NET); - mask = I4B_GET_4B(msg, I4B_MON_DR_MASK); - local = I4B_GET_1B(msg, I4B_MON_DR_LOCAL); - - if(local) - { - mprintf("\tlocal: rights = %x\n", rights); - } - else - { - mprintf("\tfrom: %d.%d.%d.%d, mask %d.%d.%d.%d, rights = %x\n", - (net >> 24) & 0x00ff, (net >> 16) & 0x00ff, (net >> 8) & 0x00ff, net & 0x00ff, - (mask >> 24) & 0x00ff, (mask >> 16) & 0x00ff, (mask >> 8) & 0x00ff, mask & 0x00ff, - rights); - } - - sub_state++; - - if(sub_state >= sub_state_count) - { - state = ST_ANYEV; - print_initialization(); - } - break; - - case ST_CONNS: - who = I4B_GET_4B(msg, I4B_MON_DC_WHO); - rights = I4B_GET_4B(msg, I4B_MON_DC_RIGHTS); - - mprintf("\tfrom: %d.%d.%d.%d, rights = %x\n", - (who >> 24) & 0x00ff, (who >> 16) & 0x00ff, (who >> 8) & 0x00ff, who & 0x00ff, - rights); - - sub_state++; - - if(sub_state >= sub_state_count) - { - state = ST_ANYEV; - print_initialization(); - } - break; - - default: - mprintf("unknown event from remote: local state = %d, evnt = %x, len = %d\n", - state, I4B_GET_2B(msg, I4B_MON_EVNT), len); - } -} - -/* - * Process input from user - */ -static void -handle_input() -{ - char buf[1024]; - int channel, controller; - - fgets(buf, sizeof(buf), stdin); - - switch(atoi(buf)) - { - case 1: - { - u_int8_t cmd[I4B_MON_DUMPRIGHTS_SIZE]; - I4B_PREP_CMD(cmd, I4B_MON_DUMPRIGHTS_CODE); -#ifdef DEBUG - if(debug & DBG_DUMPALL) - dump_event(cmd, I4B_MON_DUMPRIGHTS_SIZE, 0); -#endif - - if((sock_write(monsock, cmd, I4B_MON_DUMPRIGHTS_SIZE)) == -1) - { - fprintf(stderr, "sock_write failed: %s\n", strerror(errno)); - exit(1); - } - } - break; - - case 2: - { - u_int8_t cmd[I4B_MON_DUMPMCONS_SIZE]; - I4B_PREP_CMD(cmd, I4B_MON_DUMPMCONS_CODE); -#ifdef DEBUG - if(debug & DBG_DUMPALL) - dump_event(cmd, I4B_MON_DUMPMCONS_CODE, 0); -#endif - - if((sock_write(monsock, cmd, I4B_MON_DUMPMCONS_SIZE)) == -1) - { - fprintf(stderr, "sock_write failed: %s\n", strerror(errno)); - exit(1); - } - } - break; - - case 3: - { - u_int8_t cmd[I4B_MON_CFGREREAD_SIZE]; - I4B_PREP_CMD(cmd, I4B_MON_CFGREREAD_CODE); -#ifdef DEBUG - if(debug & DBG_DUMPALL) - dump_event(cmd, I4B_MON_CFGREREAD_CODE, 0); -#endif - - if((sock_write(monsock, cmd, I4B_MON_CFGREREAD_SIZE)) == -1) - { - fprintf(stderr, "sock_write failed: %s\n", strerror(errno)); - exit(1); - } - } - break; - - case 4: - { - u_int8_t cmd[I4B_MON_HANGUP_SIZE]; - I4B_PREP_CMD(cmd, I4B_MON_HANGUP_CODE); - - printf("Which controller you wish to hangup? "); - fgets(buf, sizeof(buf), stdin); - controller = atoi(buf); - I4B_PUT_4B(cmd, I4B_MON_HANGUP_CTRL, controller); - - printf("Which channel do you wish to hangup? "); - fgets(buf, sizeof(buf), stdin); - channel = atoi(buf); - I4B_PUT_4B(cmd, I4B_MON_HANGUP_CHANNEL, channel); - -#ifdef DEBUG - if(debug & DBG_DUMPALL) - dump_event(cmd, I4B_MON_HANGUP_CHANNEL, 0); -#endif - - if((sock_write(monsock, cmd, I4B_MON_HANGUP_SIZE)) == -1) - { - fprintf(stderr, "sock_write failed: %s\n", strerror(errno)); - exit(1); - } - } - break; - - case 9: - close(monsock); - exit(0); - break; - - default: - print_menu(); - break; - } -} - -void -reread(void) -{ - u_int8_t cmd[I4B_MON_CFGREREAD_SIZE]; - I4B_PREP_CMD(cmd, I4B_MON_CFGREREAD_CODE); -#ifdef DEBUG - if(debug & DBG_DUMPALL) - dump_event(cmd, I4B_MON_CFGREREAD_CODE, 0); -#endif - if((sock_write(monsock, cmd, I4B_MON_CFGREREAD_SIZE)) == -1) - { - fprintf(stderr, "sock_write failed: %s\n", strerror(errno)); - exit(1); - } -} - -void -hangup(int ctrl, int chan) -{ - u_int8_t cmd[I4B_MON_HANGUP_SIZE]; - - I4B_PREP_CMD(cmd, I4B_MON_HANGUP_CODE); - I4B_PUT_4B(cmd, I4B_MON_HANGUP_CTRL, ctrl); - I4B_PUT_4B(cmd, I4B_MON_HANGUP_CHANNEL, chan); - -#ifdef DEBUG - if(debug & DBG_DUMPALL) - dump_event(cmd, I4B_MON_HANGUP_CHANNEL, 0); -#endif - - if((sock_write(monsock, cmd, I4B_MON_HANGUP_SIZE)) == -1) - { - fprintf(stderr, "sock_write failed: %s\n", strerror(errno)); - exit(1); - } -} - -/* - * Display menu - */ -static void -print_menu() -{ - if(!fullscreen) - { - printf("Menu: <1> display rights, <2> display monitor connections,\n"); - printf(" <3> reread config file, <4> hangup \n"); - printf(" <9> quit isdnmonitor\n"); - fflush(stdout); - } -} - -static ssize_t -sock_read(int fd, void *buf, size_t nbytes) -{ - size_t nleft; - ssize_t nread; - unsigned char *ptr; - - ptr = buf; - nleft = nbytes; - - while(nleft > 0) - { - if((nread = read(fd, ptr, nleft)) < 0) - { - if(errno == EINTR) - { - nread = 0; - } - else - { - return(-1); - } - } - else if(nread == 0) - { - break; /* EOF */ - } - - nleft -= nread; - ptr += nread; - } - return(nbytes - nleft); -} - -static ssize_t -sock_write(int fd, void *buf, size_t nbytes) -{ - size_t nleft; - ssize_t nwritten; - unsigned char *ptr; - - ptr = buf; - nleft = nbytes; - - while(nleft > 0) - { - if((nwritten = write(fd, ptr, nleft)) <= 0) - { - if(errno == EINTR) - { - nwritten = 0; - } - else - { - return(-1); - } - } - - nleft -= nwritten; - ptr += nwritten; - } - return(nbytes); -} - -static void -mprintf(char *fmt, ...) -{ -#define PRBUFLEN 1024 - char buffer[PRBUFLEN]; - va_list ap; - - va_start(ap, fmt); - vsnprintf(buffer, PRBUFLEN-1, fmt, ap); - va_end(ap); - - if(!fullscreen || (fullscreen && (!curses_ready))) - printf("%s", buffer); - - if(logfilename != NULL) - { - fprintf(lfp, "%s", buffer); - fflush(lfp); - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnmonitor/monitor.h b/usr.sbin/i4b/isdnmonitor/monitor.h deleted file mode 100644 index 4862c4835e3a..000000000000 --- a/usr.sbin/i4b/isdnmonitor/monitor.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) 1998,1999 Martin Husemann. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b daemon - network monitor protocol definition - * ------------------------------------------------ - * - * $Id: monitor.h,v 1.16 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:52:18 1999] - * - *---------------------------------------------------------------------------*/ - -#ifndef _MONITOR_H_ -#define _MONITOR_H_ - -#define DEF_MONPORT 451 /* default monitor TCP port */ - -#ifdef __hpux -#define u_int8_t ubit8 -#define u_int32_t ubit32 -#endif -#ifdef WIN32 -#define u_int8_t BYTE -#define u_int32_t DWORD -#endif - -/* - * The monitor client connects to the isdnd daemon process via a tcp/ip - * connection from a remote machine or via a local (unix domain) socket. - * The daemon accepts multiple connections and verifies access rights. - * On connection establishment the daemon sends initial data telling - * the client the current configuration: number and type of available - * controllers, current connections, channel and interface states - * and the clients access privileges. The client sends an event mask - * telling the daemon which events it is interested in. If the client - * has appropriate rights he may send commands to the daemon. - * - * All multi-byte values are in network byte order! - */ - -/* All data packets transfered are declared as arrays of u_int8_t */ - -/* max stringlength used in this protocol */ -#define I4B_MAX_MON_STRING 256 - -/* max command size from client to server */ -#define I4B_MAX_MON_CLIENT_CMD 16 - -/* Version of the monitor protocol described here */ -#define MPROT_VERSION 0 /* major version no */ -#define MPROT_REL 5 /* release no */ - -/* - * Client access rights - */ -#define I4B_CA_COMMAND_FULL 1 /* may send any command */ -#define I4B_CA_COMMAND_RESTRICTED 2 /* may send 'harmless' commands */ -#define I4B_CA_EVNT_CHANSTATE 16 /* may watch b-channel states */ -#define I4B_CA_EVNT_CALLIN 32 /* may watch incoming calls */ -#define I4B_CA_EVNT_CALLOUT 64 /* may watch outgoing calls */ -#define I4B_CA_EVNT_I4B 128 /* may watch isdnd actions */ - -/* - * General layout of a command packet. All commands have this common - * prefix. It is prepared by the macro I4B_PREP_CMD (s.b.) - */ -#define I4B_MON_CMD 0 /* 2 byte: command code */ -#define I4B_MON_CMD_LEN 2 /* 2 byte: packet length */ -#define I4B_MON_CMD_HDR 4 /* size of header */ - -/* - * Currently events look the same as commands. We do not make - * any guarantee this will remain the same, so a different set - * of macros is used when describing events. Events are prepared - * by I4B_PREP_EVNT (s.b.) - */ -#define I4B_MON_EVNT 0 /* 2 byte: event code */ -#define I4B_MON_EVNT_LEN 2 /* 2 byte: packet length */ -#define I4B_MON_EVNT_HDR 4 /* size of header */ - -/* Initial data send by daemon after connection is established */ -#define I4B_MON_IDATA_SIZE I4B_MON_EVNT_HDR+12 -#define I4B_MON_IDATA_CODE 0 /* event code */ -#define I4B_MON_IDATA_VERSMAJOR I4B_MON_EVNT_HDR+0 /* 2 byte: isdnd major version */ -#define I4B_MON_IDATA_VERSMINOR I4B_MON_EVNT_HDR+2 /* 2 byte: isdnd minor version */ -#define I4B_MON_IDATA_NUMCTRL I4B_MON_EVNT_HDR+4 /* 2 byte: number of controllers */ -#define I4B_MON_IDATA_NUMENTR I4B_MON_EVNT_HDR+6 /* 2 byte: number of controllers */ -#define I4B_MON_IDATA_CLACCESS I4B_MON_EVNT_HDR+8 /* 4 byte: client rights */ - -/* followed by this for every controller */ -#define I4B_MON_ICTRL_SIZE I4B_MON_EVNT_HDR+I4B_MAX_MON_STRING+8 -#define I4B_MON_ICTRL_CODE 1 /* event code */ -#define I4B_MON_ICTRL_NAME I4B_MON_EVNT_HDR+0 /* string: name of controller */ -#define I4B_MON_ICTRL_BUSID I4B_MON_EVNT_HDR+I4B_MAX_MON_STRING+0 /* 2 byte: isdn bus id (reservered) */ -#define I4B_MON_ICTRL_FLAGS I4B_MON_EVNT_HDR+I4B_MAX_MON_STRING+2 /* 4 byte: controller flags (not yet defined) */ -#define I4B_MON_ICTRL_NCHAN I4B_MON_EVNT_HDR+I4B_MAX_MON_STRING+6 /* 2 byte: number of b channels on this controller */ - -/* followed by this for every entry */ -#define I4B_MON_IDEV_SIZE I4B_MON_EVNT_HDR+I4B_MAX_MON_STRING+2 -#define I4B_MON_IDEV_CODE 2 /* event code */ -#define I4B_MON_IDEV_NAME I4B_MON_EVNT_HDR+0 /* string: name of device */ -#define I4B_MON_IDEV_STATE I4B_MON_EVNT_HDR+I4B_MAX_MON_STRING+0 /* 2 byte: state of device */ - -/* - * The client sets it's protocol version and event mask (usually once after - * connection establishement) - */ -#define I4B_MON_CCMD_SETMASK 0x7e /* command code */ -#define I4B_MON_ICLIENT_SIZE I4B_MON_CMD_HDR+8 -#define I4B_MON_ICLIENT_VERMAJOR I4B_MON_CMD_HDR+0 /* 2 byte: protocol major version (always 0 for now) */ -#define I4B_MON_ICLIENT_VERMINOR I4B_MON_CMD_HDR+2 /* 2 byte: protocol minor version (always 0 for now) */ -#define I4B_MON_ICLIENT_EVENTS I4B_MON_CMD_HDR+4 /* 4 byte: client event mask */ - -/* The client requests a list of monitor rights */ -#define I4B_MON_DUMPRIGHTS_CODE 1 -#define I4B_MON_DUMPRIGHTS_SIZE I4B_MON_CMD_HDR /* no parameters */ - -/* - * In response to an I4B_MON_DUMPRIGHTS_CODE command, the daemon sends - * this event: - */ -#define I4B_MON_DRINI_CODE 2 /* event code */ -#define I4B_MON_DRINI_SIZE I4B_MON_EVNT_HDR+2 /* size of packet */ -#define I4B_MON_DRINI_COUNT I4B_MON_EVNT_HDR+0 /* 2 byte: number of records */ - -/* followed by this for each record anounced above */ -#define I4B_MON_DR_CODE 3 -#define I4B_MON_DR_SIZE I4B_MON_EVNT_HDR+13 -#define I4B_MON_DR_RIGHTS I4B_MON_EVNT_HDR+0 /* 4 byte: rights mask */ -#define I4B_MON_DR_NET I4B_MON_EVNT_HDR+4 /* 4 byte: network address */ -#define I4B_MON_DR_MASK I4B_MON_EVNT_HDR+8 /* 4 byte: network mask */ -#define I4B_MON_DR_LOCAL I4B_MON_EVNT_HDR+12 /* 1 byte: non-zero if local socket */ - -/* The client requests a list of monitor connections */ -#define I4B_MON_DUMPMCONS_CODE 2 -#define I4B_MON_DUMPMCONS_SIZE I4B_MON_CMD_HDR /* no parameters */ - -/* - * In response to an I4B_MON_DUMPMCONS_CODE command, the daemon sends - * this event: - */ -#define I4B_MON_DCINI_CODE 4 /* event code */ -#define I4B_MON_DCINI_SIZE I4B_MON_EVNT_HDR+2 /* size of packet */ -#define I4B_MON_DCINI_COUNT I4B_MON_EVNT_HDR+0 /* 2 byte: number of records */ - -/* followed by this for each record anounced above */ -#define I4B_MON_DC_CODE 5 -#define I4B_MON_DC_SIZE I4B_MON_EVNT_HDR+8 -#define I4B_MON_DC_RIGHTS I4B_MON_EVNT_HDR+0 /* 4 byte: rights mask */ -#define I4B_MON_DC_WHO I4B_MON_EVNT_HDR+4 /* 4 byte: network address */ - -/* The client requests a config file rescan */ -#define I4B_MON_CFGREREAD_CODE 3 -#define I4B_MON_CFGREREAD_SIZE I4B_MON_CMD_HDR /* no parameters */ - -/* The client requests to hangup a connection */ -#define I4B_MON_HANGUP_CODE 4 -#define I4B_MON_HANGUP_SIZE I4B_MON_CMD_HDR+8 -#define I4B_MON_HANGUP_CTRL I4B_MON_CMD_HDR+0 /* controller */ -#define I4B_MON_HANGUP_CHANNEL I4B_MON_CMD_HDR+4 /* channel */ - -/* The daemon sends a logfile event */ -#define I4B_MON_LOGEVNT_CODE 6 -#define I4B_MON_LOGEVNT_SIZE I4B_MON_EVNT_HDR+8+2*I4B_MAX_MON_STRING -#define I4B_MON_LOGEVNT_TSTAMP I4B_MON_EVNT_HDR+0 /* 4 byte: timestamp */ -#define I4B_MON_LOGEVNT_PRIO I4B_MON_EVNT_HDR+4 /* 4 byte: syslog priority */ -#define I4B_MON_LOGEVNT_WHAT I4B_MON_EVNT_HDR+8 /* followed by 2 strings: 'what' and 'message' */ -#define I4B_MON_LOGEVNT_MSG I4B_MON_EVNT_HDR+8+I4B_MAX_MON_STRING - -/* The daemon sends a charge event */ -#define I4B_MON_CHRG_CODE 7 -#define I4B_MON_CHRG_SIZE I4B_MON_EVNT_HDR+20 -#define I4B_MON_CHRG_TSTAMP I4B_MON_EVNT_HDR+0 /* 4 byte: timestamp */ -#define I4B_MON_CHRG_CTRL I4B_MON_EVNT_HDR+4 /* 4 byte: channel charged */ -#define I4B_MON_CHRG_CHANNEL I4B_MON_EVNT_HDR+8 /* 4 byte: channel charged */ -#define I4B_MON_CHRG_UNITS I4B_MON_EVNT_HDR+12 /* 4 byte: new charge value */ -#define I4B_MON_CHRG_ESTIMATED I4B_MON_EVNT_HDR+16 /* 4 byte: 0 = charge by network, 1 = calculated estimate */ - -/* The daemon sends a connect event */ -#define I4B_MON_CONNECT_CODE 8 -#define I4B_MON_CONNECT_SIZE I4B_MON_EVNT_HDR+16+4*I4B_MAX_MON_STRING -#define I4B_MON_CONNECT_TSTAMP I4B_MON_EVNT_HDR+0 /* 4 byte: time stamp */ -#define I4B_MON_CONNECT_DIR I4B_MON_EVNT_HDR+4 /* 4 byte: direction (0 = incoming, 1 = outgoing) */ -#define I4B_MON_CONNECT_CTRL I4B_MON_EVNT_HDR+8 /* 4 byte: channel connected */ -#define I4B_MON_CONNECT_CHANNEL I4B_MON_EVNT_HDR+12 /* 4 byte: channel connected */ -#define I4B_MON_CONNECT_CFGNAME I4B_MON_EVNT_HDR+16 /* name of config entry */ -#define I4B_MON_CONNECT_DEVNAME I4B_MON_EVNT_HDR+16+I4B_MAX_MON_STRING /* name of device used for connection */ -#define I4B_MON_CONNECT_REMPHONE I4B_MON_EVNT_HDR+16+2*I4B_MAX_MON_STRING /* remote phone no. */ -#define I4B_MON_CONNECT_LOCPHONE I4B_MON_EVNT_HDR+16+3*I4B_MAX_MON_STRING /* local phone no. */ - -/* The daemon sends a disconnect event */ -#define I4B_MON_DISCONNECT_CODE 9 -#define I4B_MON_DISCONNECT_SIZE I4B_MON_EVNT_HDR+12 -#define I4B_MON_DISCONNECT_TSTAMP I4B_MON_EVNT_HDR+0 /* 4 byte: time stamp */ -#define I4B_MON_DISCONNECT_CTRL I4B_MON_EVNT_HDR+4 /* 4 byte: channel disconnected */ -#define I4B_MON_DISCONNECT_CHANNEL I4B_MON_EVNT_HDR+8 /* 4 byte: channel disconnected */ - -/* The daemon sends an up/down event */ -#define I4B_MON_UPDOWN_CODE 10 -#define I4B_MON_UPDOWN_SIZE I4B_MON_EVNT_HDR+16 -#define I4B_MON_UPDOWN_TSTAMP I4B_MON_EVNT_HDR+0 /* 4 byte: time stamp */ -#define I4B_MON_UPDOWN_CTRL I4B_MON_EVNT_HDR+4 /* 4 byte: channel disconnected */ -#define I4B_MON_UPDOWN_CHANNEL I4B_MON_EVNT_HDR+8 /* 4 byte: channel disconnected */ -#define I4B_MON_UPDOWN_ISUP I4B_MON_EVNT_HDR+12 /* 4 byte: interface is up */ - -/* The daemon sends a L1/L2 status change event */ -#define I4B_MON_L12STAT_CODE 11 -#define I4B_MON_L12STAT_SIZE I4B_MON_EVNT_HDR+16 -#define I4B_MON_L12STAT_TSTAMP I4B_MON_EVNT_HDR+0 /* 4 byte: time stamp */ -#define I4B_MON_L12STAT_CTRL I4B_MON_EVNT_HDR+4 /* 4 byte: controller */ -#define I4B_MON_L12STAT_LAYER I4B_MON_EVNT_HDR+8 /* 4 byte: layer */ -#define I4B_MON_L12STAT_STATE I4B_MON_EVNT_HDR+12 /* 4 byte: state */ - -/* The daemon sends a TEI change event */ -#define I4B_MON_TEI_CODE 12 -#define I4B_MON_TEI_SIZE I4B_MON_EVNT_HDR+12 -#define I4B_MON_TEI_TSTAMP I4B_MON_EVNT_HDR+0 /* 4 byte: time stamp */ -#define I4B_MON_TEI_CTRL I4B_MON_EVNT_HDR+4 /* 4 byte: controller */ -#define I4B_MON_TEI_TEI I4B_MON_EVNT_HDR+8 /* 4 byte: tei */ - -/* The daemon sends an accounting message event */ -#define I4B_MON_ACCT_CODE 13 -#define I4B_MON_ACCT_SIZE I4B_MON_EVNT_HDR+28 -#define I4B_MON_ACCT_TSTAMP I4B_MON_EVNT_HDR+0 /* 4 byte: time stamp */ -#define I4B_MON_ACCT_CTRL I4B_MON_EVNT_HDR+4 /* 4 byte: controller */ -#define I4B_MON_ACCT_CHAN I4B_MON_EVNT_HDR+8 /* 4 byte: channel */ -#define I4B_MON_ACCT_OBYTES I4B_MON_EVNT_HDR+12 /* 4 byte: outbytes */ -#define I4B_MON_ACCT_OBPS I4B_MON_EVNT_HDR+16 /* 4 byte: outbps */ -#define I4B_MON_ACCT_IBYTES I4B_MON_EVNT_HDR+20 /* 4 byte: inbytes */ -#define I4B_MON_ACCT_IBPS I4B_MON_EVNT_HDR+24 /* 4 byte: inbps */ - -/* macros for setup/decoding of protocol packets */ - -/* clear a record */ -#define I4B_CLEAR(r) memset(&(r), 0, sizeof(r)); - -/* prepare a record as event or command */ -#define I4B_PREP_EVNT(r, e) { \ - I4B_CLEAR(r); \ - I4B_PUT_2B(r, I4B_MON_EVNT, e); \ - I4B_PUT_2B(r, I4B_MON_EVNT_LEN, sizeof(r)); \ -} -#define I4B_PREP_CMD(r, c) { \ - I4B_CLEAR(r); \ - I4B_PUT_2B(r, I4B_MON_CMD, c); \ - I4B_PUT_2B(r, I4B_MON_CMD_LEN, sizeof(r)); \ -} - -/* put 1, 2 or 4 bytes in network byte order into a record at offset off */ -#define I4B_PUT_1B(r, off, val) { ((u_int8_t*)(r))[off] = (val) & 0x00ff; } -#define I4B_PUT_2B(r, off, val) { I4B_PUT_1B(r, off, val >> 8); I4B_PUT_1B(r, off+1, val); } -#define I4B_PUT_4B(r, off, val) { I4B_PUT_1B(r, off, val >> 24); I4B_PUT_1B(r, off+1, val >> 16); I4B_PUT_1B(r, off+2, val >> 8); I4B_PUT_1B(r, off+3, val); } - -/* get 1, 2 or 4 bytes in network byte order from a record at offset off */ -#define I4B_GET_1B(r, off) (((u_int8_t*)(r))[off]) -#define I4B_GET_2B(r, off) ((((u_int8_t*)(r))[off]) << 8) | (((u_int8_t*)(r))[off+1]) -#define I4B_GET_4B(r, off) ((((u_int8_t*)(r))[off]) << 24) | ((((u_int8_t*)(r))[off+1]) << 16) | ((((u_int8_t*)(r))[off+2]) << 8) | (((u_int8_t*)(r))[off+3]) - -/* - * put a string into record r at offset off, make sure it's not to long - * and proper terminate it - */ -#define I4B_PUT_STR(r, off, str) { \ - strncpy((r)+(off), (str), I4B_MAX_MON_STRING); \ - (r)[(off)+I4B_MAX_MON_STRING-1] = (u_int8_t)0; } - -#endif /* _MONITOR_H_ */ - diff --git a/usr.sbin/i4b/isdnmonitor/monprivate.h b/usr.sbin/i4b/isdnmonitor/monprivate.h deleted file mode 100644 index d6763449c898..000000000000 --- a/usr.sbin/i4b/isdnmonitor/monprivate.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b remote monitor - private header - * ----------------------------------- - * - * $Id: monprivate.h,v 1.10 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:52:25 1999] - * - *---------------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <errno.h> -#include <signal.h> - -#ifndef WIN32 -#include <unistd.h> -#include <syslog.h> -#include <regex.h> -#include <curses.h> -#include <fcntl.h> - -#include <sys/param.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#endif - -/*---------------------------------------------------------------------------* - * definitions in i4b_ioctl.h, do something for other systems - *---------------------------------------------------------------------------*/ -#if defined (__FreeBSD__) || defined(__NetBSD__) || \ - defined (__OpenBSD__) || defined(__bsdi__) - -#include <i4b/i4b_ioctl.h> - -#else - -#define FOREIGN 1 /* we are running on a "foreign" OS */ - -#define I4B_TIME_FORMAT "%d.%m.%Y %H:%M:%S" -#define VERSION 0 -#define REL 0 -#define STEP 0 - -#endif - -/*---------------------------------------------------------------------------* - * some general definitions - *---------------------------------------------------------------------------*/ -#define GOOD 0 /* general "good" or "ok" return*/ -#define ERROR (-1) /* general error return */ -#define WARNING (-2) /* warning return */ -#define INVALID (-1) /* an invalid integer */ - -/*---------------------------------------------------------------------------* - * state definitions - *---------------------------------------------------------------------------*/ -#define ST_INIT 0 /* initial data */ -#define ST_ICTRL 1 /* initial controller list */ -#define ST_IDEV 2 /* initial entry devicename list */ -#define ST_ANYEV 3 /* any event */ -#define ST_RIGHT 4 /* one record in a list of monitor rights */ -#define ST_CONNS 5 /* monitor connections */ - -/*---------------------------------------------------------------------------* - * curses fullscreen display definitions - *---------------------------------------------------------------------------*/ -/* window dimensions */ -#define UPPER_B 2 /* upper window start */ - -/* horizontal positions for upper window */ -#define H_CNTL 0 /* controller */ -#define H_TEI 2 /* TEI */ -#define H_CHAN (H_TEI+4) /* channel */ -#define H_TELN (H_CHAN+2) /* telephone number */ -#define H_IFN (H_TELN+23) /* interfacename */ -#define H_IO (H_IFN+7) /* incoming or outgoing */ -#define H_OUT (H_IO+4) /* # of bytes out */ -#define H_OUTBPS (H_OUT+11) /* bytes per second out */ -#define H_IN (H_OUTBPS+5) /* # of bytes in */ -#define H_INBPS (H_IN+11) /* bytes per second in */ -#define H_UNITS (H_INBPS+6) /* # of charging units */ - -/* fullscreen mode menu window */ -#define WMENU_LEN 35 /* width of menu window */ -#define WMENU_TITLE "Command" /* title string */ -#define WMENU_POSLN 10 /* menu position, line */ -#define WMENU_POSCO 5 /* menu position, col */ -#define WMITEMS 4 /* no of menu items */ -#define WMENU_HGT (WMITEMS + 4) /* menu window height */ - -#define WREFRESH 0 -#define WHANGUP 1 -#define WREREAD 2 -#define WQUIT 3 - -#define WMTIMEOUT 5 /* timeout in seconds */ - -/*---------------------------------------------------------------------------* - * misc - *---------------------------------------------------------------------------*/ -#define CHPOS(uctlr, uchan) (((uctlr)*2) + (uchan)) - -/*---------------------------------------------------------------------------* - * remote state - *---------------------------------------------------------------------------*/ - -#define MAX_CTRL 4 - -typedef struct remstate { - int ch1state; - int ch2state; -} remstate_t; - -/*---------------------------------------------------------------------------* - * global variables - *---------------------------------------------------------------------------*/ -#ifdef MAIN - -remstate_t remstate[MAX_CTRL]; - -int nctrl = 0; /* # of controllers available */ -int curses_ready = 0; /* curses initialized */ -int do_bell = 0; -int nentries = 0; -int fullscreen = 0; -int debug_noscreen = 0; - -#ifndef WIN32 -WINDOW *upper_w; /* curses upper window pointer */ -WINDOW *mid_w; /* curses mid window pointer */ -WINDOW *lower_w; /* curses lower window pointer */ -#endif - -char devbuf[256]; - -char *sockpath = NULL; -char *hostname = NULL; -int portno; - -#else /* !MAIN */ - -remstate_t remstate[MAX_CTRL]; - -int nctrl; -int curses_ready; -int do_bell; -int nentries; -int fullscreen; -int debug_noscreen; - -WINDOW *upper_w; -WINDOW *mid_w; -WINDOW *lower_w; - -char devbuf[256]; - -char *sockpath; -char *hostname; -int portno; - -#endif - -extern void do_exit ( int exitval ); -extern void do_menu ( void ); -extern void init_screen ( void ); -extern void display_charge ( int pos, int charge ); -extern void display_ccharge ( int pos, int units ); -extern void display_connect(int pos, int dir, char *name, char *remtel, char *dev); -extern void display_acct ( int pos, int obyte, int obps, int ibyte, int ibps ); -extern void display_disconnect ( int pos ); -extern void display_updown ( int pos, int updown, char *device ); -extern void display_l12stat ( int controller, int layer, int state ); -extern void display_tei ( int controller, int tei ); - -extern void reread(void); -extern void hangup(int ctrl, int chan); - - diff --git a/usr.sbin/i4b/isdnphone/Makefile b/usr.sbin/i4b/isdnphone/Makefile deleted file mode 100644 index 3527e8cef36d..000000000000 --- a/usr.sbin/i4b/isdnphone/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -PROG= isdnphone -MAN= isdnphone.8 -SRCS= main.c display.c audio.c isdn.c - -DPADD= ${LIBCURSES} -LDADD= -lcurses - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/isdnphone/audio.c b/usr.sbin/i4b/isdnphone/audio.c deleted file mode 100644 index 2dc88d6afc2e..000000000000 --- a/usr.sbin/i4b/isdnphone/audio.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - audio operations - * ============================ - * - * $Id: audio.c,v 1.5 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:52:39 1999] - * - *----------------------------------------------------------------------------*/ - -#include "defs.h" - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -init_audio(char *audiodevice) -{ - int ret; - int fd; - u_long fmt = 0; - - snd_chan_param pa; - struct snd_size sz; - snd_capabilities soundcaps; - - if((fd = open(audiodevice, O_RDWR)) < 0) - { - fprintf(stderr, "unable to open %s: %s\n", audiodevice, strerror(errno)); - return(-1); - } - - ret = ioctl(fd, AIOGCAP, &soundcaps); - - if(ret == -1) - { - fprintf(stderr, "ERROR: ioctl AIOGCAP %s: %s\n", audiodevice, strerror(errno)); - return(-1); - } - - fmt = soundcaps.formats; - - if((fmt & AFMT_FULLDUPLEX) && (!(fmt & AFMT_WEIRD))) - { -#ifdef NOTDEF - if(fmt & AFMT_A_LAW) - { - play_fmt = rec_fmt = AFMT_A_LAW; - } - else -#endif - if(fmt & AFMT_MU_LAW) - { - play_fmt = rec_fmt = AFMT_MU_LAW; - } - else - { - printf("sorry, A-law or u-law not supported!\n"); - close(fd); - return(-1); - } - } - else - { - printf("no full-duplex available!\n"); - close (fd); - return(-1); - } - - pa.play_format = play_fmt; - pa.rec_format = rec_fmt; - pa.play_rate = pa.rec_rate = AUDIORATE; - - ret = ioctl(fd, AIOSFMT, &pa); - - if(ret == -1) - { - fprintf(stderr, "ERROR: ioctl AIOSFMT %s: %s\n", audiodevice, strerror(errno)); - return(-1); - } - - sz.play_size = BCH_MAX_DATALEN; - sz.rec_size = BCH_MAX_DATALEN; - - ret = ioctl(fd, AIOSSIZE, &sz); - - if(ret == -1) - { - fprintf(stderr, "ERROR: ioctl AIOSSIZE %s: %s\n", audiodevice, strerror(errno)); - return(-1); - } - - return(fd); -} - -/*---------------------------------------------------------------------------* - * audio device has speech data from microphone - *---------------------------------------------------------------------------*/ -void -audio_hdlr(void) -{ - unsigned char buffer[BCH_MAX_DATALEN]; - int ret; - - ret = read(audiofd, buffer, BCH_MAX_DATALEN); - - if(ret < 0) - { - fatal("read audio failed: %s", strerror(errno)); - } - - debug("audio_hdlr: read %d bytes\n", ret); - - if(ret > 0) - { - telwrite(ret, buffer); - } -} - -/*---------------------------------------------------------------------------* - * write audio data to loudspeaker - *---------------------------------------------------------------------------*/ -void -audiowrite(int len, unsigned char *buf) -{ - if((write(audiofd, buf, len)) < 0) - { - fatal("write audio failed: %s", strerror(errno)); - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnphone/defs.h b/usr.sbin/i4b/isdnphone/defs.h deleted file mode 100644 index fade94b40c57..000000000000 --- a/usr.sbin/i4b/isdnphone/defs.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - header file - * ======================= - * - * $Id: defs.h,v 1.6 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:52:46 1999] - * - *----------------------------------------------------------------------------*/ - -#include <ncurses.h> -#include <stdio.h> -#include <stdarg.h> -#include <signal.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <ctype.h> - -#include <sys/stat.h> -#include <sys/wait.h> -#include <sys/ioctl.h> -#include <sys/soundcard.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/param.h> - -#include <i4b/i4b_ioctl.h> -#include <i4b/i4b_tel_ioctl.h> - -/* device file prefixes */ - -#define I4BTELDEVICE "/dev/i4btel" -#define I4BTELDDEVICE "/dev/i4bteld" -#define AUDIODEVICE "/dev/audio" - -#define GOOD 0 -#define ERROR (-1) -#define WARNING (-2) - -/* main window dimensions */ - -#define MW_ROW 5 -#define MW_COL 8 - -#define MW_WIDTH 60 -#define MW_HEIGHT 8 - -#define DB_ROW 15 -#define DB_COL 1 -#define DB_WID 79 -#define DB_HGT 9 - -#define MW_STATEY 2 -#define MW_STATEX 1 -#define MW_STX 10 - -#define MW_NUMY 4 -#define MW_NUMX 1 -#define MW_NUX 10 - -#define MW_MSGY 6 -#define MW_MSGX 1 -#define MW_MSX 10 - -/* fullscreen mode menu window */ - -#define WMITEMS 4 /* no of items */ -#define WMENU_LEN 18 /* window width */ -#define WMENU_HGT (WMITEMS+4) /* window height */ -#define WMENU_TITLE "Command" -#define WMENU_POSLN 8 /* window position: lines */ -#define WMENU_POSCO 20 /* window position: columns */ - -#define CR 0x0d -#define LF 0x0a -#define TAB 0x09 -#define CNTRL_D 0x04 -#define CNTRL_L 0x0c - -#define ST_IDLE 0 -#define ST_DIALING 1 -#define ST_ACTIVE 2 -#define ST_MAX 2 - -#define AUDIORATE 8000 - -#ifdef MAIN - -WINDOW *main_w; /* curses main window pointer */ -WINDOW *dbg_w; - -int curses_ready = 0; /* flag, curses display is initialized */ -int state = ST_IDLE; - -char *states[] = { - "IDLE", - "DIALING", - "ACTIVE" -}; - -int dialerfd = -1; -int audiofd = -1; -int telfd = -1; -int curx; -char numberbuffer[TELNO_MAX]; - -int play_fmt = AFMT_MU_LAW; -int rec_fmt = AFMT_MU_LAW; - -int opt_unit = 0; -int opt_d = 0; -#else - -extern WINDOW *main_w; -extern WINDOW *dbg_w; - -extern int curses_ready; -extern int state; - -extern char *states[]; - -extern int dialerfd; -extern int audiofd; -extern int telfd; -extern int curx; -extern char numberbuffer[]; - -extern int play_fmt; -extern int rec_fmt; - -int opt_unit; -int opt_d; - -#endif - -extern void audio_hdlr ( void ); -extern void tel_hdlr ( void ); -extern void init_mainw ( void ); -extern int init_audio ( char * ); -extern void do_menu ( void ); -extern int main ( int argc, char **argv ); -extern void do_quit ( int exitval ); -extern void fatal ( char *fmt, ... ); -extern void message ( char *fmt, ... ); -extern void do_dial ( char *number ); -extern void do_hangup ( void ); - -extern void audiowrite ( int, unsigned char * ); -extern void telwrite ( int, unsigned char * ); - -extern void newstate ( int newstate ); - -int init_dial(char *device); -void dial_hdlr(void); -int init_tel(char *device); - -extern void debug ( char *fmt, ... ); - -/* EOF */ diff --git a/usr.sbin/i4b/isdnphone/display.c b/usr.sbin/i4b/isdnphone/display.c deleted file mode 100644 index 1dff9a16f3f9..000000000000 --- a/usr.sbin/i4b/isdnphone/display.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - some display operations - * =================================== - * - * $Id: display.c,v 1.4 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:52:55 1999] - * - *----------------------------------------------------------------------------*/ - -#include "defs.h" - -/*---------------------------------------------------------------------------* - * init curses fullscreen display - *---------------------------------------------------------------------------*/ -void -init_mainw(void) -{ - char buffer[512]; - - initscr(); /* curses init */ - - if((COLS < 80) || (LINES < 24)) - fatal(0, "ERROR, minimal screensize must be 80x24, is %dx%d, terminating!", COLS, LINES); - - - if((main_w = newwin(MW_HEIGHT, MW_WIDTH, MW_ROW, MW_COL)) == NULL) - fatal("ERROR, curses init main window, terminating!"); - - if(opt_d) - { - if((dbg_w = newwin(DB_HGT, DB_WID, DB_ROW, DB_COL)) == NULL) - fatal("ERROR, curses init debug window, terminating!"); - scrollok(dbg_w, TRUE); - } - - raw(); /* raw input */ - noecho(); /* do not echo input */ - keypad(stdscr, TRUE); /* use special keys */ - keypad(main_w, TRUE); /* use special keys */ - - box(main_w, 0, 0); - - sprintf(buffer, "isdnphone %d.%d ", VERSION, REL); - - wstandout(main_w); - mvwaddstr(main_w, 0, (MW_WIDTH / 2) - (strlen(buffer) / 2), buffer); - wstandend(main_w); - - mvwaddstr(main_w, MW_STATEY, MW_STATEX, " state: "); - mvwprintw(main_w, MW_STATEY, MW_STX, "%s", states[state]); - wmove(main_w, MW_STATEY+1, 1); - whline(main_w, 0, MW_WIDTH-2); - - mvwaddstr(main_w, MW_NUMY, MW_NUMX, " number: "); - wmove(main_w, MW_NUMY+1, 1); - whline(main_w, 0, MW_WIDTH-2); - - mvwaddstr(main_w, MW_MSGY, MW_MSGX, "message: "); - - wrefresh(main_w); - - curses_ready = 1; -} - -/*---------------------------------------------------------------------------* - * curses menu for fullscreen command mode - *---------------------------------------------------------------------------*/ -void -do_menu(void) -{ - static char *menu[WMITEMS] = - { - "Hangup", -#define HANGUP 0 - "Dial", -#define DIAL 1 - "Refresh", -#define REFRESH 2 - "Exit", -#define EXIT 3 - }; - - WINDOW *menu_w; - int c; - int mpos; - - /* create a new window in the lower screen area */ - - if((menu_w = newwin(WMENU_HGT, WMENU_LEN, WMENU_POSLN, WMENU_POSCO )) == NULL) - return; - - keypad(menu_w, TRUE); /* use special keys */ - - /* draw border around the window */ - - box(menu_w, 0, 0); - - /* add a title */ - - wstandout(menu_w); - mvwaddstr(menu_w, 0, (WMENU_LEN / 2) - (strlen(WMENU_TITLE) / 2), WMENU_TITLE); - wstandend(menu_w); - - /* fill the window with the menu options */ - - for(mpos=0; mpos <= (WMITEMS-1); mpos++) - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - - /* highlight the first menu option */ - - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - - /* input loop */ - - for(;;) - { - wrefresh(menu_w); - - c = wgetch(menu_w); - - switch(c) - { - case TAB: - case KEY_DOWN: /* down-move cursor */ - case ' ': - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - mpos++; - if(mpos >= WMITEMS) - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - break; - - case KEY_UP: /* up-move cursor */ - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - if(mpos) - mpos--; - else - mpos = WMITEMS-1; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - break; - - case 'R': - case 'r': - wrefresh(curscr); - goto mexit; - - case 'E': - case 'e': - case 'Q': - case 'q': - case 'X': - case 'x': - do_quit(0); - goto mexit; - break; - - case 'H': - case 'h': - do_hangup(); - goto mexit; - break; - - case 'D': - case 'd': - goto mexit; - break; - - case CR: - case LF: /* exec highlighted option */ -#ifdef KEY_ENTER - case KEY_ENTER: -#endif - switch(mpos) - { - case DIAL: - goto mexit; - break; - case HANGUP: - do_hangup(); - goto mexit; - break; - case REFRESH: - wrefresh(curscr); - break; - case EXIT: - do_quit(0); - break; - } - goto mexit; - break; - - default: - goto mexit; - break; - } - } - -mexit: - /* delete the menu window */ - - wclear(menu_w); - wrefresh(menu_w); - delwin(menu_w); - - /* re-display the original lower window contents */ - - touchwin(main_w); - wrefresh(main_w); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnphone/isdn.c b/usr.sbin/i4b/isdnphone/isdn.c deleted file mode 100644 index 34719c727269..000000000000 --- a/usr.sbin/i4b/isdnphone/isdn.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - isdn (i4b) handling - * =============================== - * - * $Id: isdn.c,v 1.4 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:53:05 1999] - * - *---------------------------------------------------------------------------*/ - -#include "defs.h" - -/*---------------------------------------------------------------------------* - * dialer init - *---------------------------------------------------------------------------*/ -int -init_dial(char *device) -{ - int ret; - - if((ret = open(device, O_RDWR)) < 0) - { - fprintf(stderr, "unable to open %s: %s\n", device, strerror(errno)); - return(-1); - } - return(ret); -} - -/*---------------------------------------------------------------------------* - * i4bteld data available handler - *---------------------------------------------------------------------------*/ -void -dial_hdlr(void) -{ - char result; - - if((read (dialerfd, &result, 1) < 0)) - { - fatal("read failed: %s", strerror(errno)); - } - - switch(result) - { - case RSP_CONN: - newstate(ST_ACTIVE); - message("connected to remote!"); - break; - - case RSP_BUSY: - message("remote is busy!"); - break; - - case RSP_HUP: - newstate(ST_IDLE); - message("disconnected from remote!"); - break; - - case RSP_NOA: - message("no answer from remote!"); - break; - - default: - message("unknown response = 0x%2x!", result); - break; - } -} - -/*---------------------------------------------------------------------------* - * telephone init - *---------------------------------------------------------------------------*/ -int -init_tel(char *device) -{ - int ret; - int format; - - if(play_fmt == AFMT_MU_LAW) - format = CVT_ALAW2ULAW; - else - format = CVT_NONE; - - if((ret = open(device, O_RDWR)) < 0) - fatal("unable to open %s: %s\n", device, strerror(errno)); - - if((ioctl(ret, I4B_TEL_SETAUDIOFMT, &format)) < 0) - fatal("ioctl I4B_TEL_SETAUDIOFMT failed: %s", strerror(errno)); - - return(ret); -} - -/*---------------------------------------------------------------------------* - * dial number - *---------------------------------------------------------------------------*/ -void -do_dial(char *number) -{ - char commandbuffer[80]; - sprintf(commandbuffer, "D%s", number); - - if((write(dialerfd, commandbuffer, strlen(commandbuffer))) < 0) - { - fatal("write commandbuffer failed: %s", strerror(errno)); - } -} - -/*---------------------------------------------------------------------------* - * hangup - *---------------------------------------------------------------------------*/ -void -do_hangup(void) -{ - char commandbuffer[80]; - - if(state == ST_IDLE) - { - message("tried hangup while ST_IDLE"); - return; - } - - sprintf(commandbuffer, "H"); - - if((write(dialerfd, commandbuffer, strlen(commandbuffer))) < 0) - { - fatal("write commandbuffer failed: %s", strerror(errno)); - } -} - -/*---------------------------------------------------------------------------* - * i4btel speech data available handler - *---------------------------------------------------------------------------*/ -void -tel_hdlr(void) -{ - unsigned char buffer[BCH_MAX_DATALEN]; - int ret; - - ret = read(telfd, buffer, BCH_MAX_DATALEN); - - if(ret < 0) - { - fatal("read telfd failed: %s", strerror(errno)); - } - - debug("tel_hdlr: read %d bytes\n", ret); - - if(ret > 0) - { - audiowrite(ret, buffer); - } -} - -/*---------------------------------------------------------------------------* - * write audio data to ISDN - *---------------------------------------------------------------------------*/ -void -telwrite(int len, unsigned char *buf) -{ - if((write(telfd, buf, len)) < 0) - { - fatal("write tel failed: %s", strerror(errno)); - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnphone/isdnphone.8 b/usr.sbin/i4b/isdnphone/isdnphone.8 deleted file mode 100644 index 5ba4782ccd3c..000000000000 --- a/usr.sbin/i4b/isdnphone/isdnphone.8 +++ /dev/null @@ -1,88 +0,0 @@ -.\" -.\" Copyright (c) 1999, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Tue Aug 27 16:42:12 2002] -.\" -.\" -.Dd August 27, 2002 -.Dt ISDNPHONE 8 -.Os -.Sh NAME -.Nm isdnphone -.Nd telephone dialing and more for isdn4bsd -.Sh SYNOPSIS -.Nm -.Op Fl d -.Op Fl h -.Op Fl k Ar string -.Op Fl n Ar number -.Op Fl u Ar unit -.Op Fl v -.Op Fl w -.Sh DESCRIPTION -The -.Nm -utility -is part of the isdn4bsd package and is used to handle dialing and hangup -for the telephone control interfaces -.Pa /dev/i4bteld Ns Aq Ar n . -.Pp -Options are provided to dial out or hang up using command line parameters -(for use in scripts) or, if none of those options are specified, bring up -a curses-based full-screen interface. -.Pp -The following options are available: -.Bl -tag -width indent -.It Fl d -Enable debugging message display. -.It Fl h -Hang up a possibly open telephone connection on the selected interface. -.It Fl k -Send the specified string using the keypad facility information element. -.It Fl n -Dial the specified number on the selected interface. -.It Fl u -Set the unit number to specify the interface used. -.It Fl v -Enable verbose result messages for dialling (-n and -w) -.It Fl w -After dialling (using the -n option), wait for the first result message. -.El -.Sh FILES -.Bl -tag -width indent -compact -.It Pa /dev/i4bteld Ns Aq Ar n -.El -.Sh EXAMPLES -The command: -.Dl "isdnphone -n 1234" -.Pp -dials calls the number 1234 to establish a call on -.Pa /dev/i4btel0 -.Sh AUTHORS -The -.Nm -utility and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/isdnphone/main.c b/usr.sbin/i4b/isdnphone/main.c deleted file mode 100644 index 8a9b92a39e19..000000000000 --- a/usr.sbin/i4b/isdnphone/main.c +++ /dev/null @@ -1,533 +0,0 @@ -/* - * Copyright (c) 1999, 2002 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - main module - * ======================= - * - * $FreeBSD$ - * - * last edit-date: [Tue Aug 27 16:38:55 2002] - * - *---------------------------------------------------------------------------*/ - -#define MAIN -#include "defs.h" - -static void kbd_hdlr(void); - -/*---------------------------------------------------------------------------* - * usage display and exit - *---------------------------------------------------------------------------*/ -static void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "isdnphone - i4b phone program, version %d.%d.%d\n",VERSION, REL, STEP); - fprintf(stderr, "usage: isdnphone -d -h -k <string> -n <number> -u <unit> -v -w\n"); - fprintf(stderr, " -d debug\n"); - fprintf(stderr, " -h hangup\n"); - fprintf(stderr, " -k string keypad string\n"); - fprintf(stderr, " -n number dial number\n"); - fprintf(stderr, " -u unit set unit number\n"); - fprintf(stderr, " -v be verbose\n"); - fprintf(stderr, " -w wait for response (with -n)\n"); - fprintf(stderr, "\n"); - exit(1); -} - -/*---------------------------------------------------------------------------* - * program entry - *---------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - int c; - char namebuffer[128]; - int bschar; - int ret; - int opt_n = 0; - int opt_s = 0; - int opt_h = 0; - int opt_k = 0; - int opt_v = 0; - int opt_w = 0; - char *number = ""; - char *subaddr = ""; - - numberbuffer[0] = '\0'; - - while ((c = getopt(argc, argv, "dhk:n:s:u:w")) != -1) - { - switch(c) - { - case 'd': - opt_d = 1; - break; - - case 'h': - opt_h = 1; - break; - - case 'k': - number = optarg; - opt_k = 1; - break; - - case 'n': - number = optarg; - opt_n = 1; - break; - - case 's': - subaddr = optarg; - opt_s = 1; - break; - - case 'u': - opt_unit = atoi(optarg); - if(opt_unit < 0 || opt_unit > 9) - usage(); - break; - - case 'v': - opt_v = 1; - break; - - case 'w': - opt_w = 1; - break; - - case '?': - default: - usage(); - break; - } - } - - sprintf(namebuffer,"%s%d", I4BTELDDEVICE, opt_unit); - - if((dialerfd = init_dial(namebuffer)) == -1) - exit(1); - - if(opt_n || opt_h || opt_k) - { - char commandbuffer[80]; - int exitval = 0; - - /* commandline operation goes here */ - - if(opt_n) - { - if(opt_s) - sprintf(commandbuffer, "D%s*%s", number, subaddr); - else - sprintf(commandbuffer, "D%s", number); - - } - else if(opt_k) - { - sprintf(commandbuffer, "K%s", number); - - } - else if(opt_h) - { - sprintf(commandbuffer, "H"); - } - - if((ret = write(dialerfd, commandbuffer, strlen(commandbuffer))) < 0) - { - fprintf(stderr, "write commandbuffer failed: %s", strerror(errno)); - exit(1); - } - - if(opt_n && opt_w) - { - char result; - - if((read (dialerfd, &result, 1) < 0)) - { - exitval = 99; - if(opt_v) - printf("error\n"); - fprintf(stderr, "error, read failed: %s\n", strerror(errno)); - } - else - { - switch(result) - { - case RSP_CONN: - exitval = 0; - if(opt_v) - printf("connected\n"); - break; - - case RSP_BUSY: - exitval = 1; - if(opt_v) - printf("busy\n"); - break; - - case RSP_HUP: - exitval = 2; - if(opt_v) - printf("disconnected\n"); - break; - - case RSP_NOA: - exitval = 3; - if(opt_v) - printf("noanswer\n"); - break; - - default: - exitval = 99; - if(opt_v) - printf("error\n"); - fprintf(stderr, "unknown response = 0x%2x!", result); - break; - } - } - } - - close(dialerfd); - - exit(exitval); - } - - if((audiofd = init_audio(AUDIODEVICE)) == -1) - exit(1); - - /* fullscreen operation here */ - - init_mainw(); - - bschar = erasechar(); - curx = 0; - - wmove(main_w, MW_NUMY, MW_NUX + curx); - - /* go into loop */ - - for (;;) - { - int maxfd = 0; - fd_set set; - struct timeval timeout; - - FD_ZERO(&set); - - FD_SET(STDIN_FILENO, &set); - if(STDIN_FILENO > maxfd) - maxfd = STDIN_FILENO; - - FD_SET(dialerfd, &set); - if(dialerfd > maxfd) - maxfd = dialerfd; - - if(state == ST_ACTIVE) - { - if(audiofd != -1) - { - FD_SET(audiofd, &set); - if(audiofd > maxfd) - maxfd = audiofd; - } - - if(telfd != -1) - { - FD_SET(telfd, &set); - if(telfd > maxfd) - maxfd = telfd; - } - } - - timeout.tv_sec = 2; - timeout.tv_usec = 0; - - wrefresh(main_w); - - /* if no char is available within timeout, do something */ - -#ifdef NOTDEF - ret = select(maxfd+1, &set, NULL, NULL, &timeout); -#else - ret = select(maxfd+1, &set, NULL, NULL, NULL); -#endif - - if(ret > 0) - { - if((telfd != -1) && (FD_ISSET(telfd, &set))) - { - message("select from ISDN"); - tel_hdlr(); - } - if((audiofd != -1) && (FD_ISSET(audiofd, &set))) - { - message("select from audio"); - audio_hdlr(); - } - if(FD_ISSET(dialerfd, &set)) - { - message("select from tel"); - dial_hdlr(); - } - if(FD_ISSET(STDIN_FILENO, &set)) - { - message("select from kbd"); - kbd_hdlr(); - } - } - } - do_quit(0); - - return(0); -} - -/*---------------------------------------------------------------------------* - * keyboard character available handler - *---------------------------------------------------------------------------*/ -static void -kbd_hdlr(void) -{ - int kchar; - - kchar = wgetch(main_w); /* get char */ - - switch (kchar) - { - case CR: - case LF: -#ifdef KEY_ENTER - case KEY_ENTER: -#endif - if((state == ST_IDLE) && - (numberbuffer[0] != '\0')) - { - message("dialing ....."); - do_dial(&numberbuffer[0]); - } - else - { - do_menu(); - } - break; - - case CNTRL_D: - if(state == ST_IDLE) - { - do_quit(0); - } - else - { - message("cannot exit while not idle!"); - beep(); - } - - break; - - case CNTRL_L: /* refresh */ - touchwin(curscr); - wrefresh(curscr); - break; - - case KEY_BACKSPACE: - case KEY_DC: - if (curx == 0) - break; - - curx--; - mvwaddch(main_w, MW_NUMY, MW_NUX + curx, ' '); - numberbuffer[curx] = '\0'; - wmove(main_w, MW_NUMY, MW_NUX + curx); - - if(curx == 0) - message(" "); - - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if(curx > (TELNO_MAX-1)) - break; - - mvwaddch(main_w, MW_NUMY, MW_NUX + curx, kchar); - - numberbuffer[curx] = kchar; - - curx++; - - numberbuffer[curx] = '\0'; - - message("press ENTER to dial number ....."); - break; - } -} - -/*---------------------------------------------------------------------------* - * exit program - *---------------------------------------------------------------------------*/ -void -do_quit(int exitval) -{ - close(dialerfd); - move(LINES-1, 0); - clrtoeol(); - refresh(); - endwin(); - exit(exitval); -} - -/*---------------------------------------------------------------------------* - * fatal error exit - *---------------------------------------------------------------------------*/ -void -fatal(char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - do_hangup(); /* failsafe */ - - if(curses_ready) - { - close(dialerfd); - move(LINES-1, 0); - clrtoeol(); - refresh(); - endwin(); - } - - fprintf(stderr, "\nFatal error: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n\n"); - - va_end(ap); - - exit(1); -} - -/*---------------------------------------------------------------------------* - * message printing - *---------------------------------------------------------------------------*/ -void -message(char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - if(curses_ready) - { - int i; - char sbuf[MW_WIDTH]; - - wmove(main_w, MW_MSGY, MW_MSX); - vsnprintf(sbuf, MW_WIDTH-MW_MSX-1, fmt, ap); - waddstr(main_w, sbuf); - for(i=strlen(sbuf);i < MW_WIDTH-MW_MSX-2; i++) - waddch(main_w, ' '); - wmove(main_w, MW_NUMY, MW_NUX + curx); - wrefresh(main_w); - } - else - { - fprintf(stderr, "ERROR: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); - } - - va_end(ap); -} - -/*---------------------------------------------------------------------------* - * message printing - *---------------------------------------------------------------------------*/ -void -debug(char *fmt, ...) -{ - va_list ap; - - if(opt_d == 0) - return; - - va_start(ap, fmt); - - vwprintw(dbg_w, fmt, ap); - wrefresh(dbg_w); - - va_end(ap); -} - -/*---------------------------------------------------------------------------* - * go to new state - *---------------------------------------------------------------------------*/ -void -newstate(int newstate) -{ - int i; - - if(newstate < 0 || newstate > ST_MAX) - { - message("newstate %d undefined!", newstate); - return; - } - - state = newstate; - - if(newstate == ST_ACTIVE) - { - char namebuffer[128]; - - sprintf(namebuffer,"%s%d", I4BTELDEVICE, opt_unit); - telfd = init_tel(namebuffer); - } - - if(newstate == ST_IDLE) - { - close(telfd); - telfd = -1; - } - - wmove(main_w, MW_STATEY, MW_STX); - waddstr(main_w, states[newstate]); - - for(i=strlen(states[newstate]);i < MW_WIDTH-MW_STX-2; i++) - waddch(main_w, ' '); - - wmove(main_w, MW_NUMY, MW_NUX + curx); - wrefresh(main_w); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntel/Makefile b/usr.sbin/i4b/isdntel/Makefile deleted file mode 100644 index e3aff090b196..000000000000 --- a/usr.sbin/i4b/isdntel/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -PROG= isdntel -MAN= isdntel.8 -SRCS= main.c display.c files.c alias.c - -DPADD= ${LIBNCURSES} -LDADD= -lncurses - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/isdntel/alias.c b/usr.sbin/i4b/isdntel/alias.c deleted file mode 100644 index 0f4dae712a15..000000000000 --- a/usr.sbin/i4b/isdntel/alias.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdntel - isdn4bsd telephone answering machine support - * ====================================================== - * - * $Id: alias.c,v 1.9 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:53:37 1999] - * - *----------------------------------------------------------------------------*/ - -#include "defs.h" -#include "alias.h" - -static struct alias *firsta = NULL; - -#define MAXBUFSZ 256 - -/*---------------------------------------------------------------------------* - * read in and init aliases - *---------------------------------------------------------------------------*/ -void -init_alias(char *filename) -{ - FILE *fp; - unsigned char buffer[MAXBUFSZ + 1]; - unsigned char number[MAXBUFSZ + 1]; - unsigned char name[MAXBUFSZ + 1]; - unsigned char *s, *d; - struct alias *newa = NULL; - struct alias *lasta = NULL; - - if((fp = fopen(filename, "r")) == NULL) - return; - - while((fgets(buffer, MAXBUFSZ, fp)) != NULL) - { - if(buffer[0] == '#' || buffer[0] == ' ' || - buffer[0] == '\t' || buffer[0] == '\n') - { - continue; - } - - s = buffer; - d = number; - - while(*s && (isdigit(*s))) - *d++ = *s++; - - *d = '\0'; - - while(*s && (isspace(*s))) - s++; - - d = name; - - while(*s && (isprint(*s))) - *d++ = *s++; - - *d = '\0'; - - if((strlen(number) > 1) && (strlen(name) > 1)) - { - if((newa = (struct alias *) malloc(sizeof(struct alias))) == NULL) - fatal("malloc failed for struct alias"); - if((newa->number = (char *) malloc(strlen(number)+1)) == NULL) - fatal("malloc failed for number alias"); - if((newa->name = (char *) malloc(strlen(name)+1)) == NULL) - fatal("malloc failed for name alias"); - strcpy(newa->name, name); - strcpy(newa->number, number); - newa->next = NULL; - - if(firsta == NULL) - { - firsta = newa; - } - else - { - lasta->next = newa; - } - lasta = newa; - } - } - fclose(fp); -} - -/*---------------------------------------------------------------------------* - * read in and init aliases - *---------------------------------------------------------------------------*/ -char * -get_alias(char *number) -{ - struct alias *ca = NULL; - - if(firsta == NULL) - return(NULL); - - ca = firsta; - - for(;;) - { - if(strlen(number) == strlen(ca->number)) - { - if(!(strcmp(number, ca->number))) - return(ca->name); - } - if(ca->next == NULL) - break; - ca = ca->next; - } - return(NULL); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntel/alias.h b/usr.sbin/i4b/isdntel/alias.h deleted file mode 100644 index 813d5bd79095..000000000000 --- a/usr.sbin/i4b/isdntel/alias.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdn4bsd common alias file handling header - * ========================================== - * - * $Id: alias.h,v 1.5 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:53:44 1999] - * - *----------------------------------------------------------------------------*/ - -#ifndef _ALIAS_H_ -#define _ALIAS_H_ - -#define ALIASFILE "/etc/isdn/isdntel.alias" - -struct alias { - char *number; /* telephone number string */ - char *name; /* name string */ - struct alias *next; /* ptr to next alias */ -}; - -#endif /* _ALIAS_H_ */ - -/* EOF */ diff --git a/usr.sbin/i4b/isdntel/defs.h b/usr.sbin/i4b/isdntel/defs.h deleted file mode 100644 index 0d8d38652b93..000000000000 --- a/usr.sbin/i4b/isdntel/defs.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdntel - isdn4bsd telephone answering support - * ============================================== - * - * $Id: defs.h,v 1.10 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:53:50 1999] - * - *----------------------------------------------------------------------------*/ - -#include <ncurses.h> -#include <stdio.h> -#include <signal.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <stdarg.h> -#include <unistd.h> -#include <fcntl.h> -#include <ctype.h> -#include <sys/time.h> -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 -#include <dirent.h> -#else -#include <sys/dir.h> -#endif -#include <sys/param.h> - -#include <i4b/i4b_ioctl.h> - -#define GOOD 0 -#define ERROR (-1) -#define WARNING (-2) - -#define SPOOLDIR "/var/isdn" -#define PLAYCMD "cat %s | g711conv -a >/dev/audio" - -/* reread timeout in seconds */ - -#define REREADTIMEOUT 60 - -/* window dimensions */ - -#define START_O 3 /* main window start */ - -#define DAT_POS 0 -#define TIM_POS (DAT_POS+10) -#define DST_POS (TIM_POS+8) -#define SRC_POS (DST_POS+17) -#define ALI_POS (SRC_POS+17) -#define SEC_POS (ALI_POS+21) -#define LAST_POS (SEC_POS+5) - -/* fullscreen mode menu window */ - -#define WMITEMS 5 /* no of items */ -#define WMENU_LEN 18 /* window width */ -#define WMENU_HGT (WMITEMS+4) /* window height */ -#define WMENU_TITLE "Command" -#define WMENU_POSLN 8 /* window position: lines */ -#define WMENU_POSCO 20 /* window position: columns */ - -#define CR 0x0d -#define LF 0x0a -#define TAB 0x09 -#define CNTRL_D 0x04 -#define CNTRL_L 0x0c - -struct onefile { - char *fname; /* filename */ - char *date; - char *time; - char *srcnumber; - char *dstnumber; - char *seconds; - char *alias; - int len; - struct onefile *next; /* ptr to next entry */ - struct onefile *prev; /* prt to previous entry */ -}; - -#ifdef MAIN - -int curses_ready = 0; /* flag, curses display is initialized */ - -struct onefile *cur_file = NULL;/* the CURRENT filename */ -struct onefile *first = NULL; /* init dir-list head-ptr */ -struct onefile *last = NULL; /* init dir-list tail-ptr */ - -WINDOW *main_w; /* curses main window pointer */ - -int nofiles = 0; -int cur_pos = 0; - -char *spooldir = SPOOLDIR; -char *playstring = PLAYCMD; - -#else - -extern int curses_ready; - -extern struct onefile *cur_file; -extern struct onefile *first; -extern struct onefile *last; - -extern WINDOW *main_w; - -extern int nofiles; -extern int cur_pos; - -extern char *spooldir; -extern char *playstring; - -#endif - -extern void init_alias( char *filename ); -extern void init_files( int inipos ); -extern void init_screen ( void ); -extern void do_menu ( void ); -extern int fill_list( void ); -extern char *get_alias( char *number ); -extern int main ( int argc, char **argv ); -extern void do_quit ( int exitval ); -extern void fatal ( char *fmt, ... ); -extern void error ( char *fmt, ... ); -extern void play ( struct onefile * ); -extern void delete ( struct onefile * ); -extern void reread( void ); - -/* EOF */ diff --git a/usr.sbin/i4b/isdntel/display.c b/usr.sbin/i4b/isdntel/display.c deleted file mode 100644 index 53e6637d5155..000000000000 --- a/usr.sbin/i4b/isdntel/display.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdntel - isdn4bsd telephone answering machine support - * ====================================================== - * - * $Id: display.c,v 1.9 2000/07/19 08:56:24 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Wed Jul 19 10:08:06 2000] - * - *----------------------------------------------------------------------------*/ - -#include "defs.h" - -static char *helpstr = "Enter Control-D to exit program or RETURN for command window"; - -/*---------------------------------------------------------------------------* - * init curses fullscreen display - *---------------------------------------------------------------------------*/ -void -init_screen(void) -{ - char buffer[512]; - - initscr(); /* curses init */ - - curses_ready = 1; - - if((COLS < 80) || (LINES < 24)) - fatal("ERROR, minimal screensize must be 80x24, is %dx%d, terminating!", COLS, LINES); - - - if((main_w = newwin(LINES-START_O-2, COLS, START_O, 0)) == NULL) - fatal("ERROR, curses init main window, terminating!"); - - raw(); /* raw input */ - noecho(); /* do not echo input */ - keypad(stdscr, TRUE); /* use special keys */ - keypad(main_w, TRUE); /* use special keys */ - scrollok(main_w, TRUE); - - sprintf(buffer, " isdntel %d.%d.%d ", VERSION, REL, STEP); - - move(0, 0); - standout(); - hline(ACS_HLINE, 5); - move(0, 5); - addstr(buffer); - move(0, 5 + strlen(buffer)); - hline(ACS_HLINE, 256); - standend(); - - move(1, 0); - addstr("Date Time Called Party Calling Party Alias Length"); - /* 31.12.96 16:45:12 1234567890123456 1234567890123456 12345678901234567890 123456 */ - - move(2, 0); - hline(ACS_HLINE, 256); - - move(LINES-2, 0); - hline(ACS_HLINE, 256); - - mvaddstr(LINES-1, (COLS / 2) - (strlen(helpstr) / 2), helpstr); - - refresh(); - - wrefresh(main_w); -} - -/*---------------------------------------------------------------------------* - * curses menu for fullscreen command mode - *---------------------------------------------------------------------------*/ -void -do_menu(void) -{ - static char *menu[WMITEMS] = - { - "Play File", -#define PLAY 0 - "Delete File", -#define DELETE 1 - "Re-Read Spool", -#define REREAD 2 - "Refresh Screen", -#define REFRESH 3 - "Exit Program", -#define EXIT 4 - }; - - WINDOW *menu_w; - int c; - int mpos; - - /* create a new window in the lower screen area */ - - if((menu_w = newwin(WMENU_HGT, WMENU_LEN, WMENU_POSLN, WMENU_POSCO )) == NULL) - return; - - keypad(menu_w, TRUE); /* use special keys */ - - /* draw border around the window */ - - box(menu_w, 0, 0); - - /* add a title */ - - wstandout(menu_w); - mvwaddstr(menu_w, 0, (WMENU_LEN / 2) - (strlen(WMENU_TITLE) / 2), WMENU_TITLE); - wstandend(menu_w); - - /* fill the window with the menu options */ - - for(mpos=0; mpos <= (WMITEMS-1); mpos++) - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - - /* highlight the first menu option */ - - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - - /* input loop */ - - for(;;) - { - wrefresh(menu_w); - - c = wgetch(menu_w); - - switch(c) - { - case TAB: - case KEY_DOWN: /* down-move cursor */ - case ' ': - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - mpos++; - if(mpos >= WMITEMS) - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - break; - - case KEY_UP: /* up-move cursor */ - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - if(mpos) - mpos--; - else - mpos = WMITEMS-1; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - break; - - case 'R': - case 'r': - wrefresh(curscr); - goto mexit; - - case 'E': - case 'e': - case 'Q': - case 'q': - case 'X': - case 'x': - do_quit(0); - goto mexit; - break; - - case 'P': - case 'p': - play(cur_file); - goto mexit; - break; - - case 'D': - case 'd': - delete(cur_file); - goto mexit; - break; - - case CR: - case LF: /* exec highlighted option */ -#ifdef KEY_ENTER - case KEY_ENTER: -#endif - switch(mpos) - { - case PLAY: - play(cur_file); - goto mexit; - break; - case DELETE: - delete(cur_file); - goto mexit; - break; - case REREAD: - reread(); - goto mexit; - break; - case REFRESH: - wrefresh(curscr); - break; - case EXIT: - do_quit(0); - break; - } - goto mexit; - break; - - default: - goto mexit; - break; - } - } - -mexit: - /* delete the menu window */ - - delwin(menu_w); - - /* re-display the original lower window contents */ - - touchwin(main_w); - wrefresh(main_w); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntel/files.c b/usr.sbin/i4b/isdntel/files.c deleted file mode 100644 index bf05b4237cd2..000000000000 --- a/usr.sbin/i4b/isdntel/files.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdntel - isdn4bsd telephone answering machine support - * ====================================================== - * - * $Id: files.c,v 1.8 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:54:06 1999] - * - *----------------------------------------------------------------------------*/ - -#include "defs.h" - -/*---------------------------------------------------------------------------* - * create a doubly linked list in sorted order, return pointer to new - * first element of list - *---------------------------------------------------------------------------*/ -struct onefile *store - (register struct onefile *new, /* new entry to store into list */ - register struct onefile *top) /* current first entry in list */ -{ - register struct onefile *old, *p; - - if (last == NULL) /* enter very first element ? */ - { - new->next = NULL; - new->prev = NULL; - last = new; /* init last */ - return (new); /* return new first */ - } - p = top; /* p = old first element */ - old = NULL; - while (p) - { - if ((strcmp(p->fname, new->fname)) < 0) /* current less new ? */ - { - old = p; - p = p->next; - } - else - { /* current >= new */ - - if (p->prev) - { - p->prev->next = new; - new->next = p; - new->prev = p->prev; - p->prev = new; - return (top); - } - new->next = p; - new->prev = NULL; - p->prev = new; - return (new); - } - } - old->next = new; - new->next = NULL; - new->prev = old; - last = new; - return (first); -} - -/*---------------------------------------------------------------------------* - * read current directory and build up a doubly linked sorted list - *---------------------------------------------------------------------------*/ -int -fill_list(void) -{ -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 - register struct dirent *dp; -#else - register struct direct *dp; -#endif - register struct onefile *new_entry; - register DIR *dirp; - int flcnt = 0; - char tmp[80]; - char *s, *d; - - if ((dirp = opendir(spooldir)) == NULL) - fatal("cannot open spooldirectory %s!\n", spooldir); - - for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) - { - if(!isdigit(*(dp->d_name))) - continue; - - if ((new_entry = (struct onefile *) malloc(sizeof(struct onefile))) == NULL) - { - fatal("files.c, fill_list(): structure onefile malloc failed"); - } - - /* alloc filename memory and copy name into it */ - - if ((new_entry->fname = (char *) malloc(strlen(dp->d_name) + 1)) == NULL) - { - fatal("files.c, fill_list(): malloc filename string memory failed"); - } - - strcpy(new_entry->fname, dp->d_name); - - /* fill in remaining fields from filename */ - - tmp[0] = dp->d_name[4]; /* day msb */ - tmp[1] = dp->d_name[5]; /* day lsb */ - tmp[2] = '.'; - tmp[3] = dp->d_name[2]; /* month msb */ - tmp[4] = dp->d_name[3]; /* month lsb */ - tmp[5] = '.'; - tmp[6] = dp->d_name[0]; /* year msb */ - tmp[7] = dp->d_name[1]; /* year lsb */ - tmp[8] = '\0'; - - if((new_entry->date = (char *) malloc(strlen(tmp) + 1)) == NULL) - { - fatal("files.c, fill_list(): malloc date string memory failed"); - } - - strcpy(new_entry->date, tmp); - - tmp[0] = dp->d_name[6]; /* hour msb */ - tmp[1] = dp->d_name[7]; /* hour lsb */ - tmp[2] = ':'; - tmp[3] = dp->d_name[8]; /* minute msb */ - tmp[4] = dp->d_name[9]; /* minute lsb */ - tmp[5] = ':'; - tmp[6] = dp->d_name[10]; /* second msb */ - tmp[7] = dp->d_name[11]; /* second lsb */ - tmp[8] = '\0'; - - if((new_entry->time = (char *) malloc(strlen(tmp) + 1)) == NULL) - { - fatal("files.c, fill_list(): malloc time string memory failed"); - } - - strcpy(new_entry->time, tmp); - - /* destination number */ - - s = &dp->d_name[13]; - d = &tmp[0]; - - while(*s && (*s != '-')) - *d++ = *s++; - - *d = '\0'; - - if((new_entry->dstnumber = (char *) malloc(strlen(tmp) + 1)) == NULL) - { - fatal("files.c, fill_list(): malloc dstnumber string memory failed"); - } - - strcpy(new_entry->dstnumber, tmp); - - /* source number */ - - s++; - d = &tmp[0]; - - while(*s && (*s != '-')) - *d++ = *s++; - - *d = '\0'; - - if((new_entry->srcnumber = (char *) malloc(strlen(tmp) + 1)) == NULL) - { - fatal("files.c, fill_list(): malloc srcnumber string memory failed"); - } - - strcpy(new_entry->srcnumber, tmp); - - /* length in seconds */ - - s++; - d = &tmp[0]; - - while(*s && (*s != '-')) - *d++ = *s++; - - *d = '\0'; - - if((new_entry->seconds = (char *) malloc(strlen(tmp) + 1)) == NULL) - { - fatal("files.c, fill_list(): malloc seconds string memory failed"); - } - - strcpy(new_entry->seconds, tmp); - - /* search for alias and add if found */ - - new_entry->alias = get_alias(new_entry->srcnumber); - - /* sort entry into linked list */ - - first = store(new_entry, first); - - flcnt++; /* increment file count */ - } - closedir(dirp); /* close current dir */ - return(flcnt); /* ok return */ -} - -/*---------------------------------------------------------------------------* - * free the current malloc'ed list - *---------------------------------------------------------------------------*/ -void -free_list(void) -{ - register struct onefile *dir; - register struct onefile *tmp; - - dir = first; /* start of linked list */ - - while (dir) /* free all */ - { - tmp = dir->next; /* save ptr to next entry */ - free(dir->fname); /* free filename space */ - free(dir->date); - free(dir->time); - free(dir->srcnumber); - free(dir->dstnumber); - free(dir->seconds); - free(dir); /* free struct space */ - dir = tmp; /* ptr = ptr to next entry */ - } - first = NULL; /* first ptr = NULL */ - last = NULL; /* last ptr = NULL */ -} - -/*---------------------------------------------------------------------------* - * delete a file - *---------------------------------------------------------------------------*/ -void -delete(struct onefile *this) -{ - char buffer[MAXPATHLEN]; - - if(this == NULL) - return; - - strlcpy(buffer, this->fname, sizeof(buffer)); - - unlink(buffer); - - free_list(); - - wclear(main_w); - - init_files(cur_pos); -} - -/*---------------------------------------------------------------------------* - * reread the spool directory - *---------------------------------------------------------------------------*/ -void -reread(void) -{ - free_list(); - - wclear(main_w); - - init_files(cur_pos); -} - -/*---------------------------------------------------------------------------* - * play a file - *---------------------------------------------------------------------------*/ -void -play(struct onefile *this) -{ - char buffer[MAXPATHLEN]; - - if(this == NULL) - return; - - snprintf(buffer, sizeof(buffer), playstring, this->fname); - - system(buffer); -} - -/*---------------------------------- EOF -------------------------------------*/ diff --git a/usr.sbin/i4b/isdntel/isdntel.8 b/usr.sbin/i4b/isdntel/isdntel.8 deleted file mode 100644 index 430c9f2df6f9..000000000000 --- a/usr.sbin/i4b/isdntel/isdntel.8 +++ /dev/null @@ -1,103 +0,0 @@ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" last edit-date: [Mon Dec 13 23:05:59 1999] -.\" -.\" $FreeBSD$ -.\" -.\" $Id: isdntel.8,v 1.9 1999/12/13 22:11:55 hm Exp $ -.\" -.Dd July 11, 1998 -.Dt ISDNTEL 8 -.Os -.Sh NAME -.Nm isdntel -.Nd isdn4bsd telephone answering management utility -.Sh SYNOPSIS -.Nm -.Op Fl a Ar aliasfile -.Op Fl d Ar spooldir -.Op Fl p Ar playcommand -.Op Fl t Ar timeout -.Sh DESCRIPTION -The -.Nm -utility is used to provide an "answering machine" functionality for incoming -telephone voice messages. -.Pp -The following options are supported: -.Bl -tag -width Ds -.It Fl a -Use -.Ar aliasfile -as the pathname for an aliasfile containing aliases for phone numbers. -The -default path is -.Em /etc/isdn/isdntel.alias . -The format of an alias entry is the number string followed by one or more -spaces or tabs. -The rest of the line is taken as the alias string. -Comments -are introduced by a leading blank, tab or "#" character. -.It Fl d -Use -.Ar spooldir -as the directory where the incoming voice messages are stored by the -"answ" script called by -.Xr isdnd 8 . -This defaults to the directory -.Em /var/isdn . -The format of a voice message filename is: -.Pp -.Dl YYMMDDhhmmss-dest_number-source_number-length_in_secs -.It Fl p -Use -.Ar playcommand -as the command string to execute for playing a voice message to some audio -output facility. -The characters -.Em %s -are replaced by the currently selected filename. -The default string is -.Dq Li cat %s \&| alaw2ulaw >/dev/audio . -.It Fl t -The value for -.Ar timeout -specifies the time in seconds the program rereads the spool directory -when there is no keyboard activity. -.El -.Pp -The screen output should be obvious. -If in doubt, consult the source. -.Sh SEE ALSO -.Xr i4btel 4 , -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh AUTHORS -The -.Nm -utility and this manual page were written by -.An Hellmuth Michaelis Aq hm@kts.org . -.Sh BUGS -Still two or more left. diff --git a/usr.sbin/i4b/isdntel/main.c b/usr.sbin/i4b/isdntel/main.c deleted file mode 100644 index 6bea96662703..000000000000 --- a/usr.sbin/i4b/isdntel/main.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdntel - isdn4bsd telephone answering machine support - * ====================================================== - * - * $Id: main.c,v 1.12 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:54:26 1999] - * - *----------------------------------------------------------------------------*/ - -#define MAIN -#include <locale.h> -#include <unistd.h> -#include "defs.h" -#include "alias.h" - -static void usage( void ); - -static int top_dis = 0; -static int bot_dis = 0; -static int cur_pos_scr = 0; - -static void makecurrent(int cur_pos, struct onefile *cur_file, int cold); - -/*---------------------------------------------------------------------------* - * program entry - *---------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - int i; - int kchar; - - char *spooldir = SPOOLDIR; - char *playstring = PLAYCMD; - char *aliasfile = ALIASFILE; - int rrtimeout = REREADTIMEOUT; - - setlocale( LC_ALL, ""); - - while ((i = getopt(argc, argv, "a:d:p:t:")) != -1) - { - switch (i) - { - case 'a': - aliasfile = optarg; - break; - - case 'd': - spooldir = optarg; - break; - - case 'p': - playstring = optarg; - break; - - case 't': - if(isdigit(*optarg)) - { - rrtimeout = strtoul(optarg, NULL, 10); - } - else - { - usage(); - } - break; - - case '?': - default: - usage(); - break; - } - } - - if(rrtimeout < 10) - rrtimeout = 10; - - if((chdir(spooldir)) != 0) - fatal("cannot change directory to spooldir %s!", spooldir); - - init_alias(aliasfile); - - init_screen(); - - init_files(0); - - /* go into loop */ - - for (;;) - { - fd_set set; - struct timeval timeout; - - FD_ZERO(&set); - FD_SET(STDIN_FILENO, &set); - timeout.tv_sec = rrtimeout; - timeout.tv_usec = 0; - - /* if no char is available within timeout, reread spool */ - - if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0) - { - reread(); - continue; - } - - kchar = wgetch(main_w); /* get char */ - - switch (kchar) - { - case CR: - case LF: -#ifdef KEY_ENTER - case KEY_ENTER: -#endif - do_menu(); - break; - - case KEY_UP: /* up-move cursor */ - if(cur_file && cur_file->prev) - { - cur_file = cur_file->prev; - cur_pos--; - } - break; - - - case TAB: - case KEY_DOWN: /* down-move cursor */ - if(cur_file && cur_file->next) - { - cur_file = cur_file->next; - cur_pos++; - } - break; - - case KEY_HOME: /* move cursor to first dir */ - break; - - case KEY_LL: /* move cursor to last file */ - break; - - case CNTRL_D: - do_quit(0); - break; - - case CNTRL_L: /* refresh */ - touchwin(curscr); - wrefresh(curscr); - break; - - } - makecurrent(cur_pos, cur_file, 0); - } - - do_quit(0); - - return(0); -} - -/*---------------------------------------------------------------------------* - * handle horizontal selection bar movement - *---------------------------------------------------------------------------*/ -static void -makecurrent(int cur_pos, struct onefile *cur_file, int cold) -{ - static int lastpos; - static struct onefile *lastfile; - char buffer[256]; - - /* un-higlight current horizontal bar */ - - if(!cold && lastfile && cur_file) - { - sprintf(buffer, "%s %s %-16s %-16s %-20s %-6s%*s", - lastfile->date, lastfile->time, - lastfile->dstnumber, lastfile->srcnumber, - lastfile->alias == NULL ? "-/-" : lastfile->alias, - lastfile->seconds, - COLS - LAST_POS - 2, ""); - - wattroff(main_w, A_REVERSE); - mvwprintw(main_w, lastpos, 0, "%s", buffer); - wattroff(main_w, A_REVERSE); - } - - if(cur_file == NULL) - { - lastpos = cur_pos_scr; - lastfile = cur_file; - return; - } - - /* have to scroll up or down ? */ - - if(cur_pos >= bot_dis) - { - /* scroll up */ - - wscrl(main_w, 1); - - bot_dis++; - top_dis++; - cur_pos_scr = LINES-START_O-3; - } - else if(cur_pos < top_dis) - { - /* scroll down */ - - wscrl(main_w, -1); - - bot_dis--; - top_dis--; - cur_pos_scr = 0; - } - else - { - cur_pos_scr = cur_pos - top_dis; - } - - sprintf(buffer, "%s %s %-16s %-16s %-20s %-6s%*s", - cur_file->date, cur_file->time, - cur_file->dstnumber, cur_file->srcnumber, - cur_file->alias == NULL ? "-/-" : cur_file->alias, - cur_file->seconds, - COLS - LAST_POS - 2, ""); - - wattron(main_w, A_REVERSE); - mvwprintw(main_w, cur_pos_scr, 0, "%s", buffer); - wattroff(main_w, A_REVERSE); - - lastpos = cur_pos_scr; - lastfile = cur_file; - - wrefresh(main_w); -} - -/*---------------------------------------------------------------------------* - * exit program - *---------------------------------------------------------------------------*/ -void -do_quit(int exitval) -{ - move(LINES-1, 0); - clrtoeol(); - refresh(); - endwin(); - exit(exitval); -} - -/*---------------------------------------------------------------------------* - * usage display and exit - *---------------------------------------------------------------------------*/ -static void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "isdntel - isdn telephone answering management support utility (version %d.%d.%d)\n", VERSION, REL, STEP); - fprintf(stderr, " usage: isdntel -a <filename> -d <directory> -p <command> -t <timeout>\n"); - fprintf(stderr, " -a <filename> use filename as alias file\n"); - fprintf(stderr, " -d <directory> use directory as spool directory\n"); - fprintf(stderr, " -p <command> specify commandline for play command\n"); - fprintf(stderr, " -t <timeout> spool directory reread timeout in seconds\n"); - fprintf(stderr, "\n"); - exit(1); -} - -/*---------------------------------------------------------------------------* - * fatal error exit - *---------------------------------------------------------------------------*/ -void -fatal(char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - if(curses_ready) - { - move(LINES-1, 0); - clrtoeol(); - refresh(); - endwin(); - } - - fprintf(stderr, "\nFatal error: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n\n"); - - va_end(ap); - - exit(1); -} - -/*---------------------------------------------------------------------------* - * error printing - *---------------------------------------------------------------------------*/ -void -error(char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - if(curses_ready) - { - wprintw(main_w, "ERROR: "); - vwprintw(main_w, fmt, ap); - wprintw(main_w, "\n"); - wrefresh(main_w); - } - else - { - fprintf(stderr, "ERROR: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); - } - - va_end(ap); -} - -/*---------------------------------------------------------------------------* - * read files and fill display - *---------------------------------------------------------------------------*/ -void -init_files(int inipos) -{ - int i; - - nofiles = fill_list(); - - top_dis = 0; - bot_dis = 0; - - cur_file = first; - - cur_pos = 0; - cur_pos_scr = 0; - - if(nofiles == 0) - return; - - for(i=0; (i < nofiles) && (i < (LINES-START_O-2)); i++) - { - mvwprintw(main_w, i, 0, "%s %s", cur_file->date, cur_file->time); - mvwprintw(main_w, i, DST_POS, "%s", cur_file->dstnumber); - mvwprintw(main_w, i, SRC_POS, "%s", cur_file->srcnumber); - mvwprintw(main_w, i, ALI_POS,"%s", cur_file->alias == NULL ? "-/-" : cur_file->alias); - mvwprintw(main_w, i, SEC_POS,"%s", cur_file->seconds); - - bot_dis++; - - if((cur_file = cur_file->next) == NULL) - break; - } - - cur_file = first; - - if(inipos) - { - for(i=0; i < inipos; i++) - { - if(cur_file->next != NULL) - cur_file = cur_file->next; - else - break; - } - } - makecurrent(cur_pos, cur_file, 1); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntelctl/Makefile b/usr.sbin/i4b/isdntelctl/Makefile deleted file mode 100644 index 41b771e9616e..000000000000 --- a/usr.sbin/i4b/isdntelctl/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ - -PROG= isdntelctl -MAN= isdntelctl.8 -SRCS= main.c - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/isdntelctl/isdntelctl.8 b/usr.sbin/i4b/isdntelctl/isdntelctl.8 deleted file mode 100644 index 4afaf00a9f7c..000000000000 --- a/usr.sbin/i4b/isdntelctl/isdntelctl.8 +++ /dev/null @@ -1,99 +0,0 @@ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdntelctl.8,v 1.9 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 23:06:45 1999] -.\" -.Dd April 21, 1999 -.Dt ISDNTELCTL 8 -.Os -.Sh NAME -.Nm isdntelctl -.Nd control isdn4bsd telephone sound format conversion -.Sh SYNOPSIS -.Nm -.Op Fl c -.Op Fl g -.Op Fl u Ar unit -.Op Fl A -.Op Fl U -.Op Fl N -.Sh DESCRIPTION -The -.Nm -utility -is part of the isdn4bsd package and is used to configure the sound format -conversion facilities of the /dev/i4btel interfaces. -.Pp -The following options are available: -.Bl -tag -width Ds -.It Fl c -Clear the telephone input queue. -.It Fl g -Get the sound format currently in use. -.It Fl u -Set the /dev/i4btel unit number. -The default value is zero to access -device /dev/i4btel0. -.It Fl A -Do A-law (ISDN line) -> u-law (userland) conversion. -.It Fl U -Do u-law (ISDN line) -> A-law (userland) conversion. -.It Fl N -Set sound conversion to do no format conversion. -.El -.Pp -The telephony data stream comes out of the line in a bit-reversed format, -so the -.Xr i4btel 4 -driver does the bit-reversion process in any case. -.Pp -Additionally, the user can specify to do A-law to u-law, u-law to A-law -or no conversion at all in the i4btel driver by using the -.Nm -utility. -.Sh FILES -/dev/i4btel<n> -.Sh EXAMPLES -The command: -.Bd -literal -offset indent -isdntelctl -g -.Ed -.Pp -displays the currently used sound format for device /dev/i4btel0. -.Sh SEE ALSO -.Xr g711conv 1 , -.Xr i4btel 4 , -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh STANDARDS -A-Law and u-Law are specified in ITU Recommendation G.711. -.Sh AUTHORS -The -.Nm -utility and this manpage were written by -.An Hellmuth Michaelis Aq hm@kts.org . diff --git a/usr.sbin/i4b/isdntelctl/main.c b/usr.sbin/i4b/isdntelctl/main.c deleted file mode 100644 index 0e9c8ff2cfa8..000000000000 --- a/usr.sbin/i4b/isdntelctl/main.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdntelctl - i4b set telephone interface options - * ------------------------------------------------ - * - * $Id: main.c,v 1.12 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:54:50 1999] - * - *---------------------------------------------------------------------------*/ - -#include <stdio.h> -#include <signal.h> -#include <errno.h> -#include <paths.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <ctype.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/time.h> - -#include <i4b/i4b_ioctl.h> -#include <i4b/i4b_tel_ioctl.h> - -static void usage ( void ); - -#define I4BTELDEVICE "/dev/i4btel" - -int opt_get = 0; -int opt_unit = 0; -int opt_U = 0; -int opt_A = 0; -int opt_C = 0; -int opt_N = 0; - -/*---------------------------------------------------------------------------* - * program entry - *---------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - int c; - int ret; - int telfd; - char namebuffer[128]; - - while ((c = getopt(argc, argv, "cgu:AUN")) != -1) - { - switch(c) - { - case 'c': - opt_C = 1; - break; - - case 'g': - opt_get = 1; - break; - - case 'u': - opt_unit = atoi(optarg); - if(opt_unit < 0 || opt_unit > 9) - usage(); - break; - - case 'A': - opt_A = 1; - break; - - case 'U': - opt_U = 1; - break; - - case 'N': - opt_N = 1; - break; - - case '?': - default: - usage(); - break; - } - } - - if(opt_get == 0 && opt_N == 0 && opt_U == 0 && opt_A == 0 && opt_C == 0) - { - opt_get = 1; - } - - if((opt_get + opt_N + opt_U + opt_A + opt_C) > 1) - { - usage(); - } - - sprintf(namebuffer,"%s%d", I4BTELDEVICE, opt_unit); - - if((telfd = open(namebuffer, O_RDWR)) < 0) - { - fprintf(stderr, "isdntelctl: cannot open %s: %s\n", namebuffer, strerror(errno)); - exit(1); - } - - if(opt_get) - { - int format; - - if((ret = ioctl(telfd, I4B_TEL_GETAUDIOFMT, &format)) < 0) - { - fprintf(stderr, "ioctl I4B_TEL_GETAUDIOFMT failed: %s", strerror(errno)); - exit(1); - } - - if(format == CVT_NONE) - { - printf("device %s does not do A-law/u-law format conversion\n", namebuffer); - } - else if(format == CVT_ALAW2ULAW) - { - printf("device %s does ISDN: A-law -> user: u-law format conversion\n", namebuffer); - } - else if(format == CVT_ULAW2ALAW) - { - printf("device %s does ISDN: u-law -> user: A-law format conversion\n", namebuffer); - } - else - { - printf("ERROR, device %s uses unknown format %d!\n", namebuffer, format); - } - exit(0); - } - - if(opt_A) - { - int format = CVT_ALAW2ULAW; - - if((ret = ioctl(telfd, I4B_TEL_SETAUDIOFMT, &format)) < 0) - { - fprintf(stderr, "ioctl I4B_TEL_SETAUDIOFMT failed: %s", strerror(errno)); - exit(1); - } - exit(0); - } - - if(opt_U) - { - int format = CVT_ULAW2ALAW; - - if((ret = ioctl(telfd, I4B_TEL_SETAUDIOFMT, &format)) < 0) - { - fprintf(stderr, "ioctl I4B_TEL_SETAUDIOFMT failed: %s", strerror(errno)); - exit(1); - } - exit(0); - } - if(opt_N) - { - int format = CVT_NONE; - - if((ret = ioctl(telfd, I4B_TEL_SETAUDIOFMT, &format)) < 0) - { - fprintf(stderr, "ioctl I4B_TEL_SETAUDIOFMT failed: %s", strerror(errno)); - exit(1); - } - exit(0); - } - if(opt_C) - { - int dummy; - if((ret = ioctl(telfd, I4B_TEL_EMPTYINPUTQUEUE, &dummy)) < 0) - { - fprintf(stderr, "ioctl I4B_TEL_EMPTYINPUTQUEUE failed: %s", strerror(errno)); - exit(1); - } - exit(0); - } - return(0); -} - -/*---------------------------------------------------------------------------* - * usage display and exit - *---------------------------------------------------------------------------*/ -static void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "isdntelctl - %si4btel control, version %d.%d.%d\n", _PATH_DEV, VERSION, REL, STEP); - fprintf(stderr, "usage: isdntelctl -c -g -u <unit> -A -N -U\n"); - fprintf(stderr, " -c clear input queue\n"); - fprintf(stderr, " -g get current settings\n"); - fprintf(stderr, " -u unit specify unit number\n"); - fprintf(stderr, " -A set conversion ISDN: A-law -> user: u-law\n"); - fprintf(stderr, " -U set conversion ISDN: u-law -> user: A-law\n"); - fprintf(stderr, " -N set conversion to no A-law/u-law conversion\n"); - fprintf(stderr, "\n"); - exit(1); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntest/Makefile b/usr.sbin/i4b/isdntest/Makefile deleted file mode 100644 index 88b491a8c8c9..000000000000 --- a/usr.sbin/i4b/isdntest/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -PROG= isdntest -MAN= isdntest.8 -SRCS= main.c - -install: - @${ECHO} "isdntest is not installed automatically" - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/isdntest/isdntest.8 b/usr.sbin/i4b/isdntest/isdntest.8 deleted file mode 100644 index 243d70b1b134..000000000000 --- a/usr.sbin/i4b/isdntest/isdntest.8 +++ /dev/null @@ -1,116 +0,0 @@ -.\" -.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdntest.8,v 1.10 1999/12/13 22:11:55 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Mon Dec 13 23:07:23 1999] -.\" -.Dd December 10, 1999 -.Dt ISDNTEST 8 -.Os -.Sh NAME -.Nm isdntest -.Nd isdn4bsd debugging and verification tool -.Sh SYNOPSIS -.Nm -.Op Fl c Ar unit -.Op Fl d Ar level -.Op Fl i Ar number -.Op Fl h -.Op Fl o Ar number -.Op Fl t Ar num -.Op Fl w -.Sh DESCRIPTION -The -.Nm -utility is part of the isdn4bsd package and may be used as a stimulation tool -for debugging the isdn4bsd kernel functionality. -.Pp -NOTE: -The -.Nm -utility must be run -.Em instead -of the -.Xr isdnd 8 -daemon and cannot be used while the daemon runs. -.Pp -The following options are available: -.Bl -tag -width Ds -.It Fl c -Use controller unit number for test. -.It Fl d -Set the debugging level -.It Fl h -Use HDLC as the B channel layer 1 protocol instead of no protocol. -.It Fl i -Use number to verify the incoming number. -.It Fl o -Use number as the outgoing number to dial. -.It Fl t -Set number of times the test pattern on the B-channel is exchanged -.It Fl w -Wait for keyboard input for terminating the call. -.El -.Pp -The -.Nm -utility is currently of not much use for end users, it is primarily a debugging -tool for development and is part of the release in the hope, that someone -enhances it as a real self test and setup-verification tool! -.Pp -The -.Nm -utility does almost no error checking and error recovery, so unexpected -hangs or crashes may occur. -.Sh FILES -.Bl -tag -width indent -.It Pa /dev/i4b -.El -.Sh EXAMPLES -For the following example, it is assumed that a machine with isdn4bsd -installed is connected to an S0 bus and that one of the valid MSN's (MSN = Multiple Subscriber Number -= telephone number) on this bus is -.Em 42 . -The -.Xr isdnd 8 -.Em must -not currently running on that machine! -Executing: -.Bd -literal -offset indent -isdntest -i 42 -o 42 -.Ed -.Pp -will setup an outgoing call from that machine to itself, connect to itself -and disconnect after 5 seconds. -The -.Nm -utility has to be finished by the user by entering Control-C. -.Sh AUTHORS -The -.Nm -utility and this manpage were written by -.An Hellmuth Michaelis Aq hm@kts.org . diff --git a/usr.sbin/i4b/isdntest/main.c b/usr.sbin/i4b/isdntest/main.c deleted file mode 100644 index 08c7b896f051..000000000000 --- a/usr.sbin/i4b/isdntest/main.c +++ /dev/null @@ -1,745 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * main.c - i4b selftest utility - * ----------------------------- - * - * $Id: main.c,v 1.16 2000/03/13 16:18:38 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sat May 13 16:50:38 2006] - * - *---------------------------------------------------------------------------*/ - -#include <stdio.h> -#include <signal.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <ctype.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/time.h> - -#include <i4b/i4b_ioctl.h> -#include <i4b/i4b_cause.h> - -static void kbdrdhdl ( void ); -static void isdnrdhdl (int isdnfd ); - -void handle_connect_ind(unsigned char *ptr); -void handle_disconnect(unsigned char *ptr); -void handle_connect_active_ind(unsigned char *ptr); - -int connect_response(int isdnfd, unsigned int cdid, int response); -int disconnect_request(int isdnfd, unsigned int cdid); -unsigned int get_cdid(int isdnfd); -int connect_request(int isdnfd, unsigned int cdid); -int do_test(void); -static void cleanup(void); -static void usage(void); -void setup_wrfix(int len, unsigned char *buf); -int check_rd(int len, unsigned char *wbuf, unsigned char *rdbuf); - -static int isdnfd; -char outgoingnumber[32]; -char incomingnumber[32]; -int debug_level = 0; - -#define I4BDEVICE "/dev/i4b" -#define DATADEV0 "/dev/i4brbch0" -#define DATAUNIT0 0 -#define DATADEV1 "/dev/i4brbch1" -#define DATAUNIT1 1 - -unsigned int out_cdid = CDID_UNUSED; -unsigned int in_cdid = CDID_UNUSED; - -int waitchar = 0; -int usehdlc = 0; -int controller = 0; -int dotest = 0; - -/*---------------------------------------------------------------------------* - * usage display and exit - *---------------------------------------------------------------------------*/ -static void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "isdntest - i4b selftest, version %d.%d.%d\n",VERSION, REL, STEP); - fprintf(stderr, "usage: isdntest [-c ctrl] [-d level] [-h] [-i telno] [-o telno] [-t num] [-w]\n"); - fprintf(stderr, " -c <ctrl> specify controller to use\n"); - fprintf(stderr, " -d <level> set debug level\n"); - fprintf(stderr, " -h use HDLC as Bchannel protocol\n"); - fprintf(stderr, " -i <telno> incoming telephone number\n"); - fprintf(stderr, " -o <telno> outgoing telephone number\n"); - fprintf(stderr, " -t <num> send test pattern num times\n"); - fprintf(stderr, " -w wait for keyboard entry to disconnect\n"); - fprintf(stderr, "\n"); - exit(1); -} - -/*---------------------------------------------------------------------------* - * program entry - *---------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - int i; - int c; - fd_set set; - int ret; - char *ptr; - - incomingnumber[0] = '\0'; - outgoingnumber[0] = '\0'; - - while ((c = getopt(argc, argv, "c:d:hi:o:t:w")) != -1) - { - switch(c) - { - case 'c': - if(isdigit(*optarg)) - { - controller = strtoul(optarg, NULL, 10); - } - else - { - fprintf(stderr, "Error: option -c requires a numeric argument!\n"); - usage(); - } - break; - - case 'd': - if(isdigit(*optarg)) - { - debug_level = strtoul(optarg, NULL, 10); - } - else - { - fprintf(stderr, "Error: option -d requires a numeric argument!\n"); - usage(); - } - break; - - case 'o': - i = 0; - ptr = optarg; - - while(*ptr) - { - if(isdigit(*ptr)) - { - outgoingnumber[i++] = *ptr++; - } - else - { - fprintf(stderr, "Error: option -o requires a numeric argument!\n"); - usage(); - } - } - outgoingnumber[i] = '\0'; - break; - - case 'i': - i = 0; - ptr = optarg; - - while(*ptr) - { - if(isdigit(*ptr)) - { - incomingnumber[i++] = *ptr++; - } - else - { - fprintf(stderr, "Error: option -i requires a numeric argument!\n"); - usage(); - } - } - incomingnumber[i] = '\0'; - break; - - case 'w': - waitchar = 1; - break; - - case 'h': - usehdlc = 1; - break; - - case 't': - if(isdigit(*optarg)) - { - dotest = strtoul(optarg, NULL, 10); - } - else - { - fprintf(stderr, "Error: option -t requires a numeric argument!\n"); - usage(); - } - break; - - case '?': - default: - usage(); - break; - } - } - - if((strlen(incomingnumber) == 0) || (strlen(outgoingnumber) == 0)) - usage(); - - fprintf(stderr, "isdntest: accepting calls from telephone number [%s] \n", incomingnumber); - fprintf(stderr, "isdntest: calling out telephone number [%s] \n", outgoingnumber); - - if((atexit(cleanup)) != 0) - { - fprintf(stderr, "isdntest: atexit error: %s\n", strerror(errno)); - exit(1); - } - - /* open isdn device */ - - if((isdnfd = open(I4BDEVICE, O_RDWR)) < 0) - { - fprintf(stderr, "\nisdntest: cannot open %s: %s\n", I4BDEVICE, strerror(errno)); - fprintf(stderr, " isdnd is probably running, to use isdntest,\n"); - fprintf(stderr, " terminate isdnd and then run isdntest again!\n"); - exit(1); - } - - if((out_cdid = get_cdid(isdnfd)) == 0) - { - fprintf(stderr, "isdntest: error getting cdid: %s\n", strerror(errno)); - exit(1); - } - - if((connect_request(isdnfd, out_cdid)) == -1) - { - fprintf(stderr, "isdntest: error, outgoing call failed!\n"); - exit(1); - } - - for(;;) - { - FD_ZERO(&set); - - FD_SET(0, &set); - - FD_SET(isdnfd, &set); - - ret = select(isdnfd + 1, &set, NULL, NULL, NULL); - - if(ret > 0) - { - if(FD_ISSET(isdnfd, &set)) - isdnrdhdl(isdnfd); - - if(FD_ISSET(0, &set)) - kbdrdhdl(); - } - else - { - fprintf(stderr, "isdntest: select error: %s\n", strerror(errno)); - } - } -} - -/*---------------------------------------------------------------------------* - * data from keyboard available - *---------------------------------------------------------------------------*/ -static void -kbdrdhdl(void) -{ - cleanup(); - exit(2); -} - -/*---------------------------------------------------------------------------* - * data from /dev/isdn available, read and process them - *---------------------------------------------------------------------------*/ -static void -isdnrdhdl(int isdnfd) -{ - static unsigned char buf[1024]; - int len; - - if((len = read(isdnfd, buf, 1024 - 1)) > 0) - { - switch (buf[0]) - { - case MSG_CONNECT_IND: - handle_connect_ind(&buf[0]); - break; - - case MSG_CONNECT_ACTIVE_IND: - handle_connect_active_ind(&buf[0]); - break; - - case MSG_DISCONNECT_IND: - handle_disconnect(&buf[0]); - break; - - default: - if(debug_level) - fprintf(stderr, "isdntest: unknown message 0x%x = %c\n", buf[0], buf[0]); - break; - } - } - else - { - fprintf(stderr, "isdntest: read error, errno = %d, length = %d", errno, len); - } -} - -/*---------------------------------------------------------------------------* - * initiate an outgoing connection - *---------------------------------------------------------------------------*/ -int -connect_request(int isdnfd, unsigned int cdid) -{ - msg_connect_req_t mcr; - int ret; - - bzero(&mcr, sizeof(msg_connect_req_t)); - - mcr.controller = controller; - mcr.channel = CHAN_ANY; /* any channel */ - mcr.cdid = cdid; /* cdid from get_cdid() */ - - if(usehdlc) - mcr.bprot = BPROT_RHDLC;/* b channel protocol */ - else - mcr.bprot = BPROT_NONE; /* b channel protocol */ - - mcr.driver = BDRV_RBCH; /* raw b channel driver */ - mcr.driver_unit = DATAUNIT0; /* raw b channel driver unit */ - - strcpy(mcr.dst_telno, outgoingnumber); - strcpy(mcr.src_telno, incomingnumber); - - if((ret = ioctl(isdnfd, I4B_CONNECT_REQ, &mcr)) < 0) - { - fprintf(stderr, "ioctl I4B_CONNECT_REQ failed: %s", strerror(errno)); - return(-1); - } - fprintf(stderr, "isdntest: calling out to telephone number [%s] \n", outgoingnumber); - return(0); -} - -/*---------------------------------------------------------------------------* - * handle setup indicator - *---------------------------------------------------------------------------*/ -void -handle_connect_ind(unsigned char *ptr) -{ - msg_connect_ind_t *msi = (msg_connect_ind_t *)ptr; - - fprintf(stderr, "isdntest: incoming SETUP: from %s to %s\n", - msi->src_telno, - msi->dst_telno); - - fprintf(stderr, " channel %d, controller %d, bprot %d, cdid %d\n", - msi->channel, - msi->controller, - msi->bprot, - msi->header.cdid); - - in_cdid = msi->header.cdid; - - if(strcmp(msi->dst_telno, outgoingnumber)) - { - msg_connect_resp_t msr; - int ret; - - fprintf(stderr, "isdntest: ignoring incoming SETUP: my number [%s] != outgoing [%s]\n", - msi->dst_telno, outgoingnumber); - - msr.cdid = in_cdid; - msr.response = SETUP_RESP_DNTCRE; - - if((ret = ioctl(isdnfd, I4B_CONNECT_RESP, &msr)) < 0) - { - fprintf(stderr, "ioctl I4B_CONNECT_RESP ignore failed: %s", strerror(errno)); - exit(1); - } - - } - else - { - msg_connect_resp_t msr; - int ret; - - fprintf(stderr, "isdntest: accepting call, sending CONNECT_RESPONSE .....\n"); - - msr.cdid = in_cdid; - msr.response = SETUP_RESP_ACCEPT; - - if(usehdlc) - msr.bprot = BPROT_RHDLC; - else - msr.bprot = BPROT_NONE; - - msr.driver = BDRV_RBCH; - msr.driver_unit = DATAUNIT1; - - if((ret = ioctl(isdnfd, I4B_CONNECT_RESP, &msr)) < 0) - { - fprintf(stderr, "ioctl I4B_CONNECT_RESP accept failed: %s", strerror(errno)); - exit(1); - } - } -} - -#define SLEEPTIME 5 - -/*---------------------------------------------------------------------------* - * handle connection active - *---------------------------------------------------------------------------*/ -void -handle_connect_active_ind(unsigned char *ptr) -{ - msg_connect_active_ind_t *msi = (msg_connect_active_ind_t *)ptr; - int i; - - fprintf(stderr, "isdntest: connection active, cdid %d\n", msi->header.cdid); - - if(out_cdid == msi->header.cdid) - { - if(waitchar) - { - fprintf(stderr, "isdntest: press any key to disconnect ...%c%c%c\n", 0x07, 0x07, 0x07); - getchar(); - } - else - { - if(dotest) - { - do_test(); - } - else - { - fprintf(stderr, "isdntest: %d secs delay until disconnect:", SLEEPTIME); - - for(i=0; i < SLEEPTIME;i++) - { - fprintf(stderr, " ."); - sleep(1); - } - fprintf(stderr, "\n"); - } - cleanup(); - exit(0); - } - } -} - -/*---------------------------------------------------------------------------* - * handle disconnect indication - *---------------------------------------------------------------------------*/ -void -handle_disconnect(unsigned char *ptr) -{ - msg_disconnect_ind_t *mdi = (msg_disconnect_ind_t *)ptr; - - if(mdi->header.cdid == out_cdid) - { - fprintf(stderr, "isdntest: incoming disconnect indication, cdid %d (out_cdid), cause %d\n", - mdi->header.cdid, mdi->cause); - - out_cdid = CDID_UNUSED; - } - else if(mdi->header.cdid == in_cdid) - { - fprintf(stderr, "isdntest: incoming disconnect indication, cdid %d (in_cdid), cause %d\n", - mdi->header.cdid, mdi->cause); - in_cdid = CDID_UNUSED; - } - else - { - fprintf(stderr, "isdntest: incoming disconnect indication, cdid %d (\?\?\?), cause %d\n", - mdi->header.cdid, mdi->cause); - } -} - -/*---------------------------------------------------------------------------* - * hang up - *---------------------------------------------------------------------------*/ -int -disconnect_request(int isdnfd, unsigned int cdid) -{ - msg_discon_req_t mdr; - int ret; - - mdr.cdid = cdid; - mdr.cause = (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL; - - if((ret = ioctl(isdnfd, I4B_DISCONNECT_REQ, &mdr)) < 0) - { - fprintf(stderr, "ioctl I4B_DISCONNECT_REQ failed: %s", strerror(errno)); - return(-1); - } - fprintf(stderr, "isdntest: sending disconnect request\n"); - return(0); -} - -/*---------------------------------------------------------------------------* - * get cdid from kernel - *---------------------------------------------------------------------------*/ -unsigned int -get_cdid(int isdnfd) -{ - msg_cdid_req_t mcr; - int ret; - - mcr.cdid = 0; - - if((ret = ioctl(isdnfd, I4B_CDID_REQ, &mcr)) < 0) - { - fprintf(stderr, "ioctl I4B_CDID_REQ failed: %s", strerror(errno)); - return(0); - } - fprintf(stderr, "isdntest: got cdid %d from kernel\n", mcr.cdid); - return(mcr.cdid); -} - -/*---------------------------------------------------------------------------* - * make shure all cdid's are inactive before leaving - *---------------------------------------------------------------------------*/ -void cleanup(void) -{ - int len; - char buf[1024]; - - if(out_cdid != CDID_UNUSED) - { - fprintf(stderr, "isdntest: cleanup, send disconnect req for out_cdid %d, in_cdid %d\n", out_cdid, in_cdid); - disconnect_request(isdnfd, out_cdid); - } - - while((out_cdid != CDID_UNUSED) || (in_cdid != CDID_UNUSED)) - { - if(debug_level) - fprintf(stderr, "isdntest: cleanup, out_cdid %d, in_cdid %d\n", out_cdid, in_cdid); - - if((len = read(isdnfd, buf, 1024 - 1)) > 0) - { - switch (buf[0]) - { - case MSG_CONNECT_IND: - handle_connect_ind(&buf[0]); - break; - - case MSG_CONNECT_ACTIVE_IND: - handle_connect_active_ind(&buf[0]); - break; - - case MSG_DISCONNECT_IND: - handle_disconnect(&buf[0]); - break; - - default: - if(debug_level) - fprintf(stderr, "isdntest: unknown message 0x%x = %c\n", buf[0], buf[0]); - break; - } - } - else - { - fprintf(stderr, "isdntest: read error, errno = %d, length = %d", errno, len); - } - } - if(debug_level) - fprintf(stderr, "isdntest: exit cleanup, out_cdid %d, in_cdid %d\n", out_cdid, in_cdid); -} - -/*---------------------------------------------------------------------------* - * test the b-channels - *---------------------------------------------------------------------------*/ -int do_test(void) -{ - -#define FPH 0x3c -#define FPL 0x66 - - int fd0, fd1; - unsigned char wrbuf[2048]; - unsigned char rdbuf[2048]; - int sz; - fd_set set; - struct timeval timeout; - int ret; - int frame; - int errcnt; - int frm_len; - int bytecnt = 0; - time_t start_time; - time_t cur_time; - time_t run_time; - - if((fd0 = open(DATADEV0, O_RDWR)) == -1) - { - fprintf(stderr, "open of %s failed: %s", DATADEV0, strerror(errno)); - return(-1); - } - - if((fd1 = open(DATADEV1, O_RDWR)) == -1) - { - fprintf(stderr, "open of %s failed: %s", DATADEV1, strerror(errno)); - return(-1); - } - - printf("\n"); - frame = 0; - errcnt = 0; - - frm_len = 2; - - start_time = time(NULL); - - printf(" frame size errors totalbytes bps elapsedtime\n"); - - for(;dotest > 0; dotest--) - { - setup_wrfix(frm_len, &wrbuf[0]); - - frame++; - - bytecnt += frm_len; - - printf("%6d %4d", frame, frm_len); - fflush(stdout); - - if((sz = write(fd0, wrbuf, frm_len)) != frm_len) - { - fprintf(stderr, "write (%d of %d bytes) to %s failed: %s\n", sz, frm_len, DATADEV0, strerror(errno)); - } - - timeout.tv_sec = 2; - timeout.tv_usec = 0; - - FD_ZERO(&set); - - FD_SET(0, &set); - FD_SET(fd1, &set); - - ret = select(fd1+1, &set, NULL, NULL, &timeout); - - if(ret > 0) - { - if(FD_ISSET(fd1, &set)) - { - if((sz = read(fd1, rdbuf, 2048)) != frm_len) - { - fprintf(stderr, "read (%d bytes) from %s failed: %s\n", sz, DATADEV1, strerror(errno)); - } - - cur_time = time(NULL); - run_time = difftime(cur_time, start_time); - - if(run_time == 0) - run_time = 1; - - printf(" %6d %10d %4d %2.2d:%2.2d:%2.2d \r", - errcnt, bytecnt, - (int)((int)bytecnt/(int)run_time), - (int)run_time/3600, (int)run_time/60, (int)run_time%60); - fflush(stdout); - - errcnt += check_rd(frm_len, &wrbuf[0], &rdbuf[0]); - -#ifdef NOTDEF - for(i=0; i<sz; i++) - { - printf("0x%02x ", (unsigned char)rdbuf[i]); - } - printf("\n"); -#endif - } - - if(FD_ISSET(0, &set)) - { - return(0); - printf("\n\n"); - } - } - else - { - fprintf(stderr, "isdntest, do_test: select error: %s\n", strerror(errno)); - } - - frm_len = frm_len*2; - if(frm_len > 2048) - frm_len = 2; - - } - printf("\n\n"); - return(0); -} - -void -setup_wrfix(int len, unsigned char *buf) -{ - register int i; - - for(i=0; i<len;) - { - *buf = FPH; - buf++; - *buf = FPL; - buf++; - i+=2; - } -} - -int -check_rd(int len, unsigned char *wbuf, unsigned char *rbuf) -{ - register int i; - int ret = 0; - - for(i=0; i<len; i++) - { - if(*wbuf != *rbuf) - { - fprintf(stderr, "\nERROR, byte %d, written 0x%02x, read 0x%02x\n", i, *wbuf, *rbuf); - ret++; - } - wbuf++; - rbuf++; - } - return(ret); -} - - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/1tr6.c b/usr.sbin/i4b/isdntrace/1tr6.c deleted file mode 100644 index db2bc7177a4a..000000000000 --- a/usr.sbin/i4b/isdntrace/1tr6.c +++ /dev/null @@ -1,756 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * 1tr6.c - print 1TR6 protocol traces - * ----------------------------------- - * - * $Id: 1tr6.c,v 1.6 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:55:31 1999] - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" - -static int p_1tr6address(char *pbuf, unsigned char buf[]); -static int p_1tr6cause(char *pbuf, unsigned char buf[]); - -/*---------------------------------------------------------------------------* - * decode the (german) national specific 1TR6 protocol - *---------------------------------------------------------------------------*/ -void -decode_1tr6(char *pbuf, int n, int off, unsigned char *buf, int raw) -{ - int codeset = 0; - int oldcodeset = 0; - int codelock = 0; - - int pd; - int len; - int j; - int i; - - if(n <= 0) - return; - - *pbuf = '\0'; - - if(raw) - { - for (i = 0; i < n; i += 16) - { - sprintf((pbuf+strlen(pbuf)),"Dump:%.3d ", i+off); - for (j = 0; j < 16; j++) - if (i + j < n) - sprintf((pbuf+strlen(pbuf)),"%02x ", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf))," "); - sprintf((pbuf+strlen(pbuf))," "); - for (j = 0; j < 16 && i + j < n; j++) - if (isprint(buf[i + j])) - sprintf((pbuf+strlen(pbuf)),"%c", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf)),"."); - sprintf((pbuf+strlen(pbuf)),"\n"); - } - } - - sprintf((pbuf+strlen(pbuf)), "1TR6: "); - - /* protocol discriminator */ - - i = 0; - - pd = buf[i]; - - switch(pd) - { - case 0x40: - sprintf((pbuf+strlen(pbuf)), "pd=N0, "); - break; - case 0x41: - sprintf((pbuf+strlen(pbuf)), "pd=N1, "); - break; - default: - sprintf((pbuf+strlen(pbuf)), "pd=UNDEF (0x%02x), ",pd); - break; - } - - /* call reference */ - - i++; - - len = buf[i] & 0x0f; - - switch(len) - { - case 1: - sprintf((pbuf+strlen(pbuf)), "cr=0x%02x %s, ", (buf[i+1] & 0x7f), (buf[i+1] & 0x80) ? "(from destination)" : "(from origination)"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "cr: LEN=%d %s 0x%02x 0x%02x, ", len, (buf[i+1] & 0x80) ? "org" : "dst", (buf[i+1] & 0x7f), (buf[i+2] & 0x7f)); - break; - } - - i += (len+1); - - /* message type */ - - sprintf((pbuf+strlen(pbuf)), "message="); - - if(pd == 0x40) /* protocol discriminator N0 */ - { - switch(buf[i]) - { - case 0x61: - sprintf((pbuf+strlen(pbuf)), "REGISTER INDICATION: "); - break; - case 0x62: - sprintf((pbuf+strlen(pbuf)), "CANCEL INDICATION: "); - break; - case 0x63: - sprintf((pbuf+strlen(pbuf)), "FACILITY STATUS: "); - break; - case 0x64: - sprintf((pbuf+strlen(pbuf)), "STATUS ACKNOWLEDGE: "); - break; - case 0x65: - sprintf((pbuf+strlen(pbuf)), "STATUS REJECT: "); - break; - case 0x66: - sprintf((pbuf+strlen(pbuf)), "FACILITY INFORMATION: "); - break; - case 0x67: - sprintf((pbuf+strlen(pbuf)), "INFORMATION ACKNOWLEDGE: "); - break; - case 0x68: - sprintf((pbuf+strlen(pbuf)), "INFORMATION REJECT: "); - break; - case 0x75: - sprintf((pbuf+strlen(pbuf)), "CLOSE: "); - break; - case 0x77: - sprintf((pbuf+strlen(pbuf)), "CLOSE ACKNOWLEDGE: "); - break; - default: - sprintf((pbuf+strlen(pbuf)), "ERROR: PD=0x40 MSG=0x%02x, ", buf[i]); - break; - } - } - else if(pd == 0x41) - { - switch(buf[i]) - { - case 0x00: - sprintf((pbuf+strlen(pbuf)), "ESCAPE: "); - break; - case 0x01: - sprintf((pbuf+strlen(pbuf)), "ALERT: "); - break; - case 0x02: - sprintf((pbuf+strlen(pbuf)), "CALL SENT: "); - break; - case 0x07: - sprintf((pbuf+strlen(pbuf)), "CONNECT: "); - break; - case 0x0f: - sprintf((pbuf+strlen(pbuf)), "CONNECT ACKNOWLEDGE: "); - break; - case 0x05: - sprintf((pbuf+strlen(pbuf)), "SETUP: "); - break; - case 0x0d: - sprintf((pbuf+strlen(pbuf)), "SETUP ACKNOWLEDGE: "); - break; - - case 0x26: - sprintf((pbuf+strlen(pbuf)), "RESUME: "); - break; - case 0x2e: - sprintf((pbuf+strlen(pbuf)), "RESUME ACKNOWLEDGE: "); - break; - case 0x22: - sprintf((pbuf+strlen(pbuf)), "RESUME REJECT: "); - break; - case 0x25: - sprintf((pbuf+strlen(pbuf)), "SUSPEND: "); - break; - case 0x2d: - sprintf((pbuf+strlen(pbuf)), "SUSPEND ACKNOWLEDGE: "); - break; - case 0x21: - sprintf((pbuf+strlen(pbuf)), "SUSPEND REJECT: "); - break; - case 0x20: - sprintf((pbuf+strlen(pbuf)), "USER INFORMATION: "); - break; - - case 0x40: - sprintf((pbuf+strlen(pbuf)), "DETACH"); - break; - case 0x45: - sprintf((pbuf+strlen(pbuf)), "DISCONNECT: "); - break; - case 0x4d: - sprintf((pbuf+strlen(pbuf)), "RELEASE: "); - break; - case 0x5a: - sprintf((pbuf+strlen(pbuf)), "RELEASE ACKNOWLEDGE"); - break; - - case 0x6e: - sprintf((pbuf+strlen(pbuf)), "CANCEL ACKNOWLEDGE: "); - break; - case 0x67: - sprintf((pbuf+strlen(pbuf)), "CANCEL REJECT: "); - break; - case 0x69: - sprintf((pbuf+strlen(pbuf)), "CONGESTION CONTROL: "); - break; - case 0x60: - sprintf((pbuf+strlen(pbuf)), "FACILITY: "); - break; - case 0x68: - sprintf((pbuf+strlen(pbuf)), "FACILITY ACKNOWLEDGE: "); - break; - case 0x66: - sprintf((pbuf+strlen(pbuf)), "FACILITY CANCEL: "); - break; - case 0x64: - sprintf((pbuf+strlen(pbuf)), "FACILITY REGISTER: "); - break; - case 0x65: - sprintf((pbuf+strlen(pbuf)), "FACILITY REJECT: "); - break; - case 0x6d: - sprintf((pbuf+strlen(pbuf)), "INFORMATION: "); - break; - case 0x6c: - sprintf((pbuf+strlen(pbuf)), "REGISTER ACKNOWLEDGE: "); - break; - case 0x6f: - sprintf((pbuf+strlen(pbuf)), "REGISTER REJECT: "); - break; - case 0x63: - sprintf((pbuf+strlen(pbuf)), "STATUS: "); - break; - - default: - sprintf((pbuf+strlen(pbuf)), "ERROR: PD=0x41 MSG=0x%02x, ", buf[i]); - break; - } - } - else - { - sprintf((pbuf+strlen(pbuf)), "ERROR: PD=0x%02x MSG=0x%02x, ", pd, buf[i]); - } - - /* other information elements */ - - i++; - - for (; i < n;) - { - sprintf((pbuf+strlen(pbuf)), "\n "); - - if(buf[i] & 0x80) - { - /* single octett info element */ - - switch(buf[i] & 0x70) - { - case 0x00: /* reserved */ - sprintf((pbuf+strlen(pbuf)), "[reserved single octett info]"); - break; - - case 0x10: /* shift */ - oldcodeset = codeset; - codeset = buf[i] & 0x07; - if(buf[i] & 0x08) - codelock = 0; - else - codelock = 1; - sprintf((pbuf+strlen(pbuf)), "[shift: codeset=%d lock=%d]", codeset, codelock); - break; - - case 0x20: /* more data */ - sprintf((pbuf+strlen(pbuf)), "[more data]"); - break; - - case 0x30: /* congestion level */ - sprintf((pbuf+strlen(pbuf)), "[congestion level = %d]", buf[i] & 0x0f); - break; - - default: - sprintf((pbuf+strlen(pbuf)), "[UNDEF SINGLE OCTET ELEMENT 0x%02x]", buf[i]); - break; - } - - i++; /* next */ - - } - else - { - /* variable length info element */ - - if(codeset == 0) - { - switch(buf[i]) - { - case 0x08: - sprintf((pbuf+strlen(pbuf)), "[cause: "); - i += p_1tr6cause(pbuf, &buf[i]); - goto next; - break; - - case 0x0c: - sprintf((pbuf+strlen(pbuf)), "[connected address: "); - i += p_1tr6address(pbuf, &buf[i]); - goto next; - break; - - case 0x10: - sprintf((pbuf+strlen(pbuf)), "[call identity: "); - break; - case 0x18: - sprintf((pbuf+strlen(pbuf)), "[channel id: channel="); - i += 2; - switch(buf[i] & 0x03) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "no channel"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "B-1"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "B-2"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "any channel"); - break; - } - if(buf[i] & 0x08) - sprintf((pbuf+strlen(pbuf)), " (exclusive)]"); - else - sprintf((pbuf+strlen(pbuf)), " (preferred)]"); - i++; - goto next; - break; - case 0x20: - sprintf((pbuf+strlen(pbuf)), "[network specific facilities: "); - i++; - len = buf[i]; - i+=2; - switch(buf[i]) - { - case 1: - sprintf((pbuf+strlen(pbuf)), "Sperre"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "AWS 1"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "AWS 2"); - break; - case 0xe: - sprintf((pbuf+strlen(pbuf)), "Konferenz"); - break; - case 0xf: - sprintf((pbuf+strlen(pbuf)), "B-Kan uebern."); - break; - case 0x10: - sprintf((pbuf+strlen(pbuf)), "aktvrg. ghlt. Vbdg."); - break; - case 0x11: - sprintf((pbuf+strlen(pbuf)), "3er Konf"); - break; - case 0x12: - sprintf((pbuf+strlen(pbuf)), "1seitg D/G Wechsel"); - break; - case 0x13: - sprintf((pbuf+strlen(pbuf)), "2seitig D/G Wechsel"); - break; - case 0x14: - sprintf((pbuf+strlen(pbuf)), "Rufnr. identifiz."); - break; - case 0x15: - sprintf((pbuf+strlen(pbuf)), "GBG"); - break; - case 0x17: - sprintf((pbuf+strlen(pbuf)), "ueberg. Ruf"); - break; - case 0x1a: - sprintf((pbuf+strlen(pbuf)), "um/weitergel. Ruf"); - break; - case 0x1b: - sprintf((pbuf+strlen(pbuf)), "unterdr. A-Rufnr."); - break; - case 0x1e: - sprintf((pbuf+strlen(pbuf)), "Verbdg. deaktivieren"); - break; - case 0x1d: - sprintf((pbuf+strlen(pbuf)), "Verbdg. aktivieren"); - break; - case 0x1f: - sprintf((pbuf+strlen(pbuf)), "SPV"); - break; - case 0x23: - sprintf((pbuf+strlen(pbuf)), "Rueckw. 2seitg. DW"); - break; - case 0x24: - sprintf((pbuf+strlen(pbuf)), "Anrufumltg. priv. Netz"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "undefined"); - break; - } - i++; - sprintf((pbuf+strlen(pbuf)), ", serv=%d", buf[i]); - i++; - sprintf((pbuf+strlen(pbuf)), ", ainfo=%d", buf[i]); - i++; - len-=4; - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf))," 0x%02x", buf[j+i]); - } - sprintf((pbuf+strlen(pbuf)),"]"); - i += j; - goto next; - break; - case 0x28: - sprintf((pbuf+strlen(pbuf)), "[display: "); - break; - case 0x2c: - sprintf((pbuf+strlen(pbuf)), "[keypad: "); - break; - case 0x6c: - sprintf((pbuf+strlen(pbuf)), "[origination address: "); - i += p_1tr6address(pbuf, &buf[i]); - goto next; - break; - case 0x70: - sprintf((pbuf+strlen(pbuf)), "[destination address: "); - i += p_1tr6address(pbuf, &buf[i]); - goto next; - break; - case 0x7e: - sprintf((pbuf+strlen(pbuf)), "[user-user information: "); - break; - case 0x7f: - sprintf((pbuf+strlen(pbuf)), "[reserved: "); - break; - default: - sprintf((pbuf+strlen(pbuf)), "[UNKNOWN INFO-ELEMENT-ID"); - break; - } - } - else if(codeset == 6) - { - switch(buf[i]) - { - case 0x01: - sprintf((pbuf+strlen(pbuf)), "[service ind: serv="); - i+= 2; - switch(buf[i]) - { - case 0x01: - sprintf((pbuf+strlen(pbuf)), "phone"); - break; - case 0x02: - sprintf((pbuf+strlen(pbuf)), "a/b"); - break; - case 0x03: - sprintf((pbuf+strlen(pbuf)), "X.21"); - break; - case 0x04: - sprintf((pbuf+strlen(pbuf)), "fax g4"); - break; - case 0x05: - sprintf((pbuf+strlen(pbuf)), "btx"); - break; - case 0x07: - sprintf((pbuf+strlen(pbuf)), "64k data"); - break; - case 0x08: - sprintf((pbuf+strlen(pbuf)), "X.25"); - break; - case 0x09: - sprintf((pbuf+strlen(pbuf)), "teletex"); - break; - case 0x0a: - sprintf((pbuf+strlen(pbuf)), "mixed"); - break; - case 0x0d: - sprintf((pbuf+strlen(pbuf)), "temex"); - break; - case 0x0e: - sprintf((pbuf+strlen(pbuf)), "picturephone"); - break; - case 0x0f: - sprintf((pbuf+strlen(pbuf)), "btx (new)"); - break; - case 0x10: - sprintf((pbuf+strlen(pbuf)), "videophone"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "undefined"); - break; - } - i++; - sprintf((pbuf+strlen(pbuf)), ", ainfo=0x%02x]", buf[i]); - i++; - goto next; - break; - case 0x02: - sprintf((pbuf+strlen(pbuf)), "[charging information: "); - break; - case 0x03: - sprintf((pbuf+strlen(pbuf)), "[date: "); - i++; - len = buf[i]; - i++; - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]); - } - sprintf((pbuf+strlen(pbuf)),"]"); - i += j; - goto next; - break; - case 0x05: - sprintf((pbuf+strlen(pbuf)), "[facility select: "); - break; - case 0x06: - sprintf((pbuf+strlen(pbuf)), "[status of facilities: "); - break; - case 0x07: - sprintf((pbuf+strlen(pbuf)), "[status of called party: "); - i+=2; - switch(buf[i]) - { - case 1: - sprintf((pbuf+strlen(pbuf)), "no information]"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "is being called]"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "undefined (0x%02x)]", buf[i]); - break; - } - i++; - goto next; - break; - case 0x08: - sprintf((pbuf+strlen(pbuf)), "[additional tx attributes: "); - i++; - len = buf[i]; - i++; - for(j = 0; j < len; j++) - { - switch(buf[j+i] &0x70) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "no satellite link"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "one satellite link"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "two satellite links"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "three satellite links"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "undefined value"); - break; - } - if(buf[j+i] & 0x80) - sprintf((pbuf+strlen(pbuf)),"(flag=req)]"); - else - sprintf((pbuf+strlen(pbuf)),"(flag=ind)]"); - } - i += j; - goto next; - break; - default: - sprintf((pbuf+strlen(pbuf)), "[UNKNOWN INFO-ELEMENT-ID"); - break; - } - } - else - { - sprintf((pbuf+strlen(pbuf)), "[ILLEGAL CODESET = 0x%02x", codeset); - } - - i++; /* index -> length */ - - len = buf[i]; - - i++; /* index -> 1st param */ - - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf))," 0x%02x", buf[j+i]); - } - - sprintf((pbuf+strlen(pbuf)),"]"); - - i += len; - -next: - - if(!codelock && (codeset != oldcodeset)) - codeset = oldcodeset; - } - } - sprintf((pbuf+strlen(pbuf)),"\n"); -} - -/*---------------------------------------------------------------------------* - * decode and print the cause - *---------------------------------------------------------------------------*/ -static int -p_1tr6cause(char *pbuf, unsigned char buf[]) -{ - int j; - int len; - int i = 0; - - i++; /* index -> length */ - - len = buf[i]; - - switch(len) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "%s", print_cause_1tr6(0)); - break; - case 1: - i++; - sprintf((pbuf+strlen(pbuf)), "%s", print_cause_1tr6(buf[i] & 0x7f)); - break; - case 2: - i++; - sprintf((pbuf+strlen(pbuf)), "%s, location: ", print_cause_1tr6(buf[i] & 0x7f)); - i++; - switch(buf[i] & 0x0f) - { - case 0x04: - sprintf((pbuf+strlen(pbuf)), "public network"); - break; - case 0x05: - sprintf((pbuf+strlen(pbuf)), "private network"); - break; - case 0x0f: - sprintf((pbuf+strlen(pbuf)), "no information"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)", buf[i] & 0x0f); - break; - } - break; - default: - i++; /* index -> length */ - len = buf[i]; - i++; /* index -> 1st param */ - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf))," 0x%02x", buf[j+i]); - } - break; - } - i++; - sprintf((pbuf+strlen(pbuf)),"]"); - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and print the ISDN (telephone) number - *---------------------------------------------------------------------------*/ -static int -p_1tr6address(char *pbuf, unsigned char buf[]) -{ - int j; - int len; - int i = 0; - int tp; - - i++; /* index -> length */ - len = buf[i]; - i++; /* index -> 1st param */ - tp = buf[i]; - - i++; - len--; - - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]); - } - - switch((tp & 0x70) >> 4) - { - case 0: - sprintf((pbuf+strlen(pbuf)), " (type=unknown, "); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), " (type=international, "); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), " (type=national, "); - break; - default: - sprintf((pbuf+strlen(pbuf)), " (type=%d, ", ((tp & 0x70) >> 4)); - break; - } - - switch(tp & 0x0f) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "plan=unknown)"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "plan=ISDN)"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "plan=%d)", (tp & 0x0f)); - break; - } - - sprintf((pbuf+strlen(pbuf)),"]"); - - i += j; - - return(i); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/Makefile b/usr.sbin/i4b/isdntrace/Makefile deleted file mode 100644 index eae0919b299b..000000000000 --- a/usr.sbin/i4b/isdntrace/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -PROG= isdntrace -MAN= isdntrace.8 -SRCS= q921.c q931.c q931_util.c q932_fac.c 1tr6.c trace.c \ - pcause_1tr6.c pcause_q850.c unknownl3.c - -.include <bsd.prog.mk> - diff --git a/usr.sbin/i4b/isdntrace/cable.txt b/usr.sbin/i4b/isdntrace/cable.txt deleted file mode 100644 index 21a1cdb830b3..000000000000 --- a/usr.sbin/i4b/isdntrace/cable.txt +++ /dev/null @@ -1,62 +0,0 @@ - *--------------------------------------------------------------------------- - * - * Custom cable to trace an ISDN S0 bus with two passive (!) ISDN boards - * --------------------------------------------------------------------- - * - * $Id: cable.txt,v 1.4 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:55:42 1999] - * - * -hm documentation of analyze mode - * - *---------------------------------------------------------------------------*/ - -The cable consists of a RJ-45 plug with both tx and rx connected and -two jacks; the tx cables from the plug are wired to one jack and the -rx cables from the plug are wired to the other jack. - -The computer must be equipped with two (!) supported passive cards and -the cable from one card is plugged into one of the jacks while the cable -to from the other card is plugged into the other jack. - -Now one card monitors the tx part of the S0 bus and the other card -monitors the rx part. - -Which card functions as the rx side and which as the tx side can be -specified as options to the isdntrace utility (-R and -T) which has -to be run in analyzer mode (-a) to support this configuration. - - - 1 - 2 - 3 - +--------------4 receiving-side board - S0-bus +--|--------------5 in computer (jack for - to analyze | | 6 cable to passive controller) - 8 | | 7 - 7 | | 8 - transmit - 6------------|--|--+ - receive - 5------------+ | | - receive + 4---------------+ | - transmit + 3------------+ | - 2 | | 1 - 1 | | 2 - plug into | | 3 - S0 bus +-----|-----------4 transmitting-side board - +-----------5 in computer (jack for - 6 cable to passive controller) - 7 - 8 - - - - RJ-45 plug RJ-45 jack - view from the front view from the front - cable goes out to the rear - - /--------- / ---------- - | 87654321 | | 12345678 | - |__ __|/ |/_ /_| - |____|/ |/___| diff --git a/usr.sbin/i4b/isdntrace/isdntrace.8 b/usr.sbin/i4b/isdntrace/isdntrace.8 deleted file mode 100644 index 166f42063a5a..000000000000 --- a/usr.sbin/i4b/isdntrace/isdntrace.8 +++ /dev/null @@ -1,228 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: isdntrace.8,v 1.14 2000/02/13 15:26:52 hm Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Wed Nov 1 15:52:28 2000] -.\" -.Dd November 1, 2000 -.Dt ISDNTRACE 8 -.Os -.Sh NAME -.Nm isdntrace -.Nd isdn4bsd ISDN protocol trace utility -.Sh SYNOPSIS -.Nm -.Op Fl a -.Op Fl b -.Op Fl d -.Op Fl f Ar filename -.Op Fl h -.Op Fl i -.Op Fl l -.Op Fl n Ar number -.Op Fl o -.Op Fl p Ar filename -.Op Fl r -.Op Fl u Ar number -.Op Fl x -.Op Fl B -.Op Fl F -.Op Fl P -.Op Fl R Ar unit -.Op Fl T Ar unit -.Sh DESCRIPTION -The -.Nm -utility is part of the isdn4bsd package and is used to provide the user with a -mnemonic display of the layers 1, 2 and 3 protocol activities on -the D channel and hex dump of the B channel(s) activities. -.Pp -Together with two passive supported cards and an easy to build cable it can -also be used to monitor the complete traffic on a S0 bus providing S0 bus -analyzer features. -.Pp -The -.Nm -utility is only available for passive supported cards. -.Pp -.Em Note -.Pp -All filenames, user specified or default, get a date and time stamp string -added in the form -yyyymmdd-hhmmss: a hyphen, four digits year, two digits -month and day, a hyphen and two digits hour, minutes and seconds. -Tracefiles no longer get overwritten. -In case a new filename is needed within a second, the filename-generating -mechanism sleeps one second. -.Pp -In case the program is sent a USR1 signal, a new user specified or default -filename with a new date and timestamp is generated and opened. -.Pp -The following options can be used: -.Bl -tag -width Ds -.It Fl a -Run -.Nm -in analyzer mode by using two passive cards and a custom cable which can -be build as described in the file -.Em cable.txt -in the isdn4bsd source distribution. -One card acts as a receiver for the -transmitting direction on the S0 bus while the other card acts as a receiver -for the receiving direction on the S0 bus. -Complete traffic monitoring is -possible using this setup. -.It Fl b -switch B channel tracing on (default off). -.It Fl d -switch D channel tracing off (default on). -.It Fl f -Use -.Ar filename -as the name of a file into which to write tracing output (default filename is -isdntrace<n> where n is the number of the unit to trace). -.It Fl h -switch display of header off (default on). -.It Fl i -print layer 1 (I.430) INFO signals to monitor layer 1 activity (default off). -.It Fl l -switch displaying of Layer 2 (Q.921) frames off (default on). -.It Fl n -This option takes a numeric argument specifying the minimum -frame size in octets a frame must have to be displayed. -(default 0) -.It Fl o -switch off writing trace output to a file (default on). -.It Fl p -Use -.Ar filename -as the name of a file used for the -B and -P options (default filename -is isdntracebin<n> where n is the number of the unit to trace). -.It Fl r -Switch off printing a raw hexadecimal dump of the packets preceding -the decoded protocol information (default on). -.It Fl u -Use -.Ar number -as the unit number of the controller card to trace (default 0). -.It Fl x -Switch on printing of packets with a non-Q.931 protocol discriminator. -(default off). -.It Fl B -Write undecoded binary trace data to a file for later or remote -analyzing (default off). -.It Fl F -This option can only be used when option -P (playback from binary data file) -is used. -The -F option causes playback not to stop at end of file but rather -to wait for additional data to be available from the input file. -.Pp -This option is useful when trace data is accumulated in binary format (to -save disk space) but a monitoring functionality is desired. -(default off). -.It Fl P -Read undecoded binary trace data from file instead from device (default off). -.It Fl R -Use -.Ar unit -as the receiving interface unit number in analyze mode. -.It Fl T -Use -.Ar unit -as the transmitting interface unit number in analyze mode. -.El -.Pp -When the USR1 signal is sent to a -.Nm -process, the currently used logfiles are reopened, so that logfile -rotation becomes possible. -.Pp -The trace output should be obvious. -It is very handy to have the following -standard texts available when tracing ISDN protocols: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar I.430 -ISDN BRI layer 1 protocol description. -.It Ar Q.921 -ISDN D-channel layer 2 protocol description. -.It Ar Q.931 -ISDN D-channel layer 3 protocol description. -.It Ar 1TR6 -German-specific ISDN layer 3 protocol description. -(NOTICE: decoding -of the 1TR6 protocol is included but not supported since i dont have -any longer access to a 1TR6 based ISDN installation.) -.El -.Pp -The -.Nm -utility -automatically detects the layer 3 protocol being used by looking at the -Protocol Discriminator (see: Q.931/1993 pp.\& 53). -.Sh FILES -.Bl -tag -width daddeldi -compact -.It Pa /dev/i4btrc<n> -The devicefile(s) used to get the trace messages for ISDN card unit <n> -out of the kernel. -.El -.Sh EXAMPLES -The command: -.Bd -literal -offset indent -isdntrace -f /var/tmp/isdn.trace -.Ed -.Pp -will start D channel tracing on passive controller 0 with all except B -channel tracing enabled and logs everything into the output file -/var/tmp/isdn.trace-yyyymmdd-hhmmss (where yyyymmdd and hhmmss are replaced -by the current date and time values). -.Sh SEE ALSO -.Xr isdnd 8 -.Sh STANDARDS -ITU Recommendations I.430, Q.920, Q.921, Q.930, Q.931 -.Pp -FTZ Richtlinie 1TR3, Band III -.Pp -ITU Recommendation Q.932 (03/93), Q.950 (03/93) -.Pp -ETSI Recommendation ETS 300 179 (10/92), ETS 300 180 (10/92) -.Pp -ETSI Recommendation ETS 300 181 (04/93), ETS 300 182 (04/93) -.Pp -ITU Recommendation X.208, X.209 -.Sh AUTHORS -.An -nosplit -The -.Nm -utility was written by -.An Gary Jennejohn Aq gj@FreeBSD.org -and -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -.Pp -This manual page was written by -.An Hellmuth Michaelis . -.Sh BUGS -Still some or more left. diff --git a/usr.sbin/i4b/isdntrace/pcause_1tr6.c b/usr.sbin/i4b/isdntrace/pcause_1tr6.c deleted file mode 100644 index b319d7452e34..000000000000 --- a/usr.sbin/i4b/isdntrace/pcause_1tr6.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * printing cause values - * --------------------- - * - * $Id: pcause_1tr6.c,v 1.6 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:56:03 1999] - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" -#include "pcause_1tr6.h" - -char * -print_cause_1tr6(unsigned char code) -{ - static char error_message[120]; - char *e; - - switch(code) - { - case CAUSE_1TR6_SHUTDN: - e = "normal D-channel shutdown"; - break; - - case CAUSE_1TR6_ICRV: - e = "invalid call reference value"; - break; - - case CAUSE_1TR6_BSNI: - e = "bearer service not implemented"; - break; - - case CAUSE_1TR6_CIDNE: - e = "call identity does not exist"; - break; - - case CAUSE_1TR6_CIIU: - e = "call identity in use"; - break; - - case CAUSE_1TR6_NCA: - e = "no channel available"; - break; - - case CAUSE_1TR6_RFNI: - e = "requested facility not implemented"; - break; - - case CAUSE_1TR6_RFNS: - e = "requested facility not subscribed"; - break; - - case CAUSE_1TR6_OCB: - e = "outgoing calls barred"; - break; - - case CAUSE_1TR6_UAB: - e = "user access busy"; - break; - - case CAUSE_1TR6_NECUG: - e = "non existent CUG"; - break; - - case CAUSE_1TR6_NECUG1: - e = "non existent CUG"; - break; - - case CAUSE_1TR6_SPV: - e = "kommunikationsbeziehung als SPV nicht erlaubt"; - break; - - case CAUSE_1TR6_DNO: - e = "destination not obtainable"; - break; - - case CAUSE_1TR6_NC: - e = "number changed"; - break; - - case CAUSE_1TR6_OOO: - e = "out of order"; - break; - - case CAUSE_1TR6_NUR: - e = "no user responding"; - break; - - case CAUSE_1TR6_UB: - e = "user busy"; - break; - - case CAUSE_1TR6_ICB: - e = "incoming calls barred"; - break; - - case CAUSE_1TR6_CR: - e = "call rejected"; - break; - - case CAUSE_1TR6_NCO: - e = "network congestion"; - break; - - case CAUSE_1TR6_RUI: - e = "remote user initiated"; - break; - - case CAUSE_1TR6_LPE: - e = "local procedure error"; - break; - - case CAUSE_1TR6_RPE: - e = "remote procedure error"; - break; - - case CAUSE_1TR6_RUS: - e = "remote user suspended"; - break; - - case CAUSE_1TR6_RUR: - e = "remote user resumed"; - break; - - case CAUSE_1TR6_UIDL: - e = "user info discharded locally"; - break; - - default: - e = "UNKNOWN error occured"; - break; - } - - sprintf(error_message, "0x%02x: %s", code & 0x7f, e); - return(error_message); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/pcause_1tr6.h b/usr.sbin/i4b/isdntrace/pcause_1tr6.h deleted file mode 100644 index 67f50deedc85..000000000000 --- a/usr.sbin/i4b/isdntrace/pcause_1tr6.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * pcause1tr6.h - 1TR6 causes definitions - * -------------------------------------- - * - * $Id: pcause_1tr6.h,v 1.5 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:56:10 1999] - * - *---------------------------------------------------------------------------*/ - -char *print_cause_1tr6(unsigned char code); - -/* 1TR6 protocol causes */ - -#define CAUSE_1TR6_SHUTDN 0x00 /* normal D-channel shutdown */ -#define CAUSE_1TR6_ICRV 0x01 /* invalid call reference value */ -#define CAUSE_1TR6_BSNI 0x03 /* bearer service not implemented */ -#define CAUSE_1TR6_CIDNE 0x07 /* call identity does not exist */ -#define CAUSE_1TR6_CIIU 0x08 /* call identity in use */ -#define CAUSE_1TR6_NCA 0x0A /* no channel available */ -#define CAUSE_1TR6_RFNI 0x10 /* requested facility not implemented */ -#define CAUSE_1TR6_RFNS 0x11 /* requested facility not subscribed */ -#define CAUSE_1TR6_OCB 0x20 /* outgoing calls barred */ -#define CAUSE_1TR6_UAB 0x21 /* user access busy */ -#define CAUSE_1TR6_NECUG 0x22 /* non existent CUG */ -#define CAUSE_1TR6_NECUG1 0x23 /* non existent CUG */ -#define CAUSE_1TR6_SPV 0x25 /* kommunikationsbeziehung als SPV nicht erlaubt */ -#define CAUSE_1TR6_DNO 0x35 /* destination not obtainable */ -#define CAUSE_1TR6_NC 0x38 /* number changed */ -#define CAUSE_1TR6_OOO 0x39 /* out of order */ -#define CAUSE_1TR6_NUR 0x3A /* no user responding */ -#define CAUSE_1TR6_UB 0x3B /* user busy */ -#define CAUSE_1TR6_ICB 0x3D /* incoming calls barred */ -#define CAUSE_1TR6_CR 0x3E /* call rejected */ -#define CAUSE_1TR6_NCO 0x59 /* network congestion */ -#define CAUSE_1TR6_RUI 0x5A /* remote user initiated */ -#define CAUSE_1TR6_LPE 0x70 /* local procedure error */ -#define CAUSE_1TR6_RPE 0x71 /* remote procedure error */ -#define CAUSE_1TR6_RUS 0x72 /* remote user suspended */ -#define CAUSE_1TR6_RUR 0x73 /* remote user resumed */ -#define CAUSE_1TR6_UIDL 0x7F /* user info discharded locally */ - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/pcause_q850.c b/usr.sbin/i4b/isdntrace/pcause_q850.c deleted file mode 100644 index 57eaf32dc955..000000000000 --- a/usr.sbin/i4b/isdntrace/pcause_q850.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * printing cause values - * --------------------- - * - * $Id: pcause_q850.c,v 1.6 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:56:18 1999] - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" -#include "pcause_q850.h" - -char * -print_cause_q850(unsigned char code) -{ - static char error_message[120]; - char *e; - - switch(code) - { - case CAUSE_Q850_SHUTDN: - e = "normal D-channel shutdown"; - break; - - case CAUSE_Q850_NUNALLC: - e = "Unallocated (unassigned) number"; - break; - - case CAUSE_Q850_NRTTN: - e = "No route to specified transit network"; - break; - - case CAUSE_Q850_NRTDST: - e = "No route to destination"; - break; - - case CAUSE_Q850_SSINFTN: - e = "Send special information tone"; - break; - - case CAUSE_Q850_MDIALTP: - e = "Misdialled trunk prefix"; - break; - - case CAUSE_Q850_CHUNACC: - e = "Channel unacceptable"; - break; - - case CAUSE_Q850_CALLAWD: - e = "Call awarded and being delivered in an established channel"; - break; - - case CAUSE_Q850_PREEMPT: - e = "Preemption"; - break; - - case CAUSE_Q850_PREECRR: - e = "Preemption - circuit reserved for reuse"; - break; - - case CAUSE_Q850_NCCLR: - e = "Normal call clearing"; - break; - - case CAUSE_Q850_USRBSY: - e = "User busy"; - break; - - case CAUSE_Q850_NOUSRRSP: - e = "No user responding"; - break; - - case CAUSE_Q850_NOANSWR: - e = "No answer from user (user alerted)"; - break; - - case CAUSE_Q850_SUBSABS: - e = "Subscriber absent"; - break; - - case CAUSE_Q850_CALLREJ: - e = "Call rejected"; - break; - - case CAUSE_Q850_NUCHNG: - e = "Number changed"; - break; - - case CAUSE_Q850_NONSELUC: - e = "Non-selected user clearing"; - break; - - case CAUSE_Q850_DSTOOORDR: - e = "Destination out of order"; - break; - - case CAUSE_Q850_INVNUFMT: - e = "Invalid number format"; - break; - - case CAUSE_Q850_FACREJ: - e = "Facility rejected"; - break; - - case CAUSE_Q850_STENQRSP: - e = "Response to STATUS ENQUIRY"; - break; - - case CAUSE_Q850_NORMUNSP: - e = "Normal, unspecified"; - break; - - case CAUSE_Q850_NOCAVAIL: - e = "No circuit / channel available"; - break; - - case CAUSE_Q850_NETOOORDR: - e = "Network out of order"; - break; - - case CAUSE_Q850_PFMCDOOSERV: - e = "Permanent frame mode connection out of service"; - break; - - case CAUSE_Q850_PFMCOPER: - e = "Permanent frame mode connection operational"; - break; - - case CAUSE_Q850_TMPFAIL: - e = "Temporary failure"; - break; - - case CAUSE_Q850_SWEQCONG: - e = "Switching equipment congestion"; - break; - - case CAUSE_Q850_ACCINFDIS: - e = "Access information discarded"; - break; - - case CAUSE_Q850_REQCNOTAV: - e = "Requested circuit/channel not available"; - break; - - case CAUSE_Q850_PRECALBLK: - e = "Precedence call blocked"; - break; - - case CAUSE_Q850_RESUNAVAIL: - e = "Resources unavailable, unspecified"; - break; - - case CAUSE_Q850_QOSUNAVAIL: - e = "Quality of service unavailable"; - break; - - case CAUSE_Q850_REQSERVNS: - e = "Requested facility not subscribed"; - break; - - case CAUSE_Q850_OCBARRCUG: - e = "Outgoing calls barred within CUG"; - break; - - case CAUSE_Q850_ICBARRCUG: - e = "Incoming calls barred within CUG"; - break; - - case CAUSE_Q850_BCAPNAUTH: - e = "Bearer capability not authorized"; - break; - - case CAUSE_Q850_BCAPNAVAIL: - e = "Bearer capability not presently available"; - break; - - case CAUSE_Q850_INCSTOACISC: - e = "Inconsistenciy in designated outg. access info and subscriber class"; - break; - - case CAUSE_Q850_SOONOTAVAIL: - e = "Service or option not available, unspecified"; - break; - - case CAUSE_Q850_BCAPNOTIMPL: - e = "Bearer capability not implemented"; - break; - - case CAUSE_Q850_CHTYPNIMPL: - e = "Channel type not implemented"; - break; - - case CAUSE_Q850_REQFACNIMPL: - e = "Requested facility not implemented"; - break; - - case CAUSE_Q850_ORDINBCAVL: - e = "Only restricted digital information bearer capability is available"; - break; - - case CAUSE_Q850_SOONOTIMPL: - e = "Service or option not implemented, unspecified"; - break; - - case CAUSE_Q850_INVCLRFVAL: - e = "Invalid call reference value"; - break; - - case CAUSE_Q850_IDCHDNOEX: - e = "Identified channel does not exist"; - break; - - case CAUSE_Q850_SUSCAEXIN: - e = "A suspended call exists, but this call identity does not"; - break; - - case CAUSE_Q850_CLIDINUSE: - e = "Call identity in use"; - break; - - case CAUSE_Q850_NOCLSUSP: - e = "No call suspended"; - break; - - case CAUSE_Q850_CLIDCLRD: - e = "Call having the requested call identity has been cleared"; - break; - - case CAUSE_Q850_UNOTMEMCUG: - e = "User not member of CUG"; - break; - - case CAUSE_Q850_INCDEST: - e = "Incompatible destination"; - break; - - case CAUSE_Q850_NONEXCUG: - e = "Non-existent CUG"; - break; - - case CAUSE_Q850_INVNTWSEL: - e = "Invalid transit network selection"; - break; - - case CAUSE_Q850_INVMSG: - e = "Invalid message, unspecified"; - break; - - case CAUSE_Q850_MIEMISS: - e = "Mandatory information element is missing"; - break; - - case CAUSE_Q850_MSGTNI: - e = "Message type non-existent or not implemented"; - break; - - case CAUSE_Q850_MSGNCMPT: - e = "Msg incompatible with call state/message type non-existent/not implemented"; - break; - - case CAUSE_Q850_IENENI: - e = "Information element/parameter non-existent or not implemented"; - break; - - case CAUSE_Q850_INVIEC: - e = "Invalid information element contents"; - break; - - case CAUSE_Q850_MSGNCWCS: - e = "Message not compatible with call state"; - break; - - case CAUSE_Q850_RECOTIMEXP: - e = "Recovery on timer expiry"; - break; - - case CAUSE_Q850_PARMNENIPO: - e = "Parameter non-existent or not implemented, passed on"; - break; - - case CAUSE_Q850_MSGUNRDPRM: - e = "Message with unrecognized parameter, discarded"; - break; - - case CAUSE_Q850_PROTERR: - e = "Protocol error, unspecified"; - break; - - case CAUSE_Q850_INTWRKU: - e = "Interworking, unspecified"; - break; - - default: - e = "ERROR, unknown cause value!"; - break; - } - - sprintf(error_message, "%d: %s (Q.850)", code, e); - return(error_message); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/pcause_q850.h b/usr.sbin/i4b/isdntrace/pcause_q850.h deleted file mode 100644 index ea21770ca3b7..000000000000 --- a/usr.sbin/i4b/isdntrace/pcause_q850.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * pcauseq850.h - Q.850 causes definitions - * --------------------------------------- - * - * $Id: pcause_q850.h,v 1.5 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:56:25 1999] - * - *---------------------------------------------------------------------------*/ - -char *print_cause_q850(unsigned char code); - -/* Q.850 causes */ - -#define CAUSE_Q850_SHUTDN 0x00 /* normal D-channel shutdown */ -#define CAUSE_Q850_NUNALLC 0x01 /* Unallocated (unassigned) number */ -#define CAUSE_Q850_NRTTN 0x02 /* No route to specified transit network */ -#define CAUSE_Q850_NRTDST 0x03 /* No route to destination */ -#define CAUSE_Q850_SSINFTN 0x04 /* Send special information tone */ -#define CAUSE_Q850_MDIALTP 0x05 /* Misdialled trunk prefix */ -#define CAUSE_Q850_CHUNACC 0x06 /* Channel unacceptable */ -#define CAUSE_Q850_CALLAWD 0x07 /* Call awarded and being delivered in an established channel */ -#define CAUSE_Q850_PREEMPT 0x08 /* Preemption */ -#define CAUSE_Q850_PREECRR 0x09 /* Preemption - circuit reserved for reuse */ -#define CAUSE_Q850_NCCLR 0x10 /* Normal call clearing */ -#define CAUSE_Q850_USRBSY 0x11 /* User busy */ -#define CAUSE_Q850_NOUSRRSP 0x12 /* No user responding */ -#define CAUSE_Q850_NOANSWR 0x13 /* No answer from user (user alerted) */ -#define CAUSE_Q850_SUBSABS 0x14 /* Subscriber absent */ -#define CAUSE_Q850_CALLREJ 0x15 /* Call rejected */ -#define CAUSE_Q850_NUCHNG 0x16 /* Number changed */ -#define CAUSE_Q850_NONSELUC 0x1A /* Non-selected user clearing */ -#define CAUSE_Q850_DSTOOORDR 0x1B /* Destination out of order */ -#define CAUSE_Q850_INVNUFMT 0x1C /* Invalid number format */ -#define CAUSE_Q850_FACREJ 0x1D /* Facility rejected */ -#define CAUSE_Q850_STENQRSP 0x1E /* Response to STATUS ENQUIRY */ -#define CAUSE_Q850_NORMUNSP 0x1F /* Normal, unspecified */ -#define CAUSE_Q850_NOCAVAIL 0x22 /* No circuit / channel available */ -#define CAUSE_Q850_NETOOORDR 0x26 /* Network out of order */ -#define CAUSE_Q850_PFMCDOOSERV 0x27 /* Permanent frame mode connection out of service */ -#define CAUSE_Q850_PFMCOPER 0x28 /* Permanent frame mode connection operational */ -#define CAUSE_Q850_TMPFAIL 0x29 /* Temporary failure */ -#define CAUSE_Q850_SWEQCONG 0x2A /* Switching equipment congestion */ -#define CAUSE_Q850_ACCINFDIS 0x2B /* Access information discarded */ -#define CAUSE_Q850_REQCNOTAV 0x2C /* Requested circuit/channel not available */ -#define CAUSE_Q850_PRECALBLK 0x2E /* Precedence call blocked */ -#define CAUSE_Q850_RESUNAVAIL 0x2F /* Resources unavailable, unspecified */ -#define CAUSE_Q850_QOSUNAVAIL 0x31 /* Quality of service unavailable */ -#define CAUSE_Q850_REQSERVNS 0x32 /* Requested facility not subscribed */ -#define CAUSE_Q850_OCBARRCUG 0x35 /* Outgoing calls barred within CUG */ -#define CAUSE_Q850_ICBARRCUG 0x36 /* Incoming calls barred within CUG */ -#define CAUSE_Q850_BCAPNAUTH 0x39 /* Bearer capability not authorized */ -#define CAUSE_Q850_BCAPNAVAIL 0x3A /* Bearer capability not presently available */ -#define CAUSE_Q850_INCSTOACISC 0x3E /* Inconsistenciy in designated outgoing access information and subscriber class */ -#define CAUSE_Q850_SOONOTAVAIL 0x3F /* Service or option not available, unspecified */ -#define CAUSE_Q850_BCAPNOTIMPL 0x41 /* Bearer capability not implemented */ -#define CAUSE_Q850_CHTYPNIMPL 0x42 /* Channel type not implemented */ -#define CAUSE_Q850_REQFACNIMPL 0x45 /* Requested facility not implemented */ -#define CAUSE_Q850_ORDINBCAVL 0x46 /* Only restricted digital information bearer capability is available */ -#define CAUSE_Q850_SOONOTIMPL 0x4F /* Service or option not implemented, unspecified */ -#define CAUSE_Q850_INVCLRFVAL 0x51 /* Invalid call reference value */ -#define CAUSE_Q850_IDCHDNOEX 0x52 /* Identified channel does not exist */ -#define CAUSE_Q850_SUSCAEXIN 0x53 /* A suspended call exists, but this call identity does not */ -#define CAUSE_Q850_CLIDINUSE 0x54 /* Call identity in use */ -#define CAUSE_Q850_NOCLSUSP 0x55 /* No call suspended */ -#define CAUSE_Q850_CLIDCLRD 0x56 /* Call having the requested call identity has been cleared */ -#define CAUSE_Q850_UNOTMEMCUG 0x57 /* User not member of CUG */ -#define CAUSE_Q850_INCDEST 0x58 /* Incompatible destination */ -#define CAUSE_Q850_NONEXCUG 0x5A /* Non-existent CUG */ -#define CAUSE_Q850_INVNTWSEL 0x5B /* Invalid transit network selection */ -#define CAUSE_Q850_INVMSG 0x5F /* Invalid message, unspecified */ -#define CAUSE_Q850_MIEMISS 0x60 /* Mandatory information element is missing */ -#define CAUSE_Q850_MSGTNI 0x61 /* Message type non-existent or not implemented */ -#define CAUSE_Q850_MSGNCMPT 0x62 /* Message not compatible with call state or message type non-existent or not implemented */ -#define CAUSE_Q850_IENENI 0x63 /* Information element/parameter non-existent or not implemented */ -#define CAUSE_Q850_INVIEC 0x64 /* Invalid information element contents */ -#define CAUSE_Q850_MSGNCWCS 0x65 /* Message not compatible with call state */ -#define CAUSE_Q850_RECOTIMEXP 0x66 /* Recovery on timer expiry */ -#define CAUSE_Q850_PARMNENIPO 0x67 /* Parameter non-existent or not implemented, passed on */ -#define CAUSE_Q850_MSGUNRDPRM 0x6E /* Message with unrecognized parameter, discarded */ -#define CAUSE_Q850_PROTERR 0x6F /* Protocol error, unspecified */ -#define CAUSE_Q850_INTWRKU 0x7F /* Interworking, unspecified */ - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/q921.c b/usr.sbin/i4b/isdntrace/q921.c deleted file mode 100644 index e8c14dc67110..000000000000 --- a/usr.sbin/i4b/isdntrace/q921.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 1996 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *---------------------------------------------------------------------------* - * - * q.921.c - print Q.921 traces - * ---------------------------- - * - * $Id: q921.c,v 1.4 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:56:46 1999] - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" - -/*---------------------------------------------------------------------------* - * decode LAPD (Q.921) protocol - *---------------------------------------------------------------------------*/ -int -decode_lapd(char *pbuf, int n, unsigned char *buf, int dir, int raw, int printit) -{ - int sap, tei, cmd, p_f; - int cnt = 0; - int i; - char locbuf[32000]; - char *lbufp = &locbuf[0]; - - *lbufp = '\0'; - *pbuf = '\0'; - - sap = (buf[0] >> 2) & 0x3f; - cnt++; - - tei = buf[1] >> 1; - cnt++; - - if(dir == FROM_TE) - cmd = !(buf[0] & 2); - else - cmd = buf[0] & 2; - - switch (sap) - { - /* SAPI control procedures */ - case 0: - { - if(printit) - sprintf((lbufp+strlen(lbufp)), "Q921: SAP=%d (Call Control), %c, TEI=%d, ", sap, cmd?'C':'R', tei); - - if((buf[2] & 0x01) == 0) - { - if(printit) - sprintf((lbufp+strlen(lbufp)), "I-Frame: "); - - p_f = buf [3] & 1; - - if(printit) - sprintf((lbufp+strlen(lbufp)), "N(S) %d N(R) %d P %d ", buf [2] >> 1, buf [3] >> 1, p_f); - - cnt += 2; - } - else if((buf[2] & 0x03) == 0x01) - { - if(printit) - sprintf((lbufp+strlen(lbufp)), "S-Frame: "); - - p_f = buf [3] & 1; - cmd = buf [2] & 0x0c; - - if(printit) - { - if (cmd == 0) - sprintf((lbufp+strlen(lbufp)), "RR N(R) %d PF %d ", buf [3] >> 1, p_f); - if (cmd == 4) - sprintf((lbufp+strlen(lbufp)), "RNR N(R) %d PF %d ", buf [3] >> 1, p_f); - if (cmd == 8) - sprintf((lbufp+strlen(lbufp)), "REJ N(R) %d PF %d ", buf [3] >> 1, p_f); - } - cnt += 2; - } - else if((buf[2] & 0x03) == 0x03) - { - if(printit) - sprintf((lbufp+strlen(lbufp)), "U-Frame: "); - - p_f = (buf [2] & 0x10) >> 4; - cmd = buf [2] & 0xec; - - if(printit) - { - if (cmd == 0x6c) - sprintf((lbufp+strlen(lbufp)), "SABME PF %d ", p_f); - if (cmd == 0x0c) - sprintf((lbufp+strlen(lbufp)), "DM PF %d ", p_f); - if (cmd == 0) - sprintf((lbufp+strlen(lbufp)), "UI PF %d ", p_f); - if (cmd == 0x40) - sprintf((lbufp+strlen(lbufp)), "DISC PF %d ", p_f); - if (cmd == 0x60) - sprintf((lbufp+strlen(lbufp)), "UA PF %d ", p_f); - if (cmd == 0x84) - sprintf((lbufp+strlen(lbufp)), "FRMR PF %d ", p_f); - if (cmd == 0xac) - sprintf((lbufp+strlen(lbufp)), "XID PF %d ", p_f); - /* information field ??? */ - } - cnt++; - } - break; - } - - /* D channel X.25 */ - - case 16: - if(printit) - sprintf((lbufp+strlen(lbufp)), "Q921: SAP=%d (X.25), %c, TEI=%d, ", sap, cmd?'C':'R', tei); - cnt = n; - goto dump; - - /* Loopback test */ - - case 32: - if(printit) - sprintf((lbufp+strlen(lbufp)), "Q921: SAP=%d (Loopbacktest), %c, TEI=%d, ", sap, cmd?'C':'R', tei); - cnt = n; - goto dump; - - /* SAPI layer 2 management functions */ - - case 63: - { - if(printit) - sprintf((lbufp+strlen(lbufp)), "Q921: SAP=%d (TEI-Management), %c, TEI=%d, ", sap, cmd?'C':'R', tei); - - if (tei != 127) - { - if(printit) - sprintf((lbufp+strlen(lbufp)), "ILLEGAL TEI\n"); - cnt = n; - goto dump; - } - - if (buf [2] != 3 && buf [3] != 0xf) - { - if(printit) - sprintf((lbufp+strlen(lbufp)), "invalid format!\n"); - cnt = n; - goto dump; - } - cnt+= 2; /* UI + MEI */ - - if(printit) - sprintf((lbufp+strlen(lbufp)), "Ri=0x%04hx, ", *(short *)&buf[4]); - cnt += 2; /* Ri */ - - switch (buf[6]) - { - case 1: - if(printit) - sprintf((lbufp+strlen(lbufp)), "IdRequest, Ai=%d", (buf [7] >> 1)); - cnt += 2; - break; - case 2: - if(printit) - sprintf((lbufp+strlen(lbufp)), "IdAssign, Ai=%d", (buf [7] >> 1)); - cnt += 2; - break; - case 3: - if(printit) - sprintf((lbufp+strlen(lbufp)), "IdDenied, Ai=%d", (buf [7] >> 1)); - cnt += 2; - break; - case 4: - if(printit) - sprintf((lbufp+strlen(lbufp)), "IdCheckReq, Ai=%d", (buf [7] >> 1)); - cnt += 2; - break; - case 5: - if(printit) - sprintf((lbufp+strlen(lbufp)), "IdCheckResp, Ai=%d", (buf [7] >> 1)); - cnt += 2; - break; - case 6: - if(printit) - sprintf((lbufp+strlen(lbufp)), "IdRemove, Ai=%d", (buf [7] >> 1)); - cnt += 2; - break; - case 7: - if(printit) - sprintf((lbufp+strlen(lbufp)), "IdVerify, Ai=%d", (buf [7] >> 1)); - cnt += 2; - break; - default: - if(printit) - sprintf((lbufp+strlen(lbufp)), "Unknown Msg Type\n"); - cnt = n; - goto dump; - } - break; - } - - /* Illegal SAPI */ - - default: - if(printit) - sprintf((lbufp+strlen(lbufp)), "Q921: ERROR, SAP=%d (Illegal SAPI), %c, TEI=%d\n", sap, cmd?'C':'R', tei); - cnt = n; - goto dump; - } - -dump: - if(printit) - sprintf((lbufp+strlen(lbufp)), "\n"); - - if(raw && printit) - { - int j; - for (i = 0; i < cnt; i += 16) - { - sprintf((pbuf+strlen(pbuf)),"Dump:%.3d ", i); - for (j = 0; j < 16; j++) - if (i + j < cnt) - sprintf((pbuf+strlen(pbuf)),"%02x ", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf))," "); - sprintf((pbuf+strlen(pbuf))," "); - for (j = 0; j < 16 && i + j < cnt; j++) - if (isprint(buf[i + j])) - sprintf((pbuf+strlen(pbuf)),"%c", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf)),"."); - sprintf((pbuf+strlen(pbuf)),"\n"); - } - } - - sprintf((pbuf+strlen(pbuf)),"%s", &locbuf[0]); - - return (cnt); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/q931.c b/usr.sbin/i4b/isdntrace/q931.c deleted file mode 100644 index d69453eb9f91..000000000000 --- a/usr.sbin/i4b/isdntrace/q931.c +++ /dev/null @@ -1,800 +0,0 @@ -/* - * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * q931.c - print Q.931 traces - * --------------------------- - * - * $FreeBSD$ - * - * last edit-date: [Wed Oct 17 14:49:16 2001] - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" - -/*---------------------------------------------------------------------------* - * decode Q.931 protocol - *---------------------------------------------------------------------------*/ -void -decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw) -{ - int codeset = 0; - int codelock = 0; - int oldcodeset = 0; - - int pd; - int len; - int j; - int i; - - if(n <= 0) - return; - - *pbuf = '\0'; - - if(raw) - { - for (i = 0; i < n; i += 16) - { - sprintf((pbuf+strlen(pbuf)),"Dump:%.3d ", i+off); - for (j = 0; j < 16; j++) - if (i + j < n) - sprintf((pbuf+strlen(pbuf)),"%02x ", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf))," "); - sprintf((pbuf+strlen(pbuf))," "); - for (j = 0; j < 16 && i + j < n; j++) - if (isprint(buf[i + j])) - sprintf((pbuf+strlen(pbuf)),"%c", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf)),"."); - sprintf((pbuf+strlen(pbuf)),"\n"); - } - } - - i = 0; - - sprintf((pbuf+strlen(pbuf)), "Q931: "); - - /* protocol discriminator */ - - pd = buf[i]; - - if(pd >= 0x00 && pd <= 0x07) - sprintf((pbuf+strlen(pbuf)), "pd=User-User (0x%02x)\n",pd); - else if(pd == 0x08) - sprintf((pbuf+strlen(pbuf)), "pd=Q.931/I.451, "); - else if(pd >= 0x10 && pd <= 0x3f) - sprintf((pbuf+strlen(pbuf)), "pd=Other Layer 3 or X.25 (0x%02x)\n",pd); - else if(pd >= 0x40 && pd <= 0x4f) - sprintf((pbuf+strlen(pbuf)), "pd=National Use (0x%02x)\n",pd); - else if(pd >= 0x50 && pd <= 0xfe) - sprintf((pbuf+strlen(pbuf)), "pd=Other Layer 3 or X.25 (0x%02x)\n",pd); - else - sprintf((pbuf+strlen(pbuf)), "pd=Reserved (0x%02x)\n",pd); - - /* call reference */ - - i++; - - len = buf[i] & 0x0f; - - switch(len) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "cr=Dummy, "); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "cr=0x%02x %s, ", (buf[i+1] & 0x7f), (buf[i+1] & 0x80) ? "(from destination)" : "(from origination)"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "cr=0x%02x 0x%02x %s, ", (buf[i+1] & 0x7f), (buf[i+2] & 0x7f), (buf[i+1] & 0x80) ? "(org)" : "(dst)"); - break; - } - - i += (len+1); - - /* message type */ - - sprintf((pbuf+strlen(pbuf)), "message="); - - switch(buf[i]) - { - /* escape to nationally specific message type */ - - case 0x00: - sprintf((pbuf+strlen(pbuf)), "ESCAPE: "); - break; - - /* call establishment */ - - case 0x01: - sprintf((pbuf+strlen(pbuf)), "ALERTING: "); - break; - case 0x02: - sprintf((pbuf+strlen(pbuf)), "CALL PROCEEDING: "); - break; - case 0x03: - sprintf((pbuf+strlen(pbuf)), "PROGRESS: "); - break; - case 0x05: - sprintf((pbuf+strlen(pbuf)), "SETUP: "); - break; - case 0x07: - sprintf((pbuf+strlen(pbuf)), "CONNECT: "); - break; - case 0x0d: - sprintf((pbuf+strlen(pbuf)), "SETUP ACKNOWLEDGE: "); - break; - case 0x0f: - sprintf((pbuf+strlen(pbuf)), "CONNECT ACKNOWLEDGE: "); - break; - - /* call information phase */ - - case 0x20: - sprintf((pbuf+strlen(pbuf)), "USER INFORMATION: "); - break; - case 0x21: - sprintf((pbuf+strlen(pbuf)), "SUSPEND REJECT: "); - break; - case 0x22: - sprintf((pbuf+strlen(pbuf)), "RESUME REJECT: "); - break; - case 0x24: - sprintf((pbuf+strlen(pbuf)), "HOLD: "); - break; - case 0x25: - sprintf((pbuf+strlen(pbuf)), "SUSPEND: "); - break; - case 0x26: - sprintf((pbuf+strlen(pbuf)), "RESUME: "); - break; - case 0x28: - sprintf((pbuf+strlen(pbuf)), "HOLD ACKNOWLEDGE: "); - break; - case 0x2d: - sprintf((pbuf+strlen(pbuf)), "SUSPEND ACKNOWLEDGE: "); - break; - case 0x2e: - sprintf((pbuf+strlen(pbuf)), "RESUME ACKNOWLEDGE: "); - break; - case 0x30: - sprintf((pbuf+strlen(pbuf)), "HOLD REJECT (Q.932): "); - break; - case 0x31: - sprintf((pbuf+strlen(pbuf)), "RETRIEVE (Q.932): "); - break; - case 0x32: - sprintf((pbuf+strlen(pbuf)), "RETRIEVE ACKNOWLEDGE (Q.932): "); - break; - case 0x37: - sprintf((pbuf+strlen(pbuf)), "RETRIEVE REJECT (Q.932): "); - break; - - /* call clearing */ - - case 0x40: - sprintf((pbuf+strlen(pbuf)), "DETACH: "); - break; - case 0x45: - sprintf((pbuf+strlen(pbuf)), "DISCONNECT: "); - break; - case 0x46: - sprintf((pbuf+strlen(pbuf)), "RESTART: "); - break; - case 0x48: - sprintf((pbuf+strlen(pbuf)), "DETACH ACKNOWLEDGE: "); - break; - case 0x4d: - sprintf((pbuf+strlen(pbuf)), "RELEASE: "); - break; - case 0x4e: - sprintf((pbuf+strlen(pbuf)), "RESTART ACKNOWLEDGE: "); - break; - case 0x5a: - sprintf((pbuf+strlen(pbuf)), "RELEASE COMPLETE: "); - break; - - /* misc messages */ - - case 0x60: - sprintf((pbuf+strlen(pbuf)), "SEGMENT: "); - break; - case 0x62: - sprintf((pbuf+strlen(pbuf)), "FACILITY (Q.932): "); - break; - case 0x64: - sprintf((pbuf+strlen(pbuf)), "REGISTER (Q.932): "); - break; - case 0x68: - sprintf((pbuf+strlen(pbuf)), "CANCEL ACKNOWLEDGE: "); - break; - case 0x6a: - sprintf((pbuf+strlen(pbuf)), "FACILITY ACKNOWLEDGE: "); - break; - case 0x6c: - sprintf((pbuf+strlen(pbuf)), "REGISTER ACKNOWLEDGE: "); - break; - case 0x6e: - sprintf((pbuf+strlen(pbuf)), "NOTIFY: "); - break; - case 0x70: - sprintf((pbuf+strlen(pbuf)), "CANCEL REJECT: "); - break; - case 0x72: - sprintf((pbuf+strlen(pbuf)), "FACILITY REJECT: "); - break; - case 0x74: - sprintf((pbuf+strlen(pbuf)), "REGISTER REJECT: "); - break; - case 0x75: - sprintf((pbuf+strlen(pbuf)), "STATUS ENQIRY: "); - break; - case 0x79: - sprintf((pbuf+strlen(pbuf)), "CONGESTION CONTROL: "); - break; - case 0x7b: - sprintf((pbuf+strlen(pbuf)), "INFORMATION: "); - break; - case 0x7d: - sprintf((pbuf+strlen(pbuf)), "STATUS: "); - break; - default: - sprintf((pbuf+strlen(pbuf)), "UNDEFINED, TYPE=0x%02x, ", buf[i]); - break; - } - - /* other information elements */ - - i++; - - for (; i < n;) - { - sprintf((pbuf+strlen(pbuf)), "\n "); - - if(buf[i] & 0x80) - { - /* single octett info element */ - - switch(buf[i] & 0x70) - { - case 0x00: /* reserved */ - sprintf((pbuf+strlen(pbuf)), "[reserved single octett info]"); - break; - - case 0x10: /* shift */ - oldcodeset = codeset; - codeset = buf[i] & 0x07; - if(buf[i] & 0x08) - codelock = 0; - else - codelock = 1; - sprintf((pbuf+strlen(pbuf)), "[shift: codeset=%d lock=%d]", codeset, codelock); - break; - - case 0x20: /* more data */ - if(buf[i] & 0x01) - sprintf((pbuf+strlen(pbuf)), "[sending complete]"); - else - sprintf((pbuf+strlen(pbuf)), "[more data]"); - break; - - case 0x30: /* congestion level */ - sprintf((pbuf+strlen(pbuf)), "[congestion level="); - switch(buf[i] & 0x0f) - { - case 0x00: - sprintf((pbuf+strlen(pbuf)), "rx-ready]"); - break; - case 0x0f: - sprintf((pbuf+strlen(pbuf)), "rx-not-ready]"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)]", buf[i] & 0x0f); - break; - } - break; - - case 0x50: /* repeat ind */ - sprintf((pbuf+strlen(pbuf)), "[repeat indicator]"); - break; - - default: - sprintf((pbuf+strlen(pbuf)), "[UNKNOWN SINGLE OCTET ELEMENT 0x%02x]", buf[i]); - break; - } - - i++; /* next */ - - } - else - { - /* variable length info element */ - - if(codeset == 0) - { - switch(buf[i]) - { - case 0x00: - sprintf((pbuf+strlen(pbuf)), "[segmented message: "); - break; - case 0x04: - sprintf((pbuf+strlen(pbuf)), "[bearer capability: "); - i += p_q931bc(pbuf, &buf[i]); - goto next; - break; - case 0x08: - sprintf((pbuf+strlen(pbuf)), "[cause: "); - i += p_q931cause(pbuf, &buf[i]); - goto next; - break; - case 0x0c: - sprintf((pbuf+strlen(pbuf)), "[connected address (old): "); - break; - case 0x0d: - sprintf((pbuf+strlen(pbuf)), "[extended facility (Q.932: )"); - break; - case 0x10: - sprintf((pbuf+strlen(pbuf)), "[call identity: "); - break; - case 0x14: - sprintf((pbuf+strlen(pbuf)), "[call state: "); - i++; - len = buf[i]; - i++; - sprintf((pbuf+strlen(pbuf)), "Std="); - switch((buf[i] & 0x60) >> 5) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "CCITT"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "ISO/IEC"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "National"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "Special"); - break; - } - sprintf((pbuf+strlen(pbuf)), ", State="); - - switch((buf[i] & 0x3f)) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "Null"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "Call initiated"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "Overlap sending"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "Outgoing call proceeding"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "Call delivered"); - break; - case 6: - sprintf((pbuf+strlen(pbuf)), "Call present"); - break; - case 7: - sprintf((pbuf+strlen(pbuf)), "Call received"); - break; - case 8: - sprintf((pbuf+strlen(pbuf)), "Connect request"); - break; - case 9: - sprintf((pbuf+strlen(pbuf)), "Incoming call proceeding"); - break; - case 10: - sprintf((pbuf+strlen(pbuf)), "Active"); - break; - case 11: - sprintf((pbuf+strlen(pbuf)), "Disconnect request"); - break; - case 12: - sprintf((pbuf+strlen(pbuf)), "Disconnect indication"); - break; - case 15: - sprintf((pbuf+strlen(pbuf)), "Suspend request"); - break; - case 17: - sprintf((pbuf+strlen(pbuf)), "Resume request"); - break; - case 19: - sprintf((pbuf+strlen(pbuf)), "Release request"); - break; - case 22: - sprintf((pbuf+strlen(pbuf)), "Call abort"); - break; - case 25: - sprintf((pbuf+strlen(pbuf)), "Overlap receiving"); - break; - case 0x3d: - sprintf((pbuf+strlen(pbuf)), "Restart request"); - break; - case 0x3e: - sprintf((pbuf+strlen(pbuf)), "Restart"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "ERROR: undefined/reserved"); - break; - } - sprintf((pbuf+strlen(pbuf)), "]"); - i++; - goto next; - break; - case 0x18: - sprintf((pbuf+strlen(pbuf)), "[channel id: channel="); - i++; - len = buf[i]; - i++; - switch(buf[i] & 0x03) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "no channel"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "B-1"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "B-2"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "any channel"); - break; - } - if(buf[i] & 0x08) - sprintf((pbuf+strlen(pbuf)), " (exclusive)]"); - else - sprintf((pbuf+strlen(pbuf)), " (preferred)]"); - i++; - goto next; - break; - case 0x19: - sprintf((pbuf+strlen(pbuf)), "[data link connection id (Q.933): "); - break; - case 0x1c: - i += q932_facility(pbuf, &buf[i]); - goto next; - break; - case 0x1e: - sprintf((pbuf+strlen(pbuf)), "[progress ind: "); - i++; - len = buf[i]; - i++; - sprintf((pbuf+strlen(pbuf)), "Std="); - switch((buf[i] & 0x60) >> 5) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "CCITT"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "ISO/IEC"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "National"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "Local"); - break; - } - sprintf((pbuf+strlen(pbuf)), ", Loc="); - - switch((buf[i] & 0x0f)) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "User"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "Private network serving local user"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "Public network serving local user"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "Transit network"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "Public network serving remote user"); - break; - case 5: - sprintf((pbuf+strlen(pbuf)), "Private network serving remote user"); - break; - case 6: - sprintf((pbuf+strlen(pbuf)), "Network beyond interworking point"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "ERROR: undefined/reserved"); - break; - } - - i++; - - sprintf((pbuf+strlen(pbuf)), "\n Description: "); - - switch((buf[i] & 0x7f)) - { - case 1: - sprintf((pbuf+strlen(pbuf)), "Call is not end-to-end ISDN"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "Destination address is non-ISDN"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "Origination address is non-ISDN"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "Call has returned to the ISDN"); - break; - case 5: - sprintf((pbuf+strlen(pbuf)), "Interworking occured, Service change"); - break; - case 8: - sprintf((pbuf+strlen(pbuf)), "In-band info or appropriate pattern now available"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "ERROR: undefined/reserved"); - break; - } - sprintf((pbuf+strlen(pbuf)), "]"); - i++; - goto next; - break; - case 0x20: - sprintf((pbuf+strlen(pbuf)), "[network specific facilities: "); - break; - case 0x24: - sprintf((pbuf+strlen(pbuf)), "[terminal capabilities: "); - break; - case 0x27: - sprintf((pbuf+strlen(pbuf)), "[notification indicator: "); - i += p_q931notification(pbuf, &buf[i]); - goto next; - break; - case 0x28: - sprintf((pbuf+strlen(pbuf)), "[display: "); - i++; - len = buf[i]; - i++; - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]); - } - sprintf((pbuf+strlen(pbuf)),"]"); - i += j; - goto next; - break; - case 0x29: - sprintf((pbuf+strlen(pbuf)), "[date/time: "); - i++; - len = buf[i]; - i++; - j = 0; - sprintf((pbuf+strlen(pbuf)),"%.2d.%.2d.%.2d", - buf[i+2], buf[i+1], buf[i]); - j+=3; - if(j < len) - { - sprintf((pbuf+strlen(pbuf))," %.2d", buf[i+3]); - j++; - } - if(j < len) - { - sprintf((pbuf+strlen(pbuf)),":%.2d", buf[i+4]); - j++; - } - if(j < len) - { - sprintf((pbuf+strlen(pbuf)),":%.2d", buf[i+5]); - j++; - } - sprintf((pbuf+strlen(pbuf)),"]"); - i += len; - goto next; - break; - case 0x2c: - sprintf((pbuf+strlen(pbuf)), "[keypad: "); - i++; - len = buf[i]; - i++; - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]); - } - sprintf((pbuf+strlen(pbuf)),"]"); - i += j; - goto next; - break; - case 0x30: - sprintf((pbuf+strlen(pbuf)), "[keypad echo: "); - break; - case 0x32: - sprintf((pbuf+strlen(pbuf)), "[information req (Q.932): "); - break; - case 0x34: - sprintf((pbuf+strlen(pbuf)), "[signal: "); - break; - case 0x36: - sprintf((pbuf+strlen(pbuf)), "[switchhook: "); - break; - case 0x38: - sprintf((pbuf+strlen(pbuf)), "[feature activation (Q.932): "); - break; - case 0x39: - sprintf((pbuf+strlen(pbuf)), "[feature ind (Q.932): "); - break; - case 0x3a: - sprintf((pbuf+strlen(pbuf)), "[service profile id (Q.932): "); - break; - case 0x3b: - sprintf((pbuf+strlen(pbuf)), "[endpoint id (Q.932): "); - break; - case 0x40: - sprintf((pbuf+strlen(pbuf)), "[information rate: "); - break; - case 0x41: - sprintf((pbuf+strlen(pbuf)), "[precedence level (Q.955): "); - break; - case 0x42: - sprintf((pbuf+strlen(pbuf)), "[end-to-end transit delay: "); - break; - case 0x43: - sprintf((pbuf+strlen(pbuf)), "[transit delay detection and indication: "); - break; - case 0x44: - sprintf((pbuf+strlen(pbuf)), "[packet layer binary parameters: "); - break; - case 0x45: - sprintf((pbuf+strlen(pbuf)), "[packet layer window size: "); - break; - case 0x46: - sprintf((pbuf+strlen(pbuf)), "[packet size: "); - break; - case 0x47: - sprintf((pbuf+strlen(pbuf)), "[closed user group: "); - break; - case 0x48: - sprintf((pbuf+strlen(pbuf)), "[link layer core parameters (Q.933): "); - break; - case 0x49: - sprintf((pbuf+strlen(pbuf)), "[link layer protocol parameters (Q.933): "); - break; - case 0x4a: - sprintf((pbuf+strlen(pbuf)), "[reverse charging information: "); - break; - case 0x4c: - sprintf((pbuf+strlen(pbuf)), "[connected number (Q.951): "); - i += p_q931address(pbuf, &buf[i]); - goto next; - break; - - break; - case 0x4d: - sprintf((pbuf+strlen(pbuf)), "[connected subaddress (Q.951): "); - break; - case 0x50: - sprintf((pbuf+strlen(pbuf)), "[X.213 priority (Q.933): "); - break; - case 0x51: - sprintf((pbuf+strlen(pbuf)), "[report type (Q.933): "); - break; - case 0x53: - sprintf((pbuf+strlen(pbuf)), "[link integrity verification (Q.933): "); - break; - case 0x57: - sprintf((pbuf+strlen(pbuf)), "[PVC status (Q.933): "); - break; - case 0x6c: - sprintf((pbuf+strlen(pbuf)), "[calling party number: "); - i += p_q931address(pbuf, &buf[i]); - goto next; - break; - case 0x6d: - sprintf((pbuf+strlen(pbuf)), "[calling party subaddress: "); - break; - case 0x70: - sprintf((pbuf+strlen(pbuf)), "[called party number: "); - i += p_q931address(pbuf, &buf[i]); - goto next; - break; - case 0x71: - sprintf((pbuf+strlen(pbuf)), "[called party subaddress: "); - break; - case 0x74: - sprintf((pbuf+strlen(pbuf)), "[redirecting number: "); - i += p_q931redir(pbuf, &buf[i]); - goto next; - break; - case 0x76: - sprintf((pbuf+strlen(pbuf)), "[redirection number: "); - i += p_q931redir(pbuf, &buf[i]); - goto next; - break; - case 0x78: - sprintf((pbuf+strlen(pbuf)), "[transit network selection: "); - break; - case 0x79: - sprintf((pbuf+strlen(pbuf)), "[restart indicator: "); - break; - case 0x7c: - sprintf((pbuf+strlen(pbuf)), "[low layer compatibility: "); - break; - case 0x7d: - sprintf((pbuf+strlen(pbuf)), "[high layer compatibility:"); - i += p_q931high_compat(pbuf, &buf[i]); - goto next; - break; - case 0x7e: - sprintf((pbuf+strlen(pbuf)), "[user-user: "); - i += p_q931user_user(pbuf, &buf[i]); - goto next; - break; - case 0x7f: - sprintf((pbuf+strlen(pbuf)), "[escape for extension: "); - break; - default: - sprintf((pbuf+strlen(pbuf)), "[UNKNOWN INFO-ELEMENT-ID=0x%02x: ", buf[i]); - break; - } - } - else - { - sprintf((pbuf+strlen(pbuf)), "[UNKNOWN CODESET=%d, IE=0x%02x: ", codeset, buf[i]); - } - - i++; /* index -> length */ - - len = buf[i]; - - sprintf((pbuf+strlen(pbuf)), "LEN=0x%02x, DATA=", len); - - i++; /* index -> 1st param */ - - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf)),"0x%02x ", buf[j+i]); - } - - sprintf((pbuf+strlen(pbuf)),"]"); - - i += len; - -next: - - if(!codelock && (codeset != oldcodeset)) - codeset = oldcodeset; - } - } - sprintf((pbuf+strlen(pbuf)),"\n"); -} - -/* EOF */ - diff --git a/usr.sbin/i4b/isdntrace/q931_util.c b/usr.sbin/i4b/isdntrace/q931_util.c deleted file mode 100644 index 9f82283d39d9..000000000000 --- a/usr.sbin/i4b/isdntrace/q931_util.c +++ /dev/null @@ -1,1047 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * q931_util.c - utility functions to print Q.931 traces - * ----------------------------------------------------- - * - * $Id: q931_util.c,v 1.11 2000/02/15 12:48:14 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Tue Feb 15 13:52:09 2000] - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" - -/*---------------------------------------------------------------------------* - * decode and print the cause - *---------------------------------------------------------------------------*/ -int -p_q931cause(char *pbuf, unsigned char *buf) -{ - int j; - int len; - int i = 0; - int ls; - int r = 0; - int rflag = 0; - - i++; /* index -> length */ - - len = buf[i]; - - i++; /* coding/location */ - len--; - - ls = buf[i]; - - i++; - len--; - - if(!(buf[i-1] & 0x80)) - { - r = buf[i]; - rflag = 1; - i++; - len--; - } - - sprintf((pbuf+strlen(pbuf)), "%s ", print_cause_q850(buf[i] & 0x7f)); - - sprintf((pbuf+strlen(pbuf)), "\n (location="); - - switch(ls & 0x0f) - { - case 0x00: - sprintf((pbuf+strlen(pbuf)), "user"); - break; - case 0x01: - sprintf((pbuf+strlen(pbuf)), "private network serving local user"); - break; - case 0x02: - sprintf((pbuf+strlen(pbuf)), "public network serving local user"); - break; - case 0x03: - sprintf((pbuf+strlen(pbuf)), "transit network"); - break; - case 0x04: - sprintf((pbuf+strlen(pbuf)), "public network serving remote user"); - break; - case 0x05: - sprintf((pbuf+strlen(pbuf)), "private network serving remote user"); - break; - case 0x07: - sprintf((pbuf+strlen(pbuf)), "international network"); - break; - case 0x0a: - sprintf((pbuf+strlen(pbuf)), "network beyond interworking point"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)", ls & 0x0f); - break; - } - - sprintf((pbuf+strlen(pbuf)), ", std="); - - switch((ls & 0x60) >> 5) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "CCITT"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "ISO/IEC"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "National"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "Local"); - break; - } - - if(rflag) - { - sprintf((pbuf+strlen(pbuf)), ", rec="); - - switch(r & 0x7f) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "Q.931"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "X.21"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "X.25"); - break; - case 5: - sprintf((pbuf+strlen(pbuf)), "Q.1031/Q.1051"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "Reserved"); - break; - } - } - - sprintf((pbuf+strlen(pbuf)),")"); - - i++; - len--; - - for(j = 0; j < len; j++) - sprintf((pbuf+strlen(pbuf))," 0x%02x", buf[j+i]); - - sprintf((pbuf+strlen(pbuf)),"]"); - - i += (len+1); - - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and print the bearer capability - *---------------------------------------------------------------------------*/ -int -p_q931bc(char *pbuf, unsigned char *buf) -{ - int len; - int i = 0; - int mr = 0; - - i++; /* index -> length */ - - len = buf[i]; - - i++; - - sprintf((pbuf+strlen(pbuf)), "\n cap="); - - switch(buf[i] & 0x1f) - { - case 0x00: - sprintf((pbuf+strlen(pbuf)), "speech"); - break; - case 0x08: - sprintf((pbuf+strlen(pbuf)), "unrestricted digital information"); - break; - case 0x09: - sprintf((pbuf+strlen(pbuf)), "restricted digital information"); - break; - case 0x10: - sprintf((pbuf+strlen(pbuf)), "3.1 kHz audio"); - break; - case 0x11: - sprintf((pbuf+strlen(pbuf)), "unrestricted digital information with tones"); - break; - case 0x18: - sprintf((pbuf+strlen(pbuf)), "video"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)", buf[i] & 0x0f); - break; - } - - sprintf((pbuf+strlen(pbuf)), "\n std="); - - switch((buf[i] & 0x60) >> 5) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "CCITT"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "ISO/IEC"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "National"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "NSI Std"); - break; - } - - i++; - len--; - - sprintf((pbuf+strlen(pbuf)), "\n rate="); - - switch(buf[i] & 0x1f) - { - case 0x00: - sprintf((pbuf+strlen(pbuf)), "packet mode"); - break; - case 0x10: - sprintf((pbuf+strlen(pbuf)), "64 kbit/s"); - break; - case 0x11: - sprintf((pbuf+strlen(pbuf)), "2 x 64 kbit/s"); - break; - case 0x13: - sprintf((pbuf+strlen(pbuf)), "384 kbit/s"); - break; - case 0x15: - sprintf((pbuf+strlen(pbuf)), "1536 kbit/s"); - break; - case 0x17: - sprintf((pbuf+strlen(pbuf)), "1920 kbit/s"); - break; - case 0x18: - sprintf((pbuf+strlen(pbuf)), "Multirate"); - mr = 1; - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)", buf[i] & 0x0f); - break; - } - - sprintf((pbuf+strlen(pbuf)), "\n mode="); - - switch((buf[i] & 0x60) >> 5) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "circuit"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "packet"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)", ((buf[i] & 0x60) >> 5)); - break; - } - - i++; - len--; - - if(!len) - goto exit; - - if(mr) - { - sprintf((pbuf+strlen(pbuf)), "\n rate multiplier=%d", buf[i] & 0x7f); - i++; - len--; - } - - if(!len) - goto exit; - - sprintf((pbuf+strlen(pbuf)), "\n layer1="); - - switch(buf[i] & 0x1f) - { - case 0x01: - sprintf((pbuf+strlen(pbuf)), "V.110"); - break; - case 0x02: - sprintf((pbuf+strlen(pbuf)), "G.711 u-law"); - break; - case 0x03: - sprintf((pbuf+strlen(pbuf)), "G.711 A-law"); - break; - case 0x04: - sprintf((pbuf+strlen(pbuf)), "G.721"); - break; - case 0x05: - sprintf((pbuf+strlen(pbuf)), "H.221/H.242"); - break; - case 0x07: - sprintf((pbuf+strlen(pbuf)), "Non-Std"); - break; - case 0x08: - sprintf((pbuf+strlen(pbuf)), "V.120"); - break; - case 0x09: - sprintf((pbuf+strlen(pbuf)), "X.31"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)", buf[i] & 0x0f); - break; - } - i++; - len--; - - if(!len) - goto exit; - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n user rate=0x%02x ", buf[i] & 0x1f); - - if(buf[i] & 0x40) - sprintf((pbuf+strlen(pbuf)), "(async,"); - else - sprintf((pbuf+strlen(pbuf)), "(sync,"); - - if(buf[i] & 0x20) - sprintf((pbuf+strlen(pbuf)), "in-band neg. possible)"); - else - sprintf((pbuf+strlen(pbuf)), "in-band neg not possible)"); - - i++; - len--; - } - - if(!len) - goto exit; - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n clk/flow=0x%02x", buf[i] & 0x1f); - - sprintf((pbuf+strlen(pbuf)), "\n intermediate rate="); - - switch((buf[i] & 0x60) >> 5) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "not used"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "8 kbit/s"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "16 kbit/s"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "32 kbit/s"); - break; - } - i++; - len--; - } - - if(!len) - goto exit; - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n hdr/mfrm/etc.=0x%02x", buf[i]); - i++; - len--; - } - - if(!len) - goto exit; - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n stop/data/parity=0x%02x", buf[i]); - i++; - len--; - } - - if(!len) - goto exit; - - if(!(buf[i-1] & 0x80)) - { - sprintf((pbuf+strlen(pbuf)), "\n modemtype=0x%02x", buf[i]); - i++; - len--; - } - - if(!len) - goto exit; - - switch(buf[i] & 0x7f) - { - case 0x42: - sprintf((pbuf+strlen(pbuf)), "\n layer2=Q.921/I.441"); - break; - case 0x46: - sprintf((pbuf+strlen(pbuf)), "\n layer2=X.25 link"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\n layer2=0x%02x",(buf[i] & 0x7f)); - break; - } - i++; - len--; - - if(!len) - goto exit; - - switch(buf[i] & 0x7f) - { - case 0x62: - sprintf((pbuf+strlen(pbuf)), "\n layer3=Q.921/I.441"); - break; - case 0x66: - sprintf((pbuf+strlen(pbuf)), "\n layer3=X.25 packet"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\n layer3=0x%02x",(buf[i] & 0x7f)); - break; - } - i++; - len--; - -exit: - sprintf((pbuf+strlen(pbuf)), "]"); - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and print the ISDN (telephone) number - *---------------------------------------------------------------------------*/ -int -p_q931address(char *pbuf, unsigned char *buf) -{ - int j; - int len; - int i = 0; - int tp; - int ind = 0; - int indflag = 0; - - i++; /* index -> length */ - len = buf[i]; - - i++; /* index -> type/plan */ - tp = buf[i]; - - i++; - len--; - - if(!(tp & 0x80)) - { - ind = buf[i]; - indflag = 1; - i++; - len--; - } - - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]); - } - - switch((tp & 0x70) >> 4) - { - case 0: - sprintf((pbuf+strlen(pbuf)), " (type=unknown, "); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), " (type=international, "); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), " (type=national, "); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), " (type=network specific, "); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), " (type=subscriber, "); - break; - case 6: - sprintf((pbuf+strlen(pbuf)), " (type=abbreviated, "); - break; - default: - sprintf((pbuf+strlen(pbuf)), " (type=reserved (%d), ", ((tp & 0x70) >> 4)); - break; - } - - switch(tp & 0x0f) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "plan=unknown"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "plan=ISDN"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "plan=Data"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "plan=Telex"); - break; - case 8: - sprintf((pbuf+strlen(pbuf)), "plan=National"); - break; - case 9: - sprintf((pbuf+strlen(pbuf)), "plan=private"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "plan=reserved (%d)", (tp & 0x0f)); - break; - } - - if(indflag) - { - sprintf((pbuf+strlen(pbuf)), ",\n "); - switch((ind & 0x60) >> 5) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "presentation allowed, "); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "presentation restricted, "); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "number not available, "); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "reserved, "); - break; - } - - switch(ind & 0x03) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "screening user provided: not screened"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "screening user provided: verified & passed"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "screening user provided: verified & failed"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "screening network provided"); - break; - } - } - - sprintf((pbuf+strlen(pbuf)),")]"); - - i += j; - - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and print HL comatibility - *---------------------------------------------------------------------------*/ -int -p_q931high_compat(char *pbuf, unsigned char *buf) -{ - int len = buf[1]; - - sprintf(pbuf+strlen(pbuf), " standard="); - - switch ((buf[2] >> 5) & 0x03) - { - case 0: sprintf(pbuf+strlen(pbuf), "CCITT"); - break; - case 1: sprintf(pbuf+strlen(pbuf), "unknown international standard"); - break; - case 2: sprintf(pbuf+strlen(pbuf), "unknown national standard"); - break; - case 3: sprintf(pbuf+strlen(pbuf), "local network standard"); - } - - len--; - - sprintf(pbuf+strlen(pbuf), ", characteristics="); - - switch (buf[3] & 0x7f) - { - case 0x01: - sprintf(pbuf+strlen(pbuf), "Telephony"); - break; - case 0x04: - sprintf(pbuf+strlen(pbuf), "Fax Group 2/3"); - break; - case 0x21: - sprintf(pbuf+strlen(pbuf), "Fax Group 4 Class I (F.184)"); - break; - case 0x24: - sprintf(pbuf+strlen(pbuf), "Teletex basic/mixed (F.230) or Fax Group 4 Class II/III (F.184)"); - break; - case 0x28: - sprintf(pbuf+strlen(pbuf), "Teletex basic/processable (F.220)"); - break; - case 0x31: - sprintf(pbuf+strlen(pbuf), "Teletex basic mode (F.200)"); - break; - case 0x32: - sprintf(pbuf+strlen(pbuf), "Videotex (F.300 and T.101)"); - break; - case 0x35: - sprintf(pbuf+strlen(pbuf), "Telex (F.60)"); - break; - case 0x38: - sprintf(pbuf+strlen(pbuf), "MHS (X.400 series)"); - break; - case 0x41: - sprintf(pbuf+strlen(pbuf), "OSI application (X.200 series)"); - break; - case 0x5e: - sprintf(pbuf+strlen(pbuf), "Maintenance"); - break; - case 0x5f: - sprintf(pbuf+strlen(pbuf), "Management"); - break; - case 0x7f: - sprintf(pbuf+strlen(pbuf), "reserved"); - break; - default: - sprintf(pbuf+strlen(pbuf), "UNKNOWN (0x%02x)", buf[3]); - break; - } - - len--; - - if (!len) - { - sprintf(pbuf+strlen(pbuf), "]"); - return 4; - } - - sprintf(pbuf+strlen(pbuf), " of "); - - switch (buf[4] & 0x7f) - { - case 0x01: - sprintf(pbuf+strlen(pbuf), "Telephony"); - break; - case 0x04: - sprintf(pbuf+strlen(pbuf), "Fax Group 2/3"); - break; - case 0x21: - sprintf(pbuf+strlen(pbuf), "Fax Group 4 Class I (F.184)"); - break; - case 0x24: - sprintf(pbuf+strlen(pbuf), "Teletex basic/mixed (F.230) or Fax Group 4 Class II/III (F.184)"); - break; - case 0x28: - sprintf(pbuf+strlen(pbuf), "Teletex basic/processable (F.220)"); - break; - case 0x31: - sprintf(pbuf+strlen(pbuf), "Teletex basic mode (F.200)"); - break; - case 0x32: - sprintf(pbuf+strlen(pbuf), "Videotex (F.300 and T.101)"); - break; - case 0x35: - sprintf(pbuf+strlen(pbuf), "Telex (F.60)"); - break; - case 0x38: - sprintf(pbuf+strlen(pbuf), "MHS (X.400 series)"); - break; - case 0x41: - sprintf(pbuf+strlen(pbuf), "OSI application (X.200 series)"); - break; - case 0x7f: - sprintf(pbuf+strlen(pbuf), "reserved"); - break; - default: - sprintf(pbuf+strlen(pbuf), "UNKNOWN (0x%02x)", buf[3]); - break; - } - sprintf(pbuf+strlen(pbuf), "]"); - return 5; -} - -/*---------------------------------------------------------------------------* - * decode and print user-user IE - *---------------------------------------------------------------------------*/ -int -p_q931user_user(char *pbuf, unsigned char *buf) -{ - int j; - int len; - int i = 0; - int pd; - - i++; /* index -> length */ - len = buf[i]; - - i++; /* index -> protocoldiscriminator */ - pd = buf[i]; - - switch(pd) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "(pd=user-specific"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "(pd=OSI high-layer protocols"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "(pd=X.244"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "(pd=reserved for system management"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "(pd=IA5 characters"); - break; - case 6: - sprintf((pbuf+strlen(pbuf)), "(pd=X.208/X.209 coded user info"); - break; - case 7: - sprintf((pbuf+strlen(pbuf)), "(pd=V.120 rate adaption"); - break; - case 8: - sprintf((pbuf+strlen(pbuf)), "(pd=Q.931/I.451 user network call control messages"); - break; - default: - if(pd >= 0x10 && pd <= 0x3f) - sprintf((pbuf+strlen(pbuf)), "(pd=0x%x=reserved for other L3 protocols incl. X.25", pd); - else if(pd >= 0x40 && pd <= 0x47) - sprintf((pbuf+strlen(pbuf)), "(pd=0x%x=national use", pd); - else if(pd >= 0x48 && pd <= 0x4f) - sprintf((pbuf+strlen(pbuf)), "(pd=0x%x=reserved for ETSI", pd); - else if(pd >= 0x50 && pd <= 0xfe) - sprintf((pbuf+strlen(pbuf)), "(pd=0x%x=reserved for other L3 protocols incl. X.25", pd); - else - sprintf((pbuf+strlen(pbuf)), "(pd=0x%x=reserved", pd); - break; - } - - i++; - len--; - - sprintf((pbuf+strlen(pbuf)),": ("); - - for(j = 0; j < len; j++) - { - if(pd == 4) - sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]); - else - sprintf((pbuf+strlen(pbuf)),"0x%2x", buf[j+i]); - } - - sprintf((pbuf+strlen(pbuf)),"))]"); - - i += j; - - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and notification indicator IE (Q.932, p44) - *---------------------------------------------------------------------------*/ -int -p_q931notification(char *pbuf, unsigned char *buf) -{ - int j = 0; - int len; - int i = 0; - int nd; - - i++; /* index -> length */ - len = buf[i]; - - i++; /* index -> notification description */ - nd = buf[i]; - - switch(nd) - { - case 0x80: - sprintf((pbuf+strlen(pbuf)), "0x%2x, user suspended", nd); - break; - case 0x81: - sprintf((pbuf+strlen(pbuf)), "0x%2x, user resumed", nd); - break; - case 0x82: - sprintf((pbuf+strlen(pbuf)), "0x%2x, bearer service changed", nd); - break; - - case 0x83: - sprintf((pbuf+strlen(pbuf)), "0x%2x, BER coded information", nd); - break; - - case 0xc2: - sprintf((pbuf+strlen(pbuf)), "0x%2x, conference established", nd); - break; - case 0xc3: - sprintf((pbuf+strlen(pbuf)), "0x%2x, conference disconnected", nd); - break; - case 0xc4: - sprintf((pbuf+strlen(pbuf)), "0x%2x, other party added", nd); - break; - case 0xc5: - sprintf((pbuf+strlen(pbuf)), "0x%2x, isolated", nd); - break; - case 0xc6: - sprintf((pbuf+strlen(pbuf)), "0x%2x, reattached", nd); - break; - case 0xc7: - sprintf((pbuf+strlen(pbuf)), "0x%2x, other party isolated", nd); - break; - case 0xc8: - sprintf((pbuf+strlen(pbuf)), "0x%2x, other party reattached", nd); - break; - case 0xc9: - sprintf((pbuf+strlen(pbuf)), "0x%2x, other party split", nd); - break; - case 0xca: - sprintf((pbuf+strlen(pbuf)), "0x%2x, other party disconnected", nd); - break; - case 0xcb: - sprintf((pbuf+strlen(pbuf)), "0x%2x, conference floating", nd); - break; - case 0xcc: - sprintf((pbuf+strlen(pbuf)), "0x%2x, conference disconnected, preemption", nd); - break; - case 0xcf: - sprintf((pbuf+strlen(pbuf)), "0x%2x, conference floating, server user preempted", nd); - break; - - case 0xe0: - sprintf((pbuf+strlen(pbuf)), "0x%2x, call is a waiting call", nd); - break; - case 0xe8: - sprintf((pbuf+strlen(pbuf)), "0x%2x, diversion activated", nd); - break; - case 0xe9: /* ECT, EN 300 369-1 V1.2.4 p12) */ - sprintf((pbuf+strlen(pbuf)), "0x%2x, call transferred, alerting", nd); - break; - case 0xea: /* ECT, EN 300 369-1 V1.2.4 p12) */ - sprintf((pbuf+strlen(pbuf)), "0x%2x, call transferred, active", nd); - break; - case 0xee: - sprintf((pbuf+strlen(pbuf)), "0x%2x, reverse charging", nd); - break; - - case 0xf9: - sprintf((pbuf+strlen(pbuf)), "0x%2x, remote hold", nd); - break; - case 0xfa: - sprintf((pbuf+strlen(pbuf)), "0x%2x, remote retrieval", nd); - break; - case 0xfb: - sprintf((pbuf+strlen(pbuf)), "0x%2x, call is diverting", nd); - break; - default: - sprintf((pbuf+strlen(pbuf)), "0x%2x, undefined", nd); - break; - } - - i++; - len--; - - if(len) - { - sprintf((pbuf+strlen(pbuf)),": ("); - - for(; j < len; j++) - { - if(nd == 4) - sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]); - else - sprintf((pbuf+strlen(pbuf)),"0x%2x", buf[j+i]); - } - - sprintf((pbuf+strlen(pbuf)),")"); - } - sprintf((pbuf+strlen(pbuf)),"]"); - i += j; - - return(i); -} - -/*---------------------------------------------------------------------------* - * decode and print redirecting/redirection number - *---------------------------------------------------------------------------*/ -int -p_q931redir(char *pbuf, unsigned char *buf) -{ - int j; - int len; - int i = 0; - int tp; - int ind = 0; - int indflag = 0; - int reas = 0; - int reasflag = 0; - - i++; /* index -> length */ - len = buf[i]; - - i++; /* index -> type/plan */ - tp = buf[i]; - - i++; - len--; - - if(!(tp & 0x80)) - { - ind = buf[i]; - indflag = 1; - i++; - len--; - - if(!(ind & 0x80)) - { - reas = buf[i]; - reasflag = 1; - i++; - len--; - } - } - - for(j = 0; j < len; j++) - { - sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]); - } - - switch((tp & 0x70) >> 4) - { - case 0: - sprintf((pbuf+strlen(pbuf)), " (type=unknown, "); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), " (type=international, "); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), " (type=national, "); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), " (type=network specific, "); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), " (type=subscriber, "); - break; - case 6: - sprintf((pbuf+strlen(pbuf)), " (type=abbreviated, "); - break; - default: - sprintf((pbuf+strlen(pbuf)), " (type=reserved (%d), ", ((tp & 0x70) >> 4)); - break; - } - - switch(tp & 0x0f) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "plan=unknown"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "plan=ISDN"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "plan=Data"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "plan=Telex"); - break; - case 8: - sprintf((pbuf+strlen(pbuf)), "plan=National"); - break; - case 9: - sprintf((pbuf+strlen(pbuf)), "plan=private"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "plan=reserved (%d)", (tp & 0x0f)); - break; - } - - if(indflag) - { - sprintf((pbuf+strlen(pbuf)), ",\n "); - switch((ind & 0x60) >> 5) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "presentation allowed"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "presentation restricted"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "number not available"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "reserved"); - break; - } - } - - if(reasflag) - { - sprintf((pbuf+strlen(pbuf)), ",\n "); - switch(reas & 0x0f) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "reason for diversion: unknown"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "reason for diversion: call forwarding busy"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "reason for diversion: call forwarding unconditional"); - break; - case 0xa: - sprintf((pbuf+strlen(pbuf)), "reason for diversion: called DTE"); - break; - case 0xf: - sprintf((pbuf+strlen(pbuf)), "reason for diversion: call forwarding unconditional"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "reason for diversion: reserved (0x%2x)",reas & 0x0f); - break; - } - } - - sprintf((pbuf+strlen(pbuf)),")]"); - - i += j; - - return(i); -} - -/* EOF */ - diff --git a/usr.sbin/i4b/isdntrace/q932_fac.c b/usr.sbin/i4b/isdntrace/q932_fac.c deleted file mode 100644 index 0a0099d3edce..000000000000 --- a/usr.sbin/i4b/isdntrace/q932_fac.c +++ /dev/null @@ -1,1236 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * q932_fac.c - decode Q.932 facilities - * ------------------------------------ - * - * $Id: q932_fac.c,v 1.8 2000/02/24 16:32:46 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Thu Feb 24 17:36:47 2000] - * - *--------------------------------------------------------------------------- - * - * - Q.932 (03/93) Generic Procedures for the Control of - * ISDN Supplementaty Services - * - Q.950 (03/93) Supplementary Services Protocols, Structure and - * General Principles - * - ETS 300 179 (10/92) Advice Of Charge: charging information during - * the call (AOC-D) supplementary service Service description - * - ETS 300 180 (10/92) Advice Of Charge: charging information at the - * end of call (AOC-E) supplementary service Service description - * - ETS 300 181 (04/93) Advice Of Charge (AOC) supplementary service - * Functional capabilities and information flows - * - ETS 300 182 (04/93) Advice Of Charge (AOC) supplementary service - * Digital Subscriber Signalling System No. one (DSS1) protocol - * - X.208 Specification of Abstract Syntax Notation One (ASN.1) - * - X.209 Specification of Basic Encoding Rules for - * Abstract Syntax Notation One (ASN.1) - * - "ASN.1 Abstract Syntax Notation One", Walter Gora, DATACOM-Verlag - * 1992, 3rd Edition (ISBN 3-89238-062-7) (german !) - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" -#include "q932_fac.h" - -static int do_component(int length, char *pbuf); -static char *uni_str(int code); -static char *opval_str(int val); -static char *bid_str(int val); -static void next_state(char *pbuf, int class, int form, int code, int val); - -static void object_id(int comp_length, unsigned char *pbuf); - -static int byte_len; -static unsigned char *byte_buf; -static int state; - -/*---------------------------------------------------------------------------* - * decode Q.931/Q.932 facility info element - *---------------------------------------------------------------------------*/ -int -q932_facility(char *pbuf, unsigned char *buf) -{ - int len; - - sprintf((pbuf+strlen(pbuf)), "[facility (Q.932): "); - - buf++; /* length */ - - len = *buf; - - buf++; /* protocol profile */ - - sprintf((pbuf+strlen(pbuf)), "Protocol="); - - switch(*buf & 0x1f) - { - case FAC_PROTO_ROP: - sprintf((pbuf+strlen(pbuf)), "Remote Operations Protocol\n"); - break; - - case FAC_PROTO_CMIP: - sprintf((pbuf+strlen(pbuf)), "CMIP Protocol (Q.941), UNSUPPORTED!\n"); - return(len+2); - break; - - case FAC_PROTO_ACSE: - sprintf((pbuf+strlen(pbuf)), "ACSE Protocol (X.217/X.227), UNSUPPORTED!\n"); - return(len+2); - break; - - default: - sprintf((pbuf+strlen(pbuf)), "Unknown Protocol (val = 0x%x), UNSUPPORTED!\n", *buf & 0x1f); - return(len+2); - break; - } - - /* next byte */ - - buf++; - len--; - - /* initialize variables for do_component */ - - byte_len = 0; - byte_buf = buf; - state = ST_EXP_COMP_TYP; - - /* decode facility */ - - do_component(len, pbuf); - - sprintf((pbuf+(strlen(pbuf)-1)), "]"); /* XXX replace last newline */ - - return(len+3); -} - -/*---------------------------------------------------------------------------* - * handle a component recursively - *---------------------------------------------------------------------------*/ -static int -do_component(int length, char *pbuf) -{ - int comp_tag_class; /* component tag class */ - int comp_tag_form; /* component form: constructor or primitive */ - int comp_tag_code; /* component code depending on class */ - int comp_length = 0; /* component length */ - -#ifdef FAC_DEBUG - sprintf((pbuf+strlen(pbuf)), "ENTER - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length); -#endif - -again: - -#ifdef FAC_DEBUG - sprintf((pbuf+strlen(pbuf)), "AGAIN - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length); -#endif - - /*----------------------------------------*/ - /* first component element: component tag */ - /*----------------------------------------*/ - - /* tag class bits */ - - sprintf((pbuf+strlen(pbuf)), "\t0x%02x Tag: ", *byte_buf); - - comp_tag_class = (*byte_buf & 0xc0) >> 6; - - switch(comp_tag_class) - { - case FAC_TAGCLASS_UNI: - sprintf((pbuf+strlen(pbuf)), "Universal"); - break; - case FAC_TAGCLASS_APW: - sprintf((pbuf+strlen(pbuf)), "Applic-wide"); - break; - case FAC_TAGCLASS_COS: - sprintf((pbuf+strlen(pbuf)), "Context-spec"); - break; - case FAC_TAGCLASS_PRU: - sprintf((pbuf+strlen(pbuf)), "Private"); - break; - } - - /* tag form bit */ - - comp_tag_form = (*byte_buf & 0x20) > 5; - - sprintf((pbuf+strlen(pbuf)), ", "); - - if(comp_tag_form == FAC_TAGFORM_CON) - { - sprintf((pbuf+strlen(pbuf)), "Constructor"); - } - else - { - sprintf((pbuf+strlen(pbuf)), "Primitive"); - } - - /* tag code bits */ - - comp_tag_code = *byte_buf & 0x1f; - - sprintf((pbuf+strlen(pbuf)), ", "); - - if(comp_tag_code == 0x1f) - { - comp_tag_code = 0; - - byte_buf++; - byte_len++; - - while(*byte_buf & 0x80) - { - comp_tag_code += (*byte_buf & 0x7f); - byte_buf++; - byte_len++; - } - comp_tag_code += (*byte_buf & 0x7f); - sprintf((pbuf+strlen(pbuf)), "%d (ext)\n", comp_tag_code); - } - else - { - comp_tag_code = (*byte_buf & 0x1f); - - if(comp_tag_class == FAC_TAGCLASS_UNI) - { - sprintf((pbuf+strlen(pbuf)), "%s (%d)\n", uni_str(comp_tag_code), comp_tag_code); - } - else - { - sprintf((pbuf+strlen(pbuf)), "code = %d\n", comp_tag_code); - } - } - - byte_buf++; - byte_len++; - - /*--------------------------------------------*/ - /* second component element: component length */ - /*--------------------------------------------*/ - - sprintf((pbuf+strlen(pbuf)), "\t0x%02x Len: ", *byte_buf); - - comp_length = 0; - - if(*byte_buf & 0x80) - { - int i = *byte_buf & 0x7f; - - byte_len += i; - - for(;i > 0;i++) - { - byte_buf++; - comp_length += (*byte_buf * (i*256)); - } - sprintf((pbuf+strlen(pbuf)), "%d (long form)\n", comp_length); - } - else - { - comp_length = *byte_buf & 0x7f; - sprintf((pbuf+strlen(pbuf)), "%d (short form)\n", comp_length); - } - - next_state(pbuf, comp_tag_class, comp_tag_form, comp_tag_code, -1); - - byte_len++; - byte_buf++; - - if(comp_length) - { - - /*---------------------------------------------*/ - /* third component element: component contents */ - /*---------------------------------------------*/ - - if(comp_tag_form) /* == constructor */ - { - do_component(comp_length, pbuf); - } - else - { - int val = 0; - if(comp_tag_class == FAC_TAGCLASS_UNI) - { - switch(comp_tag_code) - { - case FAC_CODEUNI_INT: - case FAC_CODEUNI_ENUM: - case FAC_CODEUNI_BOOL: - if(comp_length) - { - int i; - - sprintf((pbuf+strlen(pbuf)), "\t"); - - for(i = comp_length-1; i >= 0; i--) - { - sprintf((pbuf+strlen(pbuf)), "0x%02x ", *byte_buf); - val += (*byte_buf + (i*255)); - byte_buf++; - byte_len++; - if(i) - sprintf((pbuf+strlen(pbuf)), "\n\t"); - } - sprintf((pbuf+strlen(pbuf)), "Val: %d\n", val); - } - break; - - case FAC_CODEUNI_OBJI: /* object id */ - - if(comp_length) - object_id(comp_length, pbuf); - break; - - default: - if(comp_length) - { - int i; - - sprintf((pbuf+strlen(pbuf)), "\t"); - - for(i = comp_length-1; i >= 0; i--) - { - sprintf((pbuf+strlen(pbuf)), "0x%02x = %d", *byte_buf, *byte_buf); - if(isprint(*byte_buf)) - sprintf((pbuf+strlen(pbuf)), " = '%c'", *byte_buf); - byte_buf++; - byte_len++; - if(i) - sprintf((pbuf+strlen(pbuf)), "\n\t"); - } - } - break; - } - } - - else /* comp_tag_class != FAC_TAGCLASS_UNI */ - { - if(comp_length) - { - int i; - - sprintf((pbuf+strlen(pbuf)), "\t"); - - for(i = comp_length-1; i >= 0; i--) - { - sprintf((pbuf+strlen(pbuf)), "0x%02x", *byte_buf); - val += (*byte_buf + (i*255)); - byte_buf++; - byte_len++; - if(i) - sprintf((pbuf+strlen(pbuf)), "\n\t"); - } - sprintf((pbuf+strlen(pbuf)), "\n"); - } - } - next_state(pbuf, comp_tag_class, comp_tag_form, comp_tag_code, val); - } - } - -#ifdef FAC_DEBUG - sprintf((pbuf+strlen(pbuf)), "PREGOTO - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length); -#endif - if(byte_len < length) - goto again; -#ifdef FAC_DEBUG - sprintf((pbuf+strlen(pbuf)), "RETURN - comp_length = %d, byte_len = %d, length =%d\n", comp_length, byte_len, length); -#endif - return(byte_len); -} - -/*---------------------------------------------------------------------------* - * print universal id type - *---------------------------------------------------------------------------*/ -static char *uni_str(int code) -{ - static char *tbl[] = { - "BOOLEAN", - "INTEGER", - "BIT STRING", - "OCTET STRING", - "NULL", - "OBJECT IDENTIFIER", - "OBJECT DESCRIPTOR", - "EXTERNAL", - "REAL", - "ENUMERATED", - "RESERVED11", - "RESERVED12", - "RESERVED13", - "RESERVED14", - "RESERVED15", - "SEQUENCE", - "SET", - "NUMERIC STRING", - "PRINTABLE STRING", - "TELETEX STRING", - "ISO646 STRING", - "IA5 STRING", - "GRAPHIC STRING", - "GENERAL STRING" - }; - - if(code >= 1 && code <= FAC_CODEUNI_GNSTR) - return(tbl[code-1]); - else - return("ERROR, Value out of Range!"); -} - -/*---------------------------------------------------------------------------* - * print operation value - *---------------------------------------------------------------------------*/ -static char *opval_str(int val) -{ - static char buffer[80]; - char *r; - - switch(val) - { - case FAC_OPVAL_UUS: - r = "uUs"; - break; - case FAC_OPVAL_CUG: - r = "cUGCall"; - break; - case FAC_OPVAL_MCID: - r = "mCIDRequest"; - break; - case FAC_OPVAL_BTPY: - r = "beginTPY"; - break; - case FAC_OPVAL_ETPY: - r = "endTPY"; - break; - case FAC_OPVAL_ECT: - r = "eCTRequest"; - break; - case FAC_OPVAL_DIV_ACT: - r = "activationDiversion"; - break; - case FAC_OPVAL_DIV_DEACT: - r = "deactivationDiversion"; - break; - case FAC_OPVAL_DIV_ACTSN: - r = "activationStatusNotificationDiv"; - break; - case FAC_OPVAL_DIV_DEACTSN: - r = "deactivationStatusNotificationDiv"; - break; - case FAC_OPVAL_DIV_INTER: - r = "interrogationDiversion"; - break; - case FAC_OPVAL_DIV_INFO: - r = "diversionInformation"; - break; - case FAC_OPVAL_DIV_CALLDEF: - r = "callDeflection"; - break; - case FAC_OPVAL_DIV_CALLRER: - r = "callRerouting"; - break; - case FAC_OPVAL_DIV_LINF2: - r = "divertingLegInformation2"; - break; - case FAC_OPVAL_DIV_INVS: - r = "invokeStatus"; - break; - case FAC_OPVAL_DIV_INTER1: - r = "interrogationDiversion1"; - break; - case FAC_OPVAL_DIV_LINF1: - r = "divertingLegInformation1"; - break; - case FAC_OPVAL_DIV_LINF3: - r = "divertingLegInformation3"; - break; - case FAC_OPVAL_ER_CRCO: - r = "explicitReservationCreationControl"; - break; - case FAC_OPVAL_ER_MGMT: - r = "explicitReservationManagement"; - break; - case FAC_OPVAL_ER_CANC: - r = "explicitReservationCancel"; - break; - case FAC_OPVAL_MLPP_QUERY: - r = "mLPP lfb Query"; - break; - case FAC_OPVAL_MLPP_CALLR: - r = "mLPP Call Request"; - break; - case FAC_OPVAL_MLPP_CALLP: - r = "mLPP Call Preemption"; - break; - case FAC_OPVAL_AOC_REQ: - r = "chargingRequest"; - break; - case FAC_OPVAL_AOC_S_CUR: - r = "aOCSCurrency"; - break; - case FAC_OPVAL_AOC_S_SPC: - r = "aOCSSpecialArrangement"; - break; - case FAC_OPVAL_AOC_D_CUR: - r = "aOCDCurrency"; - break; - case FAC_OPVAL_AOC_D_UNIT: - r = "aOCDChargingUnit"; - break; - case FAC_OPVAL_AOC_E_CUR: - r = "aOCECurrency"; - break; - case FAC_OPVAL_AOC_E_UNIT: - r = "aOCEChargingUnit"; - break; - case FAC_OPVAL_AOC_IDOFCRG: - r = "identificationOfCharge"; - break; - case FAC_OPVAL_CONF_BEG: - r = "beginConf"; - break; - case FAC_OPVAL_CONF_ADD: - r = "addConf"; - break; - case FAC_OPVAL_CONF_SPLIT: - r = "splitConf"; - break; - case FAC_OPVAL_CONF_DROP: - r = "dropConf"; - break; - case FAC_OPVAL_CONF_ISOLATE: - r = "isolateConf"; - break; - case FAC_OPVAL_CONF_REATT: - r = "reattachConf"; - break; - case FAC_OPVAL_CONF_PDISC: - r = "partyDISC"; - break; - case FAC_OPVAL_CONF_FCONF: - r = "floatConf"; - break; - case FAC_OPVAL_CONF_END: - r = "endConf"; - break; - case FAC_OPVAL_CONF_IDCFE: - r = "indentifyConferee"; - break; - case FAC_OPVAL_REVC_REQ: - r = "requestREV"; - break; - default: - sprintf(buffer, "unknown operation value %d!", val); - r = buffer; - } - return(r); -} - -/*---------------------------------------------------------------------------* - * billing id string - *---------------------------------------------------------------------------*/ -static char *bid_str(int val) -{ - static char buffer[80]; - char *r; - - switch(val) - { - case 0: - r = "normalCharging"; - break; - case 1: - r = "reverseCharging"; - break; - case 2: - r = "creditCardCharging"; - break; - case 3: - r = "callForwardingUnconditional"; - break; - case 4: - r = "callForwardingBusy"; - break; - case 5: - r = "callForwardingNoReply"; - break; - case 6: - r = "callDeflection"; - break; - case 7: - r = "callTransfer"; - break; - default: - sprintf(buffer, "unknown billing-id value %d!", val); - r = buffer; - } - return(r); -} - -/*---------------------------------------------------------------------------* - * invoke component - *---------------------------------------------------------------------------*/ -static void -F_1_1(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_1, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t invokeComponent\n"); - state = ST_EXP_INV_ID; - } -} - -/*---------------------------------------------------------------------------* - * return result - *---------------------------------------------------------------------------*/ -static void -F_1_2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_2, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t returnResult\n"); - state = ST_EXP_RR_INV_ID; - } -} -/*---------------------------------------------------------------------------* - * return error - *---------------------------------------------------------------------------*/ -static void -F_1_3(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_3, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t returnError\n"); - state = ST_EXP_NIX; - } -} -/*---------------------------------------------------------------------------* - * reject - *---------------------------------------------------------------------------*/ -static void -F_1_4(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_1_4, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t reject\n"); - state = ST_EXP_REJ_INV_ID; - } -} - -/*---------------------------------------------------------------------------* - * return result: invoke id - *---------------------------------------------------------------------------*/ -static void -F_RJ2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ2, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val); - state = ST_EXP_REJ_OP_VAL; - } -} - -/*---------------------------------------------------------------------------* - * reject, general problem - *---------------------------------------------------------------------------*/ -static void -F_RJ30(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ30, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t General problem\n"); - } - else - { - switch(val) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized component\n"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped component\n"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "\t problem = badly structured component\n"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val); - break; - } - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * reject, invoke problem - *---------------------------------------------------------------------------*/ -static void -F_RJ31(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ31, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Invoke problem\n"); - } - else - { - switch(val) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "\t problem = duplicate invocation\n"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized operation\n"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped argument\n"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "\t problem = resource limitation\n"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "\t problem = initiator releasing\n"); - break; - case 5: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized linked identifier\n"); - break; - case 6: - sprintf((pbuf+strlen(pbuf)), "\t problem = linked resonse unexpected\n"); - break; - case 7: - sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected child operation\n"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val); - break; - } - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * reject, return result problem - *---------------------------------------------------------------------------*/ -static void -F_RJ32(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ32, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Return result problem\n"); - } - else - { - switch(val) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "\t problem = return response unexpected\n"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped result\n"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val); - break; - } - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * reject, return error problem - *---------------------------------------------------------------------------*/ -static void -F_RJ33(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RJ33, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Return error problem\n"); - } - else - { - switch(val) - { - case 0: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized invocation\n"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), "\t problem = error response unexpected\n"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), "\t problem = unrecognized error\n"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), "\t problem = unexpected error\n"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), "\t problem = mistyped parameter\n"); - break; - default: - sprintf((pbuf+strlen(pbuf)), "\t problem = unknown problem code 0x%x\n", val); - break; - } - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * invoke component: invoke id - *---------------------------------------------------------------------------*/ -static void -F_2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_2, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val); - state = ST_EXP_OP_VAL; - } -} - -/*---------------------------------------------------------------------------* - * return result: invoke id - *---------------------------------------------------------------------------*/ -static void -F_RR2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR2, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t InvokeIdentifier = %d\n", val); - state = ST_EXP_RR_OP_VAL; - } -} - -/*---------------------------------------------------------------------------* - * invoke component: operation value - *---------------------------------------------------------------------------*/ -static void -F_3(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_3, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val); - state = ST_EXP_INFO; - } -} - -/*---------------------------------------------------------------------------* - * return result: operation value - *---------------------------------------------------------------------------*/ -static void -F_RR3(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RR3, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t Operation Value = %s (%d)\n", opval_str(val), val); - state = ST_EXP_RR_RESULT; - } -} - -/*---------------------------------------------------------------------------* - * return result: RESULT - *---------------------------------------------------------------------------*/ -static void -F_RRR(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_RRR, val = %d\n", val); -#endif - state = ST_EXP_NIX; -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_4(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t specificChargingUnits\n"); - state = ST_EXP_RUL; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_4_1(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_1, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t freeOfCharge\n"); - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_4_2(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_4_2, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t chargeNotAvailable\n"); - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_5(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_5, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t recordedUnitsList [1]\n"); - state = ST_EXP_RU; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_6(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_6, val = %d\n", val); -#endif - if(val == -1) - { - sprintf((pbuf+strlen(pbuf)), "\t RecordedUnits\n"); - state = ST_EXP_RNOU; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_7(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_7, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t NumberOfUnits = %d\n", val); - state = ST_EXP_TOCI; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_8(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_8, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t typeOfChargingInfo = %s\n", val == 0 ? "subTotal" : "total"); - state = ST_EXP_DBID; - } -} - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -static void -F_9(char *pbuf, int val) -{ -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: exec F_9, val = %d\n", val); -#endif - if(val != -1) - { - sprintf((pbuf+strlen(pbuf)), "\t AOCDBillingId = %s (%d)\n", bid_str(val), val); - state = ST_EXP_NIX; - } -} - -/*---------------------------------------------------------------------------* - * state table - *---------------------------------------------------------------------------*/ -static struct statetab { - int currstate; /* input: current state we are in */ - int form; /* input: current tag form */ - int class; /* input: current tag class */ - int code; /* input: current tag code */ - void (*func)(char *,int); /* output: func to exec */ -} statetab[] = { - -/* current state tag form tag class tag code function */ -/* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/ - -/* invoke */ - - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_1_1 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 2, F_1_2 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 3, F_1_3 }, - {ST_EXP_COMP_TYP, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 4, F_1_4 }, - {ST_EXP_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_2 }, - {ST_EXP_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_3 }, - {ST_EXP_INFO, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_4 }, - {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_NULL, F_4_1 }, - {ST_EXP_INFO, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_4_2 }, - {ST_EXP_RUL, FAC_TAGFORM_CON, FAC_TAGCLASS_COS, 1, F_5 }, - {ST_EXP_RU, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SEQ, F_6 }, - {ST_EXP_RNOU, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_7 }, - {ST_EXP_TOCI, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_8 }, - {ST_EXP_DBID, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_9 }, - -/* return result */ - - {ST_EXP_RR_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR2 }, - {ST_EXP_RR_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RR3 }, - {ST_EXP_RR_RESULT, FAC_TAGFORM_CON, FAC_TAGCLASS_UNI, FAC_CODEUNI_SET, F_RRR }, - -/* current state tag form tag class tag code function */ -/* --------------------- ---------------------- ---------------------- ---------------------- ----------------*/ -/* reject */ - - {ST_EXP_REJ_INV_ID, FAC_TAGFORM_PRI, FAC_TAGCLASS_UNI, FAC_CODEUNI_INT, F_RJ2 }, - {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 0, F_RJ30 }, - {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 1, F_RJ31 }, - {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 2, F_RJ32 }, - {ST_EXP_REJ_OP_VAL, FAC_TAGFORM_PRI, FAC_TAGCLASS_COS, 3, F_RJ33 }, - -/* end */ - - {-1, -1, -1, -1, NULL } -}; - -/*---------------------------------------------------------------------------* - * state decode for do_component - *---------------------------------------------------------------------------*/ -static void -next_state(char *pbuf, int class, int form, int code, int val) -{ - int i; - -#ifdef ST_DEBUG - sprintf((pbuf+strlen(pbuf)), "next_state: class=%d, form=%d, code=%d, val=%d\n", class, form, code, val); -#endif - - for(i=0; ; i++) - { - if((statetab[i].currstate > state) || - (statetab[i].currstate == -1)) - { - break; - } - - if((statetab[i].currstate == state) && - (statetab[i].form == form) && - (statetab[i].class == class) && - (statetab[i].code == code)) - { - (*statetab[i].func)(pbuf, val); - break; - } - } -} - -/*---------------------------------------------------------------------------* - * decode OBJECT IDENTIFIER - *---------------------------------------------------------------------------*/ -static void -object_id(int comp_length, unsigned char *pbuf) -{ - int x; - int i; - int j = 0; - int id_org = 0; - int etsi = 0; - - sprintf((pbuf+strlen(pbuf)), "\t"); - - for(i = comp_length-1; i >= 0; i--, j++) - { - sprintf((pbuf+strlen(pbuf)), "0x%02x = %d", *byte_buf, *byte_buf); - - if(j == 0) - { - x = *byte_buf; - - if(x >= 0 && x <= 39) - { - sprintf((pbuf+strlen(pbuf)), " ccitt/itu-t (0)"); - switch(x) - { - case 0: - sprintf((pbuf+strlen(pbuf)), " recommendation (0)"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), " question (1)"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), " administration (2)"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), " network-operator (3)"); - break; - case 4: - sprintf((pbuf+strlen(pbuf)), " identified-organization (4)"); - id_org = 1; - break; - default: - sprintf((pbuf+strlen(pbuf)), " error: undefined-identifier (%d)", x); - break; - } - } - else if(x >= 40 && x <= 79) - { - sprintf((pbuf+strlen(pbuf)), " iso (1)"); - x -= 40; - switch(x) - { - case 0: - sprintf((pbuf+strlen(pbuf)), " standard (0)"); - break; - case 1: - sprintf((pbuf+strlen(pbuf)), " registration-authority (1)"); - break; - case 2: - sprintf((pbuf+strlen(pbuf)), " member-body (2)"); - break; - case 3: - sprintf((pbuf+strlen(pbuf)), " identified-organization (3)"); - id_org = 1; - break; - default: - sprintf((pbuf+strlen(pbuf)), " error: undefined-identifier (%d)", x); - break; - } - } - else - { - x -= 80; - sprintf((pbuf+strlen(pbuf)), " joint-iso-ccitt (3) ??? (%d)", x); - } - } - - if(j == 1) - { - if(id_org == 1) - { - if(*byte_buf == 0) - { - sprintf((pbuf+strlen(pbuf)), " etsi (0)"); - etsi = 1; - } - } - } - - if(j == 2) - { - if(etsi == 1) - { - if(*byte_buf == 0) - { - sprintf((pbuf+strlen(pbuf)), " mobileDomain (0)"); - } - if(*byte_buf == 1) - { - sprintf((pbuf+strlen(pbuf)), " inDomain (1)"); - } - } - } - - byte_buf++; - byte_len++; - - if(i) - sprintf((pbuf+strlen(pbuf)), "\n\t"); - else - sprintf((pbuf+strlen(pbuf)), "\n"); - } -} - -/* EOF */ - diff --git a/usr.sbin/i4b/isdntrace/q932_fac.h b/usr.sbin/i4b/isdntrace/q932_fac.h deleted file mode 100644 index 563de3a6a28d..000000000000 --- a/usr.sbin/i4b/isdntrace/q932_fac.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * q932_fac.h - facility header file - * --------------------------------- - * - * $Id: q932_fac.h,v 1.7 2000/02/18 16:27:39 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Feb 18 17:26:07 2000] - * - *--------------------------------------------------------------------------- - * - * - Q.932 (03/93) Generic Procedures for the Control of - * ISDN Supplementaty Services - * - Q.950 (03/93) Supplementary Services Protocols, Structure and - * General Principles - * - ETS 300 179 (10/92) Advice Of Charge: charging information during - * the call (AOC-D) supplementary service Service description - * - ETS 300 180 (10/92) Advice Of Charge: charging information at the - * end of call (AOC-E) supplementary service Service description - * - ETS 300 181 (04/93) Advice Of Charge (AOC) supplementary service - * Functional capabilities and information flows - * - ETS 300 182 (04/93) Advice Of Charge (AOC) supplementary service - * Digital Subscriber Signalling System No. one (DSS1) protocol - * - X.208 Specification of Abstract Syntax Notation One (ASN.1) - * - X.209 Specification of Basic Encoding Rules for - * Abstract Syntax Notation One (ASN.1) - * - "ASN.1 Abstract Syntax Notation One", Walter Gora, DATACOM-Verlag - * 1992, 3rd Edition (ISBN 3-89238-062-7) (german !) - * - *---------------------------------------------------------------------------*/ - -/* #define FAC_DEBUG */ -/* #define ST_DEBUG */ - -/* protocols */ -#define FAC_PROTO_ROP 0x11 -#define FAC_PROTO_CMIP 0x12 -#define FAC_PROTO_ACSE 0x13 - -/* tag classes */ -#define FAC_TAGCLASS_UNI 0x00 -#define FAC_TAGCLASS_APW 0x01 -#define FAC_TAGCLASS_COS 0x02 -#define FAC_TAGCLASS_PRU 0x03 - -/* tag forms */ -#define FAC_TAGFORM_PRI 0x00 -#define FAC_TAGFORM_CON 0x01 - -/* class UNIVERSAL values */ -#define FAC_CODEUNI_BOOL 1 -#define FAC_CODEUNI_INT 2 -#define FAC_CODEUNI_BITS 3 -#define FAC_CODEUNI_OCTS 4 -#define FAC_CODEUNI_NULL 5 -#define FAC_CODEUNI_OBJI 6 -#define FAC_CODEUNI_OBJD 7 -#define FAC_CODEUNI_EXT 8 -#define FAC_CODEUNI_REAL 9 -#define FAC_CODEUNI_ENUM 10 -#define FAC_CODEUNI_R11 11 -#define FAC_CODEUNI_R12 12 -#define FAC_CODEUNI_R13 13 -#define FAC_CODEUNI_R14 14 -#define FAC_CODEUNI_R15 15 -#define FAC_CODEUNI_SEQ 16 -#define FAC_CODEUNI_SET 17 -#define FAC_CODEUNI_NSTR 18 -#define FAC_CODEUNI_PSTR 19 -#define FAC_CODEUNI_TSTR 20 -#define FAC_CODEUNI_VSTR 21 -#define FAC_CODEUNI_ISTR 22 -#define FAC_CODEUNI_UTIME 23 -#define FAC_CODEUNI_GTIME 24 -#define FAC_CODEUNI_GSTR 25 -#define FAC_CODEUNI_VISTR 26 -#define FAC_CODEUNI_GNSTR 27 - -/* operation values */ -#define FAC_OPVAL_UUS 1 -#define FAC_OPVAL_CUG 2 -#define FAC_OPVAL_MCID 3 -#define FAC_OPVAL_BTPY 4 -#define FAC_OPVAL_ETPY 5 -#define FAC_OPVAL_ECT 6 - -#define FAC_OPVAL_DIV_ACT 7 -#define FAC_OPVAL_DIV_DEACT 8 -#define FAC_OPVAL_DIV_ACTSN 9 -#define FAC_OPVAL_DIV_DEACTSN 10 -#define FAC_OPVAL_DIV_INTER 11 -#define FAC_OPVAL_DIV_INFO 12 -#define FAC_OPVAL_DIV_CALLDEF 13 -#define FAC_OPVAL_DIV_CALLRER 14 -#define FAC_OPVAL_DIV_LINF2 15 -#define FAC_OPVAL_DIV_INVS 16 -#define FAC_OPVAL_DIV_INTER1 17 -#define FAC_OPVAL_DIV_LINF1 18 -#define FAC_OPVAL_DIV_LINF3 19 - -#define FAC_OPVAL_ER_CRCO 20 -#define FAC_OPVAL_ER_MGMT 21 -#define FAC_OPVAL_ER_CANC 22 - -#define FAC_OPVAL_MLPP_QUERY 24 -#define FAC_OPVAL_MLPP_CALLR 25 -#define FAC_OPVAL_MLPP_CALLP 26 - -#define FAC_OPVAL_AOC_REQ 30 -#define FAC_OPVAL_AOC_S_CUR 31 -#define FAC_OPVAL_AOC_S_SPC 32 -#define FAC_OPVAL_AOC_D_CUR 33 -#define FAC_OPVAL_AOC_D_UNIT 34 -#define FAC_OPVAL_AOC_E_CUR 35 -#define FAC_OPVAL_AOC_E_UNIT 36 -#define FAC_OPVAL_AOC_IDOFCRG 37 - -#define FAC_OPVAL_CONF_BEG 40 -#define FAC_OPVAL_CONF_ADD 41 -#define FAC_OPVAL_CONF_SPLIT 42 -#define FAC_OPVAL_CONF_DROP 43 -#define FAC_OPVAL_CONF_ISOLATE 44 -#define FAC_OPVAL_CONF_REATT 45 -#define FAC_OPVAL_CONF_PDISC 46 -#define FAC_OPVAL_CONF_FCONF 47 -#define FAC_OPVAL_CONF_END 48 -#define FAC_OPVAL_CONF_IDCFE 49 - -#define FAC_OPVAL_REVC_REQ 60 - -enum states { - ST_EXP_COMP_TYP, - ST_EXP_INV_ID, - ST_EXP_OP_VAL, - ST_EXP_INFO, - ST_EXP_RUL, - ST_EXP_RU, - ST_EXP_RNOU, - ST_EXP_TOCI, - ST_EXP_DBID, - - ST_EXP_RR_INV_ID, - ST_EXP_RR_OP_VAL, - ST_EXP_RR_RESULT, - - ST_EXP_REJ_INV_ID, - ST_EXP_REJ_OP_VAL, - ST_EXP_REJ_RESULT, - - ST_EXP_NIX -}; - -/* EOF */ - diff --git a/usr.sbin/i4b/isdntrace/trace.c b/usr.sbin/i4b/isdntrace/trace.c deleted file mode 100644 index 2ba1ca59ed5b..000000000000 --- a/usr.sbin/i4b/isdntrace/trace.c +++ /dev/null @@ -1,848 +0,0 @@ -/* - * Copyright (c) 1996, 2000 Hellmuth Michaelis. All rights reserved. - * - * Copyright (c) 1996 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *---------------------------------------------------------------------------* - * - * trace.c - print traces of D (B) channel activity for isdn4bsd - * ------------------------------------------------------------- - * - * $Id: trace.c,v 1.19 2000/08/28 07:06:42 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Aug 28 09:03:46 2000] - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" -#include <unistd.h> - -unsigned char buf[BSIZE]; -FILE *Fout = NULL; -FILE *BP = NULL; -int outflag = 1; -int header = 1; -int print_q921 = 1; -int unit = 0; -int dchan = 0; -int bchan = 0; -int traceon = 0; -int analyze = 0; -int Rx = RxUDEF; -int Tx = TxUDEF; -int f; -int Bopt = 0; -int Popt = 0; -int bpopt = 0; -int info = 0; -int Fopt = 0; -int xopt = 1; - -int enable_trace = TRACE_D_RX | TRACE_D_TX; - -static char outfilename[MAXPATHLEN]; -static char routfilename[MAXPATHLEN]; -static char BPfilename[MAXPATHLEN]; -static char rBPfilename[MAXPATHLEN]; - -static struct stat fst; - -static void dumpbuf( int n, unsigned char *buf, i4b_trace_hdr_t *hdr, int raw ); -static int switch_driver( int value, int rx, int tx ); -static void usage( void ); -static void exit_hdl( void ); -static void reopenfiles( int ); -void add_datetime(char *filename, char *rfilename); - -/*---------------------------------------------------------------------------* - * usage instructions - *---------------------------------------------------------------------------*/ -void -usage(void) -{ - fprintf(stderr,"\n"); - fprintf(stderr,"isdntrace - i4b package ISDN trace facility for passive cards (%02d.%02d.%d)\n", VERSION, REL, STEP); - fprintf(stderr,"usage: isdntrace -a -b -d -f <file> -h -i -l -n <val> -o -p <file> -r -u <unit>\n"); - fprintf(stderr," -x -B -F -P -R <unit> -T <unit>\n"); - fprintf(stderr," -a analyzer mode ................................... (default off)\n"); - fprintf(stderr," -b switch B channel trace on ....................... (default off)\n"); - fprintf(stderr," -d switch D channel trace off ....................... (default on)\n"); - fprintf(stderr," -f <file> write output to file filename ............ (default %s0)\n", TRACE_FILE_NAME); - fprintf(stderr," -h don't print header for each message ............. (default off)\n"); - fprintf(stderr," -i print I.430 (layer 1) INFO signals .............. (default off)\n"); - fprintf(stderr," -l don't decode low layer Q.921 messages ........... (default off)\n"); - fprintf(stderr," -n <val> process packet if it is longer than <val> octetts . (default 0)\n"); - fprintf(stderr," -o don't write output to a file .................... (default off)\n"); - fprintf(stderr," -p <file> specify filename for -B and -P ........ (default %s0)\n", BIN_FILE_NAME); - fprintf(stderr," -r don't print raw hex/ASCII dump of protocol ...... (default off)\n"); - fprintf(stderr," -u <unit> specify controller unit number ............... (default unit 0)\n"); - fprintf(stderr," -x show packets with unknown protocol discriminator (default off)\n"); - fprintf(stderr," -B write binary trace data to file filename ........ (default off)\n"); - fprintf(stderr," -F with -P and -p: wait for more data at EOF ....... (default off)\n"); - fprintf(stderr," -P playback from binary trace data file ............ (default off)\n"); - fprintf(stderr," -R <unit> analyze Rx controller unit number (for -a) ... (default unit %d)\n", RxUDEF); - fprintf(stderr," -T <unit> analyze Tx controller unit number (for -a) ... (default unit %d)\n", TxUDEF); - fprintf(stderr,"\n"); - exit(1); -} - -/*---------------------------------------------------------------------------* - * main - *---------------------------------------------------------------------------*/ -int -main(int argc, char *argv[]) -{ - char devicename[80]; - char headerbuf[256]; - - int n; - int c; - char *b; - - char *outfile = TRACE_FILE_NAME; - char *binfile = BIN_FILE_NAME; - int outfileset = 0; - int raw = 1; - int noct = -1; - time_t tm; - i4b_trace_hdr_t *ithp = NULL; - int l; - static struct stat fstnew; - - b = &buf[sizeof(i4b_trace_hdr_t)]; - - while( (c = getopt(argc, argv, "abdf:hiln:op:ru:xBFPR:T:")) != -1) - { - switch(c) - { - case 'a': - analyze = 1; - break; - - case 'b': - enable_trace |= (TRACE_B_RX | TRACE_B_TX); - break; - - case 'd': - enable_trace &= (~(TRACE_D_TX | TRACE_D_RX)); - break; - - case 'o': - outflag = 0; - break; - - case 'f': - outfile = optarg; - outfileset = 1; - break; - - case 'n': - noct = atoi(optarg); - break; - - case 'h': - header = 0; - break; - - case 'i': - enable_trace |= TRACE_I; - info = 1; - break; - - case 'l': - print_q921 = 0; - break; - - case 'p': - binfile = optarg; - bpopt = 1; - break; - - case 'r': - raw = 0; - break; - - case 'u': - unit = atoi(optarg); - if(unit < 0 || unit >= MAX_CONTROLLERS) - usage(); - break; - - case 'x': - xopt = 0; - break; - - case 'B': - Bopt = 1; - break; - - case 'F': - Fopt = 1; - break; - - case 'P': - Popt = 1; - break; - - case 'R': - Rx = atoi(optarg); - if(Rx < 0 || Rx >= MAX_CONTROLLERS) - usage(); - break; - - case 'T': - Tx = atoi(optarg); - if(Tx < 0 || Tx >= MAX_CONTROLLERS) - usage(); - break; - - case '?': - default: - usage(); - break; - } - } - - if(enable_trace == 0) - usage(); - - if(Bopt && Popt) - usage(); - - atexit(exit_hdl); - - if(Bopt) - { - if(bpopt) - sprintf(BPfilename, "%s", binfile); - else - sprintf(BPfilename, "%s%d", BIN_FILE_NAME, unit); - - add_datetime(BPfilename, rBPfilename); - - if((BP = fopen(rBPfilename, "w")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error opening file [%s]", rBPfilename); - perror(buffer); - exit(1); - } - - if((setvbuf(BP, (char *)NULL, _IONBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error setting file [%s] to unbuffered", rBPfilename); - perror(buffer); - exit(1); - } - } - - if(Popt) - { - if(bpopt) - sprintf(BPfilename, "%s", binfile); - else - sprintf(BPfilename, "%s%d", BIN_FILE_NAME, unit); - - strcpy(rBPfilename, BPfilename); - - if((BP = fopen(BPfilename, "r")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error opening file [%s]", BPfilename); - perror(buffer); - exit(1); - } - if(Fopt) - { - if(fstat(fileno(BP), &fst)) - { - char buffer[80]; - sprintf(buffer, "Error fstat file [%s]", BPfilename); - perror(buffer); - exit(1); - } - } - } - else - { - sprintf(devicename, "%s%d", I4BTRC_DEVICE, unit); - - if((f = open(devicename, O_RDWR)) < 0) - { - char buffer[80]; - - sprintf(buffer, "Error opening trace device [%s]", devicename); - perror(buffer); - exit(1); - } - } - - if(outflag) - { - if(outfileset == 0) - sprintf(outfilename, "%s%d", TRACE_FILE_NAME, unit); - else - strcpy(outfilename, outfile); - - add_datetime(outfilename, routfilename); - - if((Fout = fopen(routfilename, "w")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error opening file [%s]", routfilename); - perror(buffer); - exit(1); - } - - if((setvbuf(Fout, (char *)NULL, _IONBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error setting file [%s] to unbuffered", routfilename); - perror(buffer); - exit(1); - } - } - - if((setvbuf(stdout, (char *)NULL, _IOLBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error setting stdout to line-buffered"); - perror(buffer); - exit(1); - } - - if(!Popt) - { - if((switch_driver(enable_trace, Rx, Tx)) == -1) - exit(1); - else - traceon = 1; - } - - signal(SIGHUP, SIG_IGN); /* ignore hangup signal */ - signal(SIGUSR1, reopenfiles); /* rotate logfile(s) */ - - time(&tm); - - if(analyze) - { - sprintf(headerbuf, "\n==== isdnanalyze controller rx #%d - tx #%d ==== started %s", - Rx, Tx, ctime(&tm)); - } - else - { - sprintf(headerbuf, "\n=========== isdntrace controller #%d =========== started %s", - unit, ctime(&tm)); - } - - printf("%s", headerbuf); - - if(outflag) - fprintf(Fout, "%s", headerbuf); - - for (;;) - { - if(Popt == 0) - { - n = read(f, buf, BSIZE); - - if(Bopt) - { - if((fwrite(buf, 1, n, BP)) != n) - { - char buffer[80]; - sprintf(buffer, "Error writing file [%s]", rBPfilename); - perror(buffer); - exit(1); - } - } - - n -= sizeof(i4b_trace_hdr_t); - } - else - { -again: - if((fread(buf, 1, sizeof(i4b_trace_hdr_t), BP)) != sizeof(i4b_trace_hdr_t)) - { - if(feof(BP)) - { - if(Fopt) - { - if(ferror(BP)) - { - char buffer[80]; - sprintf(buffer, "Error reading hdr from file [%s]", rBPfilename); - perror(buffer); - exit(1); - } - - usleep(250000); - clearerr(BP); - - if(stat(rBPfilename, &fstnew) != -1) - { - if((fst.st_ino != fstnew.st_ino) || - (fstnew.st_nlink == 0)) - { - if((BP = freopen(rBPfilename, "r", BP)) == NULL) - { - char buffer[80]; - sprintf(buffer, "Error reopening file [%s]", rBPfilename); - perror(buffer); - exit(1); - } - stat(rBPfilename, &fst); - } - } - goto again; - } - else - { - printf("\nEnd of playback input file reached.\n"); - exit(0); - } - } - else - { - char buffer[80]; - sprintf(buffer, "Error reading hdr from file [%s]", rBPfilename); - perror(buffer); - exit(1); - } - } - - ithp = (i4b_trace_hdr_t *)buf; - l = ithp->length - sizeof(i4b_trace_hdr_t); - - if((n = fread(buf+sizeof(i4b_trace_hdr_t), 1, l , BP)) != l) - { - char buffer[80]; - sprintf(buffer, "Error reading data from file [%s]", rBPfilename); - perror(buffer); - exit(1); - } - - } - - if((n > 0) && (n > noct)) - { - dumpbuf(n, b, (i4b_trace_hdr_t *)buf, raw); - } - } -} - -/*---------------------------------------------------------------------------* - * format header into static buffer, return buffer address - *---------------------------------------------------------------------------*/ -char * -fmt_hdr(i4b_trace_hdr_t *hdr, int frm_len) -{ - struct tm *s; - static char hbuf[256]; - int i = 0; - - s = localtime((time_t *)&(hdr->time.tv_sec)); - - if(hdr->type == TRC_CH_I) /* Layer 1 INFO's */ - { - sprintf(hbuf,"\n-- %s - unit:%d ---------------- time:%2.2d.%2.2d %2.2d:%2.2d:%2.2d.%06u ", - ((hdr->dir) ? "NT->TE" : "TE->NT"), - hdr->unit, - s->tm_mday, - s->tm_mon + 1, - s->tm_hour, - s->tm_min, - s->tm_sec, - (u_int32_t)hdr->time.tv_usec); - } - else - { - if(hdr->trunc > 0) - { - sprintf(hbuf,"\n-- %s - unit:%d - frame:%6.6u - time:%2.2d.%2.2d %2.2d:%2.2d:%2.2d.%06u - length:%d (%d) ", - ((hdr->dir) ? "NT->TE" : "TE->NT"), - hdr->unit, - hdr->count, - s->tm_mday, - s->tm_mon + 1, - s->tm_hour, - s->tm_min, - s->tm_sec, - (u_int32_t)hdr->time.tv_usec, - frm_len, - hdr->trunc); - } - else - { - sprintf(hbuf,"\n-- %s - unit:%d - frame:%6.6u - time:%2.2d.%2.2d %2.2d:%2.2d:%2.2d.%06u - length:%d ", - ((hdr->dir) ? "NT->TE" : "TE->NT"), - hdr->unit, - hdr->count, - s->tm_mday, - s->tm_mon + 1, - s->tm_hour, - s->tm_min, - s->tm_sec, - (u_int32_t)hdr->time.tv_usec, - frm_len); - } - } - - for(i=strlen(hbuf); i <= NCOLS;) - hbuf[i++] = '-'; - - hbuf[i++] = '\n'; - hbuf[i] = '\0'; - - return(hbuf); -} - -/*---------------------------------------------------------------------------* - * decode protocol and output to file(s) - *---------------------------------------------------------------------------*/ -static void -dumpbuf(int n, unsigned char *buf, i4b_trace_hdr_t *hdr, int raw) -{ - static char l1buf[128]; - static unsigned char l2buf[32000]; - static unsigned char l3buf[32000]; - int cnt; - int nsave = n; - char *pbuf; - int i, j; - - l1buf[0] = '\0'; - l2buf[0] = '\0'; - l3buf[0] = '\0'; - - switch(hdr->type) - { - case TRC_CH_I: /* Layer 1 INFO's */ - - /* on playback, don't display layer 1 if -i ! */ - if(!(enable_trace & TRACE_I)) - break; - - pbuf = &l1buf[0]; - - switch(buf[0]) - { - case INFO0: - sprintf((pbuf+strlen(pbuf)),"I430: INFO0 (No Signal)\n"); - break; - - case INFO1_8: - sprintf((pbuf+strlen(pbuf)),"I430: INFO1 (Activation Request, Priority = 8, from TE)\n"); - break; - - case INFO1_10: - sprintf((pbuf+strlen(pbuf)),"I430: INFO1 (Activation Request, Priority = 10, from TE)\n"); - break; - - case INFO2: - sprintf((pbuf+strlen(pbuf)),"I430: INFO2 (Pending Activation, from NT)\n"); - break; - - case INFO3: - sprintf((pbuf+strlen(pbuf)),"I430: INFO3 (Synchronized, from TE)\n"); - break; - - case INFO4_8: - sprintf((pbuf+strlen(pbuf)),"I430: INFO4 (Activated, Priority = 8/9, from NT)\n"); - break; - - case INFO4_10: - sprintf((pbuf+strlen(pbuf)),"I430: INFO4 (Activated, Priority = 10/11, from NT)\n"); - break; - - default: - sprintf((pbuf+strlen(pbuf)),"I430: ERROR, invalid INFO value 0x%x!\n", buf[0]); - break; - } - break; - - case TRC_CH_D: /* D-channel data */ - - cnt = decode_lapd(l2buf, n, buf, hdr->dir, raw, print_q921); - - n -= cnt; - buf += cnt; - - if(n) - { - switch(*buf) - { - case 0x40: - case 0x41: - decode_1tr6(l3buf, n, cnt, buf, raw); - break; - - case 0x08: - decode_q931(l3buf, n, cnt, buf, raw); - break; - - default: - if(xopt) - { - l2buf[0] = '\0'; - l3buf[0] = '\0'; - } - else - { - decode_unknownl3(l3buf, n, cnt, buf, raw); - } - break; - } - } - break; - - default: /* B-channel data */ - - pbuf = &l2buf[0]; - - for (i = 0; i < n; i += 16) - { - sprintf((pbuf+strlen(pbuf)),"B%d:%.3x ", hdr->type, i); - - for (j = 0; j < 16; j++) - if (i + j < n) - sprintf((pbuf+strlen(pbuf)),"%02x ", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf))," "); - - sprintf((pbuf+strlen(pbuf))," "); - - for (j = 0; j < 16 && i + j < n; j++) - if (isprint(buf[i + j])) - sprintf((pbuf+strlen(pbuf)),"%c", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf)),"."); - - sprintf((pbuf+strlen(pbuf)),"\n"); - } - break; - } - - if(header && ((l1buf[0] != '\0' || l2buf[0] != '\0') || (l3buf[0] != 0))) - { - char *p; - p = fmt_hdr(hdr, nsave); - printf("%s", p); - if(outflag) - fprintf(Fout, "%s", p); - } - - if(l1buf[0] != '\0') - { - printf("%s", l1buf); - if(outflag) - fprintf(Fout, "%s", l1buf); - } - - if(l2buf[0] != '\0') - { - printf("%s", l2buf); - if(outflag) - fprintf(Fout, "%s", l2buf); - } - - if(l3buf[0] != '\0') - { - printf("%s", l3buf); - if(outflag) - fprintf(Fout, "%s", l3buf); - } -} - -/*---------------------------------------------------------------------------* - * exit handler function to be called at program exit - *---------------------------------------------------------------------------*/ -void -exit_hdl() -{ - if(traceon) - switch_driver(TRACE_OFF, Rx, Tx); -} - -/*---------------------------------------------------------------------------* - * switch driver debugging output on/off - *---------------------------------------------------------------------------*/ -static int -switch_driver(int value, int rx, int tx) -{ - char buffer[80]; - int v = value; - - if(analyze == 0) - { - if(ioctl(f, I4B_TRC_SET, &v) < 0) - { - sprintf(buffer, "Error ioctl I4B_TRC_SET, val = %d", v); - perror(buffer); - return(-1); - } - } - else - { - if(value == TRACE_OFF) - { - if(ioctl(f, I4B_TRC_RESETA, &v) < 0) - { - sprintf(buffer, "Error ioctl I4B_TRC_RESETA - "); - perror(buffer); - return(-1); - } - } - else - { - i4b_trace_setupa_t tsa; - - tsa.rxunit = rx; - tsa.rxflags = value; - tsa.txunit = tx; - tsa.txflags = value; - - if(ioctl(f, I4B_TRC_SETA, &tsa) < 0) - { - sprintf(buffer, "Error ioctl I4B_TRC_SETA, val = %d", v); - perror(buffer); - return(-1); - } - } - } - return(0); -} - -/*---------------------------------------------------------------------------* - * reopen files to support rotating logfile(s) on SIGUSR1 - * - * based on an idea from Ripley (ripley@nostromo.in-berlin.de) - * - * close file and reopen it for append. this will be a nop - * if the previously opened file hasn't moved but will open - * a new one otherwise, thus enabling a rotation... - * - *---------------------------------------------------------------------------*/ -static void -reopenfiles(int dummy) -{ - if(outflag) - { - fclose(Fout); - - add_datetime(outfilename, routfilename); - - if((Fout = fopen(routfilename, "a")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error re-opening file [%s]", routfilename); - perror(buffer); - exit(1); - } - - if((setvbuf(Fout, (char *)NULL, _IONBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error re-setting file [%s] to unbuffered", routfilename); - perror(buffer); - exit(1); - } - } - - if(Bopt) - { - - fclose(BP); - - add_datetime(BPfilename, rBPfilename); - - if((BP = fopen(rBPfilename, "a")) == NULL) - { - char buffer[80]; - - sprintf(buffer, "Error re-opening file [%s]", rBPfilename); - perror(buffer); - exit(1); - } - - if((setvbuf(BP, (char *)NULL, _IONBF, 0)) != 0) - { - char buffer[80]; - - sprintf(buffer, "Error re-setting file [%s] to unbuffered", rBPfilename); - perror(buffer); - exit(1); - } - } -} - -void -add_datetime(char *filename, char *rfilename) -{ - time_t timeb; - struct tm *tmp; - FILE *fx; - - time(&timeb); - tmp = localtime(&timeb); - - sprintf(rfilename, "%s-", filename); - - strftime(rfilename+strlen(rfilename), MAXPATHLEN-strlen(rfilename)-1, - "%Y%m%d-%H%M%S", tmp); - - if((fx = fopen(rfilename, "r")) != NULL) - { - fclose(fx); - - sleep(1); - - time(&timeb); - tmp = localtime(&timeb); - - sprintf(rfilename, "%s-", filename); - - strftime(rfilename+strlen(rfilename), MAXPATHLEN-strlen(rfilename)-1, - "%Y%m%d-%H%M%S", tmp); - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/trace.h b/usr.sbin/i4b/isdntrace/trace.h deleted file mode 100644 index 95c68618b272..000000000000 --- a/usr.sbin/i4b/isdntrace/trace.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1996, 2000 Hellmuth Michaelis. All rights reserved. - * - * Copyright (c) 1996 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * 4. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software and/or documentation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * trace.h - header file for isdn trace - * ------------------------------------ - * - * $Id: trace.h,v 1.12 2000/02/14 16:25:22 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Feb 14 14:43:40 2000] - * - *---------------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <fcntl.h> -#include <ctype.h> -#include <string.h> -#include <time.h> -#include <unistd.h> -#include <sys/uio.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include <sys/stat.h> -#include <sys/param.h> - -#include <i4b/i4b_ioctl.h> -#include <i4b/i4b_trace.h> - -#include "pcause_1tr6.h" /* obsolete german national ISDN */ -#include "pcause_q850.h" - -#define I4BTRC_DEVICE "/dev/i4btrc" /* trace device file */ -#define TRACE_FILE_NAME "isdntrace" /* default output filename */ -#define BIN_FILE_NAME "isdntracebin" /* default binary filename */ - -#define BSIZE 4096 /* read buffer size */ -#define NCOLS 80 /* screen width */ - -#define RxUDEF 0 /* analyze mode, default unit for receiver side */ -#define TxUDEF 1 /* analyze mode, default unit for transmitter side */ - -int decode_lapd(char *pbuf, int n, unsigned char *buf, int is_te, int raw, int printit); -void decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw); -void decode_unknownl3(char *pbuf, int n, int off, unsigned char *buf, int raw); -void decode_1tr6(char *pbuf, int n, int off, unsigned char *buf, int raw); -char *print_error(int prot, unsigned char code); -int q931_facility(char *pbuf, unsigned char *buf); -int p_q931cause(char *pbuf, unsigned char *buf); -int p_q931address(char *pbuf, unsigned char *buf); -int p_q931bc(char *pbuf, unsigned char *buf); -int p_q931high_compat(char *pbuf, unsigned char *buf); -int q932_facility(char *pbuf, unsigned char *buf); -int p_q931user_user(char *pbuf, unsigned char *buf); -int p_q931notification(char *pbuf, unsigned char *buf); -int p_q931redir(char *pbuf, unsigned char *buf); - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/unknownl3.c b/usr.sbin/i4b/isdntrace/unknownl3.c deleted file mode 100644 index 8967a6a9b037..000000000000 --- a/usr.sbin/i4b/isdntrace/unknownl3.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * unknownl3.c - print L3 packets with unknown PD - * ---------------------------------------------- - * - * $Id: unknownl3.c,v 1.2 2000/02/13 15:26:52 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sun Feb 13 14:16:44 2000] - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" - -/*---------------------------------------------------------------------------* - * decode unknown protocol - *---------------------------------------------------------------------------*/ -void -decode_unknownl3(char *pbuf, int n, int off, unsigned char *buf, int raw) -{ - int pd; - int j; - int i; - - if(n <= 0) - return; - - *pbuf = '\0'; - - if(raw) - { - for (i = 0; i < n; i += 16) - { - sprintf((pbuf+strlen(pbuf)),"Dump:%.3d ", i+off); - for (j = 0; j < 16; j++) - if (i + j < n) - sprintf((pbuf+strlen(pbuf)),"%02x ", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf))," "); - sprintf((pbuf+strlen(pbuf))," "); - for (j = 0; j < 16 && i + j < n; j++) - if (isprint(buf[i + j])) - sprintf((pbuf+strlen(pbuf)),"%c", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf)),"."); - sprintf((pbuf+strlen(pbuf)),"\n"); - } - } - - i = 0; - - /* protocol discriminator */ - - pd = buf[i]; - - sprintf((pbuf+strlen(pbuf)), "PD%02X: ", pd); - - if(pd >= 0x00 && pd <= 0x07) - sprintf((pbuf+strlen(pbuf)), "pd=User-User (0x%02x)",pd); - else if(pd == 0x08) - sprintf((pbuf+strlen(pbuf)), "pd=Q.931/I.451"); - else if(pd >= 0x10 && pd <= 0x3f) - sprintf((pbuf+strlen(pbuf)), "pd=Other Layer 3 or X.25 (0x%02x)",pd); - else if(pd >= 0x40 && pd <= 0x4f) - sprintf((pbuf+strlen(pbuf)), "pd=National Use (0x%02x)",pd); - else if(pd >= 0x50 && pd <= 0xfe) - sprintf((pbuf+strlen(pbuf)), "pd=Other Layer 3 or X.25 (0x%02x)",pd); - else - sprintf((pbuf+strlen(pbuf)), "pd=Reserved (0x%02x)",pd); - - sprintf((pbuf+strlen(pbuf)), "\n ["); - for(j = 0; j < (n-i); j++) - { - sprintf((pbuf+strlen(pbuf)),"0x%02x ", buf[j+i]); - } - - sprintf((pbuf+strlen(pbuf)),"]\n"); -} - -/* EOF */ - diff --git a/usr.sbin/i4b/man/Makefile b/usr.sbin/i4b/man/Makefile deleted file mode 100644 index 75e464bfbfb0..000000000000 --- a/usr.sbin/i4b/man/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ -MAN= i4b.4 i4bcapi.4 i4bctl.4 i4bq921.4 \ - i4bq931.4 i4brbch.4 i4btel.4 i4btrc.4 iavc.4 isic.4 ifpi.4 \ - ifpi2.4 ifpnp.4 ihfc.4 itjc.4 iwic.4 - -# Temporary removed i4bing.4 i4bipr.4 i4bisppp.4 for 7.0 timeframe. -# In case they are back also remove them from ObsoleteFiles.inc. - -.include <bsd.prog.mk> diff --git a/usr.sbin/i4b/man/i4b.4 b/usr.sbin/i4b/man/i4b.4 deleted file mode 100644 index be7b22447c7f..000000000000 --- a/usr.sbin/i4b/man/i4b.4 +++ /dev/null @@ -1,110 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 12:07:13 2002] -.\" -.Dd July 5, 2007 -.Dt I4B 4 -.Os -.Sh NAME -.Nm i4b -.Nd isdn4bsd call control ISDN driver -.Sh SYNOPSIS -.Cd device \&"i4b\&" -.Sh DESCRIPTION -The -.Nm -device driver is used by the -.Xr isdnd 8 -daemon to exchange messages with the isdn4bsd kernel part for the purpose -of call establishment, control and disconnection and to access various -control and status informations. -The -.Nm -device can only be opened by a single process and is not meant to be used -by user programs. -.Pp -The messages and message parameters are documented in the include -file -.Em /usr/include/i4b/i4b_ioctl.h . -.Pp -The most important available ioctl's are: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar I4B_CDID_REQ -Request a unique Call Description IDentifier (cdid) which identifies -uniquely a single interaction of the local D channel with the exchange. -.It Ar I4B_CONNECT_REQ -Actively request a call setup to a remote ISDN subscriber. -.It Ar I4B_CONNECT_RESP -Respond to an incoming call, either accept, reject or ignore it. -.It Ar I4B_DISCONNECT_REQ -Actively terminate a connection. -.It Ar I4B_CTRL_INFO_REQ -Request information about an installed ISDN controller card. -.It Ar I4B_DIALOUT_RESP -Give information about call setup to driver who requested dialing out. -.It Ar I4B_TIMEOUT_UPD -Update the kernels timeout value(s) in case of dynamically calculated -shorthold mode timing changes. -.It Ar I4B_UPDOWN_IND -Inform the kernel userland drivers about interface soft up/down status -changes. -.It Ar I4B_CTRL_DOWNLOAD -Download firmware to active card(s). -.It Ar I4B_ACTIVE_DIAGNOSTIC -Return diagnostic information from active cards. -.El -.Pp -Status and event messages available from the kernel are: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar MSG_CONNECT_IND -An incoming call from a remote ISDN user is indicated. -.It Ar MSG_CONNECT_ACTIVE_IND -After an incoming call has been accepted locally or an outgoing call has -been accepted by a remote, the exchange signaled an active connection -and the corresponding B-channel is switched through. -.It Ar MSG_DISCONNECT_IND -A call was terminated. -.It Ar MSG_DIALOUT_IND -A userland interface driver requests the daemon to dial out (typically a -network interface when a packet arrives in its send queue). -.It Ar MSG_IDLE_TIMEOUT_IND -A call was terminated by the isdn4bsd kernel driver because a B-channel -idle timeout occurred. -.It Ar MSG_ACCT_IND -Accounting information from a network driver. -.It Ar MSG_CHARGING_IND -Charging information from the kernel. -.El -.Sh SEE ALSO -.Xr isdnd 8 -.Sh AUTHORS -The -.Nm -device driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/i4bcapi.4 b/usr.sbin/i4b/man/i4bcapi.4 deleted file mode 100644 index 95d2bba06886..000000000000 --- a/usr.sbin/i4b/man/i4bcapi.4 +++ /dev/null @@ -1,59 +0,0 @@ -.\" -.\" Copyright (c) 2001 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Fri May 25 09:38:45 2001] -.\" -.Dd May 21, 2001 -.Dt I4BCAPI 4 -.Os -.Sh NAME -.Nm i4bcapi -.Nd CAPI driver for the isdn4bsd kernel part -.Sh SYNOPSIS -.Cd "device \*[q]i4bcapi\*[q]" -.Sh DESCRIPTION -.Nm -is a CAPI driver for the -.Em isdn4bsd -package. -It sits between layer\~4 of isdn4bsd and a driver for an active -ISDN card; currently only the -.Xr iavc 4 -driver for the AVM B1 and T1 family of active cards is supported. -.Sh SEE ALSO -.Xr iavc 4 -.Sh STANDARDS -CAPI 2.0 -.Pq Pa http://www.capi.org/ -.Sh AUTHORS -.An -nosplit -The -.Nm -device driver was written by -.An Juha-Matti Liukkonen Aq jml@cubical.fi -(Cubical Solutions Ltd, Finland). -This manpage was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/i4bctl.4 b/usr.sbin/i4b/man/i4bctl.4 deleted file mode 100644 index 20b42e83edbb..000000000000 --- a/usr.sbin/i4b/man/i4bctl.4 +++ /dev/null @@ -1,50 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 12:21:03 2002] -.\" -.Dd July 28, 2002 -.Dt I4BCTL 4 -.Os -.Sh NAME -.Nm i4bctl -.Nd control device for the isdn4bsd kernel part -.Sh SYNOPSIS -.Cd device \&"i4bctl\&" -.Sh DESCRIPTION -The -.Nm -device is used by the -.Xr isdndebug 8 -utility to get and set the current debugging level and other information -of the isdn4bsd package kernel ISDN handling layers. -.Sh SEE ALSO -.Xr isdndebug 8 -.Sh AUTHORS -The -.Nm -device driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@kts.org . diff --git a/usr.sbin/i4b/man/i4bing.4 b/usr.sbin/i4b/man/i4bing.4 deleted file mode 100644 index 0322088e09eb..000000000000 --- a/usr.sbin/i4b/man/i4bing.4 +++ /dev/null @@ -1,63 +0,0 @@ -.\" -.\" Copyright (c) 2000, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 12:21:13 2002] -.\" -.Dd July 28, 2002 -.Dt I4BING 4 -.Os -.Sh NAME -.Nm i4bing -.Nd isdn4bsd NetGraph ISDN B-channel interface driver -.Sh SYNOPSIS -.Cd device \&"i4bing\&" Op count -.Sh DESCRIPTION -The -.Nm -driver interfaces the -.Fx -NetGraph subsystem with the -isdn4bsd package. -.Pp -The driver just packs packets received from the NetGraph subsystem without -anything appended or prepended into raw HDLC packets on the B channel and -transfers them to a remote site. -Packets received from the remote site are queued into the NetGraph -subsystem. -.Pp -In the case where a packet for a remote site arrives in the driver and no -connection has been established yet, the driver communicates with the -.Xr isdnd 8 -daemon to establish a connection. -.Sh SEE ALSO -.Xr netgraph 4 , -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh AUTHORS -The -.Nm -device driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/i4bipr.4 b/usr.sbin/i4b/man/i4bipr.4 deleted file mode 100644 index 6bbc1faea49b..000000000000 --- a/usr.sbin/i4b/man/i4bipr.4 +++ /dev/null @@ -1,96 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 14:29:08 2002] -.\" -.Dd July 28, 2002 -.Dt I4BIPR 4 -.Os -.Sh NAME -.Nm i4bipr -.Nd isdn4bsd IP over ISDN B-channel network driver -.Sh SYNOPSIS -.Cd device \&"i4bipr\&" Op count -.Sh DESCRIPTION -The -.Nm -driver interfaces the IP subsystem of the operating system with the -isdn4bsd package so that transport of IP packets over an ISDN link -is possible. -.Pp -The driver just packs IP packets without anything appended or prepended -into raw HDLC packets on the B channel and transfers them to a remote site. -IP packets received from the remote site are queued into the local IP -protocol stack. -.Pp -The format of the resulting packet on the B channel is: -.Pp -.Dl (HDLC opening flag) (IP-packet) (CRC) (HDLC closing flag) -.Pp -In the case where an IP packet for a remote site arrives in the driver and no -connection has been established yet, the driver communicates with the -.Xr isdnd 8 -daemon to establish a connection. -.Pp -The driver has support for interfacing to the -.Xr bpf 4 -subsystem for using -.Xr tcpdump 1 -with the -.Nm ipr -interfaces. -.Pp -The driver optionally (when compiled with the IPR_VJ option) provides Van -Jacobsen header compression, under control of the link0 and link1 options to -.Xr ifconfig 8 : -.Pp -.Bl -tag -width 15n -offset indent -compact -.It link0 -Apply VJ compression to outgoing packets on this interface, and assume that -incoming packets require decompression. -.It link1 -Check incoming packets for Van Jacobsen compression; if they appear to be -compressed, automatically set link0. -.El -.Pp -The default values are -.Em on -for -.Em link1 -and -.Em off -for -.Em link0 . -.Sh SEE ALSO -.Xr tcpdump 1 , -.Xr bpf 4 , -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh AUTHORS -The -.Nm -device driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/i4bisppp.4 b/usr.sbin/i4b/man/i4bisppp.4 deleted file mode 100644 index 7ef4a96f8ce4..000000000000 --- a/usr.sbin/i4b/man/i4bisppp.4 +++ /dev/null @@ -1,123 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 12:43:22 2002] -.\" -.Dd July 28, 2002 -.Dt I4BISPPP 4 -.Os -.Sh NAME -.Nm i4bisppp -.Nd isdn4bsd synchronous PPP over ISDN B-channel network driver -.Sh SYNOPSIS -.Cd device \&"i4bisppp\&" Op count -.Cd device sppp -.Sh DESCRIPTION -The -.Nm -driver interfaces the IP subsystem of the operating system with the -isdn4bsd package so that a transport of IP packets over an ISDN link -is possible. -.Pp -The driver is just a glue layer between the -.Xr sppp 4 -backend and the ISDN4BSD package and needs the -.Xr sppp 4 -driver configured into the kernel. -.Pp -The network interfaces provided by this driver are named -.Em isp<n> , -where <n> is a number between 0 and count-1 from the kernel config line. -.Pp -For configuration of the i4bsppp driver, either the -.Xr spppcontrol 8 -utility is used or the driver can be configured via -.Xr isdnd 8 -and its associated -.Xr isdnd.rc 5 -file. -.Pp -In case an IP packet for a remote side arrives in the driver and no -connection is established yet, the driver communicates with the -.Xr isdnd 8 -daemon to establish a connection. -.Pp -The driver has support for interfacing to the -.Xr bpf 4 -subsystem for using -.Xr tcpdump 1 -with the -.Nm isp -interfaces. -.Pp -.Sh LINK0 and LINK1 -The -.Em link0 -and -.Em link1 -flags given as parameters to -.Xr ifconfig 8 -have the following meaning for the -.Em isp<n> -devices: -.Bl -tag -width link0 -compact -.Pp -.It Li link0 -wait passively for connection -.Pp -.It Li link1 -auto-dial on output -.El -.Pp -The -.Em link0 -and -.Em link1 -flags are set to -.Em off -by default. -.Pp -See -.Xr sppp 4 -for a more detailed discussion of the flags. -.Sh SEE ALSO -.Xr tcpdump 1 , -.Xr bpf 4 , -.Xr sppp 4 , -.Xr isdnd.rc 5 , -.Xr isdnd 8 , -.Xr spppcontrol 8 -.Sh AUTHORS -.An -nosplit -The -.Nm -device driver was written by -.An Joerg Wunsch Aq joerg@FreeBSD.org -and then added to ISDN4BSD by -.An Gary Jennejohn Aq gj@FreeBSD.org . -.Pp -This manpage was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/i4bq921.4 b/usr.sbin/i4b/man/i4bq921.4 deleted file mode 100644 index ecd729333779..000000000000 --- a/usr.sbin/i4b/man/i4bq921.4 +++ /dev/null @@ -1,48 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 12:49:44 2002] -.\" -.Dd July 28, 2002 -.Dt I4BQ921 4 -.Os -.Sh NAME -.Nm i4bq921 -.Nd isdn4bsd pseudo device driver handling the Q.921 protocol -.Sh SYNOPSIS -.Cd device \&"i4bq921\&" -.Sh DESCRIPTION -.Nm -is the ISDN D channel layer 2 handler. -.Sh SEE ALSO -.Xr i4bq931 4 -.Sh STANDARDS -ITU Recommendation Q.920 and Q.921 -.Sh AUTHORS -The -.Nm -driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/i4bq931.4 b/usr.sbin/i4b/man/i4bq931.4 deleted file mode 100644 index 937840d77121..000000000000 --- a/usr.sbin/i4b/man/i4bq931.4 +++ /dev/null @@ -1,48 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 14:11:55 2002] -.\" -.Dd July 28, 2002 -.Dt I4BQ931 4 -.Os -.Sh NAME -.Nm i4bq931 -.Nd isdn4bsd pseudo device driver handling the Q.931 protocol -.Sh SYNOPSIS -.Cd device \&"i4bq931\&" -.Sh DESCRIPTION -.Nm -is the ISDN D channel layer 3 handler. -.Sh SEE ALSO -.Xr i4bq921 4 -.Sh STANDARDS -ITU Recommendation Q.930 and Q.931 -.Sh AUTHORS -The -.Nm -driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/i4brbch.4 b/usr.sbin/i4b/man/i4brbch.4 deleted file mode 100644 index aaa6044b0349..000000000000 --- a/usr.sbin/i4b/man/i4brbch.4 +++ /dev/null @@ -1,49 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 12:52:34 2002] -.\" -.Dd July 28, 2002 -.Dt I4BRBCH 4 -.Os -.Sh NAME -.Nm i4brbch -.Nd isdn4bsd ISDN Raw B-CHannel access driver -.Sh SYNOPSIS -.Cd device \&"i4brbch\&" Op count -.Sh DESCRIPTION -The -.Nm -driver provides an interface to the raw untranslated B-channel. -It is part of the isdn4bsd package. -.Sh SEE ALSO -.Xr isdnd.rc 5 , -.Xr isdnd 8 -.Sh AUTHORS -The -.Nm -device driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/i4btel.4 b/usr.sbin/i4b/man/i4btel.4 deleted file mode 100644 index d8e17f4cda3c..000000000000 --- a/usr.sbin/i4b/man/i4btel.4 +++ /dev/null @@ -1,133 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 14:14:06 2002] -.\" -.Dd July 28, 2002 -.Dt I4BTEL 4 -.Os -.Sh NAME -.Nm i4btel -.Nd isdn4bsd ISDN B-channel telephony interface driver -.Sh SYNOPSIS -.Cd device \&"i4btel\&" Op count -.Sh DESCRIPTION -The -.Nm -driver provides an interface to the ISDN B-channel for telephony applications -and is currently used by the -.Xr isdnd 8 -for answering machine support. -The driver is part of the isdn4bsd package. -.Pp -The lower six bits of the drivers's minor number is used to specify a -unit number, whereas the upper two bits specify a functionality. -.Pp -Functionality zero is the usual telephony data stream i/o driver. -.Pp -Functionality one is used to enable commands to dial out and hang up and -receive responses about the state of the dial out progress and status. -This commands may change in the future, for details see the file -.Em i4b_tel_ioctl.h -and the -.Xr isdnphone 8 -utility. -.Pp -The telephony data stream comes out of the line in a bit-reversed format, -so the -.Nm -driver does the bit-reversion process in any case. -.Pp -Additionally, the user can specify to do A-law to u-law, u-law to A-law -or no conversion at all in the i4btel driver by using the -.Xr isdntelctl 8 -utility. -.Pp -The driver is able to process several ioctl's: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar I4B_TEL_GETAUDIOFMT -get currently used audio format conversion. -.It Ar I4B_TEL_SETAUDIOFMT -set currently used audio format conversion. -.It Ar I4B_TEL_EMPTYINPUTQUEUE -clear the input queue. -.El -.Pp -For the I4B_TEL_GETAUDIOFMT and I4B_TEL_SETAUDIOFMT, the following -parameters are available: -.Pp -.Bl -tag -width Ds -compact -offset indent -.It Ar CVT_NONE -do no A-law/u-law audio format conversion. -The conversion path looks like this: -.Pp -USER <--> bitreversing <--> ISDN-line -.Pp -.It Ar CVT_ALAW2ULAW -set set audio format conversion to do an audio conversion from A-law -(on the ISDN line) to u-law (in the userland). -The -.Xr read 2 -conversion path looks like this: -.Pp -USER <-- u-law/A-law <-- bitreversing <-- ISDN-line -.Pp -and the -.Xr write 2 -conversion path looks like this: -.Pp -USER --> u-law/A-law --> bitreversing --> ISDN-line -.Pp -.It Ar CVT_ULAW2ALAW -set set audio format conversion to do an audio conversion from u-law -(on the ISDN line) to A-law (in the userland). -The -.Xr read 2 -conversion path looks like this: -.Pp -USER <-- A-law/u-law <-- bitreversing <-- ISDN-line -.Pp -and the -.Xr write 2 -conversion path looks like this: -.Pp -USER --> A-law/u-law --> bitreversing --> ISDN-line -.Pp -.El -.Sh SEE ALSO -.Xr g711conv 1 , -.Xr isdnd.rc 5 , -.Xr isdnd 8 , -.Xr isdnphone 8 , -.Xr isdntelctl 8 -.Sh STANDARDS -A-Law and u-Law are specified in ITU Recommendation G.711. -.Sh AUTHORS -The -.Nm -device driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/i4btrc.4 b/usr.sbin/i4b/man/i4btrc.4 deleted file mode 100644 index cbd6a7f44cae..000000000000 --- a/usr.sbin/i4b/man/i4btrc.4 +++ /dev/null @@ -1,54 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 14:21:03 2002] -.\" -.Dd July 30, 1999 -.Dt I4BTRC 4 -.Os -.Sh NAME -.Nm i4btrc -.Nd "isdn4bsd ISDN interface driver for D and B channel tracing -.Sh SYNOPSIS -.Cd device \&"i4btrc\&" Op count -.Sh DESCRIPTION -The -.Nm -driver is used to add a header to the data got from the D and/or B channel -and queues it to be read and further processed by the -.Xr isdntrace 8 -or -.Xr isdndecode 8 -utilities. -.Sh SEE ALSO -.Xr isdnd 8 , -.Xr isdndecode 8 , -.Xr isdntrace 8 -.Sh AUTHORS -The -.Nm -device driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/iavc.4 b/usr.sbin/i4b/man/iavc.4 deleted file mode 100644 index e737e645a28a..000000000000 --- a/usr.sbin/i4b/man/iavc.4 +++ /dev/null @@ -1,73 +0,0 @@ -.\" -.\" Copyright (c) 2001, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 16:37:51 2002] -.\" -.Dd July 28, 2002 -.Dt IAVC 4 -.Os -.Sh NAME -.Nm iavc -.Nd isdn4bsd AVM B1/T1 driver -.Sh SYNOPSIS -.Cd "device iavc" -.Cd device \&"i4bcapi\&" -.Pp -NOTE: -For the B1 ISA card, something like -.Pp -.Bd -literal -offset indent -hint.iavc.0.at="isa" -hint.iavc.0.port="0x150" -hint.iavc.0.irq="5" -.Ed -.Pp -must be added to -.Pa /boot/device.hints -.Sh DESCRIPTION -The -.Nm -driver is used to access the AVM family of active cards to the -.Xr i4bcapi 4 -driver and the -.Em isdn4bsd -package. -Currently the AVM B1 PCI, the AVM B1 ISA and the AVM T1 PCI -cards are supported. -.Sh SEE ALSO -.Xr i4bcapi 4 -.Sh STANDARDS -CAPI 2.0 -.Pq Pa http://www.capi.org/ -.Sh AUTHORS -.An -nosplit -The -.Nm -device driver was written by -.An Juha-Matti Liukkonen Aq jml@cubical.fi -(Cubical Solutions Ltd, Finland). -This manpage was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . diff --git a/usr.sbin/i4b/man/ifpi.4 b/usr.sbin/i4b/man/ifpi.4 deleted file mode 100644 index f2f3cdf20f2f..000000000000 --- a/usr.sbin/i4b/man/ifpi.4 +++ /dev/null @@ -1,64 +0,0 @@ -.\" -.\" Copyright (c) 2000, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 16:38:40 2002] -.\" -.Dd July 28, 2002 -.Dt IFPI 4 -.Os -.Sh NAME -.Nm ifpi -.Nd isdn4bsd AVM Fritz!Card PCI Version 1 driver -.Sh SYNOPSIS -.Cd device ifpi -.Sh DESCRIPTION -The -.Nm -driver provides D-channel layer 1 support as specified in ITU Recommendation -I.430 and layer 1 support for the B-channel. -.Pp -The driver supports passive PCI ISDN Version 1.0 cards from AVM based on the -proprietary B-channel controller and PCI interface chip from AVM, Berlin, -Germany. -.Sh CAVEATS -The driver is still in a somewhat experimental state. -.Sh SEE ALSO -.Xr i4bq921 4 , -.Xr i4bq931 4 , -.Xr ifpi2 4 -.Sh STANDARDS -CCITT Recommendation I.430 -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Gary Jennejohn Aq gj@FreeBSD.org . -.Pp -This manpage was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -.Sh BUGS -Always at least one left. diff --git a/usr.sbin/i4b/man/ifpi2.4 b/usr.sbin/i4b/man/ifpi2.4 deleted file mode 100644 index 4889079c7635..000000000000 --- a/usr.sbin/i4b/man/ifpi2.4 +++ /dev/null @@ -1,60 +0,0 @@ -.\" -.\" Copyright (c) 2001 Gary Jennejohn. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 16:38:22 2002] -.\" -.Dd July 28, 2002 -.Dt IFPI2 4 -.Os -.Sh NAME -.Nm ifpi2 -.Nd isdn4bsd AVM Fritz!Card PCI Version 2 driver -.Sh SYNOPSIS -.Cd device \&"ifpi2\&" -.Sh DESCRIPTION -The -.Nm -driver provides D-channel layer 1 support as specified in ITU Recommendation -I.430 and layer 1 support for the B-channel. -.Pp -The driver supports the version 2 passive PCI ISDN cards from AVM based on -the proprietary B-channel controller and PCI interface chip from AVM, Berlin, -Germany. -.Sh CAVEATS -The driver is still in a somewhat experimental state. -.Sh SEE ALSO -.Xr i4bq921 4 , -.Xr i4bq931 4 , -.Xr ifpi 4 -.Sh STANDARDS -CCITT Recommendation I.430 -.Sh AUTHORS -The -.Nm -driver and manpage were written by -.An Gary Jennejohn Aq gj@FreeBSD.org . -.Sh BUGS -Always at least one left. diff --git a/usr.sbin/i4b/man/ifpnp.4 b/usr.sbin/i4b/man/ifpnp.4 deleted file mode 100644 index bf892189057b..000000000000 --- a/usr.sbin/i4b/man/ifpnp.4 +++ /dev/null @@ -1,67 +0,0 @@ -.\" -.\" Copyright (c) 2000 Udo Schweigert. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Ust: src/i4b/man/ifpnp.4,v 1.4 2000/04/18 08:26:31 ust Exp $ -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 16:39:35 2002] -.\" -.Dd July 28, 2002 -.Dt IFPNP 4 -.Os -.Sh NAME -.Nm ifpnp -.Nd isdn4bsd AVM Fritz!Card ISA PnP driver -.Sh SYNOPSIS -.Cd "device ifpnp" -.Sh DESCRIPTION -The -.Nm -driver provides D-channel layer 1 supports as specified in ITU Recommendation -I.430 and layer 1 support for the B-channel. -.Pp -The driver supports passive ISA PnP ISDN cards from AVM, based on the -proprietary B-channel controller and ISA PnP interface chip from -AVM, Berlin, Germany. -.Sh CAVEATS -The driver is still in a somewhat experimental state. -.Sh SEE ALSO -.Xr i4bq921 4 , -.Xr i4bq931 4 -.Sh STANDARDS -CCITT Recommendation I.430 -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Udo Schweigert Aq ust@cert.siemens.de . -.Pp -This manpage was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org -and -.An Udo Schweigert . -.Sh BUGS -Always at least one left. diff --git a/usr.sbin/i4b/man/ihfc.4 b/usr.sbin/i4b/man/ihfc.4 deleted file mode 100644 index 4d91391acb94..000000000000 --- a/usr.sbin/i4b/man/ihfc.4 +++ /dev/null @@ -1,71 +0,0 @@ -.\" -.\" Copyright (c) 2000, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 16:47:55 2002] -.\" -.Dd July 28, 2002 -.Dt IHFC 4 -.Os -.Sh NAME -.Nm ihfc -.Nd isdn4bsd ISA Cologne Chip HFC[-S][-SP] 2B[DS0] driver -.Sh SYNOPSIS -.Cd "device ihfc" -.Pp -NOTE: -.Pp -Something like: -.Li hint.ihfc.0.at="isa" -must be added to -.Pa /boot/device.hints -The driver will automatically probe for io-base and irq. -.Sh DESCRIPTION -The -.Nm -driver provides D-channel layer 1 supports as specified in ITU Recommendation -I.430 and layer 1 support for the B-channel. -.Pp -The driver supports some passive ISA ISDN cards based on the -HFC[-S][-SP] 2B[DS0] chips from Cologne Chip, currently this are the -Teles 16.3c ISA PnP, the AcerISDN P10 ISA PnP and the TELEINT ISDN SPEED No.1. -.Sh CAVEATS -The driver is still in an experimental state. -.Sh SEE ALSO -.Xr i4bq921 4 , -.Xr i4bq931 4 -.Sh STANDARDS -CCITT Recommendation I.430 -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Hans Petter Selasky Aq hselasky@c2i.net . -.Pp -This manpage was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -.Sh BUGS -Always at least one left. diff --git a/usr.sbin/i4b/man/isic.4 b/usr.sbin/i4b/man/isic.4 deleted file mode 100644 index e545c08f4c77..000000000000 --- a/usr.sbin/i4b/man/isic.4 +++ /dev/null @@ -1,359 +0,0 @@ -.\" -.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 20:14:24 2002] -.\" -.Dd July 28, 2002 -.Dt ISIC 4 -.Os -.Sh NAME -.Nm isic -.Nd isdn4bsd Siemens ISDN Chipset device driver -.Sh SYNOPSIS -.Cd "device isic" -.Sh DESCRIPTION -The -.Nm -driver provides D-channel layer 1 supports as specified in ITU Recommendation -I.430 and layer 1 support for the B-channel. -.Pp -The driver supports several 8 and 16bit passive ISA, ISA PnP and PCI -ISDN cards from various manufacturers which are all based upon the -popular Siemens ISDN chipset consisting of the ISDN Subscriber Access -Controller ISAC (such as the PEB2085 or PSB 2186) and the High-Level -Serial Communications Controller Extended HSCX (such as the SAB82525 -or PSB21525). -The newer IPAC chip (which integrates an ISAC and a HSCX in one chip, -with the added benefit of larger FIFO buffers) is also supported. -.Sh SUPPORTED CARDS: ISA bus, NON-PnP -.Bl -tag -width Ds -compact -.It Ar Teles S0/8, Dr. Neuhaus Niccy 1008, Creatix ISDN-S0/8 -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options TEL_S0_8 -.Ed -.Pp -The required entry in -.Xr device.hints 5 -file is: -.Pp -.Bd -literal -offset indent -hint.isic.0.at="isa" -hint.isic.0.maddr="0xd0000" -hint.isic.0.irq="5" -hint.isic.0.flags="1" -.Ed -.Pp -Notice that this cards must not have a -.Em port -value. -.Pp -Valid values for hint.isic.N.irq are 2, 3, 4, 5, 6 and 7. -.Pp -The i/o ports are memory mapped and the memory start address (hint.isic.N.maddr) -may be in the range 0xA0000 to 0xDF000 and use a region of 4kB of memory. -.Pp -.It Ar Teles S0/16, Creatix ISDN-S0, Dr. Neuhaus Niccy 1016 -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options TEL_S0_16 -.Ed -.Pp -The required entry in -.Xr device.hints 5 -file is: -.Pp -.Bd -literal -offset indent -hint.isic.0.at="isa" -hint.isic.0.port="0xd80" -hint.isic.0.maddr="0xd0000" -hint.isic.0.irq="5" -hint.isic.0.flags="2" -.Ed -.Pp -These boards have a jumper which specifies an i/o base address -(hint.isic.N.port) of either 0xd80, 0xe80 or 0xf80. -The remaining necessary configuration values are then -programmed at run time by accessing this i/o port. -.Pp -Valid interrupts (hint.isic.N.irq) are 2, 3, 4, 5, 10, 11, 12 or 15. -.Pp -Valid memory start addresses (hint.isic.N.maddr) are -0xC0000, 0xC2000, 0xC4000, 0xC6000, 0xC8000, 0xCA000, 0xCC000, 0xCE000, -0xD0000, 0xD2000, 0xD4000, 0xD6000, 0xD8000, 0xDA000, 0xDC000 and -0xDE000. -.Pp -Notice: Although the jumpers are labeled 0xd80, 0xe80 or 0xf80, they -also require i/o space at addresses 0x180, 0x280 or 0x380. -.Pp -.It Ar Teles S0/16.3 -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options TEL_S0_16_3 -.Ed -.Pp -The required entry in -.Xr device.hints 5 -file is: -.Pp -.Bd -literal -offset indent -hint.isic.0.at="isa" -hint.isic.0.port="0xd80" -hint.isic.0.irq="5" -hint.isic.0.flags="3" -.Ed -.Pp -This card is completely i/o mapped and must not have an -.Em maddr -statement in the hints file. -.Pp -Valid interrupts (hint.isic.N.irq) are 2, 5, 9, 10, 12 or 15. -.Pp -These boards have a jumper which specifies an i/o base address -(hint.isic.N.port) of either 0xd80, 0xe80 or 0xf80. -.Pp -Notice: Although the switch positions are labeled 0x180, 0x280 and 0x380, -the card is to be configured at 0xd80, 0xe80 or 0xf80 respectively! -.Pp -.It Ar AVM A1 and AVM Fritz!Card -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options AVM_A1 -.Ed -.Pp -The required entry in -.Xr device.hints 5 -file is: -.Pp -.Bd -literal -offset indent -hint.isic.0.at="isa" -hint.isic.0.port="0x340" -hint.isic.0.irq="5" -hint.isic.0.flags="4" -.Ed -.Pp -These boards have a jumper which specifies an i/o base address (hint.isic.N.port) -of either 0x200, 0x240, 0x300 or 0x340. -.Pp -Valid interrupt (hint.isic.N.irq) values are 3, 4, 5, 6, 7, 10, 11, 12 or 15. -.Pp -Older Versions of the AVM A1 also require setting of an IRQ jumper, newer -versions of this and the Fritz!Card only have an i/o base jumper and the -interrupt is setup at runtime by reprogramming a register. -.Pp -.It Ar USRobotics Sportster ISDN TA intern and Stollmann Tina pp -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options USR_STI -.Ed -.Pp -The required entry in -.Xr device.hints 5 -file is: -.Pp -.Bd -literal -offset indent -hint.isic.0.at="isa" -hint.isic.0.port="0x268" -hint.isic.0.irq="5" -hint.isic.0.flags="7" -.Ed -.Pp -Valid i/o port values (hint.isic.N.port) are 0x200, 0x208, 0x210, 0x218, -0x220, 0x228, 0x230, 0x238, 0x240, 0x248, 0x250, 0x258, 0x260, 0x268, -0x270 and 0x278. -.Pp -Valid interrupt (hint.isic.N.irq) values are 5, 7, 10, 11, 12, 14, 15. -.Pp -Notice: this card has a strange address decoding scheme resulting in -occupying 64 windows of some bytes length over the whole i/o address -range. -.Pp -.It Ar ITK ix1 Micro ( < V.3, non-PnP version ) -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options ITKIX1 -.Ed -.Pp -The required entry in -.Xr device.hints 5 -file is: -.Pp -.Bd -literal -offset indent -hint.isic.0.at="isa" -hint.isic.0.port="0x398" -hint.isic.0.irq="10" -hint.isic.0.flags="18" -.Ed -.Pp -Valid i/o port values must be in the range (<unknown>). -.Pp -Valid interrupt configurations are (<unknown>). -.Pp -.It Ar ELSA MicroLink ISDN/PCC-16 and ELSA PCFpro -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options ELSA_PCC16 -.Ed -.Pp -The required entry in -.Xr device.hints 5 -file is: -.Pp -.Bd -literal -offset indent -hint.isic.0.at="isa" -hint.isic.0.port="0x360" -hint.isic.0.irq="10" -hint.isic.0.flags="20" -.Ed -.Pp -Valid i/o port (hint.isic.N.port) values are 0x160, 0x170, 0x260 and 0x360. -.Pp -Valid interrupt (hint.isic.N.irq) values are 2, 3, 5, 10, 11 and 15. -.Pp -The LED's are not supported and are off. -.Pp -.El -.Sh SUPPORTED CARDS: ISA bus, PnP (Plug 'n Pray) -.Bl -tag -width Ds -compact -.It Ar Teles S0/16.3 PnP -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options TEL_S0_16_3_P -.Ed -.Pp -.It Ar Creatix ISDN-S0 P&P -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options CRTX_S0_P -.Ed -.Pp -.It Ar "Dr. Neuhaus Niccy Go@" -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options DRN_NGO -.Ed -.Pp -.It Ar "Sedlbauer Win Speed" -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options SEDLBAUER -.Ed -.Pp -.It Ar "Dynalink IS64PH" -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options DYNALINK -.Ed -.Pp -.It Ar "ELSA QuickStep 1000pro ISA" -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options ELSA_QS1ISA -.Ed -.Pp -The LED's are not supported and are off. -.Pp -.It Ar "Siemens I-Surf 2.0" -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options SIEMENS_ISURF2 -.Ed -.Pp -.It Ar "Asuscom ISDNlink 128K ISA" -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options ASUSCOM_IPAC -.Ed -.Pp -.It Ar "Eicon Diehl DIVA 2.0 and 2.02" -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options EICON_DIVA -.Ed -.Pp -.It Ar "Compaq Microcom 610 ISDN card (Compaq series PSB2222I)" -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options COMPAQ_M610 -.Ed -.Pp -.El -.Sh SUPPORTED CARDS: PCI bus -.Bl -tag -width Ds -compact -.It Ar "ELSA QuickStep 1000pro-PCI" -.Pp -The required entry in the kernel config file is: -.Bd -literal -offset indent -options ELSA_QS1PCI -.Ed -.Pp -The LED's are not supported and are off. -.Pp -.El -.Sh CAVEATS -Note that all of ISA boards with i/o ports actually use several ranges -of port addresses; Teles happen to refer to the 0xd80 range in their -documentation (the board also uses 0x180 etc.), while AVM happen to refer -to the 0x200 range in their documentation (the board also uses 0x600 etc.) -The driver matches the manufacturers' description for the purposes of -configuration, but of course makes use of all the ports in order to -operate the card. -.Sh SEE ALSO -.Xr i4bq921 4 , -.Xr i4bq931 4 -.Sh STANDARDS -CCITT Recommendation I.430 -.Sh AUTHORS -.An -nosplit -The -.Nm -driver and this manpage were written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -It is based on earlier work of -.An Arne Helme , -.An Andrew Gordon -and -.An Gary Jennejohn Aq gj@FreeBSD.org . -.Sh BUGS -Since there is no hardware documentation available from the manufacturers -of several boards, it is likely that there are many bugs left. diff --git a/usr.sbin/i4b/man/itjc.4 b/usr.sbin/i4b/man/itjc.4 deleted file mode 100644 index be4f9fe46c0d..000000000000 --- a/usr.sbin/i4b/man/itjc.4 +++ /dev/null @@ -1,66 +0,0 @@ -.\" -.\" Copyright (c) 2001 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Fri Jan 12 10:07:04 2001] -.\" -.Dd January 12, 2001 -.Dt ITJC 4 -.Os -.Sh NAME -.Nm itjc -.Nd isdn4bsd NETjet-S / Teles PCI-TJ hardware driver -.Sh SYNOPSIS -.Cd "device itjc" -.Sh DESCRIPTION -The -.Nm -driver provides D-channel layer 1 supports as specified in ITU Recommendation -I.430 and layer 1 support for the B-channel. -.Pp -The driver supports passive PCI ISDN cards based on the combination of -the Siemens/Infineon ISAC chip and the Tiger Jet Network Inc.\& Tiger 300/320 -chip. -.Pp -Currently supported cards are the Traverse Technologies NETjet-S PCI ISDN -card and the Teles PCI-TJ. -.Sh CAVEATS -The driver is in an experimental state. -.Sh SEE ALSO -.Xr i4bq921 4 , -.Xr i4bq931 4 -.Sh STANDARDS -CCITT Recommendation I.430 -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Sergio de Souza Prallon Aq prallon@tmp.com.br . -.Pp -This manpage was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -.Sh BUGS -Always at least one left. diff --git a/usr.sbin/i4b/man/iwic.4 b/usr.sbin/i4b/man/iwic.4 deleted file mode 100644 index 8d9b4df7bae8..000000000000 --- a/usr.sbin/i4b/man/iwic.4 +++ /dev/null @@ -1,68 +0,0 @@ -.\" -.\" Copyright (c) 2000, 2002 Hellmuth Michaelis. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" last edit-date: [Sun Jul 28 16:49:47 2002] -.\" -.Dd July 28, 2002 -.Dt IWIC 4 -.Os -.Sh NAME -.Nm iwic -.Nd isdn4bsd Winbond ISDN Chip device driver -.Sh SYNOPSIS -.Cd "device iwic0" -.Sh DESCRIPTION -The -.Nm -driver provides D-channel layer 1 supports as specified in ITU Recommendation -I.430 and layer 1 support for the B-channel. -.Pp -The driver supports passive PCI ISDN cards from various manufacturers -based on the Winbond W6692 chip. -.Sh SUPPORTED CARDS -.Bl -tag -width Ds -compact -.It Ar ASUSCOM P-IN100-ST-D -.Pp -.It Ar Dynalink IS64PPH -.El -.Sh CAVEATS -The driver is still in a somewhat experimental state. -.Sh SEE ALSO -.Xr i4bq921 4 , -.Xr i4bq931 4 -.Sh STANDARDS -CCITT Recommendation I.430 -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Dave Boyce Aq dave@abyss.demon.co.uk . -.Pp -This manpage was written by -.An Hellmuth Michaelis Aq hm@FreeBSD.org . -.Sh BUGS -Layer 1 persistent deactivation not yet implemented. |