-#else
-int bchannel_handle(void)
-{
- int i;
- struct bchannel *channel;
- iframe_t *frm;
- unsigned char buffer[2048];
- struct mISDNhead *hh = (struct mISDNhead *)buffer;
- int len;
-
- /* no device, no read */
- if (bchannel_device < 0)
- return(0);
-
- /* get message from kernel */
- len = mISDN_read(bchannel_device, buffer, sizeof(buffer), 0);
- if (len < 0)
- {
- if (errno == EAGAIN)
- return(0);
- PERROR("Failed to do mISDN_read()\n");
- return(0);
- }
- if (!len)
- {
-// printf("%s: ERROR: mISDN_read() returns nothing\n");
- return(0);
- }
- frm = (iframe_t *)buffer;
-
- /* global prim */
- switch(frm->prim)
- {
- case MGR_DELLAYER | CONFIRM:
- case MGR_INITTIMER | CONFIRM:
- case MGR_ADDTIMER | CONFIRM:
- case MGR_DELTIMER | CONFIRM:
- case MGR_REMOVETIMER | CONFIRM:
- return(1);
- }
-
- /* find the mISDNport that belongs to the stack */
- channel = bchannel_first;
- while(channel)
- {
- if (frm->addr == channel->b_addr)
- break;
- channel = channel->next;
- }
- if (!channel)
- {
- PERROR("message belongs to no channel: prim(0x%x) addr(0x%x) msg->len(%d)\n", frm->prim, frm->addr, len);
- goto out;
- }
-
- /* b-message */
- switch(frm->prim)
- {
- /* we don't care about confirms, we use rx data to sync tx */
- case PH_DATA | CONFIRM:
- case DL_DATA | CONFIRM:
- break;
-
- /* we receive audio data, we respond to it AND we send tones */
- case PH_DATA | INDICATION:
- case DL_DATA | INDICATION:
- case PH_CONTROL | INDICATION:
- case PH_SIGNAL | INDICATION:
- bchannel_receive(channel, frm->prim, frm->dinfo, (unsigned char *)frm->data.p, frm->len);
- break;
-
- case PH_ACTIVATE | INDICATION:
- case DL_ESTABLISH | INDICATION:
- case PH_ACTIVATE | CONFIRM:
- case DL_ESTABLISH | CONFIRM:
- PDEBUG( "DL_ESTABLISH confirm: bchannel is now activated (address 0x%x).\n", frm->addr);
- bchannel_activated(channel);
- break;
-
- case PH_DEACTIVATE | INDICATION:
- case DL_RELEASE | INDICATION:
- case PH_DEACTIVATE | CONFIRM:
- case DL_RELEASE | CONFIRM:
- PDEBUG("DL_RELEASE confirm: bchannel is now de-activated (address 0x%x).\n", frm->addr);
-// bchannel_deactivated(channel);
- break;
-
- default:
- PERROR("message not handled: prim(0x%x) addr(0x%x) msg->len(%d)\n", frm->prim, frm->addr, len);
- }
-
- out:
- return(1);
-}
-#endif