diff options
Diffstat (limited to 'usr.sbin/i4b/isdnd')
-rw-r--r-- | usr.sbin/i4b/isdnd/isdnd.8 | 9 | ||||
-rw-r--r-- | usr.sbin/i4b/isdnd/isdnd.h | 8 | ||||
-rw-r--r-- | usr.sbin/i4b/isdnd/isdnd.rc.5 | 19 | ||||
-rw-r--r-- | usr.sbin/i4b/isdnd/main.c | 48 | ||||
-rw-r--r-- | usr.sbin/i4b/isdnd/monitor.c | 22 | ||||
-rw-r--r-- | usr.sbin/i4b/isdnd/msghdl.c | 17 | ||||
-rw-r--r-- | usr.sbin/i4b/isdnd/rc_config.c | 11 | ||||
-rw-r--r-- | usr.sbin/i4b/isdnd/rc_parse.y | 45 | ||||
-rw-r--r-- | usr.sbin/i4b/isdnd/rc_scan.l | 5 | ||||
-rw-r--r-- | usr.sbin/i4b/isdnd/support.c | 9 |
10 files changed, 138 insertions, 55 deletions
diff --git a/usr.sbin/i4b/isdnd/isdnd.8 b/usr.sbin/i4b/isdnd/isdnd.8 index 950614c..f4141da 100644 --- a/usr.sbin/i4b/isdnd/isdnd.8 +++ b/usr.sbin/i4b/isdnd/isdnd.8 @@ -22,9 +22,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: isdnd.8,v 1.24 1999/02/23 16:25:49 hm Exp $ +.\" $Id: isdnd.8,v 1.25 1999/05/20 13:30:36 hm Exp $ .\" -.\" last edit-date: [Tue Feb 23 16:46:26 1999] +.\" last edit-date: [Thu May 20 14:37:42 1999] .\" .Dd February 23, 1999 .Dt isdnd 8 @@ -130,7 +130,10 @@ 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. +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 diff --git a/usr.sbin/i4b/isdnd/isdnd.h b/usr.sbin/i4b/isdnd/isdnd.h index f630a01..08b4db6 100644 --- a/usr.sbin/i4b/isdnd/isdnd.h +++ b/usr.sbin/i4b/isdnd/isdnd.h @@ -27,9 +27,9 @@ * i4b daemon - main header file * ----------------------------- * - * $Id: isdnd.h,v 1.62 1999/04/29 08:27:10 hm Exp $ + * $Id: isdnd.h,v 1.63 1999/05/20 13:30:36 hm Exp $ * - * last edit-date: [Thu Apr 29 09:35:01 1999] + * last edit-date: [Thu May 20 14:44:18 1999] * *---------------------------------------------------------------------------*/ @@ -550,6 +550,8 @@ int isdntime = 0; /* flag, log time from exchange */ char tinainitprog[MAXPATHLEN] = TINA_FILE_DEF; +char rotatesuffix[MAXPATHLEN] = ""; + #else /* !MAIN */ int isdnfd; @@ -623,6 +625,8 @@ int isdntime; char tinainitprog[MAXPATHLEN]; +char rotatesuffix[MAXPATHLEN]; + #endif /* MAIN */ char * bdrivername ( int drivertype ); diff --git a/usr.sbin/i4b/isdnd/isdnd.rc.5 b/usr.sbin/i4b/isdnd/isdnd.rc.5 index 42af1db..6cd2ca0 100644 --- a/usr.sbin/i4b/isdnd/isdnd.rc.5 +++ b/usr.sbin/i4b/isdnd/isdnd.rc.5 @@ -22,11 +22,11 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: isdnd.rc.5,v 1.34 1999/05/03 08:48:25 hm Exp $ +.\" $Id: isdnd.rc.5,v 1.36 1999/07/28 14:17:45 hm Exp $ .\" -.\" last edit-date: [Thu Apr 8 18:29:22 1999] +.\" last edit-date: [Wed Jul 28 15:57:02 1999] .\" -.Dd February, 23, 1999 +.Dd May 20, 1999 .Dt isdnd.rc 5 .Sh NAME .Nm isdnd.rc @@ -91,6 +91,8 @@ Specifies the name of the accounting file which is used when the keyword .Em useacctfile (see below) is set to .Em on . +See also system keyword +.Em rotatesuffix . If this keyword is omitted the system default is used. (optional) .It Li aliasing @@ -203,6 +205,14 @@ expects to find the program below the path 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 +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) + .It Li rtprio Specifies the realtime priority .Nm isdnd @@ -299,6 +309,7 @@ Normal behavior, call the remote site which is supposed to accept the call. .It Ar calledback Callback behavior, call the remote side which rejects the call and calls us back. +.El .It Li dialrandincr When dialing or re-dialing and this parameter is set to @@ -315,7 +326,7 @@ This keyword is used to configure if incoming and outgoing, incoming-only or outgoing only connections are possible. The keyword is optional, the default is .Em inout . -.El + .Pp The currently supported parameters are: .Pp diff --git a/usr.sbin/i4b/isdnd/main.c b/usr.sbin/i4b/isdnd/main.c index 95c4258..3c344f4 100644 --- a/usr.sbin/i4b/isdnd/main.c +++ b/usr.sbin/i4b/isdnd/main.c @@ -27,9 +27,9 @@ * i4b daemon - main program entry * ------------------------------- * - * $Id: main.c,v 1.4 1999/05/23 23:24:08 imp Exp $ + * $Id: main.c,v 1.41 1999/07/30 06:51:13 hm Exp $ * - * last edit-date: [Thu Apr 29 09:41:21 1999] + * last edit-date: [Fri Jul 30 08:14:10 1999] * *---------------------------------------------------------------------------*/ @@ -523,7 +523,10 @@ mloop( else if(ret == -1) { if(errno != EINTR) - log(LL_WRN, "ERROR, select error on isdn device, errno = %d!", errno); + { + log(LL_ERR, "ERROR, select error on isdn device, errno = %d!", errno); + do_exit(1); + } } /* handle timeout and recovery */ @@ -666,9 +669,8 @@ rereadconfig(int dummy) if(config_error_flag) { - log(LL_ERR, "there were %d error(s) in the configuration file, terminating!", config_error_flag); - unlink(PIDFILE); - exit(1); + log(LL_ERR, "rereadconfig: there were %d error(s) in the configuration file, terminating!", config_error_flag); + do_exit(1); } if(aliasing) @@ -687,13 +689,30 @@ reopenfiles(int dummy) { if(useacctfile) { + /* close file */ + fflush(acctfp); fclose(acctfp); + /* if user specified a suffix, rename the old file */ + + if(rotatesuffix[0] != '\0') + { + char filename[MAXPATHLEN]; + + sprintf(filename, "%s%s", acctfile, rotatesuffix); + + if((rename(acctfile, filename)) != 0) + { + log(LL_ERR, "reopenfiles: acct rename failed, cause = %s", strerror(errno)); + do_exit(1); + } + } + if((acctfp = fopen(acctfile, "a")) == NULL) { log(LL_ERR, "ERROR, can't open acctfile %s for writing, terminating!", acctfile); - exit(1); + do_exit(1); } setvbuf(acctfp, (char *)NULL, _IONBF, 0); } @@ -702,6 +721,21 @@ reopenfiles(int dummy) { finish_log(); + /* if user specified a suffix, rename the old file */ + + if(rotatesuffix[0] != '\0') + { + char filename[MAXPATHLEN]; + + sprintf(filename, "%s%s", logfile, rotatesuffix); + + if((rename(logfile, filename)) != 0) + { + log(LL_ERR, "reopenfiles: log rename failed, cause = %s", strerror(errno)); + do_exit(1); + } + } + if((logfp = fopen(logfile, "a")) == NULL) { fprintf(stderr, "ERROR, cannot open logfile %s: %s\n", diff --git a/usr.sbin/i4b/isdnd/monitor.c b/usr.sbin/i4b/isdnd/monitor.c index 9bc09f6..cb72683 100644 --- a/usr.sbin/i4b/isdnd/monitor.c +++ b/usr.sbin/i4b/isdnd/monitor.c @@ -33,9 +33,9 @@ * i4b daemon - network monitor server module * ------------------------------------------ * - * $Id: monitor.c,v 1.9 1999/05/06 08:24:45 hm Exp $ + * $Id: monitor.c,v 1.10 1999/05/30 08:32:30 hm Exp $ * - * last edit-date: [Mon Feb 15 16:42:18 1999] + * last edit-date: [Sun May 30 10:33:05 1999] * * -mh created * @@ -587,23 +587,35 @@ static int monitor_command(int con_index, int fd, int rights) ioctl(fd, FIONREAD, &u); if (u < I4B_MON_CMD_HDR) { if (u == 0) { + log(LL_ERR, "monitor #%d, read 0 bytes", con_index); /* socket closed by peer */ close(fd); return 1; } return 0; /* not enough data there yet */ } + bytes = recv(fd, cmd, I4B_MON_CMD_HDR, MSG_PEEK); + if (bytes < I4B_MON_CMD_HDR) + { + log(LL_ERR, "monitor #%d, read only %d bytes", con_index, bytes); return 0; /* errh? something must be wrong... */ + } + bytes = I4B_GET_2B(cmd, I4B_MON_CMD_LEN); - if (bytes >= sizeof cmd) { + + if (bytes >= sizeof cmd) + { close(fd); - log(LL_ERR, "garbage on monitor connection #%d, closing it", con_index); + log(LL_ERR, "monitor #%d, garbage on connection", con_index); return 1; } + /* now we know the size, it fits, so lets read it! */ - if (read(fd, cmd, bytes) <= 0) { + if (read(fd, cmd, bytes) <= 0) + { + log(LL_ERR, "monitor #%d, read <= 0", con_index); close(fd); return 1; } diff --git a/usr.sbin/i4b/isdnd/msghdl.c b/usr.sbin/i4b/isdnd/msghdl.c index 4d59c26..8f75d01 100644 --- a/usr.sbin/i4b/isdnd/msghdl.c +++ b/usr.sbin/i4b/isdnd/msghdl.c @@ -27,9 +27,9 @@ * i4b daemon - message from kernel handling routines * -------------------------------------------------- * - * $Id: msghdl.c,v 1.60 1999/05/10 19:34:54 hm Exp $ + * $Id: msghdl.c,v 1.61 1999/07/26 11:58:46 hm Exp $ * - * last edit-date: [Mon May 10 21:32:46 1999] + * last edit-date: [Mon Jul 26 13:55:57 1999] * *---------------------------------------------------------------------------*/ @@ -197,6 +197,7 @@ void msg_connect_active_ind(msg_connect_active_ind_t *mp) { cfg_entry_t *cep; + char *device; if((cep = get_cep_by_cdid(mp->header.cdid)) == NULL) { @@ -218,6 +219,8 @@ msg_connect_active_ind(msg_connect_active_ind_t *mp) cep->outbytes = INVALID; cep->hangup = 0; + device = bdrivername(cep->usrdevicename); + /* set the B-channel to active */ if((set_channel_busy(cep->isdncontrollerused, cep->isdnchannelused)) == ERROR) @@ -225,15 +228,17 @@ msg_connect_active_ind(msg_connect_active_ind_t *mp) if(cep->direction == DIR_OUT) { - log(LL_CHD, "%05d %s outgoing call active (ctl %d, ch %d)", + log(LL_CHD, "%05d %s outgoing call active (ctl %d, ch %d, %s%d)", cep->cdid, cep->name, - cep->isdncontrollerused, cep->isdnchannelused); + cep->isdncontrollerused, cep->isdnchannelused, + bdrivername(cep->usrdevicename), cep->usrdeviceunit); } else { - log(LL_CHD, "%05d %s incoming call active (ctl %d, ch %d)", + log(LL_CHD, "%05d %s incoming call active (ctl %d, ch %d, %s%d)", cep->cdid, cep->name, - cep->isdncontrollerused, cep->isdnchannelused); + cep->isdncontrollerused, cep->isdnchannelused, + bdrivername(cep->usrdevicename), cep->usrdeviceunit); } #ifdef USE_CURSES diff --git a/usr.sbin/i4b/isdnd/rc_config.c b/usr.sbin/i4b/isdnd/rc_config.c index b2861a4..455ac12 100644 --- a/usr.sbin/i4b/isdnd/rc_config.c +++ b/usr.sbin/i4b/isdnd/rc_config.c @@ -27,9 +27,9 @@ * i4b daemon - config file processing * ----------------------------------- * - * $Id: rc_config.c,v 1.42 1999/04/29 08:27:10 hm Exp $ + * $Id: rc_config.c,v 1.43 1999/05/20 13:30:36 hm Exp $ * - * last edit-date: [Thu Apr 29 08:49:46 1999] + * last edit-date: [Thu May 20 14:11:26 1999] * *---------------------------------------------------------------------------*/ @@ -141,6 +141,8 @@ set_config_defaults(void) rarr[i].re_flg = 0; } + strcpy(rotatesuffix, ""); + /* entry section cleanup */ for(i=0; i < CFG_ENTRY_MAX; i++, cep++) @@ -627,6 +629,11 @@ cfg_setval(int keyword) nregprog++; break; + case ROTATESUFFIX: + strcpy(rotatesuffix, yylval.str); + DBGL(DL_RCCF, (log(LL_DBG, "system: rotatesuffix = %s", yylval.str))); + break; + case RTPRIO: #ifdef USE_RTPRIO rt_prio = yylval.num; diff --git a/usr.sbin/i4b/isdnd/rc_parse.y b/usr.sbin/i4b/isdnd/rc_parse.y index 2c001c9..b826c39 100644 --- a/usr.sbin/i4b/isdnd/rc_parse.y +++ b/usr.sbin/i4b/isdnd/rc_parse.y @@ -30,9 +30,9 @@ * i4b daemon - runtime configuration parser * ----------------------------------------- * - * $Id: rc_parse.y,v 1.19 1999/04/29 08:27:10 hm Exp $ + * $Id: rc_parse.y,v 1.20 1999/05/20 13:30:36 hm Exp $ * - * last edit-date: [Thu Apr 29 08:46:01 1999] + * last edit-date: [Thu May 20 14:05:26 1999] * *---------------------------------------------------------------------------*/ @@ -72,67 +72,69 @@ int entrycount = -1; %token ACCTALL %token ACCTFILE %token ALERT -%token ALIASING %token ALIASFNAME +%token ALIASING %token ANSWERPROG %token B1PROTOCOL %token BEEPCONNECT %token CALLBACKWAIT %token CALLEDBACKWAIT +%token CALLIN +%token CALLOUT +%token CHANNELSTATE %token CONNECTPROG -%token DIALRETRIES -%token DIALRANDINCR %token DIALOUTTYPE +%token DIALRANDINCR +%token DIALRETRIES %token DIRECTION %token DISCONNECTPROG -%token DOWNTRIES %token DOWNTIME +%token DOWNTRIES %token EARLYHANGUP %token ENTRY +%token FULLCMD %token IDLETIME_IN %token IDLETIME_OUT %token IDLE_ALG_OUT -%token ISDNCONTROLLER %token ISDNCHANNEL +%token ISDNCONTROLLER %token ISDNTIME %token ISDNTXDELIN %token ISDNTXDELOUT %token LOCAL_PHONE_DIALOUT %token LOCAL_PHONE_INCOMING -%token MONITORSW -%token MONITORPORT +%token LOGEVENTS %token MONITOR %token MONITORACCESS -%token FULLCMD -%token RESTRICTEDCMD -%token CHANNELSTATE -%token CALLIN -%token CALLOUT -%token LOGEVENTS +%token MONITORPORT +%token MONITORSW %token NAME %token NO %token OFF %token ON %token RATESFILE -%token RATETYPE -%token REMOTE_NUMBERS_HANDLING -%token REMOTE_PHONE_INCOMING -%token REMOTE_PHONE_DIALOUT +%token RATETYPE %token REACTION %token RECOVERYTIME %token REGEXPR %token REGPROG +%token REMOTE_NUMBERS_HANDLING +%token REMOTE_PHONE_DIALOUT +%token REMOTE_PHONE_INCOMING +%token RESTRICTEDCMD +%token ROTATESUFFIX %token RTPRIO %token SYSTEM %token TINAINITPROG %token UNITLENGTH %token UNITLENGTHSRC %token USEACCTFILE +%token USEDOWN %token USRDEVICENAME %token USRDEVICEUNIT -%token USEDOWN %token YES + %token <str> NUMBERSTR %token <str> STRING @@ -303,7 +305,8 @@ sysnumkeyword: MONITORPORT { $$ = MONITORPORT; } | RTPRIO { $$ = RTPRIO; } ; -sysstrkeyword: REGEXPR { $$ = REGEXPR; } +sysstrkeyword: ROTATESUFFIX { $$ = ROTATESUFFIX; } + | REGEXPR { $$ = REGEXPR; } | REGPROG { $$ = REGPROG; } ; diff --git a/usr.sbin/i4b/isdnd/rc_scan.l b/usr.sbin/i4b/isdnd/rc_scan.l index 66512d8..c1c61e9 100644 --- a/usr.sbin/i4b/isdnd/rc_scan.l +++ b/usr.sbin/i4b/isdnd/rc_scan.l @@ -30,9 +30,9 @@ * i4b daemon - runtime configuration lexical analyzer * --------------------------------------------------- * - * $Id: rc_scan.l,v 1.23 1999/04/29 08:27:10 hm Exp $ + * $Id: rc_scan.l,v 1.24 1999/05/20 13:30:36 hm Exp $ * - * last edit-date: [Thu Apr 29 08:46:36 1999] + * last edit-date: [Thu May 20 14:04:13 1999] * *---------------------------------------------------------------------------*/ @@ -138,6 +138,7 @@ regprog { return REGPROG; } remdial-handling { return REMOTE_NUMBERS_HANDLING; } remote-phone-dialout { return REMOTE_PHONE_DIALOUT; } remote-phone-incoming { return REMOTE_PHONE_INCOMING; } +rotatesuffix { return ROTATESUFFIX; } rtprio { return RTPRIO; } system { return SYSTEM; } tinainitprog { return TINAINITPROG; } diff --git a/usr.sbin/i4b/isdnd/support.c b/usr.sbin/i4b/isdnd/support.c index 8c11259..f0a48fc 100644 --- a/usr.sbin/i4b/isdnd/support.c +++ b/usr.sbin/i4b/isdnd/support.c @@ -27,9 +27,9 @@ * i4b daemon - misc support routines * ---------------------------------- * - * $Id: support.c,v 1.56 1999/04/28 15:37:02 hm Exp $ + * $Id: support.c,v 1.59 1999/07/05 13:46:46 hm Exp $ * - * last edit-date: [Wed Apr 28 17:13:36 1999] + * last edit-date: [Mon Jul 5 15:29:22 1999] * *---------------------------------------------------------------------------*/ @@ -600,7 +600,10 @@ name_of_controller(int ctrl_type, int card_type) "ELSA MicroLink MCall", "ITK ix1 micro", "AVM Fritz!Card PCI", - "ELSA PCC-16" + "ELSA PCC-16", + "AVM Fritz!Card PnP", + "Siemens I-Surf 2.0 PnP", + "Asuscom ISDNlink 128K PnP" }; static char *daic_card[] = { |