1 /* $Id: isdn_concap.c,v 1.8 2000/05/11 22:29:20 kai Exp $
3 * Linux ISDN subsystem, protocol encapsulation
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 /* Stuff to support the concap_proto by isdn4linux. isdn4linux - specific
22 * stuff goes here. Stuff that depends only on the concap protocol goes to
23 * another -- protocol specific -- source file.
28 #include <linux/isdn.h>
29 #include "isdn_x25iface.h"
31 #include <linux/concap.h>
32 #include "isdn_concap.h"
35 /* The following set of device service operations are for encapsulation
36 protocols that require for reliable datalink semantics. That means:
38 - before any data is to be submitted the connection must explicitly
40 - after the successful set up of the connection is signalled the
41 connection is considered to be reliably up.
43 Auto-dialing ist not compatible with this requirements. Thus, auto-dialing
44 is completely bypassed.
46 It might be possible to implement a (non standardized) datalink protocol
47 that provides a reliable data link service while using some auto dialing
48 mechanism. Such a protocol would need an auxiliary channel (i.e. user-user-
49 signaling on the D-channel) while the B-channel is down.
53 int isdn_concap_dl_data_req(struct concap_proto
*concap
, struct sk_buff
*skb
)
55 struct net_device
*ndev
= concap
-> net_dev
;
56 isdn_net_dev
*nd
= ((isdn_net_local
*) ndev
->priv
)->netdev
;
57 isdn_net_local
*lp
= isdn_net_get_locked_lp(nd
);
59 IX25DEBUG( "isdn_concap_dl_data_req: %s \n", concap
->net_dev
->name
);
61 IX25DEBUG( "isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap
-> net_dev
-> name
, 1);
65 isdn_net_writebuf_skb(lp
, skb
);
66 spin_unlock_bh(&lp
->xmit_lock
);
67 IX25DEBUG( "isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap
-> net_dev
-> name
, 0);
72 int isdn_concap_dl_connect_req(struct concap_proto
*concap
)
74 struct net_device
*ndev
= concap
-> net_dev
;
75 isdn_net_local
*lp
= (isdn_net_local
*) ndev
->priv
;
77 IX25DEBUG( "isdn_concap_dl_connect_req: %s \n", ndev
-> name
);
80 ret
= isdn_net_dial_req( lp
);
81 if ( ret
) IX25DEBUG("dialing failed\n");
85 int isdn_concap_dl_disconn_req(struct concap_proto
*concap
)
87 IX25DEBUG( "isdn_concap_dl_disconn_req: %s \n", concap
-> net_dev
-> name
);
89 isdn_net_hangup( concap
-> net_dev
);
93 struct concap_device_ops isdn_concap_reliable_dl_dops
= {
94 &isdn_concap_dl_data_req
,
95 &isdn_concap_dl_connect_req
,
96 &isdn_concap_dl_disconn_req
99 struct concap_device_ops isdn_concap_demand_dial_dops
= {
100 NULL
, /* set this first entry to something like &isdn_net_start_xmit,
101 but the entry part of the current isdn_net_start_xmit must be
103 /* no connection control for demand dial semantics */
108 /* The following should better go into a dedicated source file such that
109 this sourcefile does not need to include any protocol specific header
112 struct concap_proto
* isdn_concap_new( int encap
)
115 case ISDN_NET_ENCAP_X25IFACE
:
116 return isdn_x25iface_proto_new();