diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/isdn/i4l/isdn_concap.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/isdn/i4l/isdn_concap.c')
-rw-r--r-- | drivers/isdn/i4l/isdn_concap.c | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/drivers/isdn/i4l/isdn_concap.c b/drivers/isdn/i4l/isdn_concap.c new file mode 100644 index 000000000000..83a4f5382bc2 --- /dev/null +++ b/drivers/isdn/i4l/isdn_concap.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /* $Id: isdn_concap.c,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $ | ||
2 | * | ||
3 | * Linux ISDN subsystem, protocol encapsulation | ||
4 | * | ||
5 | * This software may be used and distributed according to the terms | ||
6 | * of the GNU General Public License, incorporated herein by reference. | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | /* Stuff to support the concap_proto by isdn4linux. isdn4linux - specific | ||
11 | * stuff goes here. Stuff that depends only on the concap protocol goes to | ||
12 | * another -- protocol specific -- source file. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | |||
17 | #include <linux/isdn.h> | ||
18 | #include "isdn_x25iface.h" | ||
19 | #include "isdn_net.h" | ||
20 | #include <linux/concap.h> | ||
21 | #include "isdn_concap.h" | ||
22 | |||
23 | |||
24 | /* The following set of device service operations are for encapsulation | ||
25 | protocols that require for reliable datalink semantics. That means: | ||
26 | |||
27 | - before any data is to be submitted the connection must explicitly | ||
28 | be set up. | ||
29 | - after the successful set up of the connection is signalled the | ||
30 | connection is considered to be reliably up. | ||
31 | |||
32 | Auto-dialing ist not compatible with this requirements. Thus, auto-dialing | ||
33 | is completely bypassed. | ||
34 | |||
35 | It might be possible to implement a (non standardized) datalink protocol | ||
36 | that provides a reliable data link service while using some auto dialing | ||
37 | mechanism. Such a protocol would need an auxiliary channel (i.e. user-user- | ||
38 | signaling on the D-channel) while the B-channel is down. | ||
39 | */ | ||
40 | |||
41 | |||
42 | int isdn_concap_dl_data_req(struct concap_proto *concap, struct sk_buff *skb) | ||
43 | { | ||
44 | struct net_device *ndev = concap -> net_dev; | ||
45 | isdn_net_dev *nd = ((isdn_net_local *) ndev->priv)->netdev; | ||
46 | isdn_net_local *lp = isdn_net_get_locked_lp(nd); | ||
47 | |||
48 | IX25DEBUG( "isdn_concap_dl_data_req: %s \n", concap->net_dev->name); | ||
49 | if (!lp) { | ||
50 | IX25DEBUG( "isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap -> net_dev -> name, 1); | ||
51 | return 1; | ||
52 | } | ||
53 | lp->huptimer = 0; | ||
54 | isdn_net_writebuf_skb(lp, skb); | ||
55 | spin_unlock_bh(&lp->xmit_lock); | ||
56 | IX25DEBUG( "isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap -> net_dev -> name, 0); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | |||
61 | int isdn_concap_dl_connect_req(struct concap_proto *concap) | ||
62 | { | ||
63 | struct net_device *ndev = concap -> net_dev; | ||
64 | isdn_net_local *lp = (isdn_net_local *) ndev->priv; | ||
65 | int ret; | ||
66 | IX25DEBUG( "isdn_concap_dl_connect_req: %s \n", ndev -> name); | ||
67 | |||
68 | /* dial ... */ | ||
69 | ret = isdn_net_dial_req( lp ); | ||
70 | if ( ret ) IX25DEBUG("dialing failed\n"); | ||
71 | return ret; | ||
72 | } | ||
73 | |||
74 | int isdn_concap_dl_disconn_req(struct concap_proto *concap) | ||
75 | { | ||
76 | IX25DEBUG( "isdn_concap_dl_disconn_req: %s \n", concap -> net_dev -> name); | ||
77 | |||
78 | isdn_net_hangup( concap -> net_dev ); | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | struct concap_device_ops isdn_concap_reliable_dl_dops = { | ||
83 | &isdn_concap_dl_data_req, | ||
84 | &isdn_concap_dl_connect_req, | ||
85 | &isdn_concap_dl_disconn_req | ||
86 | }; | ||
87 | |||
88 | struct concap_device_ops isdn_concap_demand_dial_dops = { | ||
89 | NULL, /* set this first entry to something like &isdn_net_start_xmit, | ||
90 | but the entry part of the current isdn_net_start_xmit must be | ||
91 | separated first. */ | ||
92 | /* no connection control for demand dial semantics */ | ||
93 | NULL, | ||
94 | NULL, | ||
95 | }; | ||
96 | |||
97 | /* The following should better go into a dedicated source file such that | ||
98 | this sourcefile does not need to include any protocol specific header | ||
99 | files. For now: | ||
100 | */ | ||
101 | struct concap_proto * isdn_concap_new( int encap ) | ||
102 | { | ||
103 | switch ( encap ) { | ||
104 | case ISDN_NET_ENCAP_X25IFACE: | ||
105 | return isdn_x25iface_proto_new(); | ||
106 | } | ||
107 | return NULL; | ||
108 | } | ||