From owner-freebsd-isdn@FreeBSD.ORG Sun Jul 3 01:03:59 2005 Return-Path: X-Original-To: freebsd-isdn@FreeBSD.org Delivered-To: freebsd-isdn@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EB4E416B2E4; Sun, 3 Jul 2005 01:03:12 +0000 (GMT) (envelope-from ps@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5AF084554A; Sun, 3 Jul 2005 00:56:07 +0000 (GMT) (envelope-from ps@mu.org) Received: by elvis.mu.org (Postfix, from userid 1000) id 1D02860D4C; Sat, 2 Jul 2005 17:16:02 -0700 (PDT) X-Original-To: ps@mu.org Delivered-To: ps@mu.org Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by elvis.mu.org (Postfix) with ESMTP id F2DEF5CA7F for ; Tue, 7 Jun 2005 11:04:08 -0700 (PDT) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 0F8EB55A71; Tue, 7 Jun 2005 18:04:07 +0000 (GMT) (envelope-from owner-freebsd-bugs@freebsd.org) Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id C00F416A41C; Tue, 7 Jun 2005 18:04:06 +0000 (GMT) (envelope-from owner-freebsd-bugs@freebsd.org) X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 197BF16A41C; Tue, 7 Jun 2005 18:04:05 +0000 (GMT) (envelope-from arved@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B130443D4C; Tue, 7 Jun 2005 18:04:04 +0000 (GMT) (envelope-from arved@FreeBSD.org) Received: from freefall.freebsd.org (arved@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j57I44Ek032720; Tue, 7 Jun 2005 18:04:04 GMT (envelope-from arved@freefall.freebsd.org) Received: (from arved@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j57I446I032716; Tue, 7 Jun 2005 18:04:04 GMT (envelope-from arved) From: Tilman Linneweh Message-Id: <200506071804.j57I446I032716@freefall.freebsd.org> To: arved@FreeBSD.org, freebsd-bugs@FreeBSD.org, freebsd-isdn@FreeBSD.org X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Sender: owner-freebsd-bugs@freebsd.org Errors-To: owner-freebsd-bugs@freebsd.org X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on elvis.mu.org X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.0.3 X-Spam-Level: Cc: Subject: Re: bin/73988: ISDN - first dial attempt fails X-BeenThere: freebsd-isdn@freebsd.org List-Id: Using ISDN with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Sun, 03 Jul 2005 01:04:02 -0000 X-Original-Date: Tue, 7 Jun 2005 18:04:04 GMT X-List-Received-Date: Sun, 03 Jul 2005 01:04:02 -0000 Synopsis: ISDN - first dial attempt fails Responsible-Changed-From-To: freebsd-bugs->freebsd-isdn Responsible-Changed-By: arved Responsible-Changed-When: Tue Jun 7 18:03:48 GMT 2005 Responsible-Changed-Why: Over to ISDN Mailinglist http://www.freebsd.org/cgi/query-pr.cgi?pr=73988 _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org" From owner-freebsd-isdn@FreeBSD.ORG Mon Jul 4 11:02:17 2005 Return-Path: X-Original-To: freebsd-isdn@freebsd.org Delivered-To: freebsd-isdn@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8A9EB16A41F for ; Mon, 4 Jul 2005 11:02:17 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5871A43D53 for ; Mon, 4 Jul 2005 11:02:17 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j64B2H4t034556 for ; Mon, 4 Jul 2005 11:02:17 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j64B2Gih034549 for freebsd-isdn@freebsd.org; Mon, 4 Jul 2005 11:02:16 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 4 Jul 2005 11:02:16 GMT Message-Id: <200507041102.j64B2Gih034549@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-isdn@FreeBSD.org Cc: Subject: Current problem reports assigned to you X-BeenThere: freebsd-isdn@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Using ISDN with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2005 11:02:17 -0000 Current FreeBSD problem reports Critical problems Serious problems Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2004/11/16] bin/73988 isdn ISDN - first dial attempt fails o [2005/01/23] kern/76611 isdn i4b itjc bad enums for PIB cycle time o [2005/03/22] kern/79117 isdn iavc(4) for AVM B1 PCI does not attach 3 problems total. From owner-freebsd-isdn@FreeBSD.ORG Tue Jul 5 20:09:40 2005 Return-Path: X-Original-To: freebsd-isdn@freebsd.org Delivered-To: freebsd-isdn@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A545316A41C for ; Tue, 5 Jul 2005 20:09:40 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.swip.net [212.247.154.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D5AD43D46 for ; Tue, 5 Jul 2005 20:09:39 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: gvlK0tOCzrqh9CPROFOFPw== Received: from mp-217-207-252.daxnet.no ([193.217.207.252] verified) by mailfe02.swip.net (CommuniGate Pro SMTP 4.3.4) with ESMTP id 401160603 for freebsd-isdn@freebsd.org; Tue, 05 Jul 2005 22:09:37 +0200 From: Hans Petter Selasky To: freebsd-isdn@freebsd.org Date: Tue, 5 Jul 2005 22:10:32 +0200 User-Agent: KMail/1.7 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507052210.33599.hselasky@c2i.net> Subject: CAPI 2.0 for passive telephony devices X-BeenThere: freebsd-isdn@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: hselasky@c2i.net List-Id: Using ISDN with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2005 20:09:40 -0000 Hi, I'm almost finished integrating CAPI2.0 into I4B. The CAPI interface will have some limitations like that it only supports HDLC and transparent mode. No X.75 and no FAX/Modem yet. I have put CAPI2.0 support into /sys/dev/i4b/layer4/i4b_capidrv.c And it's only 3000 lines long. At the moment I am thinking about the CAPI 2.0 user library. I thought that the Linux way to do it could be supported too. Though I don't recommend using it. Then I have looked at C4B. I have decided to not go with that either, because things get a little complicated when having to use macros every time one is accesing a structure field. So I have created something new: All CAPI structures will now be defined using a new macro "CAPI_MAKE_STRUCT()". Here is an example showing how to use it: #define CH(m)\ m(WORD, wLength,)\ m(WORD, wApp,)\ m(WORD, wCmd,)\ m(WORD, wNum,)\ m(DWORD, dwCid,)\ m(QWORD, qwTest,)\ m(STRUCT, sTest,)\ m(BYTE_ARRAY, sArray, [20])\ CAPI_MAKE_STRUCT(CH); static void test() { struct capi_message msg. CH_DECODED_T ch; u_int16_t len; bzero(&ch, sizeof(ch)); // clear all unused fields CAPI_INIT(CH, &ch); // setup tags for encoder/decoder ch.qwTest = 123; len = capi_encode(&msg, sizeof(msg), &ch); msg.head.wLength = htole16(len); capi_decode(&msg, len, &ch); return; } Here is what CAPI_MAKE_STRUCT() produces: typedef struct CH_DECODED { u_int8_t wLength_WORD; u_int16_t wLength; u_int8_t wApp_WORD; u_int16_t wApp; u_int8_t wCmd_WORD; u_int16_t wCmd; u_int8_t wNum_WORD; u_int16_t wNum; u_int8_t dwCid_DWORD; u_int32_t dwCid; u_int8_t qwTest_QWORD; u_int64_t qwTest; u_int8_t sTest_STRUCT; struct capi_struct sTest; u_int8_t sArray_BYTE_ARRAY; u_int16_t sArray_BYTE_ARRAY_LENGTH; u_int8_t sArray [20]; u_int8_t CH_end; } __attribute__((__packed__)) CH_DECODED_T; typedef struct CH_ENCODED { u_int16_t wLength; u_int16_t wApp; u_int16_t wCmd; u_int16_t wNum; u_int32_t dwCid; u_int64_t qwTest; u_int8_t sTest_Null; u_int8_t sArray [20]; } __attribute__((__packed__)) CH_ENCODED_T; Here is what CAPI_INIT() produces: { (&ch) ->wLength_WORD = 2; (&ch) ->wApp_WORD = 2; (&ch) ->wCmd_WORD = 2; (&ch) ->wNum_WORD = 2; (&ch) ->dwCid_DWORD = 3; (&ch) ->qwTest_QWORD = 4; (&ch) ->sTest_STRUCT = 5; (&ch) ->sArray_BYTE_ARRAY = 6; (&ch) ->sTest . ie = ((void *)0); (&ch) ->sArray_BYTE_ARRAY_LENGTH = sizeof(u_int8_t [20]); (&ch) -> CH_end = 0; }; If one tries to use CAPI_INIT() on the wrong structure it will cause a compilation error! If one enters something wrong in the definition there will most likely be a compilation error. So does anyone have any objections? Else this is the way it is going to be. --HPS From owner-freebsd-isdn@FreeBSD.ORG Wed Jul 6 17:27:53 2005 Return-Path: X-Original-To: freebsd-isdn@freebsd.org Delivered-To: freebsd-isdn@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 81DE016A41C for ; Wed, 6 Jul 2005 17:27:53 +0000 (GMT) (envelope-from steve@krx.nl) Received: from smtp-vbr3.xs4all.nl (smtp-vbr3.xs4all.nl [194.109.24.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2B6BA43D46 for ; Wed, 6 Jul 2005 17:27:52 +0000 (GMT) (envelope-from steve@krx.nl) Received: from minerva.krx.nl (a80-126-90-185.adsl.xs4all.nl [80.126.90.185]) by smtp-vbr3.xs4all.nl (8.13.3/8.13.3) with ESMTP id j66HRmMr024948; Wed, 6 Jul 2005 19:27:48 +0200 (CEST) (envelope-from steve@krx.nl) Received: by minerva.krx.nl (Postfix, from userid 1000) id CC034295; Wed, 6 Jul 2005 19:27:48 +0200 (CEST) Date: Wed, 6 Jul 2005 19:27:48 +0200 From: Steven Looman To: Hans Petter Selasky , freebsd-isdn@freebsd.org Message-ID: <20050706172748.GA11402@minerva.krx.nl> References: <200507052210.33599.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200507052210.33599.hselasky@c2i.net> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by XS4ALL Virus Scanner Cc: Subject: Re: CAPI 2.0 for passive telephony devices X-BeenThere: freebsd-isdn@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Using ISDN with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2005 17:27:53 -0000 On Tue, Jul 05, 2005 at 10:10:32PM +0200, Hans Petter Selasky wrote: > Hi, > Hi, > I'm almost finished integrating CAPI2.0 into I4B. The CAPI interface will have > some limitations like that it only supports HDLC and transparent mode. No > X.75 and no FAX/Modem yet. > Great! > I have put CAPI2.0 support into /sys/dev/i4b/layer4/i4b_capidrv.c > And it's only 3000 lines long. > > At the moment I am thinking about the CAPI 2.0 user library. I thought that > the Linux way to do it could be supported too. Though I don't recommend using > it. Then I have looked at C4B. I have decided to not go with that either, > because things get a little complicated when having to use macros every time > one is accesing a structure field. So I have created something new: > > All CAPI structures will now be defined using a new macro > "CAPI_MAKE_STRUCT()". Here is an example showing how to use it: > > #define CH(m)\ > m(WORD, wLength,)\ > m(WORD, wApp,)\ > m(WORD, wCmd,)\ > m(WORD, wNum,)\ > m(DWORD, dwCid,)\ > m(QWORD, qwTest,)\ > m(STRUCT, sTest,)\ > m(BYTE_ARRAY, sArray, [20])\ > > CAPI_MAKE_STRUCT(CH); > > static void > test() > { > struct capi_message msg. > CH_DECODED_T ch; > > u_int16_t len; > > bzero(&ch, sizeof(ch)); // clear all unused fields > > CAPI_INIT(CH, &ch); // setup tags for encoder/decoder > > ch.qwTest = 123; > > len = capi_encode(&msg, sizeof(msg), &ch); > > msg.head.wLength = htole16(len); > > capi_decode(&msg, len, &ch); > return; > } > > Here is what CAPI_MAKE_STRUCT() produces: > > typedef struct CH_DECODED { u_int8_t wLength_WORD; u_int16_t wLength; > u_int8_t wApp_WORD; u_int16_t wApp; u_int8_t wCmd_WORD; u_int16_t wCmd; > u_int8_t wNum_WORD; u_int16_t wNum; u_int8_t dwCid_DWORD; u_int32_t dwCid; > u_int8_t qwTest_QWORD; u_int64_t qwTest; u_int8_t sTest_STRUCT; > struct capi_struct sTest; u_int8_t sArray_BYTE_ARRAY; > u_int16_t sArray_BYTE_ARRAY_LENGTH; u_int8_t sArray [20]; u_int8_t CH_end; } > __attribute__((__packed__)) CH_DECODED_T; > > typedef struct CH_ENCODED { u_int16_t wLength; u_int16_t wApp; > u_int16_t wCmd; u_int16_t wNum; u_int32_t dwCid; u_int64_t qwTest; > u_int8_t sTest_Null; u_int8_t sArray [20]; } > __attribute__((__packed__)) CH_ENCODED_T; > > Here is what CAPI_INIT() produces: > > { (&ch) ->wLength_WORD = 2; (&ch) ->wApp_WORD = 2; (&ch) ->wCmd_WORD = 2; > (&ch) ->wNum_WORD = 2; (&ch) ->dwCid_DWORD = 3; (&ch) ->qwTest_QWORD = 4; > (&ch) ->sTest_STRUCT = 5; (&ch) ->sArray_BYTE_ARRAY = 6; > (&ch) ->sTest . ie = ((void *)0); > (&ch) ->sArray_BYTE_ARRAY_LENGTH = sizeof(u_int8_t [20]); > (&ch) -> CH_end = 0; }; > > If one tries to use CAPI_INIT() on the wrong structure it will cause a > compilation error! > Eh.. sure, what does it do exactly and why do we need this? I don't think the error checking isn't that usefull either. > If one enters something wrong in the definition there will most likely be a > compilation error. > If you can't guarantee it, why even bother? When people depend on it and you cannot guarantee it will catch the error all is lost. > > So does anyone have any objections? Else this is the way it is going to be. > Can you show any sources? Just showing this isn't that clear to me. > > --HPS > _______________________________________________ > freebsd-isdn@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-isdn > To unsubscribe, send any mail to "freebsd-isdn-unsubscribe@freebsd.org" > From owner-freebsd-isdn@FreeBSD.ORG Wed Jul 6 21:51:12 2005 Return-Path: X-Original-To: freebsd-isdn@freebsd.org Delivered-To: freebsd-isdn@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3084D16A41C for ; Wed, 6 Jul 2005 21:51:12 +0000 (GMT) (envelope-from Thomas.Wintergerst@nord-com.net) Received: from mail0.ewetel.de (mail0.ewetel.de [212.6.122.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 96F6143D46 for ; Wed, 6 Jul 2005 21:51:11 +0000 (GMT) (envelope-from Thomas.Wintergerst@nord-com.net) Received: from kalak.lemuria.local (dialin-80-228-53-154.ewe-ip-backbone.de [80.228.53.154]) by mail0.ewetel.de (8.12.1/8.12.9) with ESMTP id j66Lp622003895; Wed, 6 Jul 2005 23:51:07 +0200 (MEST) Received: from [192.168.2.131] (crest-w2k.lemuria.local [192.168.2.131]) by kalak.lemuria.local (8.13.3/8.13.3) with ESMTP id j66LTjwS024010; Wed, 6 Jul 2005 23:29:50 +0200 (CEST) (envelope-from Thomas.Wintergerst@nord-com.net) Message-ID: <42CC4D64.5020001@nord-com.net> Date: Wed, 06 Jul 2005 23:30:12 +0200 From: Thomas Wintergerst User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stefan Bethke References: <21911322d5cbb54a6a04bcdd92371ab9@lassitu.de> In-Reply-To: <21911322d5cbb54a6a04bcdd92371ab9@lassitu.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-CheckCompat: OK Cc: freebsd-isdn@freebsd.org, Jan Stocker Subject: Re: Asterisk, chan_capi & c4b: overlap dialling X-BeenThere: freebsd-isdn@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: twinterg@gmx.de List-Id: Using ISDN with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2005 21:51:12 -0000 Hi Stefan, First: Sorry, I was "offline" for some time. So the answer comes a little bit late... Stefan Bethke wrote: > First, a great many thanks to Thomas and Jan. Getting C4B and chan_capi > to work was absolutly painless! Many thanks! > > I have just one question at the moment, and it might have nothing to do > with C4B or the FreeBSD port of chan_capi, but I figured I might try > here first: overlap dialling. > > I've got a AVM B1 ISA hooked up to the interal S0 port of a Hicom 100. I > can dial the PBX extensions with an extension like this: > exten => _14XX,1,Dial(CAPI/74:b${EXTEN:2}) > > I can dial my cell phone with a speed dial like entry like this: > exten => 1200,1,Dial,CAPI/74:b001703460140 > > However, I can't figure out how to set up the extension so I can dial > some prefix to get the PBX' dialtone, and then keep on dialling. I tried: > exten => _0.,1,StripMSD,1 > exten => _.,2,Dial,CAPI/74:bBYEXTENSION > > or this: > exten => _15.,1,Dial(CAPI/74:b${EXTEN:2}) > > but so far, nothing works. (I'm mostly trying from a Budgetone 101.) If > I block-dial the entire number (i. e. 15001703460140), the call goes > through, but just dialling 150, then trying to punch in additional > digits does not lead to any connection. > > Any hints? I cannot tell about Asterisk and how it could work. But from the CAPI point of view you will have to perform a Connect-Request without any digits to dial as the Called Party Number. After you get the first message from the ISDN network (Setup Ack, Alerting, Proceeding, etc. within an Info-Indication), you can dial further digits using Info-Requests with the Called Party Number information element containing the digits. I cannot tell how this is possible with Asterisk. Maybe Jan can help (sorry, he is not a member of this list, therefor the CC: and the full quote)? > > > Thanks, > Stefan > -- Thomas Wintergerst From owner-freebsd-isdn@FreeBSD.ORG Thu Jul 7 12:18:58 2005 Return-Path: X-Original-To: freebsd-isdn@freebsd.org Delivered-To: freebsd-isdn@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 580BE16A41C for ; Thu, 7 Jul 2005 12:18:58 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.swip.net [212.247.154.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id D485743D46 for ; Thu, 7 Jul 2005 12:18:57 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: gvlK0tOCzrqh9CPROFOFPw== Received: from mp-217-229-145.daxnet.no ([193.217.229.145] verified) by mailfe06.swip.net (CommuniGate Pro SMTP 4.3.4) with ESMTP id 406375425; Thu, 07 Jul 2005 14:18:55 +0200 From: Hans Petter Selasky To: Steven Looman Date: Thu, 7 Jul 2005 14:19:46 +0200 User-Agent: KMail/1.7 References: <200507052210.33599.hselasky@c2i.net> <20050706172748.GA11402@minerva.krx.nl> In-Reply-To: <20050706172748.GA11402@minerva.krx.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507071419.48273.hselasky@c2i.net> Cc: freebsd-isdn@freebsd.org Subject: Re: CAPI 2.0 for passive telephony devices X-BeenThere: freebsd-isdn@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: hselasky@c2i.net List-Id: Using ISDN with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jul 2005 12:18:58 -0000 On Wednesday 06 July 2005 19:27, Steven Looman wrote: > On Tue, Jul 05, 2005 at 10:10:32PM +0200, Hans Petter Selasky wrote: > > Hi, > > Hi, > > > I'm almost finished integrating CAPI2.0 into I4B. The CAPI interface will > > have some limitations like that it only supports HDLC and transparent > > mode. No X.75 and no FAX/Modem yet. > > Great! > > > I have put CAPI2.0 support into /sys/dev/i4b/layer4/i4b_capidrv.c > > And it's only 3000 lines long. > > > > All CAPI structures will now be defined using a new macro > > "CAPI_MAKE_STRUCT()". Here is an example showing how to use it: > > > > #define CH(m)\ > > m(WORD, wLength,)\ > > m(WORD, wApp,)\ > > m(WORD, wCmd,)\ > > m(WORD, wNum,)\ > > m(DWORD, dwCid,)\ > > m(QWORD, qwTest,)\ > > m(STRUCT, sTest,)\ > > m(BYTE_ARRAY, sArray, [20])\ > > > > CAPI_MAKE_STRUCT(CH); > > > > If one tries to use CAPI_INIT() on the wrong structure it will cause a > > compilation error! > > Eh.. sure, what does it do exactly and why do we need this? I don't think > the error checking isn't that usefull either. We need this to be able to parse CAPI packets. The problem is that not all elements have a constant size. Else one could just have defined a simple "struct { } __packed XXX;" for each packet type. For example "STRUCT" can have a size from 0 to 65535 bytes. So if a packet looks like this: #define XXX(m) \ m(STRUCT, s0) \ m(STRUCT, s1) \ m(WORD, wFlag) and you want to access "wFlag" one cannot do this by a simple offset into the packet, but first have to decode the length of struct "s0" then "s1" and then one is able to read "wFlag". And then the packet can be too short, and in that case "wFlag" should have a value of zero. So to make decoding easy for the applications, they are supposed to use some predefined *DECODED structures, but can also make its own using CAPI_MAKE_STRUCT(), combined with CAPI_INIT() and either capi_encode() or capi_decode() to translate a packet forth or back. Else one ends up with people writing applications that make assumptions about packets, and when those assumptions are not met, the decoding/encoding will fail, even though the packet is CAPI 2.0 compliant. So I've tried to make the packet translation process as simple and safe as possible. By using these macros it is easy to update the system later. Simply by adding a line to a macro, all generated structures and tables related to encoding/decoding of CAPI packets are updated. > Can you show any sources? Just showing this isn't that clear to me. Ok, I just took my working copy (the header file is not finished) an put it at: http://home.c2i.net/hselasky/isdn4bsd/capi/capi20.h.bz2 http://home.c2i.net/hselasky/isdn4bsd/capi/i4b_capidrv.c.bz2 --HPS