diff options
author | hm <hm@FreeBSD.org> | 2002-03-26 15:13:54 +0000 |
---|---|---|
committer | hm <hm@FreeBSD.org> | 2002-03-26 15:13:54 +0000 |
commit | 25f947ea149db4604529c9e31feda26269f819e5 (patch) | |
tree | 5abe05bd14e0b0acac3cdcf57a344efa514c2941 /sys/i4b/layer3 | |
parent | 35f8225fa61cfd2d64f4156d7ea09e738df689bd (diff) | |
download | FreeBSD-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/layer3')
-rw-r--r-- | sys/i4b/layer3/i4b_l2if.c | 26 | ||||
-rw-r--r-- | sys/i4b/layer3/i4b_q931.c | 10 | ||||
-rw-r--r-- | sys/i4b/layer3/i4b_q931.h | 20 |
3 files changed, 43 insertions, 13 deletions
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 */ |