summaryrefslogtreecommitdiffstats
path: root/sys/i4b
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 /sys/i4b
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 'sys/i4b')
-rw-r--r--sys/i4b/include/i4b_ioctl.h21
-rw-r--r--sys/i4b/include/i4b_l3l4.h2
-rw-r--r--sys/i4b/layer3/i4b_l2if.c26
-rw-r--r--sys/i4b/layer3/i4b_q931.c10
-rw-r--r--sys/i4b/layer3/i4b_q931.h20
-rw-r--r--sys/i4b/layer4/i4b_i4bdrv.c3
-rw-r--r--sys/i4b/layer4/i4b_l4.c28
7 files changed, 82 insertions, 28 deletions
diff --git a/sys/i4b/include/i4b_ioctl.h b/sys/i4b/include/i4b_ioctl.h
index 561a131..9f06b10 100644
--- a/sys/i4b/include/i4b_ioctl.h
+++ b/sys/i4b/include/i4b_ioctl.h
@@ -29,27 +29,19 @@
*
* $FreeBSD$
*
- * last edit-date: [Sun Mar 17 10:09:55 2002]
+ * last edit-date: [Tue Mar 26 14:44:15 2002]
*
*---------------------------------------------------------------------------*/
#ifndef _I4B_IOCTL_H_
#define _I4B_IOCTL_H_
-#if 0
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-#ifndef _MACHINE_TYPES_H_
-#include <machine/types.h>
-#endif /* _MACHINE_TYPES_H_ */
-#endif /* __FreeBSD__ */
-#endif
-
/*---------------------------------------------------------------------------*
* version and release number for isdn4bsd package
*---------------------------------------------------------------------------*/
#define VERSION 1 /* version number */
-#define REL 1 /* release number */
-#define STEP 1 /* release step */
+#define REL 2 /* release number */
+#define STEP 0 /* release step */
/*---------------------------------------------------------------------------*
* date/time format in i4b log messages
@@ -172,6 +164,7 @@
* max length of some strings
*---------------------------------------------------------------------------*/
#define TELNO_MAX 41 /* max length of a telephone number (+ '\0') */
+#define SUBADDR_MAX 21 /* max length of a subaddress (+ '\0') */
#define DISPLAY_MAX 91 /* max length of display information (+ '\0') */
#define DATETIME_MAX 21 /* max length of datetime information (+ '\0')*/
#define KEYPAD_MAX 35 /* max length of a keypad string (+ '\0') */
@@ -341,7 +334,9 @@ typedef struct {
#define CHAN_NO (-2) /* call waiting (CW) for incoming */
int bprot; /* b channel protocot, see BPROT_XXX */
char dst_telno[TELNO_MAX]; /* destination telno */
+ char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
char src_telno[TELNO_MAX]; /* source telno */
+ char src_subaddr[SUBADDR_MAX]; /* src subaddr */
int scr_ind;/* screening indicator */
#define SCR_NONE 0 /* no screening indicator transmitted */
#define SCR_USR_NOSC 1 /* screening user provided, not screened*/
@@ -412,7 +407,9 @@ typedef struct {
int driver; /* driver type */
int driver_unit; /* driver unit number */
int cmdlen; /* length of string */
+ int subaddrlen; /* length of subaddr */
char cmd[TELNO_MAX]; /* the number to dial */
+ char subaddr[SUBADDR_MAX]; /* dest subaddr */
} msg_dialoutnumber_ind_t;
/*---------------------------------------------------------------------------*
@@ -572,7 +569,9 @@ typedef struct {
#define ULEN_METHOD_STATIC 0 /* use unitlen_time value (see above) */
#define ULEN_METHOD_DYNAMIC 1 /* use AOCD */
char dst_telno[TELNO_MAX]; /* destination telephone no */
+ char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
char src_telno[TELNO_MAX]; /* source telephone number */
+ char src_subaddr[SUBADDR_MAX]; /* source subaddr */
char keypad[KEYPAD_MAX]; /* keypad string */
} msg_connect_req_t;
diff --git a/sys/i4b/include/i4b_l3l4.h b/sys/i4b/include/i4b_l3l4.h
index b4da38a..290a724 100644
--- a/sys/i4b/include/i4b_l3l4.h
+++ b/sys/i4b/include/i4b_l3l4.h
@@ -147,7 +147,9 @@ typedef struct
int call_state; /* from incoming SETUP */
u_char dst_telno[TELNO_MAX]; /* destination number */
+ u_char dst_subaddr[SUBADDR_MAX]; /* destination subaddr */
u_char src_telno[TELNO_MAX]; /* source number */
+ u_char src_subaddr[SUBADDR_MAX]; /* source subaddr */
int scr_ind; /* screening ind for incoming call */
int prs_ind; /* presentation ind for incoming call */
diff --git a/sys/i4b/layer3/i4b_l2if.c b/sys/i4b/layer3/i4b_l2if.c
index 2c94c31..fda3bc7 100644
--- a/sys/i4b/layer3/i4b_l2if.c
+++ b/sys/i4b/layer3/i4b_l2if.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:29:19 2001]
+ * last edit-date: [Tue Mar 26 15:03:59 2002]
*
*---------------------------------------------------------------------------*/
@@ -422,7 +422,9 @@ i4b_l3_tx_setup(call_desc_t *cd)
u_char *ptr;
int len;
int slen = strlen(cd->src_telno);
+ int sslen = strlen(cd->src_subaddr);
int dlen = strlen(cd->dst_telno);
+ int dslen = strlen(cd->dst_subaddr);
int klen = strlen(cd->keypad);
/*
@@ -437,7 +439,9 @@ i4b_l3_tx_setup(call_desc_t *cd)
len = I_FRAME_HDRLEN +
MSG_SETUP_LEN +
(slen ? (3+slen) : 0) +
+ (sslen ? (3+sslen) : 0) +
(dlen ? (3+dlen) : 0) +
+ (dslen ? (3+dslen) : 0) +
(klen ? (2+klen) : 0) +
(cd->bprot == BPROT_NONE ? 1 : 0);
@@ -521,6 +525,15 @@ i4b_l3_tx_setup(call_desc_t *cd)
ptr += slen;
}
+ if(sslen)
+ {
+ *ptr++ = IEI_CALLINGPS; /* calling subaddr */
+ *ptr++ = IEI_CALLINGPS_LEN+sslen; /* calling subaddr len */
+ *ptr++ = SUBADDR_TYPE_NSAP; /* type = NSAP */
+ strncpy(ptr, cd->src_subaddr, sslen);
+ ptr += sslen;
+ }
+
if(dlen)
{
*ptr++ = IEI_CALLEDPN; /* called party no */
@@ -529,6 +542,15 @@ i4b_l3_tx_setup(call_desc_t *cd)
strncpy(ptr, cd->dst_telno, dlen);
ptr += dlen;
}
+
+ if(dslen)
+ {
+ *ptr++ = IEI_CALLEDPS; /* calling party subaddr */
+ *ptr++ = IEI_CALLEDPS_LEN+dslen;/* calling party subaddr len */
+ *ptr++ = SUBADDR_TYPE_NSAP; /* type = NSAP */
+ strncpy(ptr, cd->dst_subaddr, dslen);
+ ptr += dslen;
+ }
DL_Data_Req(ctrl_desc[cd->controller].unit, m);
}
diff --git a/sys/i4b/layer3/i4b_q931.c b/sys/i4b/layer3/i4b_q931.c
index 89d7a07..52c5b87 100644
--- a/sys/i4b/layer3/i4b_q931.c
+++ b/sys/i4b/layer3/i4b_q931.c
@@ -431,17 +431,21 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
break;
case IEI_CALLINGPS: /* calling party subaddress */
- NDBGL3(L3_P_MSG, "IEI_CALLINGPS");
+ memcpy(cd->src_subaddr, &msg_ptr[3], min(SUBADDR_MAX, msg_ptr[1]-1));
+ cd->src_subaddr[min(SUBADDR_MAX, msg_ptr[1] - 1)] = '\0';
+ NDBGL3(L3_P_MSG, "IEI_CALLINGPS = %s", cd->src_subaddr);
break;
case IEI_CALLEDPN: /* called party number */
memcpy(cd->dst_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1));
- cd->dst_telno[min(TELNO_MAX, msg_ptr [1] - 1)] = '\0';
+ cd->dst_telno[min(TELNO_MAX, msg_ptr[1] - 1)] = '\0';
NDBGL3(L3_P_MSG, "IEI_CALLED = %s", cd->dst_telno);
break;
case IEI_CALLEDPS: /* called party subaddress */
- NDBGL3(L3_P_MSG, "IEI_CALLEDPS");
+ memcpy(cd->dst_subaddr, &msg_ptr[3], min(SUBADDR_MAX, msg_ptr[1]-1));
+ cd->dst_subaddr[min(SUBADDR_MAX, msg_ptr[1] - 1)] = '\0';
+ NDBGL3(L3_P_MSG, "IEI_CALLEDPS = %s", cd->dst_subaddr);
break;
case IEI_REDIRNO: /* redirecting number */
diff --git a/sys/i4b/layer3/i4b_q931.h b/sys/i4b/layer3/i4b_q931.h
index e00a8b4..e09f023b 100644
--- a/sys/i4b/layer3/i4b_q931.h
+++ b/sys/i4b/layer3/i4b_q931.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 Oct 18 13:29:01 2001]
+ * last edit-date: [Tue Mar 26 15:04:33 2002]
*
*---------------------------------------------------------------------------*/
@@ -79,12 +79,12 @@
#define IT_CAP_SPEECH 0x80 /* BC: information xfer capability */
#define IT_CAP_UNR_DIG_INFO 0x88 /* BC: information xfer capability */
-#define IT_RATE_64K 0x90 /* BC: information xfer rate */
-#define IT_UL1_G711A 0xa3 /* layer1 proto G.711 A-law */
+#define IT_RATE_64K 0x90 /* BC: information xfer rate */
+#define IT_UL1_G711A 0xa3 /* layer1 proto G.711 A-law */
#define IEI_CHANNELID_LEN 0x01 /* length of channel id */
-#define CHANNELID_B1 0x81 /* channel = B1 (outgoing) */
-#define CHANNELID_B2 0x82 /* channel = B2 (outgoing) */
+#define CHANNELID_B1 0x81 /* channel = B1 (outgoing) */
+#define CHANNELID_B2 0x82 /* channel = B2 (outgoing) */
#define CHANNELID_ANY 0x83 /* channel = any channel (outgoing) */
#define IE_CHAN_ID_NO 0x00 /* no channel (incoming) */
@@ -94,9 +94,13 @@
#define NUMBER_TYPEPLAN 0x81 /* type of number/numbering plan */
-#define IEI_CALLINGPN_LEN 1 /* without number string ! */
+#define IEI_CALLINGPN_LEN 1 /* without number string ! */
+#define IEI_CALLEDPN_LEN 1 /* without number string ! */
-#define IEI_CALLEDPN_LEN 1 /* without number string ! */
+#define IEI_CALLINGPS_LEN 1
+#define IEI_CALLEDPS_LEN 1
+
+#define SUBADDR_TYPE_NSAP 0x80 /* subaddr: type=NSAP */
/* CONNECT_ACK */
diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c
index 7000add..e0c4d6a 100644
--- a/sys/i4b/layer4/i4b_i4bdrv.c
+++ b/sys/i4b/layer4/i4b_i4bdrv.c
@@ -292,6 +292,9 @@ i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
strcpy(cd->dst_telno, mcr->dst_telno);
strcpy(cd->src_telno, mcr->src_telno);
+ strcpy(cd->dst_subaddr, mcr->dst_subaddr);
+ strcpy(cd->src_subaddr, mcr->src_subaddr);
+
if(mcr->keypad[0] != '\0')
strcpy(cd->keypad, mcr->keypad);
else
diff --git a/sys/i4b/layer4/i4b_l4.c b/sys/i4b/layer4/i4b_l4.c
index 0980862..1f5163b 100644
--- a/sys/i4b/layer4/i4b_l4.c
+++ b/sys/i4b/layer4/i4b_l4.c
@@ -204,6 +204,7 @@ i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd)
if((m = i4b_Dgetmbuf(sizeof(msg_dialoutnumber_ind_t))) != NULL)
{
msg_dialoutnumber_ind_t *md = (msg_dialoutnumber_ind_t *)m->m_data;
+ int i;
md->header.type = MSG_DIALOUTNUMBER_IND;
md->header.cdid = -1;
@@ -211,11 +212,20 @@ i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd)
md->driver = driver;
md->driver_unit = driver_unit;
- if(cmdlen > TELNO_MAX)
- cmdlen = TELNO_MAX;
+ for (i = 0; i < cmdlen; i++)
+ if (cmd[i] == '*')
+ break;
- md->cmdlen = cmdlen;
- bcopy(cmd, md->cmd, cmdlen);
+ /* XXX: TELNO_MAX is _with_ tailing '\0', so max is actually TELNO_MAX - 1 */
+ md->cmdlen = (i < TELNO_MAX - 1 ? i : TELNO_MAX - 1);
+ /* skip the (first) '*' */
+ md->subaddrlen = (cmdlen - i - 1 < SUBADDR_MAX - 1 ? cmdlen - i - 1 : SUBADDR_MAX - 1);
+
+ bcopy(cmd, md->cmd, md->cmdlen);
+ if (md->subaddrlen != -1)
+ bcopy(cmd+i+1, md->subaddr, md->subaddrlen);
+
+ NDBGL4(L4_TIMO, "cmd[%d]=%s, subaddr[%d]=%s", md->cmdlen, md->cmd, md->subaddrlen, md->subaddr);
i4bputqueue(m);
}
}
@@ -365,11 +375,21 @@ i4b_l4_connect_ind(call_desc_t *cd)
else
strcpy(mp->dst_telno, TELNO_EMPTY);
+ if(strlen(cd->dst_subaddr) > 0)
+ strcpy(mp->dst_subaddr, cd->dst_subaddr);
+ else
+ strcpy(mp->dst_subaddr, TELNO_EMPTY);
+
if(strlen(cd->src_telno) > 0)
strcpy(mp->src_telno, cd->src_telno);
else
strcpy(mp->src_telno, TELNO_EMPTY);
+ if(strlen(cd->src_subaddr) > 0)
+ strcpy(mp->src_subaddr, cd->src_subaddr);
+ else
+ strcpy(mp->src_subaddr, TELNO_EMPTY);
+
strcpy(mp->display, cd->display);
mp->scr_ind = cd->scr_ind;
OpenPOWER on IntegriCloud