2001-01-05 15:49:52 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2005-02-27 01:31:44 +03:00
|
|
|
*
|
2001-01-05 15:49:52 +03:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* i4b_isppp.c - isdn4bsd kernel SyncPPP driver
|
|
|
|
* --------------------------------------------
|
|
|
|
*
|
|
|
|
* Uses Serge Vakulenko's sppp backend (originally contributed with
|
|
|
|
* the "cx" driver for Cronyx's HDLC-in-hardware device). This driver
|
|
|
|
* is only the glue between sppp and i4b.
|
|
|
|
*
|
2005-12-11 15:16:03 +03:00
|
|
|
* $Id: i4b_isppp.c,v 1.19 2005/12/11 12:25:06 christos Exp $
|
2001-01-05 15:49:52 +03:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*
|
|
|
|
* last edit-date: [Fri Jan 5 11:33:47 2001]
|
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
|
2001-11-13 03:56:55 +03:00
|
|
|
#include <sys/cdefs.h>
|
2005-12-11 15:16:03 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: i4b_isppp.c,v 1.19 2005/12/11 12:25:06 christos Exp $");
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#ifndef __NetBSD__
|
|
|
|
#define USE_ISPPP
|
|
|
|
#endif
|
2002-03-16 19:55:51 +03:00
|
|
|
#include "ippp.h"
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#ifndef USE_ISPPP
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#include "sppp.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __NetBSD__
|
|
|
|
#if NI4BISPPP == 0
|
|
|
|
# error "You need to define `pseudo-device sppp <N>' with options ISPPP"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
2003-08-12 23:49:27 +04:00
|
|
|
/*
|
|
|
|
* XXX - sys/param.h on alpha (indirectly) includes sys/signal.h, which
|
|
|
|
* defines sc_sp - interfering with our use of this identifier.
|
|
|
|
* Just undef it for now.
|
|
|
|
*/
|
2005-02-27 01:31:44 +03:00
|
|
|
#undef sc_sp
|
2003-08-12 23:49:27 +04:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
#include <sys/ioccom.h>
|
|
|
|
#include <sys/sockio.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/protosw.h>
|
2002-01-04 15:21:24 +03:00
|
|
|
#include <sys/callout.h>
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <net/if_types.h>
|
|
|
|
#include <net/netisr.h>
|
|
|
|
#include <net/route.h>
|
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
#include <netinet/in_var.h>
|
|
|
|
#include <netinet/ip.h>
|
|
|
|
|
|
|
|
#include <net/slcompress.h>
|
|
|
|
|
2002-01-04 15:21:24 +03:00
|
|
|
#include <net/if_spppvar.h>
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2005-02-27 01:31:44 +03:00
|
|
|
#if defined(__FreeBSD_version) && __FreeBSD_version >= 400008
|
|
|
|
#include "bpf.h"
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
|
|
|
#include "bpfilter.h"
|
|
|
|
#endif
|
|
|
|
#if NBPFILTER > 0 || NBPF > 0
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <net/bpf.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#include <machine/i4b_ioctl.h>
|
|
|
|
#include <machine/i4b_cause.h>
|
|
|
|
#include <machine/i4b_debug.h>
|
|
|
|
#else
|
|
|
|
#include <netisdn/i4b_ioctl.h>
|
|
|
|
#include <netisdn/i4b_cause.h>
|
|
|
|
#include <netisdn/i4b_debug.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <netisdn/i4b_global.h>
|
|
|
|
#include <netisdn/i4b_mbuf.h>
|
|
|
|
#include <netisdn/i4b_l3l4.h>
|
|
|
|
|
|
|
|
#include <netisdn/i4b_l4.h>
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
2002-03-16 19:55:51 +03:00
|
|
|
#define ISPPP_FMT "ippp%d: "
|
2001-01-05 15:49:52 +03:00
|
|
|
#define ISPPP_ARG(sc) ((sc)->sc_if.if_unit)
|
|
|
|
#define PDEVSTATIC static
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
# if __FreeBSD_version >= 300001
|
|
|
|
# define CALLOUT_INIT(chan) callout_handle_init(chan)
|
|
|
|
# define TIMEOUT(fun, arg, chan, tick) chan = timeout(fun, arg, tick)
|
|
|
|
# define UNTIMEOUT(fun, arg, chan) untimeout(fun, arg, chan)
|
|
|
|
# define IOCTL_CMD_T u_long
|
|
|
|
# else
|
|
|
|
# define CALLOUT_INIT(chan) do {} while(0)
|
|
|
|
# define TIMEOUT(fun, arg, chan, tick) timeout(fun, arg, tick)
|
|
|
|
# define UNTIMEOUT(fun, arg, chan) untimeout(fun, arg)
|
|
|
|
# define IOCTL_CMD_T int
|
|
|
|
# endif
|
|
|
|
|
|
|
|
#elif defined __NetBSD__ || defined __OpenBSD__
|
|
|
|
#define ISPPP_FMT "%s: "
|
2002-01-06 16:26:46 +03:00
|
|
|
#define ISPPP_ARG(sc) ((sc)->sc_sp.pp_if.if_xname)
|
2001-01-05 15:49:52 +03:00
|
|
|
#define PDEVSTATIC /* not static */
|
|
|
|
#define IOCTL_CMD_T u_long
|
|
|
|
#else
|
|
|
|
# error "What system are you using?"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
2002-03-16 19:55:51 +03:00
|
|
|
PDEVSTATIC void ipppattach(void *);
|
|
|
|
PSEUDO_SET(ipppattach, i4b_isppp);
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2002-03-16 19:55:51 +03:00
|
|
|
PDEVSTATIC void ipppattach(void);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define I4BISPPPACCT 1 /* enable accounting messages */
|
|
|
|
#define I4BISPPPACCTINTVL 2 /* accounting msg interval in secs */
|
2005-02-27 01:31:44 +03:00
|
|
|
#define I4BISPPPDISCDEBUG 1
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#define PPP_HDRLEN 4 /* 4 octetts PPP header length */
|
|
|
|
|
|
|
|
struct i4bisppp_softc {
|
2002-01-06 16:26:46 +03:00
|
|
|
struct sppp sc_sp; /* we are derived from struct sppp */
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
int sc_state; /* state of the interface */
|
|
|
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
int sc_unit; /* unit number for Net/OpenBSD */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
call_desc_t *sc_cdp; /* ptr to call descriptor */
|
2002-03-17 23:54:04 +03:00
|
|
|
isdn_link_t *sc_ilt; /* B channel driver and state */
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#ifdef I4BISPPPACCT
|
|
|
|
int sc_iinb; /* isdn driver # of inbytes */
|
|
|
|
int sc_ioutb; /* isdn driver # of outbytes */
|
|
|
|
int sc_inb; /* # of bytes rx'd */
|
|
|
|
int sc_outb; /* # of bytes tx'd */
|
|
|
|
int sc_linb; /* last # of bytes rx'd */
|
|
|
|
int sc_loutb; /* last # of bytes tx'd */
|
|
|
|
int sc_fn; /* flag, first null acct */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
|
|
|
struct callout_handle sc_ch;
|
|
|
|
#endif
|
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
} i4bisppp_softc[NIPPP];
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
static int i4bisppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
static void i4bisppp_send(struct ifnet *ifp);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void i4bisppp_start(struct ifnet *ifp);
|
|
|
|
|
|
|
|
#if 0 /* never used ??? */
|
|
|
|
static void i4bisppp_timeout(void *cookie);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void i4bisppp_tls(struct sppp *sp);
|
|
|
|
static void i4bisppp_tlf(struct sppp *sp);
|
|
|
|
static void i4bisppp_state_changed(struct sppp *sp, int new_state);
|
|
|
|
static void i4bisppp_negotiation_complete(struct sppp *sp);
|
|
|
|
static void i4bisppp_watchdog(struct ifnet *ifp);
|
2002-03-17 12:45:58 +03:00
|
|
|
time_t i4bisppp_idletime(void *softc);
|
2002-03-17 23:54:04 +03:00
|
|
|
static void i4bisppp_rx_data_rdy(void *softc);
|
|
|
|
static void i4bisppp_tx_queue_empty(void *softc);
|
|
|
|
static void i4bisppp_activity(void *softc, int rxtx);
|
|
|
|
static void i4bisppp_connect(void *softc, void *cdp);
|
|
|
|
static void i4bisppp_disconnect(void *softc, void *cdp);
|
|
|
|
static void i4bisppp_dialresponse(void *softc, int status, cause_t cause);
|
|
|
|
static void i4bisppp_updown(void *softc, int updown);
|
|
|
|
static void* i4bisppp_ret_softc(int unit);
|
|
|
|
static void i4bisppp_set_linktab(void *softc, isdn_link_t *ilt);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
static const struct isdn_l4_driver_functions
|
|
|
|
ippp_l4_functions = {
|
|
|
|
/* L4<->B-channel functions */
|
|
|
|
i4bisppp_rx_data_rdy,
|
|
|
|
i4bisppp_tx_queue_empty,
|
|
|
|
i4bisppp_activity,
|
|
|
|
i4bisppp_connect,
|
|
|
|
i4bisppp_disconnect,
|
|
|
|
i4bisppp_dialresponse,
|
|
|
|
i4bisppp_updown,
|
|
|
|
/* Management functions */
|
|
|
|
i4bisppp_ret_softc,
|
|
|
|
i4bisppp_set_linktab,
|
|
|
|
i4bisppp_idletime
|
|
|
|
};
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
static int ippp_drvr_id = -1;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
enum i4bisppp_states {
|
|
|
|
ST_IDLE, /* initialized, ready, idle */
|
|
|
|
ST_DIALING, /* dialling out to remote */
|
|
|
|
ST_CONNECTED, /* connected to remote */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* DEVICE DRIVER ROUTINES
|
|
|
|
*===========================================================================*/
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* interface attach routine at kernel boot time
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
PDEVSTATIC void
|
|
|
|
#ifdef __FreeBSD__
|
2002-03-16 19:55:51 +03:00
|
|
|
ipppattach(void *dummy)
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2002-03-16 19:55:51 +03:00
|
|
|
ipppattach()
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
struct i4bisppp_softc *sc = i4bisppp_softc;
|
|
|
|
int i;
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
ippp_drvr_id = isdn_l4_driver_attach("ippp", NIPPP, &ippp_l4_functions);
|
|
|
|
|
2005-02-27 01:31:44 +03:00
|
|
|
for(i = 0; i < NIPPP; sc++, i++) {
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_softc = sc;
|
2002-03-17 23:54:04 +03:00
|
|
|
sc->sc_ilt = NULL;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2005-02-27 01:31:44 +03:00
|
|
|
#ifdef __FreeBSD__
|
2002-03-16 19:55:51 +03:00
|
|
|
sc->sc_sp.pp_if.if_name = "ippp";
|
2001-01-05 15:49:52 +03:00
|
|
|
#if defined(__FreeBSD_version) && __FreeBSD_version < 300001
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_next = NULL;
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_unit = i;
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2004-04-21 22:40:37 +04:00
|
|
|
snprintf(sc->sc_sp.pp_if.if_xname,
|
|
|
|
sizeof(sc->sc_sp.pp_if.if_xname), "ippp%d", i);
|
2001-01-05 15:49:52 +03:00
|
|
|
sc->sc_unit = i;
|
|
|
|
#endif
|
|
|
|
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_mtu = PP_MTU;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#ifdef __NetBSD__
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_flags = IFF_SIMPLEX | IFF_POINTOPOINT |
|
2001-01-05 15:49:52 +03:00
|
|
|
IFF_MULTICAST;
|
|
|
|
#else
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_flags = IFF_SIMPLEX | IFF_POINTOPOINT;
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_type = IFT_ISDNBASIC;
|
2001-01-05 15:49:52 +03:00
|
|
|
sc->sc_state = ST_IDLE;
|
|
|
|
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_ioctl = i4bisppp_ioctl;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
/* actually initialized by sppp_attach() */
|
2002-01-06 16:26:46 +03:00
|
|
|
/* sc->sc_sp.pp_if.if_output = sppp_output; */
|
|
|
|
|
|
|
|
sc->sc_sp.pp_if.if_start = i4bisppp_start;
|
|
|
|
|
|
|
|
sc->sc_sp.pp_if.if_hdrlen = 0;
|
|
|
|
sc->sc_sp.pp_if.if_addrlen = 0;
|
2002-02-10 18:29:58 +03:00
|
|
|
IFQ_SET_MAXLEN(&sc->sc_sp.pp_if.if_snd, IFQ_MAXLEN);
|
|
|
|
IFQ_SET_READY(&sc->sc_sp.pp_if.if_snd);
|
2002-01-06 16:26:46 +03:00
|
|
|
|
|
|
|
sc->sc_sp.pp_if.if_ipackets = 0;
|
|
|
|
sc->sc_sp.pp_if.if_ierrors = 0;
|
|
|
|
sc->sc_sp.pp_if.if_opackets = 0;
|
|
|
|
sc->sc_sp.pp_if.if_oerrors = 0;
|
|
|
|
sc->sc_sp.pp_if.if_collisions = 0;
|
|
|
|
sc->sc_sp.pp_if.if_ibytes = 0;
|
|
|
|
sc->sc_sp.pp_if.if_obytes = 0;
|
|
|
|
sc->sc_sp.pp_if.if_imcasts = 0;
|
|
|
|
sc->sc_sp.pp_if.if_omcasts = 0;
|
|
|
|
sc->sc_sp.pp_if.if_iqdrops = 0;
|
|
|
|
sc->sc_sp.pp_if.if_noproto = 0;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#if I4BISPPPACCT
|
2005-02-27 01:31:44 +03:00
|
|
|
sc->sc_sp.pp_if.if_timer = 0;
|
|
|
|
sc->sc_sp.pp_if.if_watchdog = i4bisppp_watchdog;
|
2001-01-05 15:49:52 +03:00
|
|
|
sc->sc_iinb = 0;
|
|
|
|
sc->sc_ioutb = 0;
|
|
|
|
sc->sc_inb = 0;
|
|
|
|
sc->sc_outb = 0;
|
|
|
|
sc->sc_linb = 0;
|
|
|
|
sc->sc_loutb = 0;
|
|
|
|
sc->sc_fn = 1;
|
|
|
|
#endif
|
|
|
|
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_tls = i4bisppp_tls;
|
|
|
|
sc->sc_sp.pp_tlf = i4bisppp_tlf;
|
|
|
|
sc->sc_sp.pp_con = i4bisppp_negotiation_complete;
|
|
|
|
sc->sc_sp.pp_chg = i4bisppp_state_changed;
|
|
|
|
sc->sc_sp.pp_framebytes = 0; /* no framing added by hardware */
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#if defined(__FreeBSD_version) && ((__FreeBSD_version >= 500009) || (410000 <= __FreeBSD_version && __FreeBSD_version < 500000))
|
|
|
|
/* do not call bpfattach in ether_ifattach */
|
2002-01-06 16:26:46 +03:00
|
|
|
ether_ifattach(&sc->sc_sp.pp_if, 0);
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2002-01-06 16:26:46 +03:00
|
|
|
if_attach(&sc->sc_sp.pp_if);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
2001-01-17 03:30:49 +03:00
|
|
|
#ifndef USE_ISPPP
|
2002-01-06 16:26:46 +03:00
|
|
|
sppp_attach(&sc->sc_sp.pp_if);
|
2001-01-17 03:30:49 +03:00
|
|
|
#else
|
2002-01-06 16:26:46 +03:00
|
|
|
isppp_attach(&sc->sc_sp.pp_if);
|
2001-01-17 03:30:49 +03:00
|
|
|
#endif
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#if NBPFILTER > 0 || NBPF > 0
|
|
|
|
#ifdef __FreeBSD__
|
2002-01-06 16:26:46 +03:00
|
|
|
bpfattach(&sc->sc_sp.pp_if, DLT_PPP, PPP_HDRLEN);
|
2001-01-05 15:49:52 +03:00
|
|
|
CALLOUT_INIT(&sc->sc_ch);
|
|
|
|
#endif /* __FreeBSD__ */
|
|
|
|
#ifdef __NetBSD__
|
2002-01-06 16:26:46 +03:00
|
|
|
bpfattach(&sc->sc_sp.pp_if, DLT_PPP, sizeof(u_int));
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
2005-02-27 01:31:44 +03:00
|
|
|
#endif
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* process ioctl
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static int
|
|
|
|
i4bisppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data)
|
|
|
|
{
|
|
|
|
struct i4bisppp_softc *sc = ifp->if_softc;
|
|
|
|
int error;
|
|
|
|
|
2005-02-27 01:31:44 +03:00
|
|
|
#ifndef USE_ISPPP
|
2002-01-06 16:26:46 +03:00
|
|
|
error = sppp_ioctl(&sc->sc_sp.pp_if, cmd, data);
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2002-01-06 16:26:46 +03:00
|
|
|
error = isppp_ioctl(&sc->sc_sp.pp_if, cmd, data);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
switch(cmd) {
|
|
|
|
case SIOCSIFFLAGS:
|
|
|
|
#if 0 /* never used ??? */
|
2001-01-19 15:44:44 +03:00
|
|
|
x = splnet();
|
2001-01-05 15:49:52 +03:00
|
|
|
if ((ifp->if_flags & IFF_UP) == 0)
|
|
|
|
UNTIMEOUT(i4bisppp_timeout, (void *)sp, sc->sc_ch);
|
|
|
|
splx(x);
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* start output to ISDN B-channel
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
|
|
|
i4bisppp_start(struct ifnet *ifp)
|
|
|
|
{
|
|
|
|
struct i4bisppp_softc *sc = ifp->if_softc;
|
|
|
|
struct mbuf *m;
|
|
|
|
|
|
|
|
#ifndef USE_ISPPP
|
|
|
|
if (sppp_isempty(ifp))
|
|
|
|
#else
|
|
|
|
if (isppp_isempty(ifp))
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(sc->sc_state != ST_CONNECTED)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
2001-01-19 15:44:44 +03:00
|
|
|
* s = splnet();
|
2001-01-05 15:49:52 +03:00
|
|
|
* ifp->if_flags |= IFF_OACTIVE; // - need to clear this somewhere
|
|
|
|
* splx(s);
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef USE_ISPPP
|
2002-01-06 16:26:46 +03:00
|
|
|
while ((m = sppp_dequeue(&sc->sc_sp.pp_if)) != NULL)
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2002-01-06 16:26:46 +03:00
|
|
|
while ((m = isppp_dequeue(&sc->sc_sp.pp_if)) != NULL)
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
|
|
|
|
#if NBPFILTER > 0 || NBPF > 0
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
if (ifp->if_bpf)
|
|
|
|
bpf_mtap(ifp, m);
|
|
|
|
#endif /* __FreeBSD__ */
|
|
|
|
|
|
|
|
#ifdef __NetBSD__
|
|
|
|
if (ifp->if_bpf)
|
|
|
|
bpf_mtap(ifp->if_bpf, m);
|
|
|
|
#endif
|
|
|
|
#endif /* NBPFILTER > 0 || NBPF > 0 */
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
if(IF_QFULL(sc->sc_ilt->tx_queue))
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 23:54:04 +03:00
|
|
|
NDBGL4(L4_ISPDBG, "%s, tx queue full!", sc->sc_sp.pp_if.if_xname);
|
2001-01-05 15:49:52 +03:00
|
|
|
m_freem(m);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-17 23:54:04 +03:00
|
|
|
IF_ENQUEUE(sc->sc_ilt->tx_queue, m);
|
2001-01-05 15:49:52 +03:00
|
|
|
#if 0
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_obytes += m->m_pkthdr.len;
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
sc->sc_outb += m->m_pkthdr.len;
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_opackets++;
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
sc->sc_ilt->bchannel_driver->bch_tx_start(sc->sc_ilt->l1token,
|
2002-03-17 23:54:04 +03:00
|
|
|
sc->sc_ilt->channel);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef I4BISPPPACCT
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* watchdog routine
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
|
|
|
i4bisppp_watchdog(struct ifnet *ifp)
|
|
|
|
{
|
|
|
|
struct i4bisppp_softc *sc = ifp->if_softc;
|
|
|
|
bchan_statistics_t bs;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
(*sc->sc_ilt->bchannel_driver->bch_stat)
|
|
|
|
(sc->sc_ilt->l1token, sc->sc_ilt->channel, &bs);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
sc->sc_ioutb += bs.outbytes;
|
|
|
|
sc->sc_iinb += bs.inbytes;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
|
|
|
|
{
|
|
|
|
int ri = (sc->sc_iinb - sc->sc_linb)/I4BISPPPACCTINTVL;
|
|
|
|
int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BISPPPACCTINTVL;
|
|
|
|
|
|
|
|
if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb))
|
|
|
|
sc->sc_fn = 0;
|
|
|
|
else
|
|
|
|
sc->sc_fn = 1;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
sc->sc_linb = sc->sc_iinb;
|
|
|
|
sc->sc_loutb = sc->sc_ioutb;
|
|
|
|
|
2002-03-17 14:08:31 +03:00
|
|
|
if (sc->sc_cdp)
|
|
|
|
i4b_l4_accounting(sc->sc_cdp->cdid, ACCT_DURING,
|
|
|
|
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
sc->sc_sp.pp_if.if_timer = I4BISPPPACCTINTVL;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#if 0 /* old stuff, keep it around */
|
|
|
|
printf(ISPPP_FMT "transmit timeout\n", ISPPP_ARG(sc));
|
|
|
|
i4bisppp_start(ifp);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif /* I4BISPPPACCT */
|
|
|
|
|
|
|
|
/*
|
|
|
|
*===========================================================================*
|
|
|
|
* SyncPPP layer interface routines
|
|
|
|
*===========================================================================*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* PPP this-layer-started action
|
|
|
|
*---------------------------------------------------------------------------*
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
i4bisppp_tls(struct sppp *sp)
|
|
|
|
{
|
2002-01-06 16:26:46 +03:00
|
|
|
struct i4bisppp_softc *sc = sp->pp_if.if_softc;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
if(sc->sc_state == ST_CONNECTED)
|
|
|
|
return;
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
i4b_l4_dialout(ippp_drvr_id, sc->sc_unit);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* PPP this-layer-finished action
|
|
|
|
*---------------------------------------------------------------------------*
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
i4bisppp_tlf(struct sppp *sp)
|
|
|
|
{
|
2002-01-06 16:26:46 +03:00
|
|
|
struct i4bisppp_softc *sc = sp->pp_if.if_softc;
|
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if(sc->sc_state != ST_CONNECTED)
|
|
|
|
return;
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
i4b_l4_drvrdisc(sc->sc_cdp->cdid);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* PPP interface phase change
|
|
|
|
*---------------------------------------------------------------------------*
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
i4bisppp_state_changed(struct sppp *sp, int new_state)
|
|
|
|
{
|
2002-01-06 16:26:46 +03:00
|
|
|
struct i4bisppp_softc *sc = sp->pp_if.if_softc;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
i4b_l4_ifstate_changed(sc->sc_cdp, new_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* PPP control protocol negotiation complete (run ip-up script now)
|
|
|
|
*---------------------------------------------------------------------------*
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
i4bisppp_negotiation_complete(struct sppp *sp)
|
|
|
|
{
|
2002-01-06 16:26:46 +03:00
|
|
|
struct i4bisppp_softc *sc = sp->pp_if.if_softc;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
i4b_l4_negcomplete(sc->sc_cdp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* ISDN INTERFACE ROUTINES
|
|
|
|
*===========================================================================*/
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from L4 handler at connect time
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
i4bisppp_connect(void *softc, void *cdp)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct i4bisppp_softc *sc = softc;
|
2002-01-06 16:26:46 +03:00
|
|
|
struct sppp *sp = &sc->sc_sp;
|
2001-01-19 15:44:44 +03:00
|
|
|
int s = splnet();
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
sc->sc_cdp = (call_desc_t *)cdp;
|
|
|
|
sc->sc_state = ST_CONNECTED;
|
|
|
|
|
|
|
|
#if I4BISPPPACCT
|
|
|
|
sc->sc_iinb = 0;
|
|
|
|
sc->sc_ioutb = 0;
|
|
|
|
sc->sc_inb = 0;
|
|
|
|
sc->sc_outb = 0;
|
|
|
|
sc->sc_linb = 0;
|
|
|
|
sc->sc_loutb = 0;
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_timer = I4BISPPPACCTINTVL;
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
#if 0 /* never used ??? */
|
|
|
|
UNTIMEOUT(i4bisppp_timeout, (void *)sp, sc->sc_ch);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
sp->pp_up(sp); /* tell PPP we are ready */
|
|
|
|
#ifndef __NetBSD__
|
|
|
|
sp->pp_last_sent = sp->pp_last_recv = SECOND;
|
|
|
|
#endif
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from L4 handler at disconnect time
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
i4bisppp_disconnect(void *softc, void *cdp)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
call_desc_t *cd = (call_desc_t *)cdp;
|
2002-03-17 12:45:58 +03:00
|
|
|
struct i4bisppp_softc *sc = softc;
|
2002-01-06 16:26:46 +03:00
|
|
|
struct sppp *sp = &sc->sc_sp;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
int s = splnet();
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
/* new stuff to check that the active channel is being closed */
|
|
|
|
if (cd != sc->sc_cdp)
|
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_ISPDBG, "%s: channel%d not active!", sp->pp_if.if_xname,
|
|
|
|
cd->channelid);
|
2001-01-05 15:49:52 +03:00
|
|
|
splx(s);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if I4BISPPPACCT
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_timer = 0;
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
|
2002-03-17 14:08:31 +03:00
|
|
|
i4b_l4_accounting(cd->cdid, ACCT_FINAL,
|
2001-01-05 15:49:52 +03:00
|
|
|
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if (sc->sc_state == ST_CONNECTED)
|
|
|
|
{
|
|
|
|
#if 0 /* never used ??? */
|
|
|
|
UNTIMEOUT(i4bisppp_timeout, (void *)sp, sc->sc_ch);
|
|
|
|
#endif
|
2005-02-27 01:31:44 +03:00
|
|
|
sc->sc_cdp = (call_desc_t *)0;
|
2001-01-05 15:49:52 +03:00
|
|
|
/* do thhis here because pp_down calls i4bisppp_tlf */
|
|
|
|
sc->sc_state = ST_IDLE;
|
|
|
|
sp->pp_down(sp); /* tell PPP we have hung up */
|
|
|
|
}
|
|
|
|
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is used to give a feedback from userland demon
|
|
|
|
* in case of dial problems
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
i4bisppp_dialresponse(void *softc, int status, cause_t cause)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct i4bisppp_softc *sc = softc;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_ISPDBG, "%s: status=%d, cause=%d", sc->sc_sp.pp_if.if_xname, status, cause);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
if(status != DSTAT_NONE)
|
|
|
|
{
|
|
|
|
struct mbuf *m;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_ISPDBG, "%s: clearing queues", sc->sc_sp.pp_if.if_xname);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#ifndef USE_ISPPP
|
2002-01-06 16:26:46 +03:00
|
|
|
if(!(sppp_isempty(&sc->sc_sp.pp_if)))
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2002-01-06 16:26:46 +03:00
|
|
|
if(!(isppp_isempty(&sc->sc_sp.pp_if)))
|
2005-02-27 01:31:44 +03:00
|
|
|
#endif
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
#ifndef USE_ISPPP
|
2002-01-06 16:26:46 +03:00
|
|
|
while((m = sppp_dequeue(&sc->sc_sp.pp_if)) != NULL)
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2002-01-06 16:26:46 +03:00
|
|
|
while((m = isppp_dequeue(&sc->sc_sp.pp_if)) != NULL)
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
m_freem(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* interface up/down
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
i4bisppp_updown(void *softc, int updown)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
/* could probably do something useful here */
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from the HSCX interrupt handler
|
|
|
|
* when a new frame (mbuf) has been received and was put on
|
|
|
|
* the rx queue.
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
i4bisppp_rx_data_rdy(void *softc)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct i4bisppp_softc *sc = softc;
|
2001-01-05 15:49:52 +03:00
|
|
|
struct mbuf *m;
|
2002-03-17 23:54:04 +03:00
|
|
|
int s;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
if((m = *sc->sc_ilt->rx_mbuf) == NULL)
|
2001-01-05 15:49:52 +03:00
|
|
|
return;
|
|
|
|
|
2002-01-06 16:26:46 +03:00
|
|
|
m->m_pkthdr.rcvif = &sc->sc_sp.pp_if;
|
2001-01-05 15:49:52 +03:00
|
|
|
m->m_pkthdr.len = m->m_len;
|
|
|
|
|
2002-01-06 16:26:46 +03:00
|
|
|
sc->sc_sp.pp_if.if_ipackets++;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#if I4BISPPPACCT
|
|
|
|
sc->sc_inb += m->m_pkthdr.len;
|
|
|
|
#endif
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
#ifdef I4BISPPPDEBUG
|
|
|
|
printf("i4bisppp_rx_data_ready: received packet!\n");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if NBPFILTER > 0 || NBPF > 0
|
|
|
|
|
2005-02-27 01:31:44 +03:00
|
|
|
#ifdef __FreeBSD__
|
2002-01-06 16:26:46 +03:00
|
|
|
if(sc->sc_sp.pp_if.if_bpf)
|
|
|
|
bpf_mtap(&sc->sc_sp.pp_if, m);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif /* __FreeBSD__ */
|
|
|
|
|
|
|
|
#ifdef __NetBSD__
|
2002-01-06 16:26:46 +03:00
|
|
|
if(sc->sc_sp.pp_if.if_bpf)
|
|
|
|
bpf_mtap(sc->sc_sp.pp_if.if_bpf, m);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* NBPFILTER > 0 || NBPF > 0 */
|
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
s = splnet();
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#ifndef USE_ISPPP
|
2002-01-06 16:26:46 +03:00
|
|
|
sppp_input(&sc->sc_sp.pp_if, m);
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2002-01-06 16:26:46 +03:00
|
|
|
isppp_input(&sc->sc_sp.pp_if, m);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from the HSCX interrupt handler
|
|
|
|
* when the last frame has been sent out and there is no
|
|
|
|
* further frame (mbuf) in the tx queue.
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
i4bisppp_tx_queue_empty(void *softc)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct sppp *sp = &((struct i4bisppp_softc *)softc)->sc_sp;
|
|
|
|
i4bisppp_start(&sp->pp_if);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* THIS should be used instead of last_active_time to implement
|
|
|
|
* an activity timeout mechanism.
|
|
|
|
*
|
|
|
|
* Sending back the time difference unneccessarily complicates the
|
|
|
|
* idletime checks in i4b_l4.c. Return the largest time instead.
|
|
|
|
* That way the code in i4b_l4.c needs only minimal changes.
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
time_t
|
2002-03-17 12:45:58 +03:00
|
|
|
i4bisppp_idletime(void *softc)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct sppp *sp = &((struct i4bisppp_softc *)softc)->sc_sp;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
return sp->pp_last_activity;
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from the HSCX interrupt handler
|
|
|
|
* each time a packet is received or transmitted. It should
|
|
|
|
* be used to implement an activity timeout mechanism.
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
i4bisppp_activity(void *softc, int rxtx)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct i4bisppp_softc *sc = softc;
|
|
|
|
sc->sc_cdp->last_active_time = SECOND;
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* return this drivers linktab address
|
|
|
|
*---------------------------------------------------------------------------*/
|
2002-03-17 23:54:04 +03:00
|
|
|
static void *
|
|
|
|
i4bisppp_ret_softc(int unit)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 23:54:04 +03:00
|
|
|
return &i4bisppp_softc[unit];
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* setup the isdn_linktab for this driver
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 23:54:04 +03:00
|
|
|
i4bisppp_set_linktab(void *softc, isdn_link_t *ilt)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 23:54:04 +03:00
|
|
|
struct i4bisppp_softc *sc = softc;
|
|
|
|
sc->sc_ilt = ilt;
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*/
|