Commit 20da0277 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Signal incoming calls to ttyI's again

Change the incoming call logic: Incoming calls are signalled to
the net interface code first, then the tty code. It's the lower level's
responsibility to claim the call by issueing ISDN_CMD_ACCEPTD now.
  
Remove some crud which is handled by isdn_common state machines now.
parent adde216b
...@@ -189,7 +189,6 @@ slot_dial(struct fsm_inst *fi, int pr, void *arg) ...@@ -189,7 +189,6 @@ slot_dial(struct fsm_inst *fi, int pr, void *arg)
return retval; return retval;
} }
/* FIXME join? */
static int static int
slot_acceptd(struct fsm_inst *fi, int pr, void *arg) slot_acceptd(struct fsm_inst *fi, int pr, void *arg)
{ {
...@@ -316,11 +315,6 @@ slot_data_ind(struct fsm_inst *fi, int pr, void *arg) ...@@ -316,11 +315,6 @@ slot_data_ind(struct fsm_inst *fi, int pr, void *arg)
if (!skb) if (!skb)
return; return;
} }
/* No network-device found, deliver to tty or raw-channel */
if (isdn_tty_rcv_skb(i, di, channel, skb))
return;
dev_kfree_skb(skb);
#endif #endif
} }
...@@ -339,8 +333,6 @@ slot_icall(struct fsm_inst *fi, int pr, void *arg) ...@@ -339,8 +333,6 @@ slot_icall(struct fsm_inst *fi, int pr, void *arg)
{ {
struct isdn_slot *slot = fi->userdata; struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg; isdn_ctrl *ctrl = arg;
isdn_ctrl cmd;
isdn_net_dev *p;
int sl = slot - slots; int sl = slot - slots;
int retval; int retval;
...@@ -349,23 +341,18 @@ slot_icall(struct fsm_inst *fi, int pr, void *arg) ...@@ -349,23 +341,18 @@ slot_icall(struct fsm_inst *fi, int pr, void *arg)
if (dev->global_flags & ISDN_GLOBAL_STOPPED) if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0; return 0;
strcpy(slot->num, ctrl->parm.setup.phone);
/* Try to find a network-interface which will accept incoming call */ /* Try to find a network-interface which will accept incoming call */
retval = isdn_net_find_icall(ctrl->driver, ctrl->arg, sl, retval = isdn_net_find_icall(ctrl->driver, ctrl->arg, sl,
&ctrl->parm.setup); &ctrl->parm.setup);
/* FIXME */ /* already taken by net now? */
if (retval == 1) { if (fi->state != ST_SLOT_IN)
list_for_each_entry(p, &isdn_net_devs, global_list) { goto out;
if (p->isdn_slot == sl) {
strcpy(cmd.parm.setup.eazmsn, p->mlp->msn); retval = isdn_tty_find_icall(ctrl->driver, ctrl->arg, sl,
isdn_slot_set_usage(sl, (isdn_slot_usage(sl) & ISDN_USAGE_EXCLUSIVE) | ISDN_USAGE_NET); &ctrl->parm.setup);
strcpy(isdn_slot_num(sl), ctrl->parm.setup.phone); out:
isdn_slot_command(sl, ISDN_CMD_ACCEPTD, &cmd);
break;
}
}
}
return 0; return 0;
} }
...@@ -1202,13 +1189,6 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -1202,13 +1189,6 @@ isdn_status_callback(isdn_ctrl * c)
break; break;
switch (r) { switch (r) {
case 0: case 0:
/* No network-device replies.
* Try ttyI's.
* These return 0 on no match, 1 on match and
* 3 on eventually match, if CID is longer.
*/
if (c->command == ISDN_STAT_ICALL)
if ((retval = isdn_tty_find_icall(di, c->arg, &c->parm.setup))) return(retval);
if (divert_if) if (divert_if)
if ((retval = divert_if->stat_callback(c))) if ((retval = divert_if->stat_callback(c)))
return(retval); /* processed */ return(retval); /* processed */
...@@ -1245,65 +1225,16 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -1245,65 +1225,16 @@ isdn_status_callback(isdn_ctrl * c)
dbg_statcallb("ICALL: ret=%d\n", retval); dbg_statcallb("ICALL: ret=%d\n", retval);
return retval; return retval;
break; break;
case ISDN_STAT_CINF:
if (i < 0)
return -1;
dbg_statcallb("CINF: %d %s\n", i, c->parm.num);
if (strcmp(c->parm.num, "0"))
isdn_net_stat_callback(i, c);
isdn_tty_stat_callback(i, c);
break;
case ISDN_STAT_CAUSE:
dbg_statcallb("CAUSE: %d %s\n", i, c->parm.num);
printk(KERN_INFO "isdn: %s,ch%ld cause: %s\n",
isdn_drv_drvid(di), c->arg, c->parm.num);
isdn_tty_stat_callback(i, c);
if (divert_if)
divert_if->stat_callback(c);
break;
case ISDN_STAT_DISPLAY:
dbg_statcallb("DISPLAY: %d %s\n", i, c->parm.display);
isdn_tty_stat_callback(i, c);
if (divert_if)
divert_if->stat_callback(c);
break;
case ISDN_STAT_DHUP: case ISDN_STAT_DHUP:
if (i < 0)
return -1;
dbg_statcallb("DHUP: %d\n", i);
isdn_info_update();
/* Signal hangup to network-devices */
if (isdn_net_stat_callback(i, c))
break;
isdn_v110_stat_callback(&slots[i].iv110, c); isdn_v110_stat_callback(&slots[i].iv110, c);
if (isdn_tty_stat_callback(i, c))
break;
if (divert_if) if (divert_if)
divert_if->stat_callback(c); divert_if->stat_callback(c);
break; break;
case ISDN_STAT_BCONN: case ISDN_STAT_BCONN:
if (i < 0)
return -1;
dbg_statcallb("BCONN: %ld\n", c->arg);
/* Signal B-channel-connect to network-devices */
isdn_info_update();
if (isdn_net_stat_callback(i, c))
break;
isdn_v110_stat_callback(&slots[i].iv110, c); isdn_v110_stat_callback(&slots[i].iv110, c);
if (isdn_tty_stat_callback(i, c))
break;
break; break;
case ISDN_STAT_BHUP: case ISDN_STAT_BHUP:
if (i < 0)
return -1;
dbg_statcallb("BHUP: %d\n", i);
isdn_info_update();
/* Signal hangup to network-devices */
if (isdn_net_stat_callback(i, c))
break;
isdn_v110_stat_callback(&slots[i].iv110, c); isdn_v110_stat_callback(&slots[i].iv110, c);
if (isdn_tty_stat_callback(i, c))
break;
break; break;
#endif #endif
#if 0 // FIXME #if 0 // FIXME
...@@ -2435,8 +2366,6 @@ isdn_slot_map_eaz2msn(int sl, char *msn) ...@@ -2435,8 +2366,6 @@ isdn_slot_map_eaz2msn(int sl, char *msn)
int int
isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl) isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl)
{ {
printk("%s: sl = %d\n", __FUNCTION__, sl);
ctrl->command = cmd; ctrl->command = cmd;
ctrl->driver = isdn_slot_driver(sl); ctrl->driver = isdn_slot_driver(sl);
...@@ -2576,12 +2505,14 @@ isdn_slot_num(int sl) ...@@ -2576,12 +2505,14 @@ isdn_slot_num(int sl)
} }
void void
isdn_slot_set_priv(int sl, void *priv, isdn_slot_set_priv(int sl, int usage, void *priv,
int (*stat_cb)(int sl, isdn_ctrl *ctrl), int (*stat_cb)(int sl, isdn_ctrl *ctrl),
int (*recv_cb)(int sl, struct sk_buff *skb)) int (*recv_cb)(int sl, struct sk_buff *skb))
{ {
BUG_ON(sl < 0); BUG_ON(sl < 0);
slots[sl].usage &= ISDN_USAGE_EXCLUSIVE;
slots[sl].usage |= usage;
slots[sl].priv = priv; slots[sl].priv = priv;
slots[sl].stat_cb = stat_cb; slots[sl].stat_cb = stat_cb;
slots[sl].recv_cb = recv_cb; slots[sl].recv_cb = recv_cb;
......
...@@ -95,7 +95,7 @@ extern void isdn_slot_set_usage(int slot, int usage); ...@@ -95,7 +95,7 @@ extern void isdn_slot_set_usage(int slot, int usage);
extern char *isdn_slot_num(int slot); extern char *isdn_slot_num(int slot);
extern int isdn_slot_m_idx(int slot); extern int isdn_slot_m_idx(int slot);
extern void isdn_slot_set_m_idx(int slot, int midx); extern void isdn_slot_set_m_idx(int slot, int midx);
extern void isdn_slot_set_priv(int sl, void *priv, int (*stat_cb)(int sl, isdn_ctrl *ctrl), int (*recv_cb)(int sl, struct sk_buff *skb)); extern void isdn_slot_set_priv(int sl, int usage, void *priv, int (*stat_cb)(int sl, isdn_ctrl *ctrl), int (*recv_cb)(int sl, struct sk_buff *skb));
extern void *isdn_slot_priv(int sl); extern void *isdn_slot_priv(int sl);
extern int isdn_hard_header_len(void); extern int isdn_hard_header_len(void);
......
...@@ -1202,7 +1202,7 @@ isdn_net_unbind_channel(isdn_net_dev *idev) ...@@ -1202,7 +1202,7 @@ isdn_net_unbind_channel(isdn_net_dev *idev)
if (mlp->ops->unbind) if (mlp->ops->unbind)
mlp->ops->unbind(idev); mlp->ops->unbind(idev);
isdn_slot_set_priv(idev->isdn_slot, NULL, NULL, NULL); isdn_slot_set_priv(idev->isdn_slot, 0, NULL, NULL, NULL);
skb_queue_purge(&idev->super_tx_queue); skb_queue_purge(&idev->super_tx_queue);
...@@ -1230,8 +1230,8 @@ isdn_net_bind_channel(isdn_net_dev *idev, int slot) ...@@ -1230,8 +1230,8 @@ isdn_net_bind_channel(isdn_net_dev *idev, int slot)
int retval = 0; int retval = 0;
idev->isdn_slot = slot; idev->isdn_slot = slot;
isdn_slot_set_priv(idev->isdn_slot, idev, isdn_net_stat_callback, isdn_slot_set_priv(idev->isdn_slot, ISDN_USAGE_NET, idev,
isdn_net_rcv_skb); isdn_net_stat_callback, isdn_net_rcv_skb);
if (mlp->ops->bind) if (mlp->ops->bind)
retval = mlp->ops->bind(idev); retval = mlp->ops->bind(idev);
...@@ -1382,6 +1382,7 @@ accept_icall(struct fsm_inst *fi, int pr, void *arg) ...@@ -1382,6 +1382,7 @@ accept_icall(struct fsm_inst *fi, int pr, void *arg)
isdn_slot_command(idev->isdn_slot, ISDN_CMD_SETL2, &cmd); isdn_slot_command(idev->isdn_slot, ISDN_CMD_SETL2, &cmd);
cmd.arg = mlp->l3_proto << 8; cmd.arg = mlp->l3_proto << 8;
isdn_slot_command(idev->isdn_slot, ISDN_CMD_SETL3, &cmd); isdn_slot_command(idev->isdn_slot, ISDN_CMD_SETL3, &cmd);
isdn_slot_command(idev->isdn_slot, ISDN_CMD_ACCEPTD, &cmd);
idev->dial_timer.expires = jiffies + mlp->dialtimeout; idev->dial_timer.expires = jiffies + mlp->dialtimeout;
idev->dial_event = EV_TIMER_INCOMING; idev->dial_event = EV_TIMER_INCOMING;
...@@ -1861,7 +1862,9 @@ isdn_net_hangup(isdn_net_dev *idev) ...@@ -1861,7 +1862,9 @@ isdn_net_hangup(isdn_net_dev *idev)
del_timer(&idev->dial_timer); del_timer(&idev->dial_timer);
printk(KERN_INFO "%s: local hangup\n", idev->name); printk(KERN_INFO "%s: local hangup\n", idev->name);
isdn_slot_command(idev->isdn_slot, ISDN_CMD_HANGUP, &cmd); // FIXME via state machine
if (idev->isdn_slot >= 0)
isdn_slot_command(idev->isdn_slot, ISDN_CMD_HANGUP, &cmd);
return 1; return 1;
} }
......
...@@ -656,7 +656,7 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m) ...@@ -656,7 +656,7 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
info->isdn_slot = i; info->isdn_slot = i;
isdn_slot_set_m_idx(i, info->line); isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_priv(i, info, isdn_tty_stat_callback, isdn_tty_rcv_skb); isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
info->last_dir = 1; info->last_dir = 1;
info->last_l2 = l2; info->last_l2 = l2;
strcpy(info->last_num, n); strcpy(info->last_num, n);
...@@ -738,7 +738,7 @@ isdn_tty_modem_hup(modem_info * info, int local) ...@@ -738,7 +738,7 @@ isdn_tty_modem_hup(modem_info * info, int local)
isdn_slot_all_eaz(slot); isdn_slot_all_eaz(slot);
info->emu.mdmreg[REG_RINGCNT] = 0; info->emu.mdmreg[REG_RINGCNT] = 0;
isdn_slot_free(slot); isdn_slot_free(slot);
isdn_slot_set_priv(slot, NULL, NULL, NULL); isdn_slot_set_priv(slot, 0, NULL, NULL, NULL);
info->isdn_slot = -1; info->isdn_slot = -1;
} }
...@@ -832,7 +832,7 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m) ...@@ -832,7 +832,7 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
} else { } else {
info->isdn_slot = i; info->isdn_slot = i;
isdn_slot_set_m_idx(i, info->line); isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_priv(i, info, isdn_tty_stat_callback, isdn_tty_rcv_skb); isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING); isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING);
info->last_dir = 1; info->last_dir = 1;
// strcpy(info->last_num, n); // strcpy(info->last_num, n);
...@@ -909,7 +909,7 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg) ...@@ -909,7 +909,7 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
} else { } else {
info->isdn_slot = i; info->isdn_slot = i;
isdn_slot_set_m_idx(i, info->line); isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_priv(i, info, isdn_tty_stat_callback, isdn_tty_rcv_skb); isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING); isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING);
info->last_dir = 1; info->last_dir = 1;
restore_flags(flags); restore_flags(flags);
...@@ -2138,7 +2138,7 @@ isdn_tty_match_icall(char *cid, atemu *emu, int di) ...@@ -2138,7 +2138,7 @@ isdn_tty_match_icall(char *cid, atemu *emu, int di)
* CID is longer. * CID is longer.
*/ */
int int
isdn_tty_find_icall(int di, int ch, setup_parm *setup) isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup)
{ {
char *eaz; char *eaz;
int i; int i;
...@@ -2194,7 +2194,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup) ...@@ -2194,7 +2194,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
if (!matchret) { /* EAZ is matching */ if (!matchret) { /* EAZ is matching */
info->isdn_slot = idx; info->isdn_slot = idx;
isdn_slot_set_m_idx(idx, info->line); isdn_slot_set_m_idx(idx, info->line);
isdn_slot_set_priv(idx, info, isdn_tty_stat_callback, isdn_tty_rcv_skb); isdn_slot_set_priv(idx, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
strcpy(isdn_slot_num(idx), nr); strcpy(isdn_slot_num(idx), nr);
strcpy(info->emu.cpn, eaz); strcpy(info->emu.cpn, eaz);
info->emu.mdmreg[REG_SI1I] = si2bit[si1]; info->emu.mdmreg[REG_SI1I] = si2bit[si1];
......
...@@ -104,7 +104,7 @@ extern void isdn_tty_carrier_timeout(void); ...@@ -104,7 +104,7 @@ extern void isdn_tty_carrier_timeout(void);
extern void isdn_tty_modem_xmit(void); extern void isdn_tty_modem_xmit(void);
extern int isdn_tty_init(void); extern int isdn_tty_init(void);
extern void isdn_tty_readmodem(void); extern void isdn_tty_readmodem(void);
extern int isdn_tty_find_icall(int, int, setup_parm *); extern int isdn_tty_find_icall(int, int, int, setup_parm *);
extern void isdn_tty_cleanup_xmit(modem_info *); extern void isdn_tty_cleanup_xmit(modem_info *);
extern int isdn_tty_capi_facility(capi_msg *cm); extern int isdn_tty_capi_facility(capi_msg *cm);
extern void isdn_tty_at_cout(char *, modem_info *); extern void isdn_tty_at_cout(char *, modem_info *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment