update to i4b version 0.95.04

This commit is contained in:
Hellmuth Michaelis 2000-10-09 14:22:51 +00:00
parent c199657754
commit ba518fe550
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66880
69 changed files with 5984 additions and 1045 deletions

View File

@ -1,5 +1,10 @@
# $FreeBSD$
MAINTAINER = hm@freebsd.org
SUBDIR = isdntrace isdndebug isdnd g711conv man isdntest \
isdntel isdntelctl isdnmonitor isdndecode dtmfdecode
SUBDIR = dtmfdecode g711conv isdnd isdndebug isdndecode \
isdnmonitor isdnphone isdntel isdntelctl isdntest \
isdntrace ispppcontrol man
.include <bsd.subdir.mk>

View File

@ -5,7 +5,7 @@ PROG = isdnd
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
y.tab.h holiday.c
COPTS += -I${.CURDIR}/../isdnmonitor -I${.CURDIR}/../isdntel -I${.OBJDIR}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* i4b daemon - controller state support routines
* ----------------------------------------------
*
* $Id: controller.c,v 1.19 1999/12/13 21:25:24 hm Exp $
* $Id: controller.c,v 1.23 2000/10/09 12:53:29 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:45:34 1999]
* last edit-date: [Mon Oct 9 14:37:34 2000]
*
*---------------------------------------------------------------------------*/
@ -69,7 +69,11 @@ name_of_controller(int ctrl_type, int card_type)
"ELSA PCC-16",
"AVM Fritz!Card PnP",
"Siemens I-Surf 2.0 PnP",
"Asuscom ISDNlink 128K 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"
};
static char *daic_card[] = {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* i4b daemon - curses fullscreen output
* -------------------------------------
*
* $Id: curses.c,v 1.29 1999/12/13 21:25:24 hm Exp $
* $Id: curses.c,v 1.36 2000/10/09 12:53:29 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:45:43 1999]
* last edit-date: [Thu Jun 1 16:24:43 2000]
*
*---------------------------------------------------------------------------*/
@ -41,6 +41,10 @@
#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
*---------------------------------------------------------------------------*/
@ -118,9 +122,6 @@ init_screen(void)
addstr(buffer);
standend();
move(uheight+5, 0);
addstr("Date Time Typ Information Description");
refresh();
for(i=0, j=0; i <= ncontroller; i++, j+=2)
@ -161,8 +162,10 @@ do_menu(void)
{
"1 - (D)isplay refresh",
"2 - (H)angup (choose a channel)",
"3 - (R)eread config file",
"4 - (Q)uit the program",
"3 - (R)eread config file",
"4 - (S)how card types",
"5 - (B)udget information",
"6 - (Q)uit the program",
};
WINDOW *menu_w;
@ -170,7 +173,7 @@ do_menu(void)
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)
@ -232,6 +235,12 @@ do_menu(void)
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':
@ -241,6 +250,7 @@ do_menu(void)
case ('0'+WQUIT+1): /* quit program */
case 'Q':
case 'q':
menuexit(menu_w);
do_exit(0);
goto mexit;
@ -256,6 +266,12 @@ do_menu(void)
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)
@ -265,6 +281,7 @@ do_menu(void)
break;
case WQUIT:
menuexit(menu_w);
do_exit(0);
break;
@ -275,6 +292,14 @@ do_menu(void)
case WREREAD:
rereadconfig(42);
break;
case WBUDGET:
display_budget();
break;
case WSHOW:
display_cards();
break;
}
goto mexit;
break;
@ -286,14 +311,53 @@ do_menu(void)
}
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();
}
/*---------------------------------------------------------------------------*
@ -630,6 +694,200 @@ display_chans(void)
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)
{
log(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)
{
log(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 */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* exec.h - supplemental program/script execution
* ----------------------------------------------
*
* $Id: exec.c,v 1.13 1999/12/13 21:25:24 hm Exp $
* $Id: exec.c,v 1.23 2000/10/09 12:53:29 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:45:59 1999]
* last edit-date: [Wed Sep 27 09:39:22 2000]
*
*---------------------------------------------------------------------------*/
@ -139,6 +139,19 @@ exec_prog(char *prog, char **arglist)
/* 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)
fclose(acctfp);
if(uselogfile)
fclose(logfp);
if(execvp(path,arglist) < 0 )
_exit(127);
@ -279,4 +292,115 @@ check_and_kill(cfg_entry_t *cep)
}
}
/*---------------------------------------------------------------------------*
* 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 */
log(LL_WRN, "upd_callstat_file: creating %s", filename);
fp = fopen(filename, "w");
if(fp == NULL)
{
log(LL_ERR, "ERROR, upd_callstat_file: cannot create %s, %s", filename, strerror(errno));
return;
}
ret = fprintf(fp, "%ld %ld 1", now, now);
if(ret <= 0)
log(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno));
fclose(fp);
return;
}
/* get contents */
ret = fscanf(fp, "%ld %ld %d", &s, &l, &n);
/* reset fp */
rewind(fp);
if(ret != 3)
{
/* file corrupt ? anyway, initialize */
log(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)
{
log(LL_ERR, "ERROR, upd_callstat_file: cannot open for write %s, %s", buf, strerror(errno));
return;
}
ret = fprintf(nfp, "%ld %ld %d", s, l, n);
if(ret <= 0)
log(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno));
fclose(nfp);
/* init new days stats */
n = 0;
s = now;
log(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, "%ld %ld %-3d", s, now, n);
if(ret <= 0)
log(LL_ERR, "ERROR, upd_callstat_file: fprintf failed: %s", strerror(errno));
fclose(fp);
}
/* EOF */

View File

@ -27,7 +27,7 @@
* FSM for isdnd
* -------------
*
* $Id: fsm.c,v 1.18 1999/12/13 21:25:24 hm Exp $
* $Id: fsm.c,v 1.19 2000/08/20 08:08:51 hm Exp $
*
* $FreeBSD$
*
@ -212,7 +212,7 @@ F_DFL(cfg_entry_t *cep)
{
cep->dial_count++;
if(cep->dial_count < cep->dialretries)
if(cep->dial_count < cep->dialretries || cep->dialretries == -1) /* Added by FST <mailto:fsteevie@dds.nl> for unlimited dialing (sorry, but I needed it) */
{
/* inside normal retry cycle */
@ -290,7 +290,7 @@ F_ACBR(cfg_entry_t *cep)
{
cep->dial_count++;
if(cep->dial_count < cep->dialretries)
if(cep->dial_count < cep->dialretries || cep->dialretries == -1) /* Added by FST <mailto:fsteevie@dds.nl> for unlimited dialing (sorry, but I needed it) */
{
/* inside normal retry cycle */

View File

@ -0,0 +1,202 @@
/*
* 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.
*
*---------------------------------------------------------------------------
*
* isdnd - holiday file handling
* =============================
*
* $Id: holiday.c,v 1.1 2000/10/09 11:17:07 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Oct 9 11:32:28 2000]
*
* 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)
{
log(LL_ERR, "init_holiday: error opening holidayfile %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;
}
ret = sscanf(buffer, "%d.%d.%d", &day, &month, &year);
if(ret != 3)
{
ret = sscanf(buffer, "%d.%d", &day, &month);
if(ret != 2)
{
log(LL_ERR, "init_holiday: parse error for string [%s]!", buffer);
exit(1);
}
year = 0;
}
if((newh = (struct holiday *) malloc(sizeof(struct holiday))) == NULL)
{
log(LL_ERR, "init_holiday: malloc failed for struct holiday!\n");
exit(1);
}
if(year)
{
DBGL(DL_MSG, (log(LL_DBG, "init_holidays: add %d.%d.%d", day, month, year)));
}
else
{
DBGL(DL_MSG, (log(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_MSG, (log(LL_DBG, "isholiday: %d.%d is a holiday!", d, m)));
return(1);
}
else if(ch->year == y)
{
DBGL(DL_MSG, (log(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 */

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
.\" 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
@ -22,13 +22,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: isdnd.8,v 1.27 1999/12/13 22:11:55 hm Exp $
.\" $Id: isdnd.8,v 1.29 2000/05/02 11:50:28 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Dec 13 22:57:10 1999]
.\" last edit-date: [Tue May 2 13:45:12 2000]
.\"
.Dd February 23, 1999
.Dd May 2, 2000
.Dt ISDND 8
.Os
.Sh NAME
@ -66,8 +66,7 @@ instead of the default file
If debugging support is compiled into
.Nm isdnd
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
of debugging messages are displayed. The debugging level is the sum of the
following values:
.Pp
.Bl -tag -width Ds -compact -offset indent
@ -91,6 +90,8 @@ isdn4bsd kernel i/o calls.
controller and channel busy/free messages.
.It Ar 0x200
isdnd.rc configuration file processing.
.It Ar 0x400
outgoing call budget handling.
.El
.Pp
The value can be specified in any number base supported by the
@ -103,16 +104,14 @@ disable displaying debug messages on the full-screen display.
.It Fl f
Specifying this option causes
.Nm isdnd
to enter the full-screen mode of operation.
When operating in this mode,
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
will pop-up a command window. Because the
.Nm
daemon will not listen to messages while the command window is active,
this command window will disappear automatically after 5 seconds without
@ -122,8 +121,7 @@ While the command window is active,
.Em Tab
or
.Em Space
advances to the next menu item.
To execute a command, press
advances to the next menu item. To execute a command, press
.Em Return
or
.Em Enter
@ -137,16 +135,13 @@ 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
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
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.
@ -170,8 +165,7 @@ and on which the full-screen mode output is displayed.
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
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
@ -183,8 +177,7 @@ options,
specifies a terminal type or termcap entry name (such as vt220) for the device
used for
.Nm isdnd
full-screen output.
This is useful if an unused (no getty running) tty line is
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.
@ -196,8 +189,7 @@ 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
this option disables all monitoring access. It overrides the config
file option
.Em monitor-allowed .
.El
@ -284,8 +276,7 @@ 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
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.
@ -334,8 +325,7 @@ message and the CDID corresponding to the call is no longer valid.
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. In case aliasfile handling was enabled, the aliasfile is also
reread.
Sending a USR1 signal to
@ -424,6 +414,7 @@ Exit status is 0 on success, 1 on error.
.Xr isdnd.rates 5 ,
.Xr i4bisppp 4 ,
.Xr i4bipr 4
.Xr i4bing 4
.Sh BUGS
Still one or more left.

View File

@ -64,8 +64,7 @@ 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
is the time the connection was closed. The format is the same as
described for
.Em FROM
above.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* i4b daemon - main header file
* -----------------------------
*
* $Id: isdnd.h,v 1.72 1999/12/13 21:25:24 hm Exp $
* $Id: isdnd.h,v 1.82 2000/10/09 11:17:07 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:46:50 1999]
* last edit-date: [Wed Oct 4 14:11:46 2000]
*
*---------------------------------------------------------------------------*/
@ -102,6 +102,7 @@
#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 */
#ifdef DEBUG
#define DBGL(cond, dolog) if(cond & debug_flags) dolog
@ -134,13 +135,15 @@
#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 WMITEMS 6 /* 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 WSHOW 3
#define WBUDGET 4
#define WQUIT 5
#define WMTIMEOUT 5 /* timeout in seconds */
@ -335,6 +338,49 @@ typedef struct cfg_entry {
#define DIR_INOUT 0
#define DIR_INONLY 1
#define DIR_OUTONLY 2
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
#define AUTHNAMELEN 32 /* AUTHNAMELEN must match in <machine/i4b_isppp.h> */
#define AUTHKEYLEN 16
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;
/*===========================================================================*/
/*============ filled in after start, then dynamic ==========================*/
@ -380,7 +426,7 @@ typedef struct cfg_entry {
#define N_STATES (ST_ILL+1) /* max number of states */
int disc_cause; /* cause from disconnect */
cause_t disc_cause; /* cause from disconnect */
int local_disconnect; /* flag, who disconnected */
#define DISCON_LOC 0
@ -435,6 +481,25 @@ typedef struct cfg_entry {
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
} cfg_entry_t;
/*---------------------------------------------------------------------------*
@ -563,11 +628,16 @@ int monitorport = -1;
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 */
#else /* !MAIN */
int isdnfd;
@ -607,6 +677,7 @@ int nentries;
int uselogfile;
char logfile[MAXPATHLEN];
FILE *logfp;
int logfacility;
int nregex;
struct rarr rarr[MAX_RE];
@ -641,11 +712,16 @@ int monitorport;
int accepted;
int isdntime;
int extcallattr;
char tinainitprog[MAXPATHLEN];
char rotatesuffix[MAXPATHLEN];
time_t starttime;
char holidayfile[MAXPATHLEN];
#endif /* MAIN */
char * bdrivername ( int drivertype );
@ -684,6 +760,7 @@ 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 );
@ -722,8 +799,8 @@ 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, int cause );
int sendm_disconnect_req ( cfg_entry_t *cep, int cause );
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);
@ -788,4 +865,12 @@ 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_ */

View File

@ -38,8 +38,7 @@
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,
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
@ -72,12 +71,9 @@ 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
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,

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
.\" 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
@ -22,13 +22,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: isdnd.rc.5,v 1.41 1999/12/13 22:11:55 hm Exp $
.\" $Id: isdnd.rc.5,v 1.51 2000/10/09 11:17:07 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Dec 13 23:00:48 1999]
.\" last edit-date: [Mon Oct 9 13:12:29 2000]
.\"
.Dd October 11, 1999
.Dd October 9, 2000
.Dt ISDND.RC 5
.Os
.Sh NAME
@ -83,10 +83,8 @@ The following keywords are recognized by
.Bl -tag -width system -compact
.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.
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 -compact
@ -94,8 +92,7 @@ The following keywords are valid in the system configuration section:
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)
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
@ -104,44 +101,51 @@ Specifies the name of the accounting file which is used when the keyword
.Em on .
See also system keyword
.Em rotatesuffix .
If this keyword is omitted the system default is used.
(optional)
If this keyword is omitted the system default 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)
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
.Xr isdntel 1
utility when alias processing is enabled via the
.Em aliasing
keyword.
(optional)
keyword. (optional)
.It Li beepconnect
In fullscreen mode, if this parameter is set to
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
logfile.
The default is off.
(optional)
log-file. The default is off. (optional)
.It Li mailer
This keyword is used to specify the path/name of a mail program which
which is able to use the "-s" flag to specify a subject on its
command line.
In case of a fatal error exit of
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
@ -173,8 +177,7 @@ 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
monitoring. The
.Em monitor
specification may either be:
.Pp
@ -194,8 +197,7 @@ example: up-vision-net/24
.It Li monitor-access
This keyword specifies the access rights for a previously used
.Em monitor
keyword.
The supported access rights are:
keyword. The supported access rights are:
.Pp
.Bl -tag -width Ds -compact -offset
.It Ar fullcmd
@ -207,14 +209,11 @@ The supported access rights are:
.El
.It Li ratesfile
Specifies the name of the ratesfile.
If this keyword is omitted the system
default is used.
(optional)
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
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
@ -247,21 +246,18 @@ 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 accountingfilename.
In case
rotatesuffix is used and a USR1 signal is sent to isdnd, the logfile and the
accounting file is not only closed and reopened but the old logfile is also
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 logfiles are just closed and reopened; this
is also the default behaviour.
(optional)
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 realtime priority
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
priority. This keyword is optional; if not specified the process priority of
.Nm isdnd
is not touched in any way.
( See also
@ -275,25 +271,20 @@ was compiled with -DUSE_RTPRIO.
If this parameter is set to
.Em on
charging (if available) and accounting information is written to the
accounting file.
(optional)
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
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 -compact
.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
controller is connected to. The following parameters are currently
supported:
.Pp
.Bl -tag -width calledback -compact -offset
@ -306,8 +297,7 @@ An ISDN leased line with a single B-channel (called D64S in Germany).
.El
.It Li entry
This keyword starts one configuration entry.
It must not have a parameter.
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 -compact
@ -316,8 +306,7 @@ The following keywords are valid in an entry section:
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
in its configuration entry. The default name is
.Em answer .
.Nm Isdnd
expects to find this program beneath the path
@ -326,18 +315,15 @@ 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
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
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 B channel layer 1 protocol used for this connection. The keyword is mandatory.
The currently configurable values are:
.Pp
.Bl -tag -width Ds -compact -offset
@ -347,15 +333,67 @@ HDLC framing.
No framing at all (used for telephony).
.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 successfull 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 witten 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 and
.Em budget-calloutsfile
.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)
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)
after a call from the local site to the remote site has been made. (optional)
.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.
@ -372,7 +410,7 @@ Ignore an incoming call.
.It Ar answer
Start telephone answering for an incoming voice call.
.It Ar callback
When a remote site calls, hangup and call back the remote site.
When a remote site calls, hang up and call back the remote site.
.El
.It Li dialout-type
@ -397,7 +435,9 @@ each time it dials because the other side is also dialing.
.It Li dialretries
The number of dialing retries before giving up.
(optional)
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
@ -417,6 +457,14 @@ Only incoming connections are possible.
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
@ -436,14 +484,12 @@ 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 hangup before an
expected next charging unit will occur.
(optional)
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:
line becomes idle. The current algorithms are:
.Pp
.Bl -tag -width calledback -compact -offset
@ -481,75 +527,184 @@ than the requested channel!
.It Li isdntxdel-incoming
A delay value suitable for the
.Em timeout()
kernel subroutine to delay the transmittion of the first packet after a
successfull connection is made by this value for
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
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)
IP over raw HDLC ISDN driver. (optional)
.It Li isdntxdel-outgoing
A delay value suitable for the
.Em timeout()
kernel subroutine to delay the transmittion of the first packet after a
successfull connection is made by this value for
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
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)
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
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
userland interfaces.
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
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 ipr interfaces.
This keyword is mandatory for the
.Em ipr
interfaces.
.It Li name
Defines a symbolic name for this configuration entry.
It's purpose is to
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)
to a remote site and for accounting purposes. (mandatory)
.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 -offset
.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 -offset
.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)
The rate entry used from the rates file. (optional)
.br
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)
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
@ -568,23 +723,19 @@ follows the last one used.
.El
.It Li remote-phone-dialout
The remote telephone number used when the local site dials out.
When dialing
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
interfaces. It may be specified more than once to try to dial to several
numbers until one succeeds.
.It Li remote-phone-incoming
The remote telephone number used to verify an incoming call.
When a remote site
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
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.
@ -594,22 +745,19 @@ This keyword is mandatory for the ipr interfaces.
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 hangup a connection.
(optional)
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 shorthold mode.
The currently configurable values are:
takes the unitlength for short-hold mode. The currently configurable values are:
.Pp
.Bl -tag -width Ds -compact -offset
.It Ar none
Then unitlength is not specified anywhere.
.It Ar cmdl
Use the unitlength specified on the commandline.
Use the unitlength specified on the command line.
.It Ar conf
Use the unitlength specified in the configuration file with the keyword
.Em unitlength .
@ -619,16 +767,14 @@ 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''
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 userland interface which is used for interfacing ISDN B channel
data to the userland.
The keyword is mandatory.
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 -offset
@ -640,6 +786,8 @@ This parameter configures a synchronous PPP over ISDN interface.
This specifies a Raw B CHannel access interface.
.It Ar tel
ISDN telephony.
.It Ar ing
configures a ISDN B-channel to NetGraph interface.
.El
.It Li usrdeviceunit
@ -659,36 +807,56 @@ This parameter is optional and is set to
.Em off
by default.
.It Li connectprog
specifies a program run everytime after a connection is established and
address negotiation is complete (i.e.: the connection is useable).
.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 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 -offset
.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
.It Li disconnectprog
specifies a program run everytime 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)
.Pp
The following examples describe the "T-ISDN xxl" tariff of the german Telekom:
.Bl -tag -width Ds -compact -offset
.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 SHORTHOLD MODE
.Sh IDLETIME CALCULATION AND SHORT-HOLD MODE
.Bl -tag -width incoming calls -compact
.It Li incoming calls
It is assumed that the calling side knows most about charging structures and
@ -752,13 +920,10 @@ must be greater than 0 (zero);
.Ed
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
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
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:
@ -788,8 +953,8 @@ For example British Telecom bill this way.
Each call is divided into two periods, the first is the
.Em unchecked
period and the second is the
.Em checked
. The
.Em checked .
The
.Em checked
period starts 1 second before the first units time expires.
.Pp

View File

@ -27,7 +27,7 @@
* i4b daemon - logging routines
* -----------------------------
*
* $Id: log.c,v 1.23 1999/12/13 21:25:25 hm Exp $
* $Id: log.c,v 1.25 2000/10/09 12:53:29 hm Exp $
*
* $FreeBSD$
*
@ -174,7 +174,7 @@ log(int what, const char *fmt, ...)
#warning "FreeBSD ncurses is buggy: write to last column = auto newline!"
COLS-((strlen(dp))+(strlen(logtab[what].text))+3), buffer);
#else
COLS-((strlen(dp))+(strlen(logtab[what].text))+2), buffer);
(int)(COLS-((strlen(dp))+(strlen(logtab[what].text))+2)), buffer);
#endif
wrefresh(lower_w);
}

View File

@ -27,11 +27,11 @@
* i4b daemon - main program entry
* -------------------------------
*
* $Id: main.c,v 1.49 1999/12/13 21:25:25 hm Exp $
* $Id: main.c,v 1.54 2000/10/09 12:53:29 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:47:35 1999]
* last edit-date: [Mon Oct 2 22:57:08 2000]
*
*---------------------------------------------------------------------------*/
@ -89,7 +89,7 @@ usage(void)
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\n", DL_RCCF);
fprintf(stderr, " rc-file = 0x%04x, budget = 0x%04x\n", DL_RCCF, DL_BDGT);
fprintf(stderr, " -dn no debug output on fullscreen display\n");
#endif
fprintf(stderr, " -f fullscreen status display\n");
@ -126,14 +126,10 @@ main(int argc, char **argv)
setlocale (LC_ALL, "");
while ((i = getopt(argc, argv, "bmc:d:fFlL:Pr:s:t:u:")) != -1)
while ((i = getopt(argc, argv, "mc:d:fFlL:Pr:s:t:u:")) != -1)
{
switch (i)
{
case 'b':
do_bell = 1;
break;
#ifdef I4B_EXTERNAL_MONITOR
case 'm':
inhibit_monitor = 1;
@ -365,6 +361,10 @@ main(int argc, char **argv)
if(aliasing)
init_alias(aliasfile);
/* init holidays */
init_holidays(holidayfile);
/* init remote monitoring */
#ifdef I4B_EXTERNAL_MONITOR
@ -405,6 +405,8 @@ main(int argc, char **argv)
}
#endif
starttime = time(NULL); /* get starttime */
srandom(580403); /* init random number gen */
mloop( /* enter loop of no return .. */

View File

@ -33,7 +33,7 @@
* i4b daemon - network monitor server module
* ------------------------------------------
*
* $Id: monitor.c,v 1.29 1999/12/13 21:25:25 hm Exp $
* $Id: monitor.c,v 1.30 2000/10/09 12:53:29 hm Exp $
*
* $FreeBSD$
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* i4b daemon - message from kernel handling routines
* --------------------------------------------------
*
* $Id: msghdl.c,v 1.71 1999/12/13 21:25:25 hm Exp $
* $Id: msghdl.c,v 1.78 2000/09/21 11:29:51 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:47:54 1999]
* last edit-date: [Thu Sep 21 11:11:48 2000]
*
*---------------------------------------------------------------------------*/
@ -66,10 +66,17 @@ msg_connect_ind(msg_connect_ind_t *mp)
#define SRC (aliasing == 0 ? mp->src_telno : src_tela)
#define DST (aliasing == 0 ? mp->dst_telno : dst_tela)
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;
}
@ -103,17 +110,12 @@ msg_connect_ind(msg_connect_ind_t *mp)
}
}
if(aliasing)
{
src_tela = get_alias(mp->src_telno);
dst_tela = get_alias(mp->dst_telno);
}
if(cep->inout == DIR_OUTONLY)
{
log(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;
}
@ -176,6 +178,7 @@ msg_connect_ind(msg_connect_ind_t *mp)
break;
case REACT_CALLBACK:
#ifdef NOTDEF
/*XXX reserve channel ??? */ decr_free_channels(mp->controller);
#endif
@ -184,15 +187,42 @@ msg_connect_ind(msg_connect_ind_t *mp)
log(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)
{
log(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;
}
}
log(LL_CHD, "%05d %s callback: 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_NORMAL);
cep->last_release_time = time(NULL);
cep->cdid = CDID_RESERVED;
next_state(cep, EV_CBRQ);
@ -204,6 +234,7 @@ msg_connect_ind(msg_connect_ind_t *mp)
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
}
@ -250,6 +281,29 @@ msg_connect_active_ind(msg_connect_active_ind_t *mp)
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, (log(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, (log(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
{
@ -735,7 +789,25 @@ msg_dialout(msg_dialout_ind_t *mp)
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)
{
log(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, (log(LL_DBG, "msg_dialout: get_cdid() returned 0!")));
@ -770,6 +842,24 @@ msg_dialoutnumber(msg_dialoutnumber_ind_t *mp)
return;
}
if(cep->budget_calloutperiod && cep->budget_calloutncalls)
{
cep->budget_calltype = 0;
cep->budget_callout_req++;
if(cep->budget_calloutncalls_cnt == 0)
{
log(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, (log(LL_DBG, "msg_dialoutnumber: get_cdid() returned 0!")));
@ -922,6 +1012,9 @@ strapp(char *buf, const char *txt)
return buf;
}
/*---------------------------------------------------------------------------*
* handle incoming MSG_PACKET_IND message
*---------------------------------------------------------------------------*/
static char *
ipapp(char *buf, unsigned long a )
{
@ -935,6 +1028,9 @@ ipapp(char *buf, unsigned long a )
return buf;
}
/*---------------------------------------------------------------------------*
* handle incoming MSG_PACKET_IND message
*---------------------------------------------------------------------------*/
void
msg_packet_ind(msg_packet_ind_t *mp)
{
@ -1093,7 +1189,7 @@ sendm_connect_req(cfg_entry_t *cep)
* send message "connect response" to kernel
*---------------------------------------------------------------------------*/
int
sendm_connect_resp(cfg_entry_t *cep, int cdid, int response, int cause)
sendm_connect_resp(cfg_entry_t *cep, int cdid, int response, cause_t cause)
{
msg_connect_resp_t mcr;
int ret;
@ -1105,6 +1201,7 @@ sendm_connect_resp(cfg_entry_t *cep, int cdid, int response, int cause)
if(response == SETUP_RESP_REJECT)
{
mcr.cause = cause;
DBGL(DL_DRVR, (log(LL_DBG, "sendm_connect_resp: reject, cause=0x%x", cause)));
}
else if(response == SETUP_RESP_ACCEPT)
{
@ -1118,6 +1215,8 @@ sendm_connect_resp(cfg_entry_t *cep, int cdid, int response, int cause)
mcr.driver_unit = cep->usrdeviceunit;
mcr.max_idle_time = cep->idle_time_in;
DBGL(DL_DRVR, (log(LL_DBG, "sendm_connect_resp: accept")));
}
if((ret = ioctl(isdnfd, I4B_CONNECT_RESP, &mcr)) < 0)
@ -1125,9 +1224,6 @@ sendm_connect_resp(cfg_entry_t *cep, int cdid, int response, int cause)
log(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));
}
DBGL(DL_DRVR, (log(LL_DBG, "sendm_connect_resp: sent CONNECT_RESP")));
return(ret);
}
@ -1135,7 +1231,7 @@ sendm_connect_resp(cfg_entry_t *cep, int cdid, int response, int cause)
* send message "disconnect request" to kernel
*---------------------------------------------------------------------------*/
int
sendm_disconnect_req(cfg_entry_t *cep, int cause)
sendm_disconnect_req(cfg_entry_t *cep, cause_t cause)
{
msg_discon_req_t mcr;
int ret = 0;

View File

@ -27,11 +27,11 @@
* i4b daemon - location of files
* ------------------------------
*
* $Id: pathnames.h,v 1.10 1999/12/13 21:25:25 hm Exp $
* $Id: pathnames.h,v 1.11 2000/10/09 11:17:07 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:48:01 1999]
* last edit-date: [Mon Oct 2 22:55:28 2000]
*
*---------------------------------------------------------------------------*/
@ -41,17 +41,18 @@
#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"
#ifdef __bsdi__
#define ACCT_FILE_DEF "/var/log/isdnd.acct"
#else
#define ACCT_FILE_DEF "/var/account/isdnd.acct"
#endif
#define PIDFILE "/var/run/isdnd.pid"

View File

@ -27,7 +27,7 @@
* printing cause values
* ---------------------
*
* $Id: pcause.c,v 1.12 1999/12/13 21:25:25 hm Exp $
* $Id: pcause.c,v 1.13 2000/10/09 12:53:29 hm Exp $
*
* $FreeBSD$
*

View File

@ -35,7 +35,7 @@
* i4b daemon - charging rates description file handling
* -----------------------------------------------------
*
* $Id: rates.c,v 1.10 1999/12/13 21:25:25 hm Exp $
* $Id: rates.c,v 1.11 2000/10/09 12:53:29 hm Exp $
*
* $FreeBSD$
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* i4b daemon - config file processing
* -----------------------------------
*
* $Id: rc_config.c,v 1.49 1999/12/13 21:25:25 hm Exp $
* $Id: rc_config.c,v 1.60 2000/10/09 11:17:07 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:48:38 1999]
* last edit-date: [Fri Oct 6 10:08:09 2000]
*
*---------------------------------------------------------------------------*/
@ -40,6 +40,21 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/callout.h>
#include <sys/ioctl.h>
#include <net/if.h>
#ifdef __NetBSD__
#include <net/if_sppp.h>
#else
#if __FreeBSD__ == 3
#include <sys/param.h>
#include <sys/mbuf.h>
#endif
#include <net/if_var.h>
#include <machine/i4b_isppp.h>
#endif
#include "isdnd.h"
#include "y.tab.h"
@ -56,6 +71,7 @@ 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;
@ -202,6 +218,12 @@ set_config_defaults(void)
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;
@ -223,6 +245,113 @@ cfg_set_controller_default()
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) {
log(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) {
log(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.myauth.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.myauth.proto = cep->ppp_expect_auth == AUTH_PAP ? PPP_PAP : PPP_CHAP;
strncpy(spr.defs.myauth.name, cep->ppp_expect_name, AUTHNAMELEN);
strncpy(spr.defs.myauth.secret, cep->ppp_expect_password, AUTHKEYLEN);
}
}
if (cep->ppp_send_auth != AUTH_UNDEF)
{
if(cep->ppp_send_auth == AUTH_NONE)
{
spr.defs.hisauth.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.hisauth.proto = cep->ppp_send_auth == AUTH_PAP ? PPP_PAP : PPP_CHAP;
strncpy(spr.defs.hisauth.name, cep->ppp_send_name, AUTHNAMELEN);
strncpy(spr.defs.hisauth.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) {
log(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
*---------------------------------------------------------------------------*/
@ -297,6 +426,128 @@ cfg_setval(int keyword)
DBGL(DL_RCCF, (log(LL_DBG, "system: beepconnect = %d", yylval.booln)));
break;
case BUDGETCALLBACKPERIOD:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-callbackperiod = %d", entrycount, yylval.num)));
cfg_entry_tab[entrycount].budget_callbackperiod = yylval.num;
break;
case BUDGETCALLBACKNCALLS:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-callbackncalls = %d", entrycount, yylval.num)));
cfg_entry_tab[entrycount].budget_callbackncalls = yylval.num;
break;
case BUDGETCALLOUTPERIOD:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-calloutperiod = %d", entrycount, yylval.num)));
cfg_entry_tab[entrycount].budget_calloutperiod = yylval.num;
break;
case BUDGETCALLOUTNCALLS:
DBGL(DL_RCCF, (log(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, (log(LL_DBG, "entry %d: budget-callbacksfile-rotate = %d", entrycount, yylval.booln)));
break;
case BUDGETCALLBACKSFILE:
{
FILE *fp;
int s, l;
int n;
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: budget-callbacksfile = %s", 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, (log(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, (log(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)
{
log(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, (log(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, (log(LL_DBG, "entry %d: budget-calloutsfile-rotate = %d", entrycount, yylval.booln)));
break;
case BUDGETCALLOUTSFILE:
{
FILE *fp;
int s, l;
int n;
DBGL(DL_RCCF, (log(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, (log(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, (log(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)
{
log(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, (log(LL_DBG, "entry %d: using calloutsfile %s", entrycount, yylval.str)));
}
fclose(fp);
}
}
break;
case CALLBACKWAIT:
if(yylval.num < CALLBACKWAIT_MIN)
{
@ -403,6 +654,16 @@ cfg_setval(int keyword)
cfg_entry_tab[entrycount].earlyhangup = yylval.num;
break;
case EXTCALLATTR:
DBGL(DL_RCCF, (log(LL_DBG, "system: extcallattr = %d", yylval.booln)));
extcallattr = yylval.booln;
break;
case HOLIDAYFILE:
strcpy(holidayfile, yylval.str);
DBGL(DL_RCCF, (log(LL_DBG, "system: holidayfile = %s", yylval.str)));
break;
case IDLE_ALG_OUT:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: idle-algorithm-outgoing = %s", entrycount, yylval.str)));
@ -517,6 +778,82 @@ cfg_setval(int keyword)
strcpy(cfg_entry_tab[entrycount].name, yylval.str);
break;
case PPP_AUTH_RECHALLENGE:
DBGL(DL_RCCF, (log(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, (log(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, (log(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
{
log(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, (log(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, (log(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, (log(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
{
log(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, (log(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, (log(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 PROTOCOL:
DBGL(DL_RCCF, (log(LL_DBG, "controller %d: protocol = %s", controllercount, yylval.str)));
if(!(strcmp(yylval.str, "dss1")))
@ -743,6 +1080,8 @@ cfg_setval(int keyword)
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
{
log(LL_ERR, "ERROR parsing config file: unknown parameter for keyword \"usrdevicename\" at line %d!", lineno);
@ -765,6 +1104,11 @@ cfg_setval(int keyword)
cfg_entry_tab[entrycount].usedown = yylval.booln;
break;
case VALID:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: valid = %s", entrycount, yylval.str)));
parse_valid(entrycount, yylval.str);
break;
default:
log(LL_ERR, "ERROR parsing config file: unknown keyword at line %d!", lineno);
config_error_flag++;
@ -772,6 +1116,87 @@ cfg_setval(int keyword)
}
}
/*---------------------------------------------------------------------------*
* 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)
{
log(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)
{
log(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 */
log(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
*---------------------------------------------------------------------------*/
@ -806,8 +1231,7 @@ check_config(void)
if((cep->isdncontroller < 0) || (cep->isdncontroller > (ncontroller-1)))
{
log(LL_ERR, "check_config: isdncontroller out of range in entry %d!", i);
error++;
log(LL_ERR, "check_config: WARNING, isdncontroller out of range in entry %d!", i);
}
/* numbers used for dialout */
@ -847,6 +1271,33 @@ check_config(void)
log(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)
{
log(LL_ERR, "check_config: no remote authentification name in entry %d!", i);
error++;
}
if(cep->ppp_send_password[0] == 0)
{
log(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)
{
log(LL_ERR, "check_config: no local authentification name in entry %d!", i);
error++;
}
if(cep->ppp_expect_password[0] == 0)
{
log(LL_ERR, "check_config: no local authentification secret in entry %d!", i);
error++;
}
}
}
if(error)
{
@ -1165,6 +1616,64 @@ print_config(void)
}
}
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;

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -30,11 +30,11 @@
* i4b daemon - runtime configuration parser
* -----------------------------------------
*
* $Id: rc_parse.y,v 1.24 1999/12/13 21:25:25 hm Exp $
* $Id: rc_parse.y,v 1.30 2000/10/09 11:17:07 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:48:48 1999]
* last edit-date: [Mon Oct 2 22:51:23 2000]
*
*---------------------------------------------------------------------------*/
@ -81,6 +81,14 @@ int controllercount = -1;
%token ANSWERPROG
%token B1PROTOCOL
%token BEEPCONNECT
%token BUDGETCALLOUTPERIOD
%token BUDGETCALLOUTNCALLS
%token BUDGETCALLOUTSFILE
%token BUDGETCALLOUTSFILEROTATE
%token BUDGETCALLBACKPERIOD
%token BUDGETCALLBACKNCALLS
%token BUDGETCALLBACKSFILE
%token BUDGETCALLBACKSFILEROTATE
%token CALLBACKWAIT
%token CALLEDBACKWAIT
%token CALLIN
@ -97,7 +105,9 @@ int controllercount = -1;
%token DOWNTRIES
%token EARLYHANGUP
%token ENTRY
%token EXTCALLATTR
%token FULLCMD
%token HOLIDAYFILE
%token IDLETIME_IN
%token IDLETIME_OUT
%token IDLE_ALG_OUT
@ -119,6 +129,14 @@ int controllercount = -1;
%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 PROTOCOL
%token RATESFILE
%token RATETYPE
@ -140,6 +158,7 @@ int controllercount = -1;
%token USEDOWN
%token USRDEVICENAME
%token USRDEVICEUNIT
%token VALID
%token YES
@ -150,7 +169,7 @@ int controllercount = -1;
%type <booln> boolean
%type <num> sysfilekeyword sysnumkeyword sysstrkeyword sysboolkeyword
%type <num> numkeyword strkeyword boolkeyword monrights monright
%type <num> filekeyword numkeyword strkeyword boolkeyword monrights monright
%type <num> cstrkeyword
%type <str> filename
@ -316,6 +335,7 @@ boolean: NO { $$ = FALSE; }
sysfilekeyword: RATESFILE { $$ = RATESFILE; }
| ACCTFILE { $$ = ACCTFILE; }
| ALIASFNAME { $$ = ALIASFNAME; }
| HOLIDAYFILE { $$ = HOLIDAYFILE; }
| TINAINITPROG { $$ = TINAINITPROG; }
;
@ -323,6 +343,7 @@ sysboolkeyword: USEACCTFILE { $$ = USEACCTFILE; }
| ALIASING { $$ = ALIASING; }
| ACCTALL { $$ = ACCTALL; }
| BEEPCONNECT { $$ = BEEPCONNECT; }
| EXTCALLATTR { $$ = EXTCALLATTR; }
| ISDNTIME { $$ = ISDNTIME; }
| MONITORSW { $$ = MONITORSW; }
;
@ -354,13 +375,21 @@ entries: entry
| entries entry
;
entry: strentry
entry: fileentry
| strentry
| numentry
| boolentry
| nullentry
| error '\n'
;
fileentry: filekeyword '=' filename '\n'
{
cfg_setval($1);
}
;
strentry: strkeyword '=' STRING '\n'
{
cfg_setval($1);
@ -385,6 +414,10 @@ numentry: numkeyword '=' NUMBERSTR '\n'
}
;
filekeyword: BUDGETCALLBACKSFILE { $$ = BUDGETCALLBACKSFILE; }
| BUDGETCALLOUTSFILE { $$ = BUDGETCALLOUTSFILE; }
;
strkeyword: ANSWERPROG { $$ = ANSWERPROG; }
| B1PROTOCOL { $$ = B1PROTOCOL; }
| CONNECTPROG { $$ = CONNECTPROG; }
@ -395,15 +428,26 @@ strkeyword: ANSWERPROG { $$ = ANSWERPROG; }
| LOCAL_PHONE_INCOMING { $$ = LOCAL_PHONE_INCOMING; }
| LOCAL_PHONE_DIALOUT { $$ = LOCAL_PHONE_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_PHONE_DIALOUT { $$ = REMOTE_PHONE_DIALOUT; }
| UNITLENGTHSRC { $$ = UNITLENGTHSRC; }
| USRDEVICENAME { $$ = USRDEVICENAME; }
| VALID { $$ = VALID; }
;
numkeyword: ALERT { $$ = ALERT; }
| BUDGETCALLBACKPERIOD { $$ = BUDGETCALLBACKPERIOD; }
| BUDGETCALLBACKNCALLS { $$ = BUDGETCALLBACKNCALLS; }
| BUDGETCALLOUTPERIOD { $$ = BUDGETCALLOUTPERIOD; }
| BUDGETCALLOUTNCALLS { $$ = BUDGETCALLOUTNCALLS; }
| CALLBACKWAIT { $$ = CALLBACKWAIT; }
| CALLEDBACKWAIT { $$ = CALLEDBACKWAIT; }
| DIALRETRIES { $$ = DIALRETRIES; }
@ -422,11 +466,14 @@ numkeyword: ALERT { $$ = ALERT; }
| DOWNTRIES { $$ = DOWNTRIES; }
;
boolkeyword: DIALRANDINCR { $$ = DIALRANDINCR; }
boolkeyword: BUDGETCALLBACKSFILEROTATE { $$ = BUDGETCALLBACKSFILEROTATE; }
| BUDGETCALLOUTSFILEROTATE { $$ = BUDGETCALLOUTSFILEROTATE; }
| DIALRANDINCR { $$ = DIALRANDINCR; }
| PPP_AUTH_RECHALLENGE { $$ = PPP_AUTH_RECHALLENGE; }
| PPP_AUTH_PARANOID { $$ = PPP_AUTH_PARANOID; }
| USEDOWN { $$ = USEDOWN; }
;
/* ================== */
/* controller section */
/* ================== */

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -30,11 +30,11 @@
* i4b daemon - runtime configuration lexical analyzer
* ---------------------------------------------------
*
* $Id: rc_scan.l,v 1.27 1999/12/13 21:25:25 hm Exp $
* $Id: rc_scan.l,v 1.33 2000/10/09 11:17:07 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:48:57 1999]
* last edit-date: [Mon Oct 2 22:49:40 2000]
*
*---------------------------------------------------------------------------*/
@ -95,6 +95,14 @@ aliasfile { return ALIASFNAME; }
answerprog { return ANSWERPROG; }
b1protocol { return B1PROTOCOL; }
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; }
connectprog { return CONNECTPROG; }
@ -109,6 +117,8 @@ downtries { return DOWNTRIES; }
downtime { return DOWNTIME; }
earlyhangup { return EARLYHANGUP; }
entry { return ENTRY; }
extcallattr { return EXTCALLATTR; }
holidayfile { return HOLIDAYFILE; }
idletime-incoming { return IDLETIME_IN; }
idletime-outgoing { return IDLETIME_OUT; }
idle-algorithm-outgoing { return IDLE_ALG_OUT; }
@ -135,6 +145,14 @@ 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_NAME; }
ppp-send-auth { return PPP_SEND_AUTH; }
ppp-send-name { return PPP_SEND_NAME; }
ppp-send-password { return PPP_SEND_PASSWORD; }
protocol { return PROTOCOL; }
ratesfile { return RATESFILE; }
ratetype { return RATETYPE; }
@ -154,6 +172,7 @@ useacctfile { return USEACCTFILE; }
usrdevicename { return USRDEVICENAME; }
usrdeviceunit { return USRDEVICEUNIT; }
usedown { return USEDOWN; }
valid { return VALID; }
yes { return YES; }
\n { lineno++; return '\n'; }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,15 +27,17 @@
* i4b daemon - misc support routines
* ----------------------------------
*
* $Id: support.c,v 1.63 1999/12/13 21:25:25 hm Exp $
* $Id: support.c,v 1.66 2000/10/09 11:17:07 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:49:05 1999]
* last edit-date: [Wed Oct 4 18:24:27 2000]
*
*---------------------------------------------------------------------------*/
#include "isdnd.h"
static int isvalidtime(cfg_entry_t *cep);
/*---------------------------------------------------------------------------*
* find an active entry by driver type and driver unit
@ -56,6 +58,14 @@ find_active_entry_by_driver(int drivertype, int driverunit)
continue;
}
/* check time interval */
if(isvalidtime(cep) == 0)
{
DBGL(DL_MSG, (log(LL_DBG, "find_active_entry_by_driver: entry %d, time not valid!", i)));
continue;
}
/* found */
if(cep->cdid == CDID_UNUSED)
@ -96,6 +106,14 @@ find_by_device_for_dialout(int drivertype, int driverunit)
continue;
}
/* check time interval */
if(isvalidtime(cep) == 0)
{
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialout: entry %d, time not valid!", i)));
continue;
}
/* found, check if already reserved */
if(cep->cdid == CDID_RESERVED)
@ -151,6 +169,14 @@ find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, cha
continue;
}
/* check time interval */
if(isvalidtime(cep) == 0)
{
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, time not valid!", i)));
continue;
}
/* found, check if already reserved */
if(cep->cdid == CDID_RESERVED)
@ -275,6 +301,14 @@ get_cep_by_driver(int drivertype, int driverunit)
continue;
}
/* check time interval */
if(isvalidtime(cep) == 0)
{
DBGL(DL_MSG, (log(LL_DBG, "get_cep_by_driver: entry %d, time not valid!", i)));
continue;
}
DBGL(DL_MSG, (log(LL_DBG, "get_cep_by_driver: found entry %d!", i)));
return(cep);
}
@ -347,35 +381,6 @@ find_matching_entry_incoming(msg_connect_ind_t *mp)
}
if (n >= cep->incoming_numbers_count)
continue;
/* screening indicator XXX */
switch(mp->scr_ind)
{
case SCR_NONE:
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: %s - no screening indicator", mp->src_telno)));
break;
case SCR_USR_NOSC:
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: %s - screening user provided, not screened", mp->src_telno)));
break;
case SCR_USR_PASS:
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: %s - screening user provided, verified & passed", mp->src_telno)));
break;
case SCR_USR_FAIL:
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: %s - screening user provided, verified & failed", mp->src_telno)));
break;
case SCR_NET:
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: %s - screening network provided", mp->src_telno)));
break;
default:
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: ERROR %s - invalid screening indicator!", mp->src_telno)));
break;
}
/* check b protocol */
@ -476,13 +481,21 @@ find_matching_entry_incoming(msg_connect_ind_t *mp)
break;
}
/* check time interval */
if(isvalidtime(cep) == 0)
{
DBGL(DL_MSG, (log(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, mp->src_telno);
@ -589,10 +602,11 @@ bdrivername(int drivertype)
"tel",
"ipr",
"isp",
"ibc"
"ibc",
"ing"
};
if(drivertype >= BDRV_RBCH && drivertype <= BDRV_IBC)
if(drivertype >= BDRV_RBCH && drivertype <= BDRV_ING)
return(bdtab[drivertype]);
else
return("unknown");
@ -849,5 +863,162 @@ dialresponse(cfg_entry_t *cep, int dstat)
DBGL(DL_DRVR, (log(LL_DBG, "dialresponse: sent [%s]", stattab[dstat])));
}
/* EOF */
/*--------------------------------------------------------------------------*
* screening/presentation indicator
*--------------------------------------------------------------------------*/
void
handle_scrprs(int cdid, int scr, int prs, char *caller)
{
/* screening indicator */
if(scr < SCR_NONE || scr > SCR_NET)
{
log(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)
{
log(LL_CHD, "%05d %s %s", cdid, caller, scrtab[scr]);
}
else
{
DBGL(DL_MSG, (log(LL_DBG, "%s - %s", caller, scrtab[scr])));
}
}
/* presentation indicator */
if(prs < PRS_NONE || prs > PRS_RESERVED)
{
log(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)
{
log(LL_CHD, "%05d %s %s", cdid, caller, prstab[prs]);
}
else
{
DBGL(DL_MSG, (log(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_MSG, (log(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_MSG, (log(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_MSG, (log(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_MSG, (log(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_MSG, (log(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_MSG, (log(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_MSG, (log(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_MSG, (log(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);
}
/* EOF */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* i4b daemon - timer/timing support routines
* ------------------------------------------
*
* $Id: timer.c,v 1.19 1999/12/13 21:25:25 hm Exp $
* $Id: timer.c,v 1.21 2000/05/03 09:32:38 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:49:13 1999]
* last edit-date: [Tue May 2 15:58:31 2000]
*
*---------------------------------------------------------------------------*/
@ -142,6 +142,28 @@ handle_recovery(void)
{
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, (log(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, (log(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 */

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
.\" 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
@ -22,13 +22,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: isdndebug.8,v 1.10 1999/12/13 22:11:55 hm Exp $
.\" $Id: isdndebug.8,v 1.11 2000/05/31 08:15:29 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Dec 13 23:01:42 1999]
.\" last edit-date: [Wed May 31 10:15:07 2000]
.\"
.Dd May, 29, 1999
.Dd May, 31, 2000
.Dt ISDNDEBUG 8
.Os
.Sh NAME
@ -36,9 +36,9 @@
.Nd display and control isdn4bsd kernel variables and statistics
.Sh SYNOPSIS
.Nm
.Op Fl c
.Op Fl e
.Op Fl g
.Op Fl h
.Op Fl l Ar layer
.Op Fl m
.Op Fl q
@ -46,7 +46,7 @@
.Op Fl s Ar value
.Op Fl u Ar unit
.Op Fl z
.Op Fl H
.Op Fl C
.Op Fl Q
.Sh DESCRIPTION
.Nm isdndebug
@ -57,23 +57,20 @@ manipulated using this utility.
.Pp
A second usage of
.Nm
is to display and reset the HSCX (the HSCX is the chip responsible for
the B-channel handling in the
.Xr isic 4
driver) error counters and and to display and reset the D-channel layer 2
is to display and reset chipset specific statistics and/or error counters
and 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 h
Display the HSCX error counters.
.It Fl l
Specify the layer for which a command applies.
Default is all layers.
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).
@ -83,16 +80,15 @@ Display the Q.921 (D-channel layer 2) frame receive/transmit statistics.
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
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 -h, -q, -H and -Q flags.
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 HSCX error counters to zero.
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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* main.c - i4b set debug options
* ------------------------------
*
* $Id: main.c,v 1.23 1999/12/13 21:25:25 hm Exp $
* $Id: main.c,v 1.27 2000/07/24 12:22:08 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:49:40 1999]
* last edit-date: [Mon Jul 24 14:25:33 2000]
*
*---------------------------------------------------------------------------*/
@ -73,10 +73,9 @@ int opt_max = 0;
int opt_err = 0;
int opt_zero = 0;
int opt_unit = 0;
int opt_hscx = 0;
int opt_rhscx = 0;
int opt_lapd = 0;
int opt_rlapd = 0;
int opt_chipstat = 0;
/*---------------------------------------------------------------------------*
* usage display and exit
@ -86,18 +85,18 @@ usage(void)
{
fprintf(stderr, "\n");
fprintf(stderr, "isdndebug - i4b set debug level, version %d.%d.%d, compiled %s %s\n", VERSION, REL, STEP, __DATE__, __TIME__);
fprintf(stderr, "usage: isdndebug -e -g -h -l <layer> -m -q -r -s <value> -u <unit> -z -H -Q\n");
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, " -h get HSCX event counters\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 -h, -q, -H and -Q commands\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, " -H reset HSCX event counters to zero\n");
fprintf(stderr, " -C reset chipset statistics\n");
fprintf(stderr, " -Q reset Q.921 statistics\n");
fprintf(stderr, "\n");
exit(1);
@ -113,10 +112,14 @@ main(int argc, char **argv)
ctl_debug_t cdbg;
int ret;
while ((c = getopt(argc, argv, "eghl:mqrs:u:zHQ")) != -1)
while ((c = getopt(argc, argv, "ceghl:mqrs:u:zCHQ")) != -1)
{
switch(c)
{
case 'c':
opt_chipstat = 1;
break;
case 'e':
opt_err = 1;
break;
@ -125,10 +128,6 @@ main(int argc, char **argv)
opt_get = 1;
break;
case 'h':
opt_hscx = 1;
break;
case 'q':
opt_lapd = 1;
break;
@ -163,10 +162,6 @@ main(int argc, char **argv)
opt_zero = 1;
break;
case 'H':
opt_rhscx = 1;
break;
case 'Q':
opt_rlapd = 1;
break;
@ -179,14 +174,14 @@ main(int argc, char **argv)
}
if(opt_get == 0 && opt_set == 0 && opt_reset == 0 && opt_max == 0 &&
opt_err == 0 && opt_zero == 0 && opt_hscx == 0 && opt_rhscx == 0 &&
opt_lapd == 0 && opt_rlapd == 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_hscx + opt_rhscx + opt_lapd + opt_rlapd) > 1)
opt_lapd + opt_rlapd + opt_chipstat) > 1)
{
usage();
}
@ -197,69 +192,80 @@ main(int argc, char **argv)
exit(1);
}
if(opt_hscx)
if(opt_chipstat)
{
hscxstat_t hst;
hst.unit = opt_unit;
hst.chan = 0;
struct chipstat cst;
u_char *name;
if((ret = ioctl(isdnfd, I4B_CTL_GET_HSCXSTAT, &hst)) < 0)
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_HSCXSTAT failed: %s", strerror(errno));
fprintf(stderr, "ioctl I4B_CTL_GET_CHIPSTAT failed: %s", strerror(errno));
exit(1);
}
printf("\nHSCX events: VFR RDO CRC RAB XDU RFO\n");
printf("unit %d chan %d: %6d %6d %6d %6d %6d %6d\n",
hst.unit, hst.chan,
hst.vfr, hst.rdo, hst.crc, hst.rab, hst.xdu, hst.rfo);
hst.unit = opt_unit;
hst.chan = 1;
if((ret = ioctl(isdnfd, I4B_CTL_GET_HSCXSTAT, &hst)) < 0)
switch(cst.driver_type)
{
fprintf(stderr, "ioctl I4B_CTL_GET_HSCXSTAT failed: %s", strerror(errno));
exit(1);
}
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",
hst.unit, hst.chan,
hst.vfr, hst.rdo, hst.crc, hst.rab, hst.xdu, hst.rfo);
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);
exit(0);
}
if(opt_rhscx)
{
hscxstat_t hst;
hst.unit = opt_unit;
hst.chan = 0;
cst.driver_unit = opt_unit;
cst.driver_bchannel = 1;
if((ret = ioctl(isdnfd, I4B_CTL_CLR_HSCXSTAT, &hst)) < 0)
{
fprintf(stderr, "ioctl I4B_CTL_CLR_HSCXSTAT failed: %s", strerror(errno));
exit(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;
}
printf("HSCX event counters unit %d chan %d reset to zero!\n",
hst.unit, hst.chan);
hst.unit = opt_unit;
hst.chan = 1;
if((ret = ioctl(isdnfd, I4B_CTL_CLR_HSCXSTAT, &hst)) < 0)
{
fprintf(stderr, "ioctl I4B_CTL_CLR_HSCXSTAT failed: %s", strerror(errno));
exit(1);
}
printf("HSCX event counters unit %d chan %d reset to zero!\n",
hst.unit, hst.chan);
exit(0);
}
@ -536,22 +542,24 @@ 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(" ++++-++++-++++-++++-++------------------ unassigned\n");
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(" ++++-++++-++++-++++--------------------- unassigned\n");
}
/*---------------------------------------------------------------------------*
@ -598,7 +606,7 @@ printl3(unsigned long val)
printf(" ||+----------- facility messages\n");
printf(" |+------------ facility error messages\n");
printf(" +------------- Q.931 messages exchanged\n");
printf(" ++++-++++-++++-++++-++++-++------------- unassigned\n");
printf(" ++++-++++-++++-++++-++++-+-------------- unassigned\n");
}
/*---------------------------------------------------------------------------*
@ -608,20 +616,20 @@ 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(" ||+----------- tina driver debug messages\n");
printf(" |+------------ tina driver messages\n");
printf(" +------------- tina driver error messages\n");
printf(" ++++-++++-++++-++++-++++-+-------------- unassigned\n");
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(" |||+----------- tina driver debug messages\n");
printf(" ||+------------ tina driver messages\n");
printf(" |+------------- tina driver error messages\n");
printf(" +-------------- ing driver debug messages\n");
printf(" ++++-++++-++++-++++-++++---------------- unassigned\n");
}
/* EOF */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,31 @@
* facility.c - decode Q.932 facilities
* ------------------------------------
*
* $Id: facility.c,v 1.4 1999/12/13 21:25:25 hm Exp $
* $Id: facility.c,v 1.5 2000/02/21 15:17:17 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:49:56 1999]
* 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 !)
*
*---------------------------------------------------------------------------*/
@ -623,6 +643,179 @@ F_1_4(char *pbuf, int val)
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;
}
}
@ -868,6 +1061,16 @@ static struct statetab {
{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 }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -24,14 +24,34 @@
*
*---------------------------------------------------------------------------
*
* facility.h - Q.932 facility header file
* ---------------------------------------
* facility.h - facility header file
* ---------------------------------
*
* $Id: facility.h,v 1.4 1999/12/13 21:25:25 hm Exp $
* $Id: facility.h,v 1.5 2000/02/21 15:17:17 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:50:06 1999]
* 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 !)
*
*---------------------------------------------------------------------------*/
@ -148,6 +168,10 @@ enum states {
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
};

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1998, 1999 Hellmuth Michaelis. All rights reserved.
.\" 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
@ -22,13 +22,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: isdndecode.8,v 1.7 1999/12/13 22:11:55 hm Exp $
.\" $Id: isdndecode.8,v 1.9 2000/02/21 15:17:17 hm Exp $
.\"
.\" last edit-date: [Mon Dec 13 23:03:21 1999]
.\" last edit-date: [Mon Feb 21 16:15:09 2000]
.\"
.\" $FreeBSD$
.\"
.Dd September 17, 1998
.Dd February 21, 2000
.Dt ISDNDECODE 8
.Os
.Sh NAME
@ -46,6 +46,7 @@
.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
@ -66,81 +67,65 @@ 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
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
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
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
@ -152,14 +137,12 @@ ISDN D-channel layer 2 protocol description.
ISDN D-channel layer 3 protocol description.
.El
.Pp
.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
@ -169,13 +152,10 @@ isdndecode -f /var/tmp/isdn.decode
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 BUGS
Still one left.
.Sh STANDARDS
ITU Recommendations I.430, Q.920, Q.921, Q.930, Q.931
.Pp
@ -186,7 +166,6 @@ ETSI Recommendation ETS 300 179 (10/92), ETS 300 180 (10/92)
ETSI Recommendation ETS 300 181 (04/93), ETS 300 182 (04/93)
.Pp
ITU Recommendation X.208, X.209
.Sh AUTHOR
The
.Nm

View File

@ -27,11 +27,11 @@
* layer3.c - decode and print layer 3 (Q.931) information
* -------------------------------------------------------
*
* $Id: layer3.c,v 1.7 1999/12/13 21:25:25 hm Exp $
* $Id: layer3.c,v 1.9 2000/02/21 15:17:17 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:50:48 1999]
* last edit-date: [Mon Feb 21 15:54:58 2000]
*
*---------------------------------------------------------------------------*/
@ -206,6 +206,7 @@ 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 */
@ -263,7 +264,7 @@ struct ie {
{ 0x79, "restart indicator", f_null },
{ 0x7c, "low layer compatibility", f_null },
{ 0x7d, "high layer compatibility", f_hlc },
{ 0x7e, "user-user", f_null },
{ 0x7e, "user-user", f_uu },
{ 0x7f, "escape for extension", f_null },
{ 0xff, "unknown information element", f_null }
};
@ -310,6 +311,13 @@ layer3(char *pbuf, int n, int off, unsigned char *buf)
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 */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* layer3_subr.c - subroutines for IE decoding
* -------------------------------------------
*
* $Id: layer3_subr.c,v 1.6 1999/12/13 21:25:25 hm Exp $
* $Id: layer3_subr.c,v 1.8 2000/02/21 15:17:17 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:51:00 1999]
* last edit-date: [Mon Feb 21 15:45:16 2000]
*
*---------------------------------------------------------------------------*/
@ -609,155 +609,157 @@ f_bc(char *pbuf, unsigned char *buf, int off)
if(!len)
goto exit;
sprintf((pbuf+strlen(pbuf)), "\n layer1=");
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);
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--;
i++;
len--;
if(!len)
goto exit;
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;
{
sprintf((pbuf+strlen(pbuf)), "\n user rate=0x%02x ", buf[i] & 0x1f);
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] & 0x40)
sprintf((pbuf+strlen(pbuf)), "(async,");
else
sprintf((pbuf+strlen(pbuf)), "(sync,");
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(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;
switch(buf[i] & 0x7f)
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 0x42:
sprintf((pbuf+strlen(pbuf)), "\n layer2=Q.921/I.441");
case 0:
sprintf((pbuf+strlen(pbuf)), "not used");
break;
case 0x46:
sprintf((pbuf+strlen(pbuf)), "\n layer2=X.25 link");
case 1:
sprintf((pbuf+strlen(pbuf)), "8 kbit/s");
break;
default:
sprintf((pbuf+strlen(pbuf)), "\n layer2=0x%02x",(buf[i] & 0x7f));
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--;
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:
@ -1043,5 +1045,78 @@ f_hlc(char *pbuf, unsigned char *buf, int off)
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 */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* main.c - isdndecode main program file
* -------------------------------------
*
* $Id: main.c,v 1.12 1999/12/13 21:25:25 hm Exp $
* $Id: main.c,v 1.13 2000/02/21 15:17:17 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:51:07 1999]
* last edit-date: [Mon Feb 21 16:19:30 2000]
*
*---------------------------------------------------------------------------*/
@ -55,7 +55,10 @@ 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];
@ -65,6 +68,36 @@ 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
*---------------------------------------------------------------------------*/
@ -81,7 +114,6 @@ main(int argc, char *argv[])
int c;
char *b;
int enable_trace = TRACE_D_RX | TRACE_D_TX;
char *outfile = DECODE_FILE_NAME;
char *binfile = BIN_FILE_NAME;
int outfileset = 0;
@ -92,7 +124,7 @@ main(int argc, char *argv[])
b = &buf[sizeof(i4b_trace_hdr_t)];
while( (c = getopt(argc, argv, "abdf:hiln:op:u:BPR:T:")) != -1)
while( (c = getopt(argc, argv, "abdf:hiln:op:u:xBPR:T:")) != -1)
{
switch(c)
{
@ -116,7 +148,7 @@ main(int argc, char *argv[])
outfile = optarg;
outfileset = 1;
break;
case 'h':
header = 0;
break;
@ -134,21 +166,25 @@ main(int argc, char *argv[])
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)
@ -173,7 +209,7 @@ main(int argc, char *argv[])
if(Bopt && Popt)
usage();
atexit(exit_hdl);
if(Bopt)
@ -182,14 +218,14 @@ main(int argc, char *argv[])
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];
@ -198,7 +234,7 @@ main(int argc, char *argv[])
perror(buffer);
exit(1);
}
if((setvbuf(BP, (char *)NULL, _IONBF, 0)) != 0)
{
char buffer[80];
@ -207,7 +243,7 @@ main(int argc, char *argv[])
perror(buffer);
exit(1);
}
}
}
if(Popt)
{
@ -215,7 +251,7 @@ main(int argc, char *argv[])
sprintf(BPfilename, "%s", binfile);
else
sprintf(BPfilename, "%s%d", BIN_FILE_NAME, unit);
if((BP = fopen(BPfilename, "r")) == NULL)
{
char buffer[80];
@ -226,27 +262,27 @@ main(int argc, char *argv[])
}
}
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];
@ -254,7 +290,7 @@ main(int argc, char *argv[])
sprintf(buffer, "%s%s", outfilename, DECODE_FILE_NAME_BAK);
rename(outfilename, buffer);
}
if((Fout = fopen(outfilename, "w")) == NULL)
{
char buffer[80];
@ -263,7 +299,7 @@ main(int argc, char *argv[])
perror(buffer);
exit(1);
}
if((setvbuf(Fout, (char *)NULL, _IONBF, 0)) != 0)
{
char buffer[80];
@ -290,12 +326,12 @@ main(int argc, char *argv[])
else
traceon = 1;
}
signal(SIGHUP, SIG_IGN); /* ignore hangup signal */
signal(SIGUSR1, reopenfiles); /* rotate logfile(s) */
signal(SIGUSR1, reopenfiles); /* rotate logfile(s) */
time(&tm);
if(analyze)
{
sprintf(headerbuf, "\n==== isdnanalyze controller rx #%d - tx #%d ==== started %s",
@ -306,9 +342,9 @@ main(int argc, char *argv[])
sprintf(headerbuf, "\n=========== isdntrace controller #%d =========== started %s",
unit, ctime(&tm));
}
printf("%s", headerbuf);
if(outflag)
fprintf(Fout, "%s", headerbuf);
@ -329,10 +365,10 @@ main(int argc, char *argv[])
}
}
n -= sizeof(i4b_trace_hdr_t);
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))
@ -351,7 +387,7 @@ main(int argc, char *argv[])
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];
@ -425,13 +461,13 @@ fmt_hdr(i4b_trace_hdr_t *hdr, int frm_len)
frm_len);
}
}
for(i=strlen(hbuf); i <= NCOLS;)
hbuf[i++] = '-';
hbuf[i++] = '\n';
hbuf[i] = '\0';
return(hbuf);
}
@ -456,17 +492,29 @@ dumpbuf(int n, unsigned char *buf, i4b_trace_hdr_t *hdr)
switch(hdr->type)
{
case TRC_CH_I: /* Layer 1 INFO's */
layer1(l1buf, buf);
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 */
@ -745,32 +793,4 @@ sprintline(int layer, char *buffer, int oct_count, int oct_val,
}
}
/*---------------------------------------------------------------------------*
* 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," -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," -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);
}
/* EOF */

View File

@ -52,20 +52,17 @@ devices supported by the isdn4bsd package.
The options are as follows:
.Bl -tag -width Ds
.It Fl c
Switch to (curses-) fullscreen mode of operation.
In this mode,
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
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
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
@ -75,8 +72,7 @@ While the command window is active,
.Em Tab
or
.Em Space
advances to the next menu item.
To execute a command, press
advances to the next menu item. To execute a command, press
.Em Return
or
.Em Enter

View File

@ -33,7 +33,7 @@
* i4b daemon - network monitor client
* -----------------------------------
*
* $Id: main.c,v 1.34 1999/12/13 21:25:26 hm Exp $
* $Id: main.c,v 1.35 2000/08/24 11:48:57 hm Exp $
*
* $FreeBSD$
*
@ -527,7 +527,7 @@ print_logevent(time_t tstamp, int prio, char * what, char * msg)
COLS-((strlen(buf))+(strlen(what))+3), msg);
#else
wprintw(lower_w, "%s %s %-.*s\n", buf, what,
COLS-((strlen(buf))+(strlen(what))+2), msg);
(int)(COLS-((strlen(buf))+(strlen(what))+2)), msg);
#endif
wrefresh(lower_w);
}

View File

@ -0,0 +1,10 @@
# $FreeBSD$
PROG = isdnphone
SRCS = main.c display.c audio.c isdn.c
MAN8 = isdnphone.8
DPADD = ${LIBCURSES}
LDADD = -lcurses
.include <bsd.prog.mk>

View File

@ -0,0 +1,159 @@
/*
* 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 */

View File

@ -0,0 +1,189 @@
/*
* 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/types.h>
#include <sys/time.h>
#include <sys/param.h>
#include <machine/i4b_ioctl.h>
#include <machine/i4b_tel_ioctl.h>
#include <machine/soundcard.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 */

View File

@ -0,0 +1,246 @@
/*
* 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 */

View File

@ -0,0 +1,191 @@
/*
* 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 */

View File

@ -0,0 +1,74 @@
.\"
.\" 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: isdnphone.8,v 1.4 1999/12/13 22:11:55 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Dec 13 23:05:19 1999]
.\"
.\"
.Dd March 24, 1999
.Dt ISDNPHONE 8
.Os
.Sh NAME
.Nm isdnphone
.Nd telephone dialing and more for isdn4bsd
.Sh SYNOPSIS
.Nm
.Op Fl h
.Op Fl n Ar number
.Op Fl u Ar unit
.Sh DESCRIPTION
.Nm isdnphone
is part of the isdn4bsd package and is used to handle dialing and hangup
for the telephone control interfaces /dev/i4bteld<n>.
.Pp
Options are provided to dial out or hang up using commandline parameters
(for use in scripts) or, if none of those options are specified, bring up
a curses-based fullscreen interface.
.Pp
The following options are available:
.Bl -tag -width Ds
.It Fl h
hang up a possibly open telefone connection on the selected interface.
.It Fl n
dial the specified number on the selected interface.
.It Fl u
Set the unit number to specify the interface used.
.Pp
.Sh FILES
/dev/i4bteld<n>
.Sh EXAMPLES
The command:
.Bd -literal -offset indent
isdnphone -n 1234
.Ed
.Pp
dials calls the number 1234 to establish a call on /dev/i4btel0
.Sh AUTHOR
The
.Nm
utility and this manpage were written by
.An Hellmuth Michaelis Aq hm@kts.org .

View File

@ -0,0 +1,451 @@
/*
* 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 - main module
* =======================
*
* $Id: main.c,v 1.12 1999/12/13 21:25:26 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:53:25 1999]
*
*---------------------------------------------------------------------------*/
#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, compiled %s %s\n",VERSION, REL, STEP, __DATE__, __TIME__);
fprintf(stderr, "usage: isdnphone -d -h -n <number> -u <unit>\n");
fprintf(stderr, " -d debug\n");
fprintf(stderr, " -h hangup\n");
fprintf(stderr, " -n number dial number\n");
fprintf(stderr, " -u unit set unit number\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_h = 0;
char *number = "";
numberbuffer[0] = '\0';
while ((c = getopt(argc, argv, "dhn:u:")) != -1)
{
switch(c)
{
case 'd':
opt_d = 1;
break;
case 'h':
opt_h = 1;
break;
case 'n':
number = optarg;
opt_n = 1;
break;
case 'u':
opt_unit = atoi(optarg);
if(opt_unit < 0 || opt_unit > 9)
usage();
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)
{
char commandbuffer[80];
/* commandline operation goes here */
if(opt_n)
{
sprintf(commandbuffer, "D%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);
}
close(dialerfd);
exit(0);
}
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 */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* isdntel - isdn4bsd telephone answering machine support
* ======================================================
*
* $Id: display.c,v 1.7 1999/12/13 21:25:26 hm Exp $
* $Id: display.c,v 1.9 2000/07/19 08:56:24 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:53:57 1999]
* last edit-date: [Wed Jul 19 10:08:06 2000]
*
*----------------------------------------------------------------------------*/
@ -49,8 +49,10 @@ init_screen(void)
initscr(); /* curses init */
curses_ready = 1;
if((COLS < 80) || (LINES < 24))
fatal(0, "ERROR, minimal screensize must be 80x24, is %dx%d, terminating!", COLS, LINES);
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)
@ -88,8 +90,6 @@ init_screen(void)
refresh();
wrefresh(main_w);
curses_ready = 1;
}
/*---------------------------------------------------------------------------*

View File

@ -50,14 +50,11 @@ The following options are supported:
.It Fl a
Use
.Ar aliasfile
as the pathname for an aliasfile containing aliases for phone numbers.
The
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
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
@ -74,11 +71,9 @@ The format of a voice message filename is:
Use
.Ar playcommand
as the command string to execute for playing a voice message to some audio
output facility.
The characters
output facility. The characters
.Em %s
are replaced by the currently selected filename.
The default string is
are replaced by the currently selected filename. The default string is
.Em cat %s | alaw2ulaw >/dev/audio
.It Fl t
The value for
@ -87,8 +82,7 @@ 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.
The screen output should be obvious. If in doubt, consult the source.
.Sh SEE ALSO
.Xr isdnd 8
.Xr isdnd.rc 5

View File

@ -54,8 +54,7 @@ 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
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.

View File

@ -27,11 +27,11 @@
* main.c - i4b selftest utility
* -----------------------------
*
* $Id: main.c,v 1.15 1999/12/13 21:25:26 hm Exp $
* $Id: main.c,v 1.16 2000/03/13 16:18:38 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:55:19 1999]
* last edit-date: [Mon Mar 13 17:19:26 2000]
*
*---------------------------------------------------------------------------*/
@ -459,6 +459,7 @@ handle_connect_active_ind(unsigned char *ptr)
fprintf(stderr, "\n");
}
cleanup();
exit(0);
}
}
}
@ -548,7 +549,8 @@ void cleanup(void)
while((out_cdid != CDID_UNUSED) || (in_cdid != CDID_UNUSED))
{
fprintf(stderr, "isdntest: cleanup, out_cdid %d, in_cdid %d\n", out_cdid, in_cdid);
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)
{
@ -567,7 +569,8 @@ void cleanup(void)
break;
default:
fprintf(stderr, "isdntest: unknown message 0x%x = %c\n", buf[0], buf[0]);
if(debug_level)
fprintf(stderr, "isdntest: unknown message 0x%x = %c\n", buf[0], buf[0]);
break;
}
}
@ -576,7 +579,8 @@ void cleanup(void)
fprintf(stderr, "isdntest: read error, errno = %d, length = %d", errno, len);
}
}
fprintf(stderr, "isdntest: exit cleanup, out_cdid %d, in_cdid %d\n", out_cdid, in_cdid);
if(debug_level)
fprintf(stderr, "isdntest: exit cleanup, out_cdid %d, in_cdid %d\n", out_cdid, in_cdid);
}
/*---------------------------------------------------------------------------*

View File

@ -1,7 +1,7 @@
# $FreeBSD$
PROG = isdntrace
SRCS = q921.c q931.c q931_util.c q932_fac.c 1tr6.c trace.c \
pcause_1tr6.c pcause_q850.c
pcause_1tr6.c pcause_q850.c unknownl3.c
#CFLAGS += -Wall -g
MAN8 = isdntrace.8

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
.\" 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
@ -22,13 +22,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: isdntrace.8,v 1.12 1999/12/13 22:11:55 hm Exp $
.\" $Id: isdntrace.8,v 1.14 2000/02/13 15:26:52 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Dec 13 23:08:17 1999]
.\" last edit-date: [Sun Feb 13 14:38:42 2000]
.\"
.Dd October 19, 1998
.Dd February, 13, 2000
.Dt ISDNTRACE 8
.Os
.Sh NAME
@ -48,6 +48,7 @@
.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
@ -67,6 +68,18 @@ The
.Nm
utility is only available for passive supported cards.
.Pp
.Em Note
.br
All filenames, user specified or default, get a date and time stamp string
added in the form -yymmdd-hhmmss: a hyphen, two digits year, month, 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.
.br
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
@ -75,11 +88,9 @@ Run
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
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
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).
@ -98,8 +109,7 @@ print layer 1 (I.430) INFO signals to monitor layer 1 activity (default off).
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 octetts a frame must have to be displayed.
(default 0)
frame size in octetts 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
@ -114,13 +124,15 @@ the decoded protocol information (default on).
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
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
@ -143,8 +155,7 @@ When the USR1 signal is sent to a
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
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
@ -155,8 +166,7 @@ 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
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
@ -183,7 +193,8 @@ isdntrace -f /var/tmp/isdn.trace
.Pp
will start D channel tracing on passive controller 0 with all except B
channel tracing enabled and logs everything into the output file
/tmp/isdn.trace.
/var/tmp/isdn.trace-yymmdd-hhmmss (where yymmdd and hhmmss are replaced
by the current date and time values).
.Sh SEE ALSO
.Xr isdnd 8

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* q931.c - print Q.931 traces
* ---------------------------
*
* $Id: q931.c,v 1.6 1999/12/13 21:25:26 hm Exp $
* $Id: q931.c,v 1.10 2000/02/14 16:25:22 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:56:56 1999]
* last edit-date: [Mon Feb 14 14:51:13 2000]
*
*---------------------------------------------------------------------------*/
@ -59,7 +59,6 @@ decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw)
if(raw)
{
for (i = 0; i < n; i += 16)
{
sprintf((pbuf+strlen(pbuf)),"Dump:%.3d ", i+off);
@ -87,17 +86,17 @@ decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw)
pd = buf[i];
if(pd >= 0x00 && pd <= 0x07)
sprintf((pbuf+strlen(pbuf)), "pd=User-User (0x%02x), ",pd);
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), ",pd);
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), ",pd);
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), ",pd);
sprintf((pbuf+strlen(pbuf)), "pd=Other Layer 3 or X.25 (0x%02x)\n",pd);
else
sprintf((pbuf+strlen(pbuf)), "pd=Reserved (0x%02x), ",pd);
sprintf((pbuf+strlen(pbuf)), "pd=Reserved (0x%02x)\n",pd);
/* call reference */
@ -119,7 +118,7 @@ decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw)
}
i += (len+1);
/* message type */
sprintf((pbuf+strlen(pbuf)), "message=");
@ -168,7 +167,7 @@ decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw)
sprintf((pbuf+strlen(pbuf)), "RESUME REJECT: ");
break;
case 0x24:
sprintf((pbuf+strlen(pbuf)), "HOLD (Q.932): ");
sprintf((pbuf+strlen(pbuf)), "HOLD: ");
break;
case 0x25:
sprintf((pbuf+strlen(pbuf)), "SUSPEND: ");
@ -177,7 +176,7 @@ decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw)
sprintf((pbuf+strlen(pbuf)), "RESUME: ");
break;
case 0x28:
sprintf((pbuf+strlen(pbuf)), "HOLD ACKNOWLEDGE (Q.932): ");
sprintf((pbuf+strlen(pbuf)), "HOLD ACKNOWLEDGE: ");
break;
case 0x2d:
sprintf((pbuf+strlen(pbuf)), "SUSPEND ACKNOWLEDGE: ");
@ -578,7 +577,9 @@ decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw)
sprintf((pbuf+strlen(pbuf)), "[terminal capabilities: ");
break;
case 0x27:
sprintf((pbuf+strlen(pbuf)), "[notification ind: ");
sprintf((pbuf+strlen(pbuf)), "[notification indicator: ");
i += p_q931notification(pbuf, &buf[i]);
goto next;
break;
case 0x28:
sprintf((pbuf+strlen(pbuf)), "[display: ");
@ -721,9 +722,13 @@ decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw)
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: ");
@ -741,6 +746,8 @@ decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw)
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: ");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* q931_util.c - utility functions to print Q.931 traces
* -----------------------------------------------------
*
* $Id: q931_util.c,v 1.6 1999/12/13 21:25:26 hm Exp $
* $Id: q931_util.c,v 1.11 2000/02/15 12:48:14 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:57:03 1999]
* last edit-date: [Tue Feb 15 13:52:09 2000]
*
*---------------------------------------------------------------------------*/
@ -695,5 +695,353 @@ p_q931high_compat(char *pbuf, unsigned char *buf)
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 */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* q932_fac.c - decode Q.932 facilities
* ------------------------------------
*
* $Id: q932_fac.c,v 1.6 1999/12/13 21:25:26 hm Exp $
* $Id: q932_fac.c,v 1.8 2000/02/24 16:32:46 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:57:11 1999]
* last edit-date: [Thu Feb 24 17:36:47 2000]
*
*---------------------------------------------------------------------------
*
@ -64,6 +64,8 @@ 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;
@ -300,6 +302,13 @@ do_component(int length, char *pbuf)
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)
{
@ -643,6 +652,179 @@ F_1_4(char *pbuf, int val)
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;
}
}
@ -888,6 +1070,16 @@ static struct statetab {
{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 }
@ -924,5 +1116,121 @@ next_state(char *pbuf, int class, int form, int code, int val)
}
}
/*---------------------------------------------------------------------------*
* 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 */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* 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
@ -27,11 +27,11 @@
* q932_fac.h - facility header file
* ---------------------------------
*
* $Id: q932_fac.h,v 1.6 1999/12/13 21:25:26 hm Exp $
* $Id: q932_fac.h,v 1.7 2000/02/18 16:27:39 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:57:18 1999]
* last edit-date: [Fri Feb 18 17:26:07 2000]
*
*---------------------------------------------------------------------------
*
@ -168,6 +168,10 @@ enum states {
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
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 1999 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1996, 2000 Hellmuth Michaelis. All rights reserved.
*
* Copyright (c) 1996 Gary Jennejohn. All rights reserved.
*
@ -35,11 +35,11 @@
* trace.c - print traces of D (B) channel activity for isdn4bsd
* -------------------------------------------------------------
*
* $Id: trace.c,v 1.15 1999/12/13 21:25:26 hm Exp $
* $Id: trace.c,v 1.19 2000/08/28 07:06:42 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:57:48 1999]
* last edit-date: [Mon Aug 28 09:03:46 2000]
*
*---------------------------------------------------------------------------*/
@ -64,9 +64,15 @@ 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 char outfilename[1024];
static char BPfilename[1024];
static struct stat fst;
static void dumpbuf( int n, unsigned char *buf, i4b_trace_hdr_t *hdr, int raw );
@ -74,6 +80,7 @@ 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
@ -84,7 +91,7 @@ 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," -B -F -P -R <unit> -T <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");
@ -97,6 +104,7 @@ usage(void)
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");
@ -122,7 +130,6 @@ main(int argc, char *argv[])
int c;
char *b;
int enable_trace = TRACE_D_RX | TRACE_D_TX;
char *outfile = TRACE_FILE_NAME;
char *binfile = BIN_FILE_NAME;
int outfileset = 0;
@ -135,7 +142,7 @@ main(int argc, char *argv[])
b = &buf[sizeof(i4b_trace_hdr_t)];
while( (c = getopt(argc, argv, "abdf:hiln:op:ru:BFPR:T:")) != -1)
while( (c = getopt(argc, argv, "abdf:hiln:op:ru:xBFPR:T:")) != -1)
{
switch(c)
{
@ -192,6 +199,10 @@ main(int argc, char *argv[])
usage();
break;
case 'x':
xopt = 0;
break;
case 'B':
Bopt = 1;
break;
@ -238,18 +249,13 @@ main(int argc, char *argv[])
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, TRACE_FILE_NAME_BAK);
rename(BPfilename, buffer);
}
if((BP = fopen(BPfilename, "w")) == NULL)
add_datetime(BPfilename, rBPfilename);
if((BP = fopen(rBPfilename, "w")) == NULL)
{
char buffer[80];
sprintf(buffer, "Error opening file [%s]", BPfilename);
sprintf(buffer, "Error opening file [%s]", rBPfilename);
perror(buffer);
exit(1);
}
@ -258,7 +264,7 @@ main(int argc, char *argv[])
{
char buffer[80];
sprintf(buffer, "Error setting file [%s] to unbuffered", BPfilename);
sprintf(buffer, "Error setting file [%s] to unbuffered", rBPfilename);
perror(buffer);
exit(1);
}
@ -271,6 +277,8 @@ main(int argc, char *argv[])
else
sprintf(BPfilename, "%s%d", BIN_FILE_NAME, unit);
strcpy(rBPfilename, BPfilename);
if((BP = fopen(BPfilename, "r")) == NULL)
{
char buffer[80];
@ -311,20 +319,13 @@ main(int argc, char *argv[])
else
strcpy(outfilename, outfile);
add_datetime(outfilename, routfilename);
if((Fout = fopen(outfilename, "r")) != NULL)
{
char buffer[1024];
fclose(Fout);
sprintf(buffer, "%s%s", outfilename, TRACE_FILE_NAME_BAK);
rename(outfilename, buffer);
}
if((Fout = fopen(outfilename, "w")) == NULL)
if((Fout = fopen(routfilename, "w")) == NULL)
{
char buffer[80];
sprintf(buffer, "Error opening file [%s]", outfilename);
sprintf(buffer, "Error opening file [%s]", routfilename);
perror(buffer);
exit(1);
}
@ -333,7 +334,7 @@ main(int argc, char *argv[])
{
char buffer[80];
sprintf(buffer, "Error setting file [%s] to unbuffered", outfile);
sprintf(buffer, "Error setting file [%s] to unbuffered", routfilename);
perror(buffer);
exit(1);
}
@ -388,7 +389,7 @@ main(int argc, char *argv[])
if((fwrite(buf, 1, n, BP)) != n)
{
char buffer[80];
sprintf(buffer, "Error writing file [%s]", BPfilename);
sprintf(buffer, "Error writing file [%s]", rBPfilename);
perror(buffer);
exit(1);
}
@ -408,7 +409,7 @@ main(int argc, char *argv[])
if(ferror(BP))
{
char buffer[80];
sprintf(buffer, "Error reading hdr from file [%s]", BPfilename);
sprintf(buffer, "Error reading hdr from file [%s]", rBPfilename);
perror(buffer);
exit(1);
}
@ -416,19 +417,19 @@ main(int argc, char *argv[])
usleep(250000);
clearerr(BP);
if(stat(BPfilename, &fstnew) != -1)
if(stat(rBPfilename, &fstnew) != -1)
{
if((fst.st_ino != fstnew.st_ino) ||
(fstnew.st_nlink == 0))
{
if((BP = freopen(BPfilename, "r", BP)) == NULL)
if((BP = freopen(rBPfilename, "r", BP)) == NULL)
{
char buffer[80];
sprintf(buffer, "Error reopening file [%s]", BPfilename);
sprintf(buffer, "Error reopening file [%s]", rBPfilename);
perror(buffer);
exit(1);
}
stat(BPfilename, &fst);
stat(rBPfilename, &fst);
}
}
goto again;
@ -442,7 +443,7 @@ main(int argc, char *argv[])
else
{
char buffer[80];
sprintf(buffer, "Error reading hdr from file [%s]", BPfilename);
sprintf(buffer, "Error reading hdr from file [%s]", rBPfilename);
perror(buffer);
exit(1);
}
@ -454,7 +455,7 @@ main(int argc, char *argv[])
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);
sprintf(buffer, "Error reading data from file [%s]", rBPfilename);
perror(buffer);
exit(1);
}
@ -482,7 +483,7 @@ fmt_hdr(i4b_trace_hdr_t *hdr, int frm_len)
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.%6u ",
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,
@ -496,7 +497,7 @@ fmt_hdr(i4b_trace_hdr_t *hdr, int frm_len)
{
if(hdr->trunc > 0)
{
sprintf(hbuf,"\n-- %s - unit:%d - frame:%6.6u - time:%2.2d.%2.2d %2.2d:%2.2d:%2.2d.%6u - length:%d (%d) ",
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,
@ -511,7 +512,7 @@ fmt_hdr(i4b_trace_hdr_t *hdr, int frm_len)
}
else
{
sprintf(hbuf,"\n-- %s - unit:%d - frame:%6.6u - time:%2.2d.%2.2d %2.2d:%2.2d:%2.2d.%6u - length:%d ",
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,
@ -555,6 +556,11 @@ dumpbuf(int n, unsigned char *buf, i4b_trace_hdr_t *hdr, int raw)
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])
@ -609,9 +615,21 @@ dumpbuf(int n, unsigned char *buf, i4b_trace_hdr_t *hdr, int raw)
decode_1tr6(l3buf, n, cnt, buf, raw);
break;
default:
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;
@ -750,11 +768,13 @@ reopenfiles(int dummy)
{
fclose(Fout);
if((Fout = fopen(outfilename, "a")) == NULL)
add_datetime(outfilename, routfilename);
if((Fout = fopen(routfilename, "a")) == NULL)
{
char buffer[80];
sprintf(buffer, "Error re-opening file [%s]", outfilename);
sprintf(buffer, "Error re-opening file [%s]", routfilename);
perror(buffer);
exit(1);
}
@ -763,7 +783,7 @@ reopenfiles(int dummy)
{
char buffer[80];
sprintf(buffer, "Error re-setting file [%s] to unbuffered", outfilename);
sprintf(buffer, "Error re-setting file [%s] to unbuffered", routfilename);
perror(buffer);
exit(1);
}
@ -774,11 +794,13 @@ reopenfiles(int dummy)
fclose(BP);
if((BP = fopen(BPfilename, "a")) == NULL)
add_datetime(BPfilename, rBPfilename);
if((BP = fopen(rBPfilename, "a")) == NULL)
{
char buffer[80];
sprintf(buffer, "Error re-opening file [%s]", BPfilename);
sprintf(buffer, "Error re-opening file [%s]", rBPfilename);
perror(buffer);
exit(1);
}
@ -787,12 +809,42 @@ reopenfiles(int dummy)
{
char buffer[80];
sprintf(buffer, "Error re-setting file [%s] to unbuffered", BPfilename);
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;
/* EOF */
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 */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 1999 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1996, 2000 Hellmuth Michaelis. All rights reserved.
*
* Copyright (c) 1996 Gary Jennejohn. All rights reserved.
*
@ -35,11 +35,11 @@
* trace.h - header file for isdn trace
* ------------------------------------
*
* $Id: trace.h,v 1.9 1999/12/13 21:25:26 hm Exp $
* $Id: trace.h,v 1.12 2000/02/14 16:25:22 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:58:07 1999]
* last edit-date: [Mon Feb 14 14:43:40 2000]
*
*---------------------------------------------------------------------------*/
@ -57,6 +57,7 @@
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <machine/i4b_ioctl.h>
#include <machine/i4b_trace.h>
@ -66,7 +67,6 @@
#define I4BTRC_DEVICE "/dev/i4btrc" /* trace device file */
#define TRACE_FILE_NAME "isdntrace" /* default output filename */
#define TRACE_FILE_NAME_BAK ".last" /* backup filename trailer */
#define BIN_FILE_NAME "isdntracebin" /* default binary filename */
#define BSIZE 4096 /* read buffer size */
@ -77,6 +77,7 @@
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);
@ -85,5 +86,8 @@ 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 */

View File

@ -0,0 +1,106 @@
/*
* 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 */

View File

@ -0,0 +1,7 @@
# $FreeBSD$
PROG = ispppcontrol
SRCS = ispppcontrol.c
MAN8 = ispppcontrol.8
.include <bsd.prog.mk>

View File

@ -0,0 +1,245 @@
.\" Copyright (C) 1997 by Joerg Wunsch, Dresden
.\" 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(S) ``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(S) 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.
.\"
.\" From: spppcontrol.1,v 1.1.1.1 1997/10/11 11:30:30 joerg Exp
.\"
.\" $Id: ispppcontrol.8,v 1.2 2000/08/31 08:51:06 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Oct 9 16:20:25 2000]
.\"
.Dd August 31, 2000
.Os
.Dt ISPPPCONTROL 8
.Sh NAME
.Nm ispppcontrol
.Nd display or set parameters for an isdn4bsd isp interface
.Sh SYNOPSIS
.Nm
.Op Fl v
.Ar ifname
.Op Ar parameter Ns Op \&= Ns Ar value
.Op Ar ...
.Sh DESCRIPTION
The
.Xr i4bisppp 4
driver might require a number of additional arguments or optional
parameters besides the settings that can be adjusted with
.Xr ifconfig 8 .
These are things like authentication protocol parameters, but also
other tunable configuration variables. The
.Nm
utility can be used to display the current settings, or adjust these
parameters as required.
.Pp
For whatever intent
.Nm
is being called, at least the parameter
.Ar ifname
needs to be specified, naming the interface for which the settings
are to be performed or displayed. Use
.Xr ifconfig 8 ,
or
.Xr netstat 1
to see which interfaces are available.
.Pp
If no other parameter is given,
.Nm
will just list the current settings for
.Ar ifname
and exit. The reported settings include the current PPP phase the
interface is in, which can be one of the names
.Em dead ,
.Em establish ,
.Em authenticate ,
.Em network ,
or
.Em terminate .
If an authentication protocol is configured for the interface, the
name of the protocol to be used, as well as the system name to be used
or expected will be displayed, plus any possible options to the
authentication protocol if applicable. Note that the authentication
secrets (sometimes also called
.Em keys )
are not being returned by the underlying system call, and are thus not
displayed.
.Pp
If any additional parameter is supplied, superuser privileges are
required, and the command works in
.Ql set
mode. This is normally done quietly, unless the option
.Fl v
is also enabled, which will cause a final printout of the settings as
described above once all other actions have been taken. Use of this
mode will be rejected if the interface is currently in any other phase
than
.Em dead .
Note that you can force an interface into
.Em dead
phase by calling
.Xr ifconfig 8
with the parameter
.Ql down .
.Pp
The currently supported parameters include:
.Bl -tag -offset indent -width indent
.It Ar authproto Ns \&= Ns Em protoname
Set both, his and my authentication protocol to
.Em protoname .
The protocol name can be one of
.Ql chap ,
.Ql pap ,
or
.Ql none .
In the latter case, the use of an authentication protocol will be
turned off for the named interface. This has the side-effect of
clearing the other authentication-related parameters for this
interface as well (i. e., system name and authentication secret will
be forgotten).
.It Ar myauthproto Ns \&= Ns Em protoname
Same as above, but only for my end of the link. I. e., this is the
protocol when remote is authenticator, and I am the peer required to
authenticate.
.It Ar hisauthproto Ns \&= Ns Em protoname
Same as above, but only for his end of the link.
.It Ar myauthname Ns \&= Ns Em name
Set my system name for the authentication protocol.
.It Ar hisauthname Ns \&= Ns Em name
Set his system name for the authentication protocol. For CHAP, this
will only be used as a hint, causing a warning message if remote did
supply a different name. For PAP, it's the name remote must use to
authenticate himself (in connection with his secret).
.It Ar myauthsecret Ns \&= Ns Em secret
Set my secret (key, password) for use in the authentication phase.
For CHAP, this will be used to compute the response hash value, based
on remote's challenge. For PAP, it will be transmitted as plaintext
together with the system name. Don't forget to quote the secrets from
the shell if they contain shell metacharacters (or white space).
.It Ar myauthkey Ns \&= Ns Em secret
Same as above.
.It Ar hisauthsecret Ns \&= Ns Em secret
Same as above, to be used if we are authenticator and the remote peer
needs to authenticate.
.It Ar hisauthkey Ns \&= Ns Em secret
Same as above.
.It Ar callin
Require remote to authenticate himself only when he's calling in, but
not when we are caller. This is required for some peers that do not
implement the authentication protocols symmetrically (like Ascend
routers, for example).
.It Ar always
The opposite of
.Ar callin .
Require remote to always authenticate, regardless of which side is
placing the call. This is the default, and will not be explicitly
displayed in
.Ql list
mode.
.It Ar norechallenge
Only meaningful with CHAP. Do not re-challenge peer once the initial
CHAP handshake was successful. Used to work around broken peer
implementations that can't grok being re-challenged once the
connection is up.
.It Ar rechallenge
With CHAP, send re-challenges at random intervals while the connection
is in network phase. (The intervals are currently in the range of 300
through approximately 800 seconds.) This is the default, and will not
be explicitly displayed in
.Ql list
mode.
.It Ar lcp-timeout Ns \&= Ns Em timeout-value
Allows to change the value of the LCP timeout. The default value of the
LCP timeout is currently set to 3 seconds which is too high for some
remote PPP implentations. The timeout-value must specified in milliseconds.
.It Ar enable-vj
Enable negotiation of Van Jacobsen header compression.
.It Ar disable-vj
Disable negotiation of Van Jacobsen header compression.
.El
.Sh EXAMPLES
.Bd -literal
# ispppcontrol isp0
isp0: phase=dead
myauthproto=chap myauthname="uriah"
hisauthproto=chap hisauthname="ifb-gw" norechallenge
lcp timeout: 3.000 s
enable_vj: on
.Ed
.Pp
Display the settings for isp0. The interface is currently in
.Em dead
phase, i. e. the LCP layer is down, and no traffic is possible. Both
ends of the connection use the CHAP protocol, my end tells remote the
system name
.Ql uriah ,
and remote is expected to authenticate by the name
.Ql ifb-gw .
Once the initial CHAP handshake was successful, no further CHAP
challenges will be transmitted. There are supposedly some known CHAP
secrets for both ends of the link which are not being shown.
.Pp
.Bd -literal
# ispppcontrol isp0 \e
authproto=chap \e
myauthname=uriah myauthsecret='some secret' \e
hisauthname=ifb-gw hisauthsecret='another' \e
norechallenge
.Ed
.Pp
A possible call to
.Nm
that could have been used to bring the interface into the state shown
by the previous example.
.Sh SEE ALSO
.Xr netstat 1 ,
.Xr i4bisppp 4 ,
.Xr ifconfig 8
.Rs
.%A B. Lloyd, W. Simpson
.%T "PPP Authentication Protocols"
.%O RFC 1334
.Re
.Rs
.%A W. Simpson, Editor
.%T "The Point-to-Point Protocol (PPP)"
.%O RFC 1661
.Re
.Rs
.%A W. Simpson
.%T "PPP Challenge Handshake Authentication Protocol (CHAP)"
.%O RFC 1994
.Re
.Sh HISTORY
The
.Nm
utility is based on the
.Xr spppcontrol 8
utility which appeared in
.Fx 3.0 .
.Sh AUTHOR
The program was written by
.ie t J\(:org Wunsch,
.el Joerg Wunsch,
Dresden.

View File

@ -0,0 +1,315 @@
/*
* Copyright (c) 1997 Joerg Wunsch
*
* 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 DEVELOPERS ``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 DEVELOPERS 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.
*
* From: spppcontrol.c,v 1.3 1998/01/07 07:55:26 charnier Exp
*
*---------------------------------------------------------------------------
*
* last edit-date: [Mon Oct 9 16:21:15 2000]
*
*---------------------------------------------------------------------------
*
* $FreeBSD$
*/
#ifndef lint
static const char rcsid[] =
"$Id: ispppcontrol.c,v 1.4 2000/08/24 11:48:57 hm Exp $";
#endif /* not lint */
#include <sys/param.h>
#include <sys/callout.h>
#include <sys/ioctl.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/sysctl.h>
#include <net/if.h>
#if (defined (__FreeBSD__) && __FreeBSD__ >= 3)
#include <net/if_var.h>
#endif
#if defined (__FreeBSD__) || defined (__OpenBSD__)
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <net/slcompress.h>
#endif
#ifdef __NetBSD__
#include <net/if_sppp.h>
#else
#include <machine/i4b_isppp.h>
#endif
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
static void usage(void);
void print_vals(const char *ifname, struct spppreq *sp);
const char *phase_name(enum ppp_phase phase);
const char *proto_name(u_short proto);
const char *authflags(u_short flags);
#define PPP_PAP 0xc023
#define PPP_CHAP 0xc223
int hz = 0;
int
main(int argc, char **argv)
{
int s, c;
int errs = 0, verbose = 0;
size_t off;
const char *ifname, *cp;
struct ifreq ifr;
struct spppreq spr;
int len;
int mib[2];
struct clockinfo clockinfo;
while ((c = getopt(argc, argv, "v")) != -1)
switch (c) {
case 'v':
verbose++;
break;
default:
errs++;
break;
}
argv += optind;
argc -= optind;
if (errs || argc < 1)
usage();
ifname = argv[0];
strncpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name);
/* use a random AF to create the socket */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
err(EX_UNAVAILABLE, "ifconfig: socket");
argc--;
argv++;
spr.cmd = (int)SPPPIOGDEFS;
ifr.ifr_data = (caddr_t)&spr;
if (ioctl(s, SIOCGIFGENERIC, &ifr) == -1)
err(EX_OSERR, "SIOCGIFGENERIC(SPPPIOGDEFS)");
mib[0] = CTL_KERN;
mib[1] = KERN_CLOCKRATE;
len = sizeof(clockinfo);
if(sysctl(mib, 2, &clockinfo, &len, NULL, 0) == -1)
{
fprintf(stderr, "error, cannot sysctl kern.clockrate!\n");
exit(1);
}
hz = clockinfo.hz;
if (argc == 0) {
/* list only mode */
print_vals(ifname, &spr);
return 0;
}
#define startswith(s) strncmp(argv[0], s, (off = strlen(s))) == 0
while (argc > 0) {
if (startswith("authproto=")) {
cp = argv[0] + off;
if (strcmp(cp, "pap") == 0)
spr.defs.myauth.proto =
spr.defs.hisauth.proto = PPP_PAP;
else if (strcmp(cp, "chap") == 0)
spr.defs.myauth.proto =
spr.defs.hisauth.proto = PPP_CHAP;
else if (strcmp(cp, "none") == 0)
spr.defs.myauth.proto =
spr.defs.hisauth.proto = 0;
else
errx(EX_DATAERR, "bad auth proto: %s", cp);
} else if (startswith("myauthproto=")) {
cp = argv[0] + off;
if (strcmp(cp, "pap") == 0)
spr.defs.myauth.proto = PPP_PAP;
else if (strcmp(cp, "chap") == 0)
spr.defs.myauth.proto = PPP_CHAP;
else if (strcmp(cp, "none") == 0)
spr.defs.myauth.proto = 0;
else
errx(EX_DATAERR, "bad auth proto: %s", cp);
} else if (startswith("myauthname="))
strncpy(spr.defs.myauth.name, argv[0] + off,
AUTHNAMELEN);
else if (startswith("myauthsecret=") ||
startswith("myauthkey="))
strncpy(spr.defs.myauth.secret, argv[0] + off,
AUTHKEYLEN);
else if (startswith("hisauthproto=")) {
cp = argv[0] + off;
if (strcmp(cp, "pap") == 0)
spr.defs.hisauth.proto = PPP_PAP;
else if (strcmp(cp, "chap") == 0)
spr.defs.hisauth.proto = PPP_CHAP;
else if (strcmp(cp, "none") == 0)
spr.defs.hisauth.proto = 0;
else
errx(EX_DATAERR, "bad auth proto: %s", cp);
} else if (startswith("hisauthname="))
strncpy(spr.defs.hisauth.name, argv[0] + off,
AUTHNAMELEN);
else if (startswith("hisauthsecret=") ||
startswith("hisauthkey="))
strncpy(spr.defs.hisauth.secret, argv[0] + off,
AUTHKEYLEN);
else if (strcmp(argv[0], "callin") == 0)
spr.defs.hisauth.flags |= AUTHFLAG_NOCALLOUT;
else if (strcmp(argv[0], "always") == 0)
spr.defs.hisauth.flags &= ~AUTHFLAG_NOCALLOUT;
else if (strcmp(argv[0], "norechallenge") == 0)
spr.defs.hisauth.flags |= AUTHFLAG_NORECHALLENGE;
else if (strcmp(argv[0], "rechallenge") == 0)
spr.defs.hisauth.flags &= ~AUTHFLAG_NORECHALLENGE;
#ifndef __NetBSD__
else if (strcmp(argv[0], "enable-vj") == 0)
spr.defs.enable_vj = 1;
else if (strcmp(argv[0], "disable-vj") == 0)
spr.defs.enable_vj = 0;
#endif
else if (startswith("lcp-timeout=")) {
int timeout_arg = atoi(argv[0]+off);
if ((timeout_arg > 20000) || (timeout_arg <= 0))
errx(EX_DATAERR, "bad lcp timeout value: %s",
argv[0]+off);
spr.defs.lcp.timeout = timeout_arg * hz / 1000;
} else
errx(EX_DATAERR, "bad parameter: \"%s\"", argv[0]);
argv++;
argc--;
}
spr.cmd = (int)SPPPIOSDEFS;
if (ioctl(s, SIOCSIFGENERIC, &ifr) == -1)
err(EX_OSERR, "SIOCSIFGENERIC(SPPPIOSDEFS)");
if (verbose)
print_vals(ifname, &spr);
return 0;
}
static void
usage(void)
{
fprintf(stderr, "%s\n%s\n",
"usage: ispppcontrol [-v] ifname [{my|his}auth{proto|name|secret}=...]",
" ispppcontrol [-v] ifname callin|always");
exit(EX_USAGE);
}
void
print_vals(const char *ifname, struct spppreq *sp)
{
#ifndef __NetBSD__
time_t send, recv;
#endif
printf("%s:\tphase=%s\n", ifname, phase_name(sp->defs.pp_phase));
if (sp->defs.myauth.proto) {
printf("\tmyauthproto=%s myauthname=\"%.*s\"\n",
proto_name(sp->defs.myauth.proto),
AUTHNAMELEN, sp->defs.myauth.name);
}
if (sp->defs.hisauth.proto) {
printf("\thisauthproto=%s hisauthname=\"%.*s\"%s\n",
proto_name(sp->defs.hisauth.proto),
AUTHNAMELEN, sp->defs.hisauth.name,
authflags(sp->defs.hisauth.flags));
}
#ifndef __NetBSD__
if (sp->defs.pp_phase > PHASE_DEAD) {
send = time(NULL) - sp->defs.pp_last_sent;
recv = time(NULL) - sp->defs.pp_last_recv;
printf("\tidle_time=%ld\n", (send<recv)? send : recv);
}
#endif
printf("\tlcp timeout: %.3f s\n",
(double)sp->defs.lcp.timeout / hz);
#ifndef __NetBSD__
printf("\tenable_vj: %s\n",
sp->defs.enable_vj ? "on" : "off");
#endif
}
const char *
phase_name(enum ppp_phase phase)
{
switch (phase) {
case PHASE_DEAD: return "dead";
case PHASE_ESTABLISH: return "establish";
case PHASE_TERMINATE: return "terminate";
case PHASE_AUTHENTICATE: return "authenticate";
case PHASE_NETWORK: return "network";
}
return "illegal";
}
const char *
proto_name(u_short proto)
{
static char buf[12];
switch (proto) {
case PPP_PAP: return "pap";
case PPP_CHAP: return "chap";
}
sprintf(buf, "0x%x", (unsigned)proto);
return buf;
}
const char *
authflags(u_short flags)
{
static char buf[32];
buf[0] = '\0';
if (flags & AUTHFLAG_NOCALLOUT)
strcat(buf, " callin");
if (flags & AUTHFLAG_NORECHALLENGE)
strcat(buf, " norechallenge");
return buf;
}

View File

@ -1,6 +1,6 @@
# $FreeBSD$
MAN4 = i4b.4 i4bctl.4 i4bipr.4 i4bq921.4 i4bq931.4 i4brbch.4 i4btel.4 \
i4btrc.4 isic.4 daic.4 i4bisppp.4
i4btrc.4 isic.4 i4bisppp.4 iwic.4 ifpi.4 ifpnp.4 ihfc.4
.include <bsd.prog.mk>

View File

@ -1,112 +0,0 @@
.\" Copyright (c) 1997 Martin Husemann <martin@rumolt.teuto.de>
.\" 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. The name of the author may not be used to endorse or promote products
.\" derived from this software withough specific prior written permission
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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: daic.4,v 1.2 1999/12/13 22:11:55 hm Exp $
.\"
.\" last edit-date: [Tue Dec 14 22:13:53 1999]
.\"
.\" $FreeBSD$
.\"
.\" -mh writing manual pages
.\"
.\"
.Dd January 30, 1998
.Dt DAIC 4
.Os
.Sh NAME
.Nm daic
.Nd isdn4bsd driver for EICON.Diehl active isdn cards
.Pp
The
.Nm
driver supports the old Diehl active cards:
.Em S, SX, SXn, SCOM
and
.Em QUADRO.
.Sh SYNOPSIS
.Pp
Use a config line like this
.Cd "daic0 at isa? iomem 0xd8000 irq 10"
.Pp
For a
.Em QUADRO
card use the same, the driver will detect the board type and use
all four ports, each attached as a controller of its own to the
ISDN4BSD system, which can be listed using the isdnctl utility.
.Sh DESCRIPTION
The
.Nm
driver interfaces the isdn card to the ISDN4BSD kernel subsystem.
All lower layer isdn control is handled by the card.
This should
allow you to run any national isdn protocol delivered by EICON.Diehl
for your card, but the driver has only been tested with the DSS1
protocol and some parts of the cards interface are isdn protocol
dependend.
.Pp
The
.Nm
driver is written to conform to the software interface documented
by Diehl in their
.Nm ISDN-Karten Benutzerhandbuch
from 1992.
.Sh MICROCODE DOWNLOAD
Every active card needs its own operating software before it can
work.
You have to download this to the card before using it with
ISDN4BSD.
Use the isdnctl utility to do this, i.e. call
.Nm "isdnctl -d te_etsi.sx 1"
to download the file
.Nm te_etsi.sx
to controller number 1.
Use
.Nm "isdnctl -l"
to list all available controllers (and ports).
You have to select the
correct isdn protocol file for your isdn interface, see the Diehl documentation
for details.
.Pp
The cards bootstrap process involves another file, which is independend
of the card type you use and the protocol you run.
It is called
.Nm download.bin
in current versions of the Diehl software distribution and has to be
copied to the kernel compile directory under
.Nm dev/ic/microcode/daic
and converted into a header file used when compiling the kernel by running
.Nm make
in that directory.
Your kernel compile will fail and remind you of this
if you forget to do this.
Due to copright restrictions we cannot distribute
the driver with this file integrated.
But if you own a card, you do have
the file (or can get it from the Diehl web server).
.Sh BUGS
The driver is not yet finished.
It will only compile on NetBSD and
even there will not work.
This should be fixed soon and the driver
will be ported to FreeBSD.
.Sh SEE ALSO
.Xr isdnctl 1

68
usr.sbin/i4b/man/i4bing.4 Normal file
View File

@ -0,0 +1,68 @@
.\"
.\" 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.
.\"
.\" $Id: i4bing.4,v 1.1 2000/01/10 19:14:18 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Jan 10 20:13:11 2000]
.\"
.Dd January 10, 2000
.Dt I4BING 4
.Os
.Sh NAME
.Nm i4bing
.Nd isdn4bsd NetGraph ISDN B-channel interface driver
.Sh SYNOPSIS
.Cd pseudo-device \&"i4bing\&" Op count
.Sh DESCRIPTION
The
.Nm
driver interfaces the FreeBSD 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
The format of the resulting packet on the B channel is:
.Pp
.Dl (HDLC opening flag) (Packet) (CRC) (HDLC closing flag)
.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.
.Pp
.Sh SEE ALSO
.Xr isdnd 8
.Xr isdnd.rc 5
.Xr netgraph 4
.Sh AUTHOR
The
.Nm
device driver and this manpage were written by
.An Hellmuth Michaelis Aq hm@kts.org .

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
.\" 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
@ -22,13 +22,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: i4bisppp.4,v 1.12 1999/12/13 22:11:55 hm Exp $
.\" $Id: i4bisppp.4,v 1.13 2000/08/31 08:45:07 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Dec 13 23:11:15 1999]
.\" last edit-date: [Thu Aug 31 10:40:17 2000]
.\"
.Dd December 22, 1998
.Dd August 31, 2000
.Dt I4BISPPP 4
.Os
.Sh NAME
@ -48,6 +48,20 @@ is possible.
The driver is just a glue layer between Serge Vakulenko's sppp
backend and the ISDN4BSD package.
.Pp
Beginning with i4b version 0.95 (and only for FreeBSD), the sppp
subsystem was integrated into the
.Nm
driver to support more i4b/ISDN specific options. As a consequence it is no
longer necessary to add a "options sppp" to your kernel
.Xr config 8
file. For configuration of the i4bsppp driver, either the
.Xr ispppcontrol 8
utility is used or it is configured via
.Xr isdnd 1
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
@ -62,7 +76,7 @@ with the
interfaces.
.Pp
The
.Xr spppcontrol 8
.Xr ispppcontrol 8
utility is used to configure all aspects of PPP required to connect to a
remote site.
.Sh LINK0 and LINK1
@ -99,7 +113,7 @@ for a more detailed discussion of the flags,
.Sh SEE ALSO
.Xr isdnd 8
.Xr isdnd.rc 5
.Xr spppcontrol 8
.Xr ispppcontrol 8
.Xr sppp 4
.Xr bpf 4
.Xr tcpdump 1
@ -107,8 +121,9 @@ for a more detailed discussion of the flags,
The
.Nm
device driver was written by
.An Joerg Wunsch
.An Joerg Wunsch Aq joerg@freebsd.org
and then added to ISDN4BSD by
.An Gary Jennejohn .
.An Gary Jennejohn Aq gary@freebsd.org .
.Pp
This manpage was written by
.An Hellmuth Michaelis Aq hm@kts.org .

View File

@ -41,8 +41,7 @@ none
.Sh DESCRIPTION
The
.Nm
driver provides an interface to the raw untranslated B-channel.
It is
driver provides an interface to the raw untranslated B-channel. It is
part of the isdn4bsd package.
.Sh SEE ALSO
.Xr isdnd 8

View File

@ -44,8 +44,7 @@ The
driver provides an interface to the 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.
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, wheras the upper two bits specify a functionality.
@ -86,8 +85,7 @@ 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
do no A-law/u-law audio format conversion. The conversion path looks like
this:
.Pp
USER <--> bitreversing <--> ISDN-line

View File

@ -33,7 +33,7 @@
.Os
.Sh NAME
.Nm i4btrc
.Nd "isdn4bsd ISDN interface driver for D and B channel tracing"
.Nd isdn4bsd ISDN interface driver for D and B channel tracing
.Sh FreeBSD SYNOPSIS
.Cd pseudo-device \&"i4btrc\&" Op count
.Sh NetBSD SYNOPSIS

69
usr.sbin/i4b/man/ifpi.4 Normal file
View File

@ -0,0 +1,69 @@
.\"
.\" 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.
.\"
.\" $Id: ifpi.4,v 1.1 2000/03/16 15:25:05 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Thu Mar 16 16:27:40 2000]
.\"
.Dd July 30, 1999
.Dt IFPI 4
.Os
.Sh NAME
.Nm ifpi
.Nd isdn4bsd AVM Fritz!Card PCI driver
.Sh SYNOPSIS
.Pp
.Cd "device ifpi0"
.Pp
.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 AVM based on the proprietary
B-channel controller and PCI interface chip from AVM, Berlin, Germany.
.Pp
.Sh CAVEATS
The driver is still in a somewhat experimental state.
.Pp
.Sh BUGS
Always at least one left.
.Sh STANDARDS
CCITT Recommendation I.430
.Sh SEE ALSO
.Xr i4bq921 4
.Xr i4bq931 4
.Sh AUTHOR
The
.Nm
driver was written by
.An Gary Jennejohn Aq gj@freebsd.org .
.Pp
This manpage was written by
.An Hellmuth Michaelis Aq hm@kts.org .

71
usr.sbin/i4b/man/ifpnp.4 Normal file
View File

@ -0,0 +1,71 @@
.\"
.\" 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.
.\"
.\" $Id: ifpnp.4,v 1.2 2000/04/25 13:01:20 hm Exp $
.\" $Ust: src/i4b/man/ifpnp.4,v 1.4 2000/04/18 08:26:31 ust Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Tue Apr 25 15:03:27 2000]
.\"
.Dd April 18, 2000
.Dt IFPNP 4
.Os
.Sh NAME
.Nm ifpnp
.Nd isdn4bsd AVM Fritz!Card PnP driver
.Sh SYNOPSIS
.Pp
.Cd "device ifpnp"
.Pp
.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.
.Pp
.Sh CAVEATS
The driver is still in a somewhat experimental state.
.Pp
.Sh BUGS
Always at least one left.
.Sh STANDARDS
CCITT Recommendation I.430
.Sh SEE ALSO
.Xr i4bq921 4
.Xr i4bq931 4
.Sh AUTHOR
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@kts.org
and
.An Udo Schweigert Aq ust@cert.siemens.de .

76
usr.sbin/i4b/man/ihfc.4 Normal file
View File

@ -0,0 +1,76 @@
.\"
.\" 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.
.\"
.\" $Id: ihfc.4,v 1.2 2000/07/24 12:22:09 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Tue Apr 25 15:03:14 2000]
.\"
.Dd July 20, 2000
.Dt IHFC 4
.Os
.Sh NAME
.Nm ihfc
.Nd isdn4bsd Cologne Chip Designs HFC[-S][-SP] 2B[DS0] driver
.Sh SYNOPSIS
.Pp
All PnP cards (AcerISDN P10, Teles 16.3c PnP):
.Pp
.Cd "device ihfc"
.Pp
Non-PnP cards (TELEINT ISDN SPEED No.1):
.Pp
.Cd "device ihfc0 at isa?"
.Pp
NOTE: The driver will automatically probe for io-base and irq.
.Pp
.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 ISDN cards based on the HFC[-S][-SP] 2B[DS0]
chips from Cologne Chip Designs such as the Teles 16.3c and
the AcerISDN P10.
.Pp
.Sh CAVEATS
The driver is still in a somewhat experimental state.
.Pp
.Sh BUGS
Always at least one left.
.Sh STANDARDS
CCITT Recommendation I.430
.Sh SEE ALSO
.Xr i4bq921 4
.Xr i4bq931 4
.Sh AUTHOR
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 .

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
.\" 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
@ -22,187 +22,150 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: isic.4,v 1.26 1999/12/13 22:11:55 hm Exp $
.\" $Id: isic.4,v 1.28 2000/03/16 15:25:05 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Dec 13 23:16:08 1999]
.\" last edit-date: [Thu Mar 16 16:21:45 2000]
.\"
.Dd July 30, 1999
.Dd March 16, 2000
.Dt ISIC 4
.Os
.Sh NAME
.Nm isic
.Nd isdn4bsd Siemens ISDN Chipset device driver
.Sh FreeBSD SYNOPSIS
.Sh FreeBSD SYNOPSIS (FreeBSD >= 4.0)
.Br
.Pp
.Em Note:
the keywords
.Em net
and
.Em vector isicintr
are no longer required for FreeBSD-current (FreeBSD 4.x)!
Asuscom ISDNLink 128K (ISA PnP):
.Cd options \&"ASUSCOM_IPAC\&"
.Cd "device isic0"
.Pp
For a Teles S0/8 or Niccy 1008 card:
.Cd options \&"TEL_S0_8\&"
.Cd "device isic0 at isa? iomem 0xd0000 net irq 5 flags 1 vector isicintr"
.Pp
For a Teles S0/16 or Creatix ISDN-S0 or Niccy 1016 card:
.Cd options \&"TEL_S0_16\&"
.Cd "device isic0 at isa? port 0xd80 iomem 0xd0000 net irq 5 flags 2 vector isicintr"
.Pp
For a Teles S0/16.3 card:
.Cd options \&"TEL_S0_16_3\&"
.Cd "device isic0 at isa? port 0xd80 net irq 5 flags 3 vector isicintr"
.Pp
For an AVM A1 or AVM Fritz!Card classic:
AVM A1 or AVM Fritz!Card classic:
.Cd options \&"AVM_A1\&"
.Cd "device isic0 at isa? port 0x340 net irq 5 flags 4 vector isicintr"
.Cd "device isic0 at isa? port 0x340 irq 5 flags 4"
.Pp
For an AVM Fritz!Card PCMCIA:
.Cd options \&"AVM_A1\&"
.Cd options \&"AVM_A1_PCMCIA\&"
.Cd "device isic0 at isa? port 0x340 net irq 5 flags 10 vector isicintr"
.Pp
For an AVM Fritz!Card PnP:
.Cd options \&"AVM_PNP\&"
.Cd "device isic0 at isa? port ? net irq ? vector isicintr"
.Pp
For a Teles S0/16.3 PnP card (PnP):
.Cd options \&"TEL_S0_16_3_P\&"
.Cd "device isic0 at isa? port ? net irq ? vector isicintr"
.Pp
For a Creatix ISDN-S0 P&P card (PnP):
.Cd options \&"CRTX_S0_P\&"
.Cd "device isic0 at isa? port ? net irq ? vector isicintr"
.Pp
For an USRobotics Sportster ISDN TA internal or Stollmann Tina-pp card:
.Cd options \&"USR_STI\&"
.Cd "device isic0 at isa? port 0x268 net irq 5 flags 7 vector isicintr"
.Pp
For an ITK micro ix1 card:
.Cd options \&"ITKIX1\&"
.Cd "device isic0 at isa? port 0x398 net irq 10 flags 18 vector isicintr"
.Pp
For a Dr. Neuhaus Niccy Go@ (PnP):
Dr. Neuhaus Niccy Go@ (PnP):
.Cd options \&"DRN_NGO\&"
.Cd "device isic0 at isa? port ? net irq ? vector isicintr"
.Cd "device isic0"
.Pp
For a Sedlbauer Win Speed card (PnP):
.Cd options \&"SEDLBAUER\&"
.Cd "device isic0 at isa? port ? net irq ? vector isicintr"
.Pp
For a Dynalink IS64PH (PnP):
.Cd options \&"DYNALINK\&"
.Cd "device isic0 at isa? port ? net irq ? vector isicintr"
.Pp
For an ELSA QuickStep 1000pro ISA (PnP):
ELSA QuickStep 1000pro ISA (PnP):
.Cd options \&"ELSA_QS1ISA\&"
.Cd "device isic0 at isa? port ? net irq ? vector isicintr"
.Cd "device isic0"
.Pp
For an ELSA QuickStep 1000pro PCI:
ELSA MicroLink ISDN/PCI (ELSA QuickStep 1000pro PCI):
.Cd options \&"ELSA_QS1PCI\&"
.Cd "device isic0"
.Pp
For a Siemens I-Surf 2.0 PnP:
ELSA PCC-16:
.Cd options \&"ELSA_PCC16\&"
.Cd "device isic0 at isa? port 0x360 irq 10 flags 20"
.Pp
Sedlbauer Win Speed card (PnP):
.Cd options \&"SEDLBAUER\&"
.Cd "device isic0"
.Pp
Siemens I-Surf 2.0 PnP:
.Cd options \&"SIEMENS_ISURF2\&"
.Cd "device isic0 at isa? port ? net irq ? vector isicintr"
.Cd "device isic0"
.Pp
.Ar FreeBSD PnP configuration:
Teles S0/8 or Niccy 1008 card:
.Cd options \&"TEL_S0_8\&"
.Cd "device isic0 at isa? iomem 0xd0000 irq 5 flags 1"
.Pp
To be able to use PnP cards under FreeBSD, you have to add
Teles S0/16 or Creatix ISDN-S0 or Niccy 1016 card:
.Cd options \&"TEL_S0_16\&"
.Cd "device isic0 at isa? port 0xd80 iomem 0xd0000 irq 5 flags 2"
.Pp
.Cd controller pnp0
Teles S0/16.3 card:
.Cd options \&"TEL_S0_16_3\&"
.Cd "device isic0 at isa? port 0xd80 irq 5 flags 3"
.Pp
to you kernel config file.
More, it is recommended to add
Teles S0/16.3 PnP card (PnP) or
Creatix ISDN-S0 P&P card (PnP):
.Cd options \&"TEL_S0_16_3_P\&"
.Cd "device isic0"
.Pp
.Cd options \&"USERCONFIG\&"
.Pp
to your kernel config file to be able to adjust your PnP configuration
in case of trouble.
.Pp
See also:
.Xr pnp 4
and
.Xr boot 8
USRobotics Sportster ISDN TA internal or Stollmann Tina-pp card:
.Cd options \&"USR_STI\&"
.Cd "device isic0 at isa? port 0x268 irq 5 flags 7"
.Pp
.Sh NetBSD SYNOPSIS
On the ISA bus:
.Pp
For a Teles S0/8 or Niccy 1008 card:
Teles S0/8 or Niccy 1008 card:
.Cd options \&"TEL_S0_8\&"
.Cd "isic0 at isa? iomem 0xd0000 irq 5"
.Pp
For a Teles S0/16 or Creatix ISDN-S0 or Niccy 1016 card:
Teles S0/16 or Creatix ISDN-S0 or Niccy 1016 card:
.Cd options \&"TEL_S0_16\&"
.Cd "isic0 at isa? port 0xd80 iomem 0xd0000 irq 5"
.Pp
For a Teles S0/16.3 card:
Teles S0/16.3 card:
.Cd options \&"TEL_S0_16_3\&"
.Cd "isic0 at isa? port 0xd80 irq 5"
.Pp
For an AVM A1 or AVM Fritz card:
AVM A1 or AVM Fritz card:
.Cd options \&"AVM_A1\&"
.Cd "isic0 at isa? port 0x340 irq 5"
.Pp
For an USRobotics Sportster ISDN TA internal or Stollmann Tina-pp card:
USRobotics Sportster ISDN TA internal or Stollmann Tina-pp card:
.Cd options \&"USR_STI\&"
.Cd "isic0 at isa? port 0x268 irq 5"
.Pp
For an ITK ix1 micro card:
ITK ix1 micro card:
.Cd options \&"ITKIX1\&"
.Cd "isic0 at isa? port 0x398 irq 10"
.Pp
On the ISAPNP bus:
.Pp
For a Teles S0/16.3 PnP card
Teles S0/16.3 PnP card
.Cd options \&"TEL_S0_16_3_P\&"
.Cd "isic* at isapnp?"
.Pp
For a Creatix ISDN-S0 P&P card
Creatix ISDN-S0 P&P card
.Cd options \&"CRTX_S0_P\&"
.Cd "isic* at isapnp?"
.Pp
For a Dr. Neuhaus Niccy GO@
Dr. Neuhaus Niccy GO@
.Cd options \&"DRN_NGO\&"
.Cd "isic* at isapnp?"
.Pp
For an ELSA QuickStep 1000pro (ISA version):
ELSA QuickStep 1000pro (ISA version):
.Cd options \&"ELSA_QS1ISA\&"
.Cd "isic* at isapnp?"
.Pp
For a Sedlbauer WinSpeed:
Sedlbauer WinSpeed:
.Cd options \&"SEDLBAUER\&"
.Cd "isic* at isapnp?"
.Pp
For a Dynalink IS64PH:
Dynalink IS64PH:
.Cd options \&"DYNALINK\&"
.Cd "isic* at isapnp?"
.Pp
Cards on the PCI bus:
.Pp
For an ELSA QuickStep 1000pro (PCI version)
ELSA QuickStep 1000pro (PCI version)
.Cd options \&"ELSA_QS1PCI\&"
.Cd "isic* at pci?"
.Pp
Cards on the PCMCIA or PCCARD bus:
.Pp
For an AVM Fritz!Card PCMCIA
AVM Fritz!Card PCMCIA
.Cd options \&"AVM_A1_PCMCIA\&"
.Cd "isic* at pcmcia? function ?"
.Pp
For an ELSA MicroLink ISDN/MC
ELSA MicroLink ISDN/MC
.Cd options \&"ELSA_ISDNMC\&"
.Cd "isic* at pcmcia? function ?"
.Pp
For an ELSA MicroLink MC/all
ELSA MicroLink MC/all
.Cd options \&"ELSA_MCALL\&"
.Cd "isic* at pcmcia? function ?"
.Pp
Cards on the Amiga Zorro bus:
.Pp
For a BSC/ITH ISDN Master, ITH ISDN MasterII or VMC ISDN Blaster
BSC/ITH ISDN Master, ITH ISDN MasterII or VMC ISDN Blaster
.Cd "aster* at zbus?"
.Cd "isic* at aster? port ?"
.Pp
@ -245,8 +208,7 @@ The required (optional under NetBSD)
value is 2.
.Pp
These boards have a jumper which specifies an i/o base address of either
0xd80, 0xe80 or 0xf80.
The remaining necessary configuration values are then
0xd80, 0xe80 or 0xf80. The remaining necessary configuration values are then
programmed at run time by accessing this i/o port.
.Pp
Valid interrupts are 2, 3, 4, 5, 10, 11, 12 or 15.
@ -320,8 +282,7 @@ Valid i/o port values are 0x200, 0x208, 0x210, 0x218, 0x220, 0x228, 0x230,
Valid interrupt configurations are 5, 7, 10, 11, 12, 14, 15.
.Pp
Notice: this card has a strange address decoding scheme resulting in 64
windows of some bytes length.
Anyway, support for this card is good because
windows of some bytes length. Anyway, support for this card is good because
the manufacturer gave out technical docs for this card!
.Pp
.Pp
@ -335,23 +296,12 @@ The card is auto-configured by the PnP kernel subsystem.
.Pp
.It Ar "Sedlbauer Win Speed"
.Pp
Valid i/o port values must be in the range 0x100 ... 0x3f0.
(alignment 0x8,
Valid i/o port values must be in the range 0x100 ... 0x3f0. (alignment 0x8,
len 0x8)
.Pp
Valid interrupt configurations are 3, 4, 5, 7, 10, 11, 12, 13, 15.
.Pp
The card is auto-configured by the PnP kernel subsystem.
.Em FreeBSD:
This card is PnP only, and so it can be configured using USERCONFIG
('man 4 pnp'). This can be done via
.Em /kernel.config
\&. For example:
.Pp
.Cd USERCONFIG
.Cd pnp 1 0 os enable port0 0x270 irq0 10
.Cd quit
.Pp
.Pp
.It Ar "ELSA QuickStep 1000pro (ISA)"
.Pp
@ -389,8 +339,7 @@ Note that currently, you have to jumper the card interupt for
.Em IPL 2
instead of IPL 6 (which is used by most AmigaOS software).
.Pp
Note that the ITH ISDN MasterII doesn't work in the DraCo Zorro bus.
This
Note that the ITH ISDN MasterII doesn't work in the DraCo Zorro bus. This
is no NetBSD problem, but general.
.El
.Pp

77
usr.sbin/i4b/man/iwic.4 Normal file
View File

@ -0,0 +1,77 @@
.\"
.\" 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.
.\"
.\" $Id: iwic.4,v 1.2 2000/03/16 15:25:05 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Thu Mar 16 16:27:46 2000]
.\"
.Dd July 30, 1999
.Dt IWIC 4
.Os
.Sh NAME
.Nm iwic
.Nd isdn4bsd Winbond ISDN Chip device driver
.Sh SYNOPSIS
.Pp
.Cd "device iwic0"
.Pp
.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.
.Pp
.Sh SUPPORTED CARDS
.Pp
.Bl -tag -width Ds -compact -offset
.It Ar ASUSCOM P-IN100-ST-D
.Pp
.It Ar Dynalink IS64PPH
.El
.Pp
.Sh CAVEATS
The driver is still in a somewhat experimental state.
.Pp
.Sh BUGS
Layer 1 persistent deactivation not yet implemented.
.Sh STANDARDS
CCITT Recommendation I.430
.Sh SEE ALSO
.Xr i4bq921 4
.Xr i4bq931 4
.Sh AUTHOR
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@kts.org .