- return(0);
- }
-
-#if 0
- chan_trace_header(mISDNport, mISDNport->b_port[i], "BCHANNEL create socket", DIRECTION_OUT);
- add_trace("channel", NULL, "%d", i+1+(i>=15));
- add_trace("socket", NULL, "%d", mISDNport->b_socket[i]);
- end_trace();
-#endif
- return(1);
-}
-#else
- unsigned char buff[1024];
- layer_info_t li;
- mISDN_pid_t pid;
-
- if (bchannel->b_stid)
- {
- CERROR(NULL, NULL, "Stack already created for address 0x%lx\n", bchannel->b_stid);
- return(0);
- }
-
- if (bchannel->b_addr)
- {
- CERROR(NULL, NULL, "Stack already created for address 0x%lx\n", bchannel->b_addr);
- return(0);
- }
-
- /* create new layer */
- CDEBUG(NULL, NULL, "creating new layer for stid 0x%lx.\n" , bchannel->handle);
- memset(&li, 0, sizeof(li));
- memset(&pid, 0, sizeof(pid));
- li.object_id = -1;
- li.extentions = 0;
- li.st = bchannel->handle;
- strcpy(li.name, "B L4");
- li.pid.layermask = ISDN_LAYER((4));
- li.pid.protocol[4] = ISDN_PID_L4_B_USER;
- ret = mISDN_new_layer(bchannel_device, &li);
- if (ret)
- {
- failed_new_layer:
- CERROR(NULL, NULL, "mISDN_new_layer() failed to add bchannel for stid 0x%lx.\n", bchannel->handle);
- goto failed;
- }
- if (!li.id)
- {
- goto failed_new_layer;
- }
- bchannel->b_stid = bchannel->handle;
- bchannel->b_addr = li.id;
- CDEBUG(NULL, NULL, "new layer (b_addr=0x%x)\n", bchannel->b_addr);
-
- /* create new stack */
- pid.protocol[1] = ISDN_PID_L1_B_64TRANS;
- pid.protocol[2] = ISDN_PID_L2_B_TRANS;
- pid.protocol[3] = ISDN_PID_L3_B_DSP;
- pid.protocol[4] = ISDN_PID_L4_B_USER;
- pid.layermask = ISDN_LAYER((1)) | ISDN_LAYER((2)) | ISDN_LAYER((3)) | ISDN_LAYER((4));
- ret = mISDN_set_stack(bchannel_device, bchannel->b_stid, &pid);
- if (ret)
- {
- stack_error:
- CERROR(NULL, NULL, "mISDN_set_stack() failed (ret=%d) to add bchannel stid=0x%lx\n", ret, bchannel->b_stid);
- mISDN_write_frame(bchannel_device, buff, bchannel->b_addr, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
- goto failed;
- }
- ret = mISDN_get_setstack_ind(bchannel_device, bchannel->b_addr);
- if (ret)
- goto stack_error;
-
- /* get layer id */
- bchannel->b_addr = mISDN_get_layerid(bchannel_device, bchannel->b_stid, 4);
- if (!bchannel->b_addr)
- goto stack_error;
-#if 0
- chan_trace_header(mISDNport, mISDNport->b_port[i], "BCHANNEL create stack", DIRECTION_OUT);
- add_trace("channel", NULL, "%d", i+1+(i>=15));
- add_trace("stack", "id", "0x%08x", mISDNport->b_stid[i]);
- add_trace("stack", "address", "0x%08x", mISDNport->b_addr[i]);
- end_trace();
-#endif
-
- return(1);
-
-failed:
- bchannel->b_stid = 0;
- bchannel->b_addr = 0;
- return(0);
+ return 0;
+ }
+
+ /* queue */
+ if (bchannel->b_mode == 1 && queue) {
+ bchannel->nodsp_queue_out = 0;
+ bchannel->nodsp_queue_in = queue * 8;
+ if (bchannel->nodsp_queue_in > QUEUE_BUFFER_MAX-1)
+ bchannel->nodsp_queue_in = QUEUE_BUFFER_MAX-1;
+ bchannel->nodsp_queue = bchannel->nodsp_queue_in; /* store initial load */
+ memset(&bchannel->nodsp_queue_buffer, (options.law=='a')?0x2a:0xff, QUEUE_BUFFER_SIZE);
+ bchannel->queue_sent = 0;
+ } else
+ bchannel->nodsp_queue = 0;
+
+ return 1;