summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorhm <hm@FreeBSD.org>2002-03-26 15:13:54 +0000
committerhm <hm@FreeBSD.org>2002-03-26 15:13:54 +0000
commit25f947ea149db4604529c9e31feda26269f819e5 (patch)
tree5abe05bd14e0b0acac3cdcf57a344efa514c2941 /usr.sbin
parent35f8225fa61cfd2d64f4156d7ea09e738df689bd (diff)
downloadFreeBSD-src-25f947ea149db4604529c9e31feda26269f819e5.zip
FreeBSD-src-25f947ea149db4604529c9e31feda26269f819e5.tar.gz
Add support for Q.931 subaddresses.
Submitted by: Steven Looman <fsteevie@wish.net>
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/i4b/isdnd/curses.c14
-rw-r--r--usr.sbin/i4b/isdnd/dial.c35
-rw-r--r--usr.sbin/i4b/isdnd/exec.c12
-rw-r--r--usr.sbin/i4b/isdnd/fsm.c8
-rw-r--r--usr.sbin/i4b/isdnd/isdnd.h29
-rw-r--r--usr.sbin/i4b/isdnd/isdnd.rc.557
-rw-r--r--usr.sbin/i4b/isdnd/monitor.c14
-rw-r--r--usr.sbin/i4b/isdnd/msghdl.c18
-rw-r--r--usr.sbin/i4b/isdnd/rc_config.c63
-rw-r--r--usr.sbin/i4b/isdnd/rc_parse.y14
-rw-r--r--usr.sbin/i4b/isdnd/rc_scan.l9
-rw-r--r--usr.sbin/i4b/isdnd/support.c78
-rw-r--r--usr.sbin/i4b/isdnd/timer.c8
-rw-r--r--usr.sbin/i4b/isdndecode/layer3.c8
-rw-r--r--usr.sbin/i4b/isdnphone/main.c18
15 files changed, 284 insertions, 101 deletions
diff --git a/usr.sbin/i4b/isdnd/curses.c b/usr.sbin/i4b/isdnd/curses.c
index cd4191f..19e7af7 100644
--- a/usr.sbin/i4b/isdnd/curses.c
+++ b/usr.sbin/i4b/isdnd/curses.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b daemon - curses fullscreen output
* -------------------------------------
*
- * $Id: curses.c,v 1.36 2000/10/09 12:53:29 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Jun 1 16:24:43 2000]
+ * last edit-date: [Tue Mar 26 14:35:33 2002]
*
*---------------------------------------------------------------------------*/
@@ -408,16 +406,16 @@ display_connect(cfg_entry_t *cep)
if(aliasing)
{
if(cep->direction == DIR_IN)
- snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->real_phone_incoming));
+ snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->real_phone_incoming.number));
else
- snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->remote_phone_dialout));
+ snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->remote_phone_dialout.number));
}
else
{
if(cep->direction == DIR_IN)
- snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->real_phone_incoming);
+ snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->real_phone_incoming.number);
else
- snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->remote_phone_dialout);
+ snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->remote_phone_dialout.number);
}
buffer[H_IFN - H_TELN - 1] = '\0';
diff --git a/usr.sbin/i4b/isdnd/dial.c b/usr.sbin/i4b/isdnd/dial.c
index 0bb362c..5ccbd33 100644
--- a/usr.sbin/i4b/isdnd/dial.c
+++ b/usr.sbin/i4b/isdnd/dial.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 11:05:01 2001]
+ * last edit-date: [Tue Mar 26 14:35:19 2002]
*
*---------------------------------------------------------------------------*/
@@ -55,16 +55,18 @@ select_first_dialno(cfg_entry_t *cep)
if(cep->remote_numbers_count == 1)
{
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[0].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: only one no, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: only one no, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = 0;
return;
}
if(cep->remote_numbers_handling == RNH_FIRST)
{
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[0].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use first, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use first, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = 0;
return;
}
@@ -77,8 +79,9 @@ select_first_dialno(cfg_entry_t *cep)
{
if(cep->remote_numbers_handling == RNH_LAST)
{
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[i].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use last, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[i].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[i].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use last, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = i;
return;
}
@@ -87,8 +90,9 @@ select_first_dialno(cfg_entry_t *cep)
if(++i >= cep->remote_numbers_count)
i = 0;
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[i].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use next, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[i].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[i].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use next, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = i;
return;
}
@@ -97,8 +101,8 @@ select_first_dialno(cfg_entry_t *cep)
if(++i >= cep->remote_numbers_count)
i = 0;
}
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[0].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: no last found (use 0), no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: no last found (use 0), no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = 0;
}
@@ -116,8 +120,9 @@ select_next_dialno(cfg_entry_t *cep)
if(cep->remote_numbers_count == 1)
{
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[0].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_next_dialno: only one no, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_next_dialno: only one no, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = 0;
return;
}
@@ -133,7 +138,7 @@ select_next_dialno(cfg_entry_t *cep)
if(cep->last_remote_number >= cep->remote_numbers_count)
cep->last_remote_number = 0;
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[cep->last_remote_number].number);
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[cep->last_remote_number].number);
DBGL(DL_DIAL, (log(LL_DBG, "select_next_dialno: index=%d, no=%s",
cep->last_remote_number,
diff --git a/usr.sbin/i4b/isdnd/exec.c b/usr.sbin/i4b/isdnd/exec.c
index 6c9ed62..17bc88e 100644
--- a/usr.sbin/i4b/isdnd/exec.c
+++ b/usr.sbin/i4b/isdnd/exec.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Mon Nov 19 15:21:38 2001]
+ * last edit-date: [Tue Mar 26 14:35:46 2002]
*
*---------------------------------------------------------------------------*/
@@ -228,13 +228,13 @@ exec_answer(cfg_entry_t *cep)
/* if destination telephone number avail, add it as argument */
- if(*cep->local_phone_incoming)
- argv[4] = cep->local_phone_incoming;
+ if(*cep->local_phone_incoming.number)
+ argv[4] = cep->local_phone_incoming.number;
/* if source telephone number avail, add it as argument */
- if(*cep->real_phone_incoming)
- argv[6] = cep->real_phone_incoming;
+ if(*cep->real_phone_incoming.number)
+ argv[6] = cep->real_phone_incoming.number;
if(*cep->display)
{
diff --git a/usr.sbin/i4b/isdnd/fsm.c b/usr.sbin/i4b/isdnd/fsm.c
index fc1d2f4..e555fa8 100644
--- a/usr.sbin/i4b/isdnd/fsm.c
+++ b/usr.sbin/i4b/isdnd/fsm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Sat Jul 21 18:25:48 2001]
+ * last edit-date: [Tue Mar 26 14:35:56 2002]
*
*---------------------------------------------------------------------------*/
@@ -210,7 +210,7 @@ F_DFL(cfg_entry_t *cep)
{
cep->dial_count++;
- if(cep->dial_count < cep->dialretries || cep->dialretries == -1) /* Added by FST <mailto:fsteevie@dds.nl> for unlimited dialing (sorry, but I needed it) */
+ if(cep->dial_count < cep->dialretries || cep->dialretries == -1)
{
/* inside normal retry cycle */
@@ -288,7 +288,7 @@ F_ACBR(cfg_entry_t *cep)
{
cep->dial_count++;
- if(cep->dial_count < cep->dialretries || cep->dialretries == -1) /* Added by FST <mailto:fsteevie@dds.nl> for unlimited dialing (sorry, but I needed it) */
+ if(cep->dial_count < cep->dialretries || cep->dialretries == -1)
{
/* inside normal retry cycle */
diff --git a/usr.sbin/i4b/isdnd/isdnd.h b/usr.sbin/i4b/isdnd/isdnd.h
index 8fdf80d..91285f3 100644
--- a/usr.sbin/i4b/isdnd/isdnd.h
+++ b/usr.sbin/i4b/isdnd/isdnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Dec 27 10:16:53 2001]
+ * last edit-date: [Tue Mar 26 14:36:20 2002]
*
*---------------------------------------------------------------------------*/
@@ -208,7 +208,16 @@ enum events
* this struct describes the numbers to try to dial out
*---------------------------------------------------------------------------*/
typedef struct {
+ char number[TELNO_MAX]; /* number */
+ char subaddr[SUBADDR_MAX]; /* subaddr */
+} number_t;
+
+/*---------------------------------------------------------------------------*
+ * this struct describes the numbers to try to dial out
+ *---------------------------------------------------------------------------*/
+typedef struct {
char number[TELNO_MAX]; /* remote number to dial */
+ char subaddr[SUBADDR_MAX]; /* remote subaddr */
int flag; /* usage flag */
#define RNF_IDLE 0
#define RNF_SUCC 1 /* last dial was ok */
@@ -219,6 +228,7 @@ typedef struct {
*---------------------------------------------------------------------------*/
typedef struct {
char number[TELNO_MAX]; /* calling party number */
+ char subaddr[SUBADDR_MAX];/* calling party subaddr */
} incoming_number_t;
/*---------------------------------------------------------------------------*
@@ -250,20 +260,23 @@ typedef struct cfg_entry {
int usrdeviceunit; /* userland unit to use */
int remote_numbers_count; /* number of remote numbers */
+ int remote_subaddr_count; /* number of remote subaddr */
#define MAXRNUMBERS 8 /* max remote numbers */
remote_number_t remote_numbers[MAXRNUMBERS]; /* remote numbers to dial */
+
int remote_numbers_handling; /* how to handle the remote dialing */
#define RNH_NEXT 0 /* use next number after last successfull */
#define RNH_LAST 1 /* use last successfull for next call */
#define RNH_FIRST 2 /* always use first number for next call */
- char local_phone_dialout[TELNO_MAX]; /* our number to tell remote*/
- char local_phone_incoming[TELNO_MAX]; /* answer calls for this local number */
+ number_t local_phone_dialout; /* our number to tell remote*/
+ number_t local_phone_incoming; /* answer calls for this local number */
#define MAX_INCOMING 8
int incoming_numbers_count; /* number of incoming allowed numbers */
+ int incoming_subaddr_count; /* number of incoming allowed subaddr */
incoming_number_t remote_phone_incoming[MAX_INCOMING]; /* answer calls from this remote machine */
int dialin_reaction; /* what to do with incoming calls */
@@ -340,6 +353,8 @@ typedef struct cfg_entry {
#define DIR_INONLY 1
#define DIR_OUTONLY 2
+ int usesubaddr; /* use subaddresses */
+
int budget_callbackperiod; /* length of a budget period (s)*/
int budget_callbackncalls; /* call budget for a period */
char *budget_callbacks_file; /* filename to store callback stats */
@@ -438,11 +453,11 @@ typedef struct cfg_entry {
int hangup; /* flag, hangup connection asap */
- char real_phone_incoming[TELNO_MAX]; /* real remote telno in case of wildcard */
+ number_t real_phone_incoming; /* real remote telno in case of wildcard */
int last_remote_number; /* index of last used dialout number*/
- char remote_phone_dialout[TELNO_MAX]; /* used remote number to dial */
+ number_t remote_phone_dialout; /* used remote number to dial */
int direction; /* incoming or outgoing */
#define DIR_IN 0
@@ -752,7 +767,7 @@ int exec_answer ( cfg_entry_t *cep );
int exec_connect_prog ( cfg_entry_t *cep, const char *prog, int link_down );
pid_t exec_prog ( char *prog, char **arglist );
cfg_entry_t * find_by_device_for_dialout ( int drivertype, int driverunit );
-cfg_entry_t *find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, char *cmd);
+cfg_entry_t *find_by_device_for_dialoutnumber(msg_dialoutnumber_ind_t *mp);
cfg_entry_t *find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd);
cfg_entry_t * find_matching_entry_incoming ( msg_connect_ind_t *mp );
cfg_entry_t * find_active_entry_by_driver ( int drivertype, int driverunit );
diff --git a/usr.sbin/i4b/isdnd/isdnd.rc.5 b/usr.sbin/i4b/isdnd/isdnd.rc.5
index 4ede33e..1533b93 100644
--- a/usr.sbin/i4b/isdnd/isdnd.rc.5
+++ b/usr.sbin/i4b/isdnd/isdnd.rc.5
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -24,9 +24,9 @@
.\"
.\" $FreeBSD$
.\"
-.\" last edit-date: [Sat Jul 21 13:27:41 2001]
+.\" last edit-date: [Tue Mar 26 14:35:02 2002]
.\"
-.Dd July 21, 2001
+.Dd March 26, 2002
.Dt ISDND.RC 5
.Os
.Sh NAME
@@ -577,6 +577,15 @@ out to a remote site, the number specified here is put into the
This keyword is mandatory for the
.Em ipr
user-land interfaces.
+.It Li local-subaddr-dialout
+The local subaddress used when the local site dials out.
+When dialing
+out to a remote site, the subaddress specified here is put into the
+.Em "Calling Party Subaddress Information Element" .
+.Pp
+This keyword is mandatory for the
+.Em ipr
+user-land interfaces.
.It Li local-phone-incoming
The local telephone number used for verifying the destination of incoming
calls.
@@ -590,6 +599,19 @@ got from the telephone exchange.
This keyword is mandatory for the
.Em ipr
interfaces.
+.It Li local-subaddr-incoming
+The local subaddress used for verifying the destination of incoming
+calls.
+When a remote site dials in, this subaddress is used to verify that it
+is the local site which the remote site wants to connect to.
+It is compared
+with the
+.Em "Called Party Subaddress Information Element"
+got from the telephone exchange.
+.Pp
+This keyword is mandatory for the
+.Em ipr
+interfaces.
.It Li name
Defines a symbolic name for this configuration entry.
Its purpose is to
@@ -757,6 +779,17 @@ This keyword is mandatory for the
interfaces.
It may be specified more than once to try to dial to several
numbers until one succeeds.
+.It Li remote-subaddr-dialout
+The remote subaddress used when the local site dials out.
+When dialing
+out to a remote site, the subaddress specified here is put into the
+.Em "Called Party Subaddress Information Element" .
+.Pp
+This keyword is mandatory for the
+.Em ipr
+interfaces.
+It may be specified more than once to linked it to the
+remote-phone-dialout numbers until one succeeds.
.It Li remote-phone-incoming
The remote telephone number used to verify an incoming call.
When a remote site
@@ -770,6 +803,19 @@ got from the telephone exchange.
This keyword is mandatory for the ipr interfaces.
.Pp
This keyword may have a wildcard parameter '*' to permit anyone dialing in.
+.It Li remote-subaddr-incoming
+The remote subaddress used to verify an incoming call.
+When a remote site
+dials in, this subaddress is used to verify that it is the correct remote site
+which is herewith authorized to connect into the local system.
+This parameter
+is compared against the
+.Em "Calling Party Subaddress Information Element"
+got from the telephone exchange.
+.Pp
+This keyword is mandatory for the ipr interfaces.
+.Pp
+This keyword may have a wildcard parameter '*' to permit anyone dialing in.
.It Li unitlength
The length of a charging unit in seconds.
This is used in conjunction with
@@ -834,6 +880,11 @@ dialing activities in case of transient failures (such as busy lines).
This parameter is optional and is set to
.Em off
by default.
+.It Li usesubaddr
+is used to enable the use of subaddresses.
+This parameter is optional and is set to
+.Em off
+by default.
.It Li valid
.Em Note :
this feature is considered experimental!
diff --git a/usr.sbin/i4b/isdnd/monitor.c b/usr.sbin/i4b/isdnd/monitor.c
index bd934d1..45952eb 100644
--- a/usr.sbin/i4b/isdnd/monitor.c
+++ b/usr.sbin/i4b/isdnd/monitor.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998,1999 Martin Husemann. All rights reserved.
+ * Copyright (c) 1998, 1999 Martin Husemann. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,11 +33,9 @@
* i4b daemon - network monitor server module
* ------------------------------------------
*
- * $Id: monitor.c,v 1.30 2000/10/09 12:53:29 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon Dec 13 21:47:44 1999]
+ * last edit-date: [Tue Mar 26 14:37:03 2002]
*
*---------------------------------------------------------------------------*/
@@ -1071,13 +1069,13 @@ monitor_evnt_connect(cfg_entry_t *cep)
if(cep->direction == DIR_OUT)
{
- I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->remote_phone_dialout);
- I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_dialout);
+ I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->remote_phone_dialout.number);
+ I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_dialout.number);
}
else
{
- I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->real_phone_incoming);
- I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_incoming);
+ I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->real_phone_incoming.number);
+ I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_incoming.number);
}
monitor_broadcast(mask, evnt, sizeof evnt);
}
diff --git a/usr.sbin/i4b/isdnd/msghdl.c b/usr.sbin/i4b/isdnd/msghdl.c
index d53f578..0d5364a 100644
--- a/usr.sbin/i4b/isdnd/msghdl.c
+++ b/usr.sbin/i4b/isdnd/msghdl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 11:13:29 2001]
+ * last edit-date: [Tue Mar 26 14:37:25 2002]
*
*---------------------------------------------------------------------------*/
@@ -831,7 +831,7 @@ msg_dialoutnumber(msg_dialoutnumber_ind_t *mp)
DBGL(DL_DRVR, (log(LL_DBG, "msg_dialoutnumber: dial req from %s, unit %d", bdrivername(mp->driver), mp->driver_unit)));
- if((cep = find_by_device_for_dialoutnumber(mp->driver, mp->driver_unit, mp->cmdlen, mp->cmd)) == NULL)
+ if((cep = find_by_device_for_dialoutnumber(mp)) == NULL)
{
DBGL(DL_DRVR, (log(LL_DBG, "msg_dialoutnumber: config entry reserved or no match")));
return;
@@ -1216,8 +1216,12 @@ sendm_connect_req(cfg_entry_t *cep)
else
mcr.unitlen_method = ULEN_METHOD_STATIC;
- strcpy(mcr.dst_telno, cep->remote_phone_dialout);
- strcpy(mcr.src_telno, cep->local_phone_dialout);
+ strcpy(mcr.dst_telno, cep->remote_phone_dialout.number);
+ if(cep->usesubaddr)
+ strcpy(mcr.dst_subaddr, cep->remote_phone_dialout.subaddr);
+ strcpy(mcr.src_telno, cep->local_phone_dialout.number);
+ if(cep->usesubaddr)
+ strcpy(mcr.src_subaddr, cep->local_phone_dialout.subaddr);
strcpy(mcr.keypad, cep->keypad);
cep->last_dial_time = time(NULL);
@@ -1236,8 +1240,8 @@ sendm_connect_req(cfg_entry_t *cep)
log(LL_CHD, "%05d %s dialing out from %s to %s",
cep->cdid,
cep->name,
- aliasing ? get_alias(cep->local_phone_dialout) : cep->local_phone_dialout,
- aliasing ? get_alias(cep->remote_phone_dialout) : cep->remote_phone_dialout);
+ aliasing ? get_alias(cep->local_phone_dialout.number) : cep->local_phone_dialout.number,
+ aliasing ? get_alias(cep->remote_phone_dialout.number) : cep->remote_phone_dialout.number);
return(ret);
}
diff --git a/usr.sbin/i4b/isdnd/rc_config.c b/usr.sbin/i4b/isdnd/rc_config.c
index 9d27231..09a2c2e 100644
--- a/usr.sbin/i4b/isdnd/rc_config.c
+++ b/usr.sbin/i4b/isdnd/rc_config.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Wed Dec 26 12:57:07 2001]
+ * last edit-date: [Tue Mar 26 14:37:38 2002]
*
*---------------------------------------------------------------------------*/
@@ -219,6 +219,8 @@ set_config_defaults(void)
cep->state = ST_IDLE;
cep->aoc_valid = AOC_INVALID;
+
+ cep->usesubaddr = 0;
}
}
@@ -769,12 +771,22 @@ cfg_setval(int keyword)
case LOCAL_PHONE_DIALOUT:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_phone_dialout = %s", entrycount, yylval.str)));
- strcpy(cfg_entry_tab[entrycount].local_phone_dialout, yylval.str);
+ strcpy(cfg_entry_tab[entrycount].local_phone_dialout.number, yylval.str);
+ break;
+
+ case LOCAL_SUBADDR_DIALOUT:
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_subaddr_dialout = %s", entrycount, yylval.str)));
+ strcpy(cfg_entry_tab[entrycount].local_phone_dialout.subaddr, yylval.str);
break;
case LOCAL_PHONE_INCOMING:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_phone_incoming = %s", entrycount, yylval.str)));
- strcpy(cfg_entry_tab[entrycount].local_phone_incoming, yylval.str);
+ strcpy(cfg_entry_tab[entrycount].local_phone_incoming.number, yylval.str);
+ break;
+
+ case LOCAL_SUBADDR_INCOMING:
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_subaddr_incoming = %s", entrycount, yylval.str)));
+ strcpy(cfg_entry_tab[entrycount].local_phone_incoming.subaddr, yylval.str);
break;
case MAILER:
@@ -941,6 +953,21 @@ cfg_setval(int keyword)
break;
+ case REMOTE_SUBADDR_DIALOUT:
+ if(cfg_entry_tab[entrycount].remote_subaddr_count >= MAXRNUMBERS)
+ {
+ log(LL_ERR, "ERROR parsing config file: too many remote subaddresses at line %d!", lineno);
+ config_error_flag++;
+ break;
+ }
+
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: remote_subaddr_dialout #%d = %s",
+ entrycount, cfg_entry_tab[entrycount].remote_numbers_count, yylval.str)));
+
+ strcpy(cfg_entry_tab[entrycount].remote_numbers[cfg_entry_tab[entrycount].remote_numbers_count].subaddr, yylval.str);
+
+ break;
+
case REMOTE_NUMBERS_HANDLING:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: remdial_handling = %s", entrycount, yylval.str)));
if(!(strcmp(yylval.str, "next")))
@@ -972,6 +999,21 @@ cfg_setval(int keyword)
}
break;
+ case REMOTE_SUBADDR_INCOMING:
+ {
+ int n;
+ n = cfg_entry_tab[entrycount].incoming_numbers_count;
+ if (n >= MAX_INCOMING)
+ {
+ log(LL_ERR, "ERROR parsing config file: too many \"remote_subaddr_incoming\" entries at line %d!", lineno);
+ config_error_flag++;
+ break;
+ }
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: remote_subaddr_incoming #%d = %s", entrycount, n, yylval.str)));
+ strcpy(cfg_entry_tab[entrycount].remote_phone_incoming[n].subaddr, yylval.str);
+ }
+ break;
+
case RATESFILE:
strcpy(ratesfile, yylval.str);
DBGL(DL_RCCF, (log(LL_DBG, "system: ratesfile = %s", yylval.str)));
@@ -1136,6 +1178,11 @@ cfg_setval(int keyword)
DBGL(DL_RCCF, (log(LL_DBG, "system: useacctfile = %d", yylval.booln)));
break;
+ case USESUBADDR:
+ cfg_entry_tab[entrycount].usesubaddr = yylval.booln;
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: usesubaddr = %d", entrycount, yylval.booln)));
+ break;
+
case USEDOWN:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: usedown = %d", entrycount, yylval.booln)));
cfg_entry_tab[entrycount].usedown = yylval.booln;
@@ -1280,7 +1327,7 @@ check_config(void)
log(LL_ERR, "check_config: remote-phone-dialout not set in entry %d!", i);
error++;
}
- if(strlen(cep->local_phone_dialout) == 0)
+ if(strlen(cep->local_phone_dialout.number) == 0)
{
log(LL_ERR, "check_config: local-phone-dialout not set in entry %d!", i);
error++;
@@ -1291,7 +1338,7 @@ check_config(void)
if(cep->inout != DIR_OUTONLY)
{
- if(strlen(cep->local_phone_incoming) == 0)
+ if(strlen(cep->local_phone_incoming.number) == 0)
{
log(LL_ERR, "check_config: local-phone-incoming not set in entry %d!", i);
error++;
@@ -1616,7 +1663,7 @@ print_config(void)
fprintf(PFILE, "remote-phone-dialout = %s\t\t# telephone number for dialing out to remote\n", cep->remote_numbers[0].number);
}
- fprintf(PFILE, "local-phone-dialout = %s\t\t# show this number to remote when dialling out\n", cep->local_phone_dialout);
+ fprintf(PFILE, "local-phone-dialout = %s\t\t# show this number to remote when dialling out\n", cep->local_phone_dialout.number);
fprintf(PFILE, "dialout-type = %s\n", cep->dialouttype ? "calledback\t\t# i am called back by remote" : "normal\t\t# i am not called back by remote");
}
@@ -1624,7 +1671,7 @@ print_config(void)
{
int n;
- fprintf(PFILE, "local-phone-incoming = %s\t\t# incoming calls must match this (mine) telephone number\n", cep->local_phone_incoming);
+ fprintf(PFILE, "local-phone-incoming = %s\t\t# incoming calls must match this (mine) telephone number\n", cep->local_phone_incoming.number);
for (n = 0; n < cep->incoming_numbers_count; n++)
fprintf(PFILE, "remote-phone-incoming = %s\t\t# this is a valid remote number to call me\n",
cep->remote_phone_incoming[n].number);
diff --git a/usr.sbin/i4b/isdnd/rc_parse.y b/usr.sbin/i4b/isdnd/rc_parse.y
index 529a6a8..6630de9 100644
--- a/usr.sbin/i4b/isdnd/rc_parse.y
+++ b/usr.sbin/i4b/isdnd/rc_parse.y
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Fri Jul 20 19:14:23 2001]
+ * last edit-date: [Tue Mar 26 14:37:50 2002]
*
*---------------------------------------------------------------------------*/
@@ -117,7 +117,9 @@ int controllercount = -1;
%token ISDNTXDELIN
%token ISDNTXDELOUT
%token LOCAL_PHONE_DIALOUT
+%token LOCAL_SUBADDR_DIALOUT
%token LOCAL_PHONE_INCOMING
+%token LOCAL_SUBADDR_INCOMING
%token LOGEVENTS
%token MAILER
%token MAILTO
@@ -147,7 +149,9 @@ int controllercount = -1;
%token REGPROG
%token REMOTE_NUMBERS_HANDLING
%token REMOTE_PHONE_DIALOUT
+%token REMOTE_SUBADDR_DIALOUT
%token REMOTE_PHONE_INCOMING
+%token REMOTE_SUBADDR_INCOMING
%token RESTRICTEDCMD
%token ROTATESUFFIX
%token RTPRIO
@@ -156,6 +160,7 @@ int controllercount = -1;
%token UNITLENGTH
%token UNITLENGTHSRC
%token USEACCTFILE
+%token USESUBADDR
%token USEDOWN
%token USRDEVICENAME
%token USRDEVICEUNIT
@@ -427,7 +432,9 @@ strkeyword: ANSWERPROG { $$ = ANSWERPROG; }
| DISCONNECTPROG { $$ = DISCONNECTPROG; }
| IDLE_ALG_OUT { $$ = IDLE_ALG_OUT; }
| LOCAL_PHONE_INCOMING { $$ = LOCAL_PHONE_INCOMING; }
+ | LOCAL_SUBADDR_INCOMING { $$ = LOCAL_SUBADDR_INCOMING; }
| LOCAL_PHONE_DIALOUT { $$ = LOCAL_PHONE_DIALOUT; }
+ | LOCAL_SUBADDR_DIALOUT { $$ = LOCAL_SUBADDR_DIALOUT; }
| NAME { $$ = NAME; }
| PPP_EXPECT_AUTH { $$ = PPP_EXPECT_AUTH; }
| PPP_EXPECT_NAME { $$ = PPP_EXPECT_NAME; }
@@ -438,7 +445,9 @@ strkeyword: ANSWERPROG { $$ = ANSWERPROG; }
| REACTION { $$ = REACTION; }
| REMOTE_NUMBERS_HANDLING { $$ = REMOTE_NUMBERS_HANDLING; }
| REMOTE_PHONE_INCOMING { $$ = REMOTE_PHONE_INCOMING; }
+ | REMOTE_SUBADDR_INCOMING { $$ = REMOTE_SUBADDR_INCOMING; }
| REMOTE_PHONE_DIALOUT { $$ = REMOTE_PHONE_DIALOUT; }
+ | REMOTE_SUBADDR_DIALOUT { $$ = REMOTE_SUBADDR_DIALOUT; }
| UNITLENGTHSRC { $$ = UNITLENGTHSRC; }
| USRDEVICENAME { $$ = USRDEVICENAME; }
| VALID { $$ = VALID; }
@@ -475,6 +484,7 @@ boolkeyword: BUDGETCALLBACKSFILEROTATE { $$ = BUDGETCALLBACKSFILEROTATE; }
| PPP_AUTH_RECHALLENGE { $$ = PPP_AUTH_RECHALLENGE; }
| PPP_AUTH_PARANOID { $$ = PPP_AUTH_PARANOID; }
| USEDOWN { $$ = USEDOWN; }
+ | USESUBADDR { $$ = USESUBADDR; }
;
/* ================== */
diff --git a/usr.sbin/i4b/isdnd/rc_scan.l b/usr.sbin/i4b/isdnd/rc_scan.l
index 34a55dc..d8cdfb6 100644
--- a/usr.sbin/i4b/isdnd/rc_scan.l
+++ b/usr.sbin/i4b/isdnd/rc_scan.l
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Fri Jul 20 19:14:55 2001]
+ * last edit-date: [Tue Mar 26 14:37:59 2002]
*
*---------------------------------------------------------------------------*/
@@ -128,7 +128,9 @@ isdntime { return ISDNTIME; }
isdntxdel-incoming { return ISDNTXDELIN; }
isdntxdel-outgoing { return ISDNTXDELOUT; }
local-phone-dialout { return LOCAL_PHONE_DIALOUT; }
+local-subaddr-dialout { return LOCAL_SUBADDR_DIALOUT; }
local-phone-incoming { return LOCAL_PHONE_INCOMING; }
+local-subaddr-incoming { return LOCAL_SUBADDR_INCOMING; }
mailer { return MAILER; }
mailto { return MAILTO; }
maxconnecttime { return MAXCONNECTTIME; }
@@ -162,7 +164,9 @@ regexpr { return REGEXPR; }
regprog { return REGPROG; }
remdial-handling { return REMOTE_NUMBERS_HANDLING; }
remote-phone-dialout { return REMOTE_PHONE_DIALOUT; }
+remote-subaddr-dialout { return REMOTE_SUBADDR_DIALOUT; }
remote-phone-incoming { return REMOTE_PHONE_INCOMING; }
+remote-subaddr-incoming { return REMOTE_SUBADDR_INCOMING; }
rotatesuffix { return ROTATESUFFIX; }
rtprio { return RTPRIO; }
system { return SYSTEM; }
@@ -170,6 +174,7 @@ tinainitprog { return TINAINITPROG; }
unitlength { return UNITLENGTH; }
unitlengthsrc { return UNITLENGTHSRC; }
useacctfile { return USEACCTFILE; }
+usesubaddr { return USESUBADDR; }
usrdevicename { return USRDEVICENAME; }
usrdeviceunit { return USRDEVICEUNIT; }
usedown { return USEDOWN; }
diff --git a/usr.sbin/i4b/isdnd/support.c b/usr.sbin/i4b/isdnd/support.c
index 92e5222..cd5e36d 100644
--- a/usr.sbin/i4b/isdnd/support.c
+++ b/usr.sbin/i4b/isdnd/support.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 13:14:55 2001]
+ * last edit-date: [Tue Mar 26 14:38:11 2002]
*
*---------------------------------------------------------------------------*/
@@ -150,7 +150,7 @@ find_by_device_for_dialout(int drivertype, int driverunit)
* find entry by drivertype and driverunit and setup for dialing out
*---------------------------------------------------------------------------*/
cfg_entry_t *
-find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, char *cmd)
+find_by_device_for_dialoutnumber(msg_dialoutnumber_ind_t *mp)
{
cfg_entry_t *cep = NULL;
int i, j;
@@ -161,8 +161,8 @@ find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, cha
/* compare driver type and unit */
- if(!((cep->usrdevicename == drivertype) &&
- (cep->usrdeviceunit == driverunit)))
+ if(!((cep->usrdevicename == mp->driver) &&
+ (cep->usrdeviceunit == mp->driver_unit)))
{
continue;
}
@@ -195,17 +195,31 @@ find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, cha
/* check number and copy to cep->remote_numbers[] */
- for(j = 0; j < cmdlen; j++)
+ for(j = 0; j < mp->cmdlen; j++)
{
- if(!(isdigit(*(cmd+j))))
+ if(!(isdigit(*(mp->cmd+j))))
{
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, dial string contains non-digit at pos %d", i, j)));
return(NULL);
}
/* fill in number to dial */
- cep->remote_numbers[0].number[j] = *(cmd+j);
+ cep->remote_numbers[0].number[j] = *(mp->cmd+j);
}
cep->remote_numbers[0].number[j] = '\0';
+
+/* XXX subaddr does not have to be a digit! isgraph() would be a better idea */
+ for(j = 0; j < mp->subaddrlen; j++)
+ {
+ if(!(isdigit(*(mp->subaddr+j))))
+ {
+ DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, subaddr string contains non-digit at pos %d", i, j)));
+ return(NULL);
+ }
+ /* fill in number to dial */
+ cep->remote_numbers[0].subaddr[j] = *(mp->subaddr+j);
+ }
+ cep->remote_numbers[0].subaddr[j] = '\0';
+
cep->remote_numbers_count = 1;
if((setup_dialout(cep)) == GOOD)
@@ -273,7 +287,7 @@ find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd)
cep->remote_numbers[0].number[0] = '\0';
cep->remote_numbers_count = 0;
- cep->remote_phone_dialout[0] = '\0';
+ cep->remote_phone_dialout.number[0] = '\0';
bzero(cep->keypad, KEYPAD_MAX);
strncpy(cep->keypad, cmd, cmdlen);
@@ -430,31 +444,59 @@ find_matching_entry_incoming(msg_connect_ind_t *mp)
/* check my number */
- if(strncmp(cep->local_phone_incoming, mp->dst_telno, strlen(cep->local_phone_incoming)))
+ if(strncmp(cep->local_phone_incoming.number, mp->dst_telno, strlen(cep->local_phone_incoming.number)))
{
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, myno %s != incomingno %s", i,
- cep->local_phone_incoming, mp->dst_telno)));
+ cep->local_phone_incoming.number, mp->dst_telno)));
+ continue;
+ }
+
+ if (cep->usesubaddr && strncmp(cep->local_phone_incoming.subaddr, mp->dst_subaddr, strlen(cep->local_phone_incoming.subaddr)))
+ {
+ DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, mysubno %s != incomingsubno %s", i,
+ cep->local_phone_incoming.subaddr, mp->dst_subaddr)));
continue;
}
- /* check all allowed remote number's for this entry */
+ /* check all allowed remote number's for this entry */
for (n = 0; n < cep->incoming_numbers_count; n++)
{
incoming_number_t *in = &cep->remote_phone_incoming[n];
- if(in->number[0] == '*')
+
+ if(in->number[0] == '*' && cep->usesubaddr && in->subaddr[0] == '*')
+ break;
+
+ if(in->number[0] == '*' && !cep->usesubaddr)
+ break;
+
+ if(in->number[0] == '*' && cep->usesubaddr && !strncmp(in->subaddr, mp->src_subaddr, strlen(in->subaddr)))
break;
- if(strncmp(in->number, mp->src_telno, strlen(in->number)))
+
+ if(strncmp(in->number, mp->src_telno, strlen(in->number)) && !cep->usesubaddr)
{
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, remno %s != incomingfromno %s", i,
in->number, mp->src_telno)));
}
- else
- break;
+
+ if(strncmp(in->number, mp->src_telno, strlen(in->number)) && cep->usesubaddr && in->subaddr[0] == '*')
+ {
+ DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, remno %s != incomingfromno %s", i,
+ in->number, mp->src_telno)));
+ }
+
+ if(strncmp(in->number, mp->src_telno, strlen(in->number)) && cep->usesubaddr && strncmp(in->subaddr, mp->src_subaddr, strlen(in->subaddr)))
+ {
+ DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, remno %s != incomingfromno %s", i,
+ in->number, mp->src_telno)));
+ }
+
+ break;
}
+
if (n >= cep->incoming_numbers_count)
continue;
-
+
/* check b protocol */
if(cep->b1protocol != mp->bprot)
@@ -583,7 +625,7 @@ find_matching_entry_incoming(msg_connect_ind_t *mp)
/* cp number to real one used */
- strcpy(cep->real_phone_incoming, mp->src_telno);
+ strcpy(cep->real_phone_incoming.number, mp->src_telno);
/* copy display string */
diff --git a/usr.sbin/i4b/isdnd/timer.c b/usr.sbin/i4b/isdnd/timer.c
index 2632137..34c0c43 100644
--- a/usr.sbin/i4b/isdnd/timer.c
+++ b/usr.sbin/i4b/isdnd/timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Fri Jul 20 20:29:28 2001]
+ * last edit-date: [Tue Mar 26 14:38:24 2002]
*
*---------------------------------------------------------------------------*/
@@ -205,8 +205,8 @@ handle_active(cfg_entry_t *cep, time_t now)
{
log(LL_CHD, "%05d %s answering: incoming call from %s to %s",
cep->cdid, cep->name,
- cep->real_phone_incoming,
- cep->local_phone_incoming);
+ cep->real_phone_incoming.number,
+ cep->local_phone_incoming.number);
next_state(cep, EV_MCI);
}
break;
diff --git a/usr.sbin/i4b/isdndecode/layer3.c b/usr.sbin/i4b/isdndecode/layer3.c
index b54479e..12a7633 100644
--- a/usr.sbin/i4b/isdndecode/layer3.c
+++ b/usr.sbin/i4b/isdndecode/layer3.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* layer3.c - decode and print layer 3 (Q.931) information
* -------------------------------------------------------
*
- * $Id: layer3.c,v 1.9 2000/02/21 15:17:17 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon Feb 21 15:54:58 2000]
+ * last edit-date: [Tue Mar 26 14:39:02 2002]
*
*---------------------------------------------------------------------------*/
@@ -501,7 +499,7 @@ layer3(char *pbuf, int n, int off, unsigned char *buf)
sprintf((pbuf+strlen(pbuf)),"0x%02x ", buf[j+i]);
}
- sprintf((pbuf+strlen(pbuf)),"]");
+ sprintf((pbuf+strlen(pbuf)),"]\n");
i += len;
diff --git a/usr.sbin/i4b/isdnphone/main.c b/usr.sbin/i4b/isdnphone/main.c
index c79e779..7be5118 100644
--- a/usr.sbin/i4b/isdnphone/main.c
+++ b/usr.sbin/i4b/isdnphone/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1999, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Wed Oct 17 14:08:44 2001]
+ * last edit-date: [Tue Mar 26 14:39:27 2002]
*
*---------------------------------------------------------------------------*/
@@ -67,13 +67,15 @@ main(int argc, char **argv)
int bschar;
int ret;
int opt_n = 0;
+ int opt_s = 0;
int opt_h = 0;
int opt_k = 0;
char *number = "";
+ char *subaddr = "";
numberbuffer[0] = '\0';
- while ((c = getopt(argc, argv, "dhk:n:u:")) != -1)
+ while ((c = getopt(argc, argv, "dhk:n:s:u:")) != -1)
{
switch(c)
{
@@ -94,6 +96,11 @@ main(int argc, char **argv)
number = optarg;
opt_n = 1;
break;
+
+ case 's':
+ subaddr = optarg;
+ opt_s = 1;
+ break;
case 'u':
opt_unit = atoi(optarg);
@@ -121,7 +128,10 @@ main(int argc, char **argv)
if(opt_n)
{
- sprintf(commandbuffer, "D%s", number);
+ if (opt_s)
+ sprintf(commandbuffer, "D%s*%s", number, subaddr);
+ else
+ sprintf(commandbuffer, "D%s", number);
}
else if(opt_k)
OpenPOWER on IntegriCloud