/* $Id: isdn_concap.c,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $1*2* Linux ISDN subsystem, protocol encapsulation3*4* This software may be used and distributed according to the terms5* of the GNU General Public License, incorporated herein by reference.6*7*/89/* Stuff to support the concap_proto by isdn4linux. isdn4linux - specific10* stuff goes here. Stuff that depends only on the concap protocol goes to11* another -- protocol specific -- source file.12*13*/141516#include <linux/isdn.h>17#include "isdn_x25iface.h"18#include "isdn_net.h"19#include <linux/concap.h>20#include "isdn_concap.h"212223/* The following set of device service operations are for encapsulation24protocols that require for reliable datalink semantics. That means:2526- before any data is to be submitted the connection must explicitly27be set up.28- after the successful set up of the connection is signalled the29connection is considered to be reliably up.3031Auto-dialing ist not compatible with this requirements. Thus, auto-dialing32is completely bypassed.3334It might be possible to implement a (non standardized) datalink protocol35that provides a reliable data link service while using some auto dialing36mechanism. Such a protocol would need an auxiliary channel (i.e. user-user-37signaling on the D-channel) while the B-channel is down.38*/394041static int isdn_concap_dl_data_req(struct concap_proto *concap, struct sk_buff *skb)42{43struct net_device *ndev = concap -> net_dev;44isdn_net_dev *nd = ((isdn_net_local *) netdev_priv(ndev))->netdev;45isdn_net_local *lp = isdn_net_get_locked_lp(nd);4647IX25DEBUG( "isdn_concap_dl_data_req: %s \n", concap->net_dev->name);48if (!lp) {49IX25DEBUG( "isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap -> net_dev -> name, 1);50return 1;51}52lp->huptimer = 0;53isdn_net_writebuf_skb(lp, skb);54spin_unlock_bh(&lp->xmit_lock);55IX25DEBUG( "isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap -> net_dev -> name, 0);56return 0;57}585960static int isdn_concap_dl_connect_req(struct concap_proto *concap)61{62struct net_device *ndev = concap -> net_dev;63isdn_net_local *lp = netdev_priv(ndev);64int ret;65IX25DEBUG( "isdn_concap_dl_connect_req: %s \n", ndev -> name);6667/* dial ... */68ret = isdn_net_dial_req( lp );69if ( ret ) IX25DEBUG("dialing failed\n");70return ret;71}7273static int isdn_concap_dl_disconn_req(struct concap_proto *concap)74{75IX25DEBUG( "isdn_concap_dl_disconn_req: %s \n", concap -> net_dev -> name);7677isdn_net_hangup( concap -> net_dev );78return 0;79}8081struct concap_device_ops isdn_concap_reliable_dl_dops = {82&isdn_concap_dl_data_req,83&isdn_concap_dl_connect_req,84&isdn_concap_dl_disconn_req85};8687/* The following should better go into a dedicated source file such that88this sourcefile does not need to include any protocol specific header89files. For now:90*/91struct concap_proto * isdn_concap_new( int encap )92{93switch ( encap ) {94case ISDN_NET_ENCAP_X25IFACE:95return isdn_x25iface_proto_new();96}97return NULL;98}99100101