+
+
+ mISDNport = mISDNport->next;
+ }
+
+}
+#else
+int mISDN_handler(void)
+{
+ int ret;
+ struct mISDNport *mISDNport;
+ class PmISDN *isdnport;
+ int i;
+ msg_t *msg;
+ iframe_t *frm;
+ msg_t *dmsg;
+ mISDNuser_head_t *hh;
+ net_stack_t *nst;
+
+ /* the que avoids loopbacks when replying to stack after receiving
+ * from stack. */
+ mISDNport = mISDNport_first;
+ while(mISDNport)
+ {
+ /* process turning on/off rx */
+ i = 0;
+ while(i < mISDNport->b_num)
+ {
+ isdnport=mISDNport->b_port[i];
+ if (isdnport)
+ {
+ /* call bridges in user space OR crypto OR recording */
+ if (isdnport->p_m_joindata || isdnport->p_m_crypt_msg_loops || isdnport->p_m_crypt_listen || isdnport->p_record)
+ {
+ /* rx IS required */
+ if (isdnport->p_m_rxoff)
+ {
+ /* turn on RX */
+ isdnport->p_m_rxoff = 0;
+ PDEBUG(DEBUG_BCHANNEL, "%s: receive data is required, so we turn them on\n");
+ if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
+ ph_control(mISDNport, isdnport, mISDNport->b_addr[isdnport->p_m_b_index], CMX_RECEIVE_ON, 0, "DSP-RXOFF", 0);
+ return(1);
+ }
+ } else
+ {
+ /* rx NOT required */
+ if (!isdnport->p_m_rxoff)
+ {
+ /* turn off RX */
+ isdnport->p_m_rxoff = 1;
+ PDEBUG(DEBUG_BCHANNEL, "%s: receive data is not required, so we turn them off\n");
+ if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
+ ph_control(mISDNport, isdnport, mISDNport->b_addr[isdnport->p_m_b_index], CMX_RECEIVE_OFF, 0, "DSP-RXOFF", 1);
+ return(1);
+ }
+ }
+ /* recording */
+ if (isdnport->p_record)
+ {
+ /* txdata IS required */
+ if (!isdnport->p_m_txdata)
+ {
+ /* turn on RX */
+ isdnport->p_m_txdata = 1;
+ PDEBUG(DEBUG_BCHANNEL, "%s: transmit data is required, so we turn them on\n");
+ if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
+ ph_control(mISDNport, isdnport, mISDNport->b_addr[isdnport->p_m_b_index], CMX_TXDATA_ON, 0, "DSP-TXDATA", 1);
+ return(1);
+ }
+ } else
+ {
+ /* txdata NOT required */
+ if (isdnport->p_m_txdata)
+ {
+ /* turn off RX */
+ isdnport->p_m_txdata = 0;
+ PDEBUG(DEBUG_BCHANNEL, "%s: transmit data is not required, so we turn them off\n");
+ if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
+ ph_control(mISDNport, isdnport, mISDNport->b_addr[isdnport->p_m_b_index], CMX_TXDATA_OFF, 0, "DSP-TXDATA", 0);
+ return(1);
+ }
+ }
+ }
+ i++;
+ }
+#if 0
+ if (mISDNport->l1timeout && now>mISDNport->l1timeout)
+ { ---}
+ PDEBUG(DEBUG_ISDN, "the L1 establish timer expired, we release all pending messages.\n", mISDNport->portnum);
+ mISDNport->l1timeout = 0;
+#endif
+
+ if (mISDNport->l2establish)
+ {
+ if (now-mISDNport->l2establish > 5)
+ {
+ if (mISDNport->ntmode)
+ {
+ PDEBUG(DEBUG_ISDN, "the L2 establish timer expired, we try to establish the link NT portnum=%d.\n", mISDNport->portnum);
+ time(&mISDNport->l2establish);
+ /* establish */
+ dmsg = create_l2msg(DL_ESTABLISH | REQUEST, 0, 0);
+ if (mISDNport->nst.manager_l3(&mISDNport->nst, dmsg))
+ free_msg(dmsg);
+ } else {
+ iframe_t act;
+
+ PDEBUG(DEBUG_ISDN, "the L2 establish timer expired, we try to establish the link TE portnum=%d.\n", mISDNport->portnum);
+ time(&mISDNport->l2establish);
+ /* establish */
+ act.prim = DL_ESTABLISH | REQUEST;
+ act.addr = (mISDNport->upper_id & ~LAYER_ID_MASK) | 3 | FLG_MSG_DOWN;
+ act.dinfo = 0;
+ act.len = 0;
+ mISDN_write(mISDNdevice, &act, mISDN_HEADER_LEN+act.len, TIMEOUT_1SEC);
+ }
+ l1l2l3_trace_header(mISDNport, NULL, DL_ESTABLISH | REQUEST, DIRECTION_OUT);
+ end_trace();
+ return(1);
+ }
+ }
+ if ((dmsg = msg_dequeue(&mISDNport->downqueue)))
+ {
+ if (mISDNport->ntmode)
+ {
+ hh = (mISDNuser_head_t *)dmsg->data;
+ PDEBUG(DEBUG_ISDN, "sending queued NT l3-down-message: prim(0x%x) dinfo(0x%x) msg->len(%d)\n", hh->prim, hh->dinfo, dmsg->len);
+ if (mISDNport->nst.manager_l3(&mISDNport->nst, dmsg))
+ free_msg(dmsg);
+ } else