update to i4b version 0.95.04
This commit is contained in:
parent
60bbb7f51a
commit
575265a740
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_cause.h - causes and cause handling for i4b
|
||||
* -----------------------------------------------
|
||||
*
|
||||
* $Id: i4b_cause.h,v 1.11 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_cause.h,v 1.13 2000/02/06 19:01:14 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:51 1999]
|
||||
* last edit-date: [Sun Feb 6 19:46:41 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -70,7 +70,8 @@
|
||||
#define CAUSE_I4B_L1ERROR 7 /* L1 error / persistent deact */
|
||||
#define CAUSE_I4B_LLDIAL 8 /* no dialout on leased line */
|
||||
#define CAUSE_I4B_MAX 9
|
||||
/* NOTE: update isdnd/pcause.c when adding causes !!!!! */
|
||||
/* NOTE: update isdnd/pcause.c when adding causes !!!!! */
|
||||
/* NOTE: update layer3/i4b_q931.c when adding causes !!!!! */
|
||||
|
||||
/* CAUSET_Q850 - causes defined in Q.850 */
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,58 +27,52 @@
|
||||
* i4b_debug.h - i4b debug header file
|
||||
* -----------------------------------
|
||||
*
|
||||
* $Id: i4b_debug.h,v 1.20 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_debug.h,v 1.32 2000/07/24 12:22:08 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:59 1999]
|
||||
* last edit-date: [Wed May 31 09:51:34 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define DO_I4B_DEBUG /* enable debugging code inclusion */
|
||||
#if !defined DO_I4B_DEBUG
|
||||
# define DO_I4B_DEBUG 1 /* default = include debugging code */
|
||||
#elif DO_I4B_DEBUG != 0
|
||||
# undef DO_I4B_DEBUG
|
||||
# define DO_I4B_DEBUG 1
|
||||
#endif
|
||||
|
||||
#undef DO_I4B_MAXDEBUG /* enable ALL debug messages by default */
|
||||
#undef DO_I4B_MAXDEBUG /* default = disable ALL debug messages */
|
||||
|
||||
#ifdef DO_I4B_DEBUG
|
||||
#if DO_I4B_DEBUG
|
||||
|
||||
extern unsigned int i4b_l1_debug;
|
||||
extern unsigned int i4b_l2_debug;
|
||||
extern unsigned int i4b_l3_debug;
|
||||
extern unsigned int i4b_l4_debug;
|
||||
|
||||
#define DBGL1(bits, routine, what) \
|
||||
if(bits & i4b_l1_debug) \
|
||||
{ \
|
||||
printf("i4b-L1-%s: ", routine); \
|
||||
printf what ; \
|
||||
}
|
||||
#define NDBGL1(bits, fmt, args...) \
|
||||
if(bits & i4b_l1_debug) \
|
||||
{ printf("i4b-L1 %s: " fmt "\n", __FUNCTION__ , ##args ); }
|
||||
|
||||
#define DBGL2(bits, routine, what) \
|
||||
if(bits & i4b_l2_debug) \
|
||||
{ \
|
||||
printf("i4b-L2-%s: ", routine); \
|
||||
printf what ; \
|
||||
}
|
||||
|
||||
#define DBGL3(bits, routine, what) \
|
||||
if(bits & i4b_l3_debug) \
|
||||
{ \
|
||||
printf("i4b-L3-%s: ", routine); \
|
||||
printf what ; \
|
||||
}
|
||||
|
||||
#define DBGL4(bits, routine, what) \
|
||||
if(bits & i4b_l4_debug) \
|
||||
{ \
|
||||
printf("i4b-L4-%s: ", routine); \
|
||||
printf what ; \
|
||||
}
|
||||
#define NDBGL2(bits, fmt, args...) \
|
||||
if(bits & i4b_l2_debug) \
|
||||
{ printf("i4b-L2 %s: " fmt "\n", __FUNCTION__ , ##args ); }
|
||||
|
||||
#define NDBGL3(bits, fmt, args...) \
|
||||
if(bits & i4b_l3_debug) \
|
||||
{ printf("i4b-L3 %s: " fmt "\n", __FUNCTION__ , ##args ); }
|
||||
|
||||
#define NDBGL4(bits, fmt, args...) \
|
||||
if(bits & i4b_l4_debug) \
|
||||
{ printf("i4b-L4 %s: " fmt "\n", __FUNCTION__ , ##args ); }
|
||||
|
||||
#else /* !DO_I4B_DEBUG */
|
||||
|
||||
#define DBGL1(bits, routine, what);
|
||||
#define DBGL2(bits, routine, what);
|
||||
#define DBGL3(bits, routine, what);
|
||||
#define DBGL4(bits, routine, what);
|
||||
#define NDBGL1(bits, fmt, args...);
|
||||
#define NDBGL2(bits, fmt, args...);
|
||||
#define NDBGL3(bits, fmt, args...);
|
||||
#define NDBGL4(bits, fmt, args...);
|
||||
|
||||
#endif /* DO_I4B_DEBUG */
|
||||
|
||||
@ -98,9 +92,11 @@ extern unsigned int i4b_l4_debug;
|
||||
#define L1_T_ERR 0x0800 /* Timer error messages */
|
||||
#define L1_H_XFRERR 0x1000 /* HSCX data xfer error */
|
||||
#define L1_I_CICO 0x2000 /* ISAC command in/out */
|
||||
#define L1_S_MSG 0x4000 /* silent messages (soft-HDLC) */
|
||||
#define L1_S_ERR 0x8000 /* error messages (soft-HDLC) */
|
||||
|
||||
#define L1_DEBUG_MAX 0x3fef /* all messages on except IRQ! */
|
||||
#define L1_DEBUG_ERR (L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR)
|
||||
#define L1_DEBUG_MAX 0xffef /* all messages on except IRQ! */
|
||||
#define L1_DEBUG_ERR (L1_S_ERR | L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR)
|
||||
|
||||
#ifndef L1_DEBUG_DEFAULT
|
||||
#ifdef DO_I4B_MAXDEBUG
|
||||
@ -176,8 +172,9 @@ extern unsigned int i4b_l4_debug;
|
||||
#define L4_TINADBG 0x0100 /* tina driver debug messages */
|
||||
#define L4_TINAMSG 0x0200 /* tina driver messages */
|
||||
#define L4_TINAERR 0x0400 /* tina driver error messages */
|
||||
#define L4_INGDBG 0x0800 /* ing driver debug messages */
|
||||
|
||||
#define L4_DEBUG_MAX 0x07ff /* all messages on */
|
||||
#define L4_DEBUG_MAX 0x0fff /* all messages on */
|
||||
#define L4_DEBUG_ERR (L4_ERR | L4_TINADBG | L4_TINAMSG | L4_TINAERR)
|
||||
|
||||
#ifndef L4_DEBUG_DEFAULT
|
||||
@ -205,9 +202,23 @@ typedef struct {
|
||||
#define I4B_CTL_SET_DEBUG _IOW('C', 1, ctl_debug_t)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* get hscx statistics
|
||||
* generic get chipset statistics
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/* for the ihfc-driver: structure for HFC-1/S/SP statistics */
|
||||
|
||||
typedef struct {
|
||||
int txframes;
|
||||
int rxframes;
|
||||
int xdu;
|
||||
int rdo;
|
||||
int crc;
|
||||
int rab;
|
||||
} hfcstat_t;
|
||||
|
||||
|
||||
/* for the isic-driver: structure for HSCX statistics */
|
||||
|
||||
typedef struct {
|
||||
int unit; /* controller number */
|
||||
int chan; /* channel number */
|
||||
@ -218,44 +229,61 @@ typedef struct {
|
||||
int xdu;
|
||||
int rfo;
|
||||
} hscxstat_t;
|
||||
|
||||
#define I4B_CTL_GET_HSCXSTAT _IOWR('C', 2, hscxstat_t)
|
||||
|
||||
#define I4B_CTL_CLR_HSCXSTAT _IOW('C', 3, hscxstat_t)
|
||||
/* generic statistics structure */
|
||||
|
||||
struct chipstat {
|
||||
int driver_type; /* type, L1DRVR_XXXX */
|
||||
int driver_unit; /* the unit number */
|
||||
int driver_bchannel; /* the B-channel */
|
||||
union stats { /* union for all drivers */
|
||||
hfcstat_t hfcstat; /* for ihfc driver, L1DRVR_IHFC */
|
||||
hscxstat_t hscxstat; /* for isic driver, L1DRVR_ISIC */
|
||||
} stats;
|
||||
};
|
||||
|
||||
/* get statistics */
|
||||
|
||||
#define I4B_CTL_GET_CHIPSTAT _IOWR('C', 2, struct chipstat)
|
||||
|
||||
/* clear statistics */
|
||||
|
||||
#define I4B_CTL_CLR_CHIPSTAT _IOW('C', 3, struct chipstat)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* get LAPD/Q.921 statistics
|
||||
*---------------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
/* transmit */
|
||||
|
||||
u_long tx_i; /* I */
|
||||
u_long tx_rr; /* RR */
|
||||
u_long tx_rnr; /* RNR */
|
||||
u_long tx_rej; /* REJ */
|
||||
/* transmit */
|
||||
|
||||
u_long tx_i; /* I */
|
||||
u_long tx_rr; /* RR */
|
||||
u_long tx_rnr; /* RNR */
|
||||
u_long tx_rej; /* REJ */
|
||||
u_long tx_sabme; /* SABME*/
|
||||
u_long tx_dm; /* DM */
|
||||
u_long tx_dm; /* DM */
|
||||
u_long tx_disc; /* DISC */
|
||||
u_long tx_ua; /* UA */
|
||||
u_long tx_ua; /* UA */
|
||||
u_long tx_frmr; /* FRMR */
|
||||
u_long tx_tei; /* TEI */
|
||||
u_long tx_tei; /* TEI */
|
||||
|
||||
/* receive */
|
||||
/* receive */
|
||||
|
||||
u_long rx_i; /* I */
|
||||
u_long rx_rr; /* RR */
|
||||
u_long rx_rnr; /* RNR */
|
||||
u_long rx_rej; /* REJ */
|
||||
u_long rx_i; /* I */
|
||||
u_long rx_rr; /* RR */
|
||||
u_long rx_rnr; /* RNR */
|
||||
u_long rx_rej; /* REJ */
|
||||
u_long rx_sabme; /* SABME*/
|
||||
u_long rx_tei; /* TEI */
|
||||
u_long rx_ui; /* UI */
|
||||
u_long rx_tei; /* TEI */
|
||||
u_long rx_ui; /* UI */
|
||||
u_long rx_disc; /* DISC */
|
||||
u_long rx_xid; /* XID */
|
||||
u_long rx_dm; /* DM */
|
||||
u_long rx_ua; /* UA */
|
||||
u_long rx_xid; /* XID */
|
||||
u_long rx_dm; /* DM */
|
||||
u_long rx_ua; /* UA */
|
||||
u_long rx_frmr; /* FRMR */
|
||||
|
||||
/* errors */
|
||||
/* errors */
|
||||
|
||||
u_long err_rx_len; /* incorrect length */
|
||||
u_long err_rx_badf; /* bad frame type */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_ioctl.h - messages kernel <--> userland
|
||||
* -------------------------------------------
|
||||
*
|
||||
* $Id: i4b_ioctl.h,v 1.150 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_ioctl.h,v 1.196 2000/10/09 11:17:07 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:12:16 1999]
|
||||
* last edit-date: [Mon Oct 9 13:17:34 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -48,8 +48,8 @@
|
||||
* version and release number for isdn4bsd package
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define VERSION 0 /* version number */
|
||||
#define REL 90 /* release number */
|
||||
#define STEP 1 /* release step */
|
||||
#define REL 95 /* release number */
|
||||
#define STEP 04 /* release step */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* date/time format in i4b log messages
|
||||
@ -86,6 +86,20 @@
|
||||
#define CTRL_AVMB1 4 /* AVM B1 active card */
|
||||
#define CTRL_NUMTYPES 5 /* number of controller types */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* CTRL_PASSIVE: driver types
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define MAXL1UNITS 8 /* max number of units */
|
||||
|
||||
#define L1DRVR_ISIC 0 /* isic - driver */
|
||||
#define L1DRVR_IWIC 1 /* iwic - driver */
|
||||
#define L1DRVR_IFPI 2 /* ifpi - driver */
|
||||
#define L1DRVR_IHFC 3 /* ihfc - driver */
|
||||
#define L1DRVR_IFPNP 4 /* ifpnp - driver */
|
||||
|
||||
/* MAXL1DRVR MUST be updated when more passive drivers are added !!! */
|
||||
#define MAXL1DRVR (L1DRVR_IFPNP + 1)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* card types for CTRL_PASSIVE
|
||||
*---------------------------------------------------------------------------*/
|
||||
@ -114,16 +128,21 @@
|
||||
#define CARD_TYPEP_AVM_PNP 21 /* AVM FRITZ!CARD PnP */
|
||||
#define CARD_TYPEP_SIE_ISURF2 22 /* Siemens I-Surf 2 PnP */
|
||||
#define CARD_TYPEP_ASUSCOMIPAC 23 /* Asuscom ISDNlink 128 K PnP */
|
||||
#define CARD_TYPEP_WINB6692 24 /* Winbond W6692 based */
|
||||
#define CARD_TYPEP_16_3C 25 /* Teles S0/16.3c PnP (HFC-S/SP */
|
||||
#define CARD_TYPEP_ACERP10 26 /* Acer ISDN P10 (HFC-S) */
|
||||
#define CARD_TYPEP_TELEINT_NO_1 27 /* TELEINT ISDN SPEED No. 1 (HFC-1) */
|
||||
|
||||
/*
|
||||
* in case you add support for more cards, please update:
|
||||
*
|
||||
* isdnd: support.c, name_of_controller()
|
||||
* isdnd: controller.c, name_of_controller()
|
||||
* diehl/diehlctl: main.c, listall()
|
||||
*
|
||||
* and adjust CARD_TYPEP_MAX below.
|
||||
*/
|
||||
|
||||
#define CARD_TYPEP_MAX 23 /* max type */
|
||||
#define CARD_TYPEP_MAX 27 /* max type */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* card types for CTRL_DAIC
|
||||
@ -162,6 +181,7 @@
|
||||
#define BDRV_IPR 2 /* IP over raw HDLC interface driver */
|
||||
#define BDRV_ISPPP 3 /* sync Kernel PPP interface driver */
|
||||
#define BDRV_IBC 4 /* BSD/OS point to point driver */
|
||||
#define BDRV_ING 5 /* NetGraph ing driver */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* B channel protocol
|
||||
@ -311,6 +331,12 @@ typedef struct {
|
||||
#define SCR_USR_PASS 2 /* screening user provided, verified & passed */
|
||||
#define SCR_USR_FAIL 3 /* screening user provided, verified & failed */
|
||||
#define SCR_NET 4 /* screening network provided */
|
||||
int prs_ind;/* presentation indicator */
|
||||
#define PRS_NONE 0 /* no presentation indicator transmitted*/
|
||||
#define PRS_ALLOWED 1 /* presentation allowed */
|
||||
#define PRS_RESTRICT 2 /* presentation restricted */
|
||||
#define PRS_NNINTERW 3 /* number not available due to interworking */
|
||||
#define PRS_RESERVED 4 /* reserved */
|
||||
char display[DISPLAY_MAX]; /* content of display IE*/
|
||||
} msg_connect_ind_t;
|
||||
|
||||
|
253
sys/i386/include/i4b_isppp.h
Normal file
253
sys/i386/include/i4b_isppp.h
Normal file
@ -0,0 +1,253 @@
|
||||
/*
|
||||
* Defines for synchronous PPP/Cisco link level subroutines.
|
||||
*
|
||||
* Copyright (C) 1994 Cronyx Ltd.
|
||||
* Author: Serge Vakulenko, <vak@cronyx.ru>
|
||||
*
|
||||
* Heavily revamped to conform to RFC 1661.
|
||||
* Copyright (C) 1997, Joerg Wunsch.
|
||||
*
|
||||
* This software is distributed with NO WARRANTIES, not even the implied
|
||||
* warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Authors grant any other persons or organizations permission to use
|
||||
* or modify this software as long as this message is kept with the software,
|
||||
* all derivative works or modified versions.
|
||||
*
|
||||
* From: Version 2.0, Fri Oct 6 20:39:21 MSK 1995
|
||||
*
|
||||
* From: if_sppp.h,v 1.14 1999/03/30 13:28:26 phk Exp
|
||||
*
|
||||
* $Id: i4b_isppp.h,v 1.5 2000/07/18 15:05:37 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _I4B_ISPPP_H_
|
||||
#define _I4B_ISPPP_H_
|
||||
|
||||
#define SPPP_VJ /* use VJ compression */
|
||||
|
||||
|
||||
#ifdef SPPP_VJ
|
||||
#if !(defined (KERNEL) || defined (_KERNEL))
|
||||
#ifdef __FreeBSD__
|
||||
#if 0
|
||||
/*
|
||||
* this is needed on FreeBSD to make /usr/src/usr.bin/kdump and
|
||||
* /usr/src/usr.bin/truss compile.
|
||||
*/
|
||||
#include <sys/mbuf.h>
|
||||
#endif
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <net/slcompress.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define IDX_LCP 0 /* idx into state table */
|
||||
|
||||
struct slcp {
|
||||
u_long opts; /* LCP options to send (bitfield) */
|
||||
u_long magic; /* local magic number */
|
||||
u_long mru; /* our max receive unit */
|
||||
u_long their_mru; /* their max receive unit */
|
||||
u_long protos; /* bitmask of protos that are started */
|
||||
u_char echoid; /* id of last keepalive echo request */
|
||||
/* restart max values, see RFC 1661 */
|
||||
int timeout;
|
||||
int max_terminate;
|
||||
int max_configure;
|
||||
int max_failure;
|
||||
};
|
||||
|
||||
#define IDX_IPCP 1 /* idx into state table */
|
||||
|
||||
struct sipcp {
|
||||
u_long opts; /* IPCP options to send (bitfield) */
|
||||
u_int flags;
|
||||
#define IPCP_HISADDR_SEEN 1 /* have seen his address already */
|
||||
#define IPCP_MYADDR_DYN 2 /* my address is dynamically assigned */
|
||||
#define IPCP_MYADDR_SEEN 4 /* have seen his address already */
|
||||
#define IPCP_VJ 8 /* We can use VJ compression */
|
||||
int max_state; /* Max-Slot-Id */
|
||||
int compress_cid; /* Comp-Slot-Id */
|
||||
};
|
||||
|
||||
#define AUTHNAMELEN 32
|
||||
#define AUTHKEYLEN 16
|
||||
|
||||
struct sauth {
|
||||
u_short proto; /* authentication protocol to use */
|
||||
u_short flags;
|
||||
#define AUTHFLAG_NOCALLOUT 1 /* do not require authentication on */
|
||||
/* callouts */
|
||||
#define AUTHFLAG_NORECHALLENGE 2 /* do not re-challenge CHAP */
|
||||
u_char name[AUTHNAMELEN]; /* system identification name */
|
||||
u_char secret[AUTHKEYLEN]; /* secret password */
|
||||
u_char challenge[AUTHKEYLEN]; /* random challenge */
|
||||
};
|
||||
|
||||
#define IDX_PAP 2
|
||||
#define IDX_CHAP 3
|
||||
|
||||
#define IDX_COUNT (IDX_CHAP + 1) /* bump this when adding cp's! */
|
||||
|
||||
/*
|
||||
* Don't change the order of this. Ordering the phases this way allows
|
||||
* for a comparision of ``pp_phase >= PHASE_AUTHENTICATE'' in order to
|
||||
* know whether LCP is up.
|
||||
*/
|
||||
enum ppp_phase {
|
||||
PHASE_DEAD, PHASE_ESTABLISH, PHASE_TERMINATE,
|
||||
PHASE_AUTHENTICATE, PHASE_NETWORK
|
||||
};
|
||||
|
||||
struct sppp {
|
||||
/* NB: pp_if _must_ be first */
|
||||
struct ifnet pp_if; /* network interface data */
|
||||
struct ifqueue pp_fastq; /* fast output queue */
|
||||
struct ifqueue pp_cpq; /* PPP control protocol queue */
|
||||
struct sppp *pp_next; /* next interface in keepalive list */
|
||||
u_int pp_mode; /* major protocol modes (cisco/ppp/...) */
|
||||
u_int pp_flags; /* sub modes */
|
||||
u_short pp_alivecnt; /* keepalive packets counter */
|
||||
u_short pp_loopcnt; /* loopback detection counter */
|
||||
u_long pp_seq; /* local sequence number */
|
||||
u_long pp_rseq; /* remote sequence number */
|
||||
time_t pp_last_sent;
|
||||
time_t pp_last_recv;
|
||||
enum ppp_phase pp_phase; /* phase we're currently in */
|
||||
int state[IDX_COUNT]; /* state machine */
|
||||
u_char confid[IDX_COUNT]; /* id of last configuration request */
|
||||
int rst_counter[IDX_COUNT]; /* restart counter */
|
||||
int fail_counter[IDX_COUNT]; /* negotiation failure counter */
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
|
||||
struct callout_handle ch[IDX_COUNT]; /* per-proto and if callouts */
|
||||
struct callout_handle pap_my_to_ch; /* PAP needs one more... */
|
||||
#endif
|
||||
struct slcp lcp; /* LCP params */
|
||||
struct sipcp ipcp; /* IPCP params */
|
||||
struct sauth myauth; /* auth params, i'm peer */
|
||||
struct sauth hisauth; /* auth params, i'm authenticator */
|
||||
#ifdef SPPP_VJ
|
||||
int enable_vj; /* enable VJ negotiation */
|
||||
struct slcompress pp_comp; /* for VJ compression */
|
||||
#endif
|
||||
/*
|
||||
* These functions are filled in by sppp_attach(), and are
|
||||
* expected to be used by the lower layer (hardware) drivers
|
||||
* in order to communicate the (un)availability of the
|
||||
* communication link. Lower layer drivers that are always
|
||||
* ready to communicate (like hardware HDLC) can shortcut
|
||||
* pp_up from pp_tls, and pp_down from pp_tlf.
|
||||
*/
|
||||
void (*pp_up)(struct sppp *sp);
|
||||
void (*pp_down)(struct sppp *sp);
|
||||
/*
|
||||
* These functions need to be filled in by the lower layer
|
||||
* (hardware) drivers if they request notification from the
|
||||
* PPP layer whether the link is actually required. They
|
||||
* correspond to the tls and tlf actions.
|
||||
*/
|
||||
void (*pp_tls)(struct sppp *sp);
|
||||
void (*pp_tlf)(struct sppp *sp);
|
||||
/*
|
||||
* These (optional) functions may be filled by the hardware
|
||||
* driver if any notification of established connections
|
||||
* (currently: IPCP up) is desired (pp_con) or any internal
|
||||
* state change of the interface state machine should be
|
||||
* signaled for monitoring purposes (pp_chg).
|
||||
*/
|
||||
void (*pp_con)(struct sppp *sp);
|
||||
void (*pp_chg)(struct sppp *sp, int new_state);
|
||||
/* These two fields are for use by the lower layer */
|
||||
void *pp_lowerp;
|
||||
int pp_loweri;
|
||||
};
|
||||
|
||||
#define PP_KEEPALIVE 0x01 /* use keepalive protocol */
|
||||
#define PP_CALLIN 0x08 /* we are being called */
|
||||
#define PP_NEEDAUTH 0x10 /* remote requested authentication */
|
||||
|
||||
|
||||
#define PP_MTU 1500 /* default/minimal MRU */
|
||||
#define PP_MAX_MRU 2048 /* maximal MRU we want to negotiate */
|
||||
|
||||
/*
|
||||
* Definitions to pass struct sppp data down into the kernel using the
|
||||
* SIOC[SG]IFGENERIC ioctl interface.
|
||||
*
|
||||
* In order to use this, create a struct spppreq, fill in the cmd
|
||||
* field with SPPPIOGDEFS, and put the address of this structure into
|
||||
* the ifr_data portion of a struct ifreq. Pass this struct to a
|
||||
* SIOCGIFGENERIC ioctl. Then replace the cmd field by SPPPIOCDEFS,
|
||||
* modify the defs field as desired, and pass the struct ifreq now
|
||||
* to a SIOCSIFGENERIC ioctl.
|
||||
*/
|
||||
|
||||
#define SPPPIOGDEFS ((caddr_t)(('S' << 24) + (1 << 16) + sizeof(struct sppp)))
|
||||
#define SPPPIOSDEFS ((caddr_t)(('S' << 24) + (2 << 16) + sizeof(struct sppp)))
|
||||
|
||||
struct spppreq {
|
||||
u_long cmd;
|
||||
struct sppp defs;
|
||||
};
|
||||
|
||||
#ifndef SIOCSIFGENERIC
|
||||
#define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */
|
||||
#endif
|
||||
|
||||
#ifndef SIOCGIFGENERIC
|
||||
#define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */
|
||||
#endif
|
||||
|
||||
#if defined(KERNEL) || defined(_KERNEL)
|
||||
|
||||
#ifndef USE_ISPPP
|
||||
|
||||
void sppp_attach (struct ifnet *ifp);
|
||||
void sppp_detach (struct ifnet *ifp);
|
||||
void sppp_input (struct ifnet *ifp, struct mbuf *m);
|
||||
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300003
|
||||
int sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data);
|
||||
#else
|
||||
#ifdef __FreeBSD__
|
||||
int sppp_ioctl (struct ifnet *ifp, int cmd, void *data);
|
||||
#else
|
||||
int sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct mbuf *sppp_dequeue (struct ifnet *ifp);
|
||||
struct mbuf *sppp_pick(struct ifnet *ifp);
|
||||
int sppp_isempty (struct ifnet *ifp);
|
||||
void sppp_flush (struct ifnet *ifp);
|
||||
|
||||
#else /* USE_ISPPP */
|
||||
|
||||
void isppp_attach (struct ifnet *ifp);
|
||||
void isppp_detach (struct ifnet *ifp);
|
||||
void isppp_input (struct ifnet *ifp, struct mbuf *m);
|
||||
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300003
|
||||
int isppp_ioctl (struct ifnet *ifp, u_long cmd, void *data);
|
||||
#else
|
||||
#ifdef __FreeBSD__
|
||||
int isppp_ioctl (struct ifnet *ifp, int cmd, void *data);
|
||||
#else
|
||||
int isppp_ioctl (struct ifnet *ifp, u_long cmd, void *data);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct mbuf *isppp_dequeue (struct ifnet *ifp);
|
||||
struct mbuf *isppp_pick(struct ifnet *ifp);
|
||||
int isppp_isempty (struct ifnet *ifp);
|
||||
void isppp_flush (struct ifnet *ifp);
|
||||
#endif /* USE_ISPPP */
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _I4B_ISPPP_H_ */
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_tel_ioctl.h telephony interface ioctls
|
||||
* ------------------------------------------
|
||||
*
|
||||
* $Id: i4b_tel_ioctl.h,v 1.11 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_tel_ioctl.h,v 1.13 2000/01/12 14:49:36 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:07:18 1999]
|
||||
* last edit-date: [Wed Jan 12 15:47:11 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -62,6 +62,19 @@
|
||||
|
||||
#define I4B_TEL_VR_REQ _IOR('A', 3, msg_vr_req_t)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* send tones out of the tel interface
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define I4B_TEL_MAXTONES 32
|
||||
|
||||
struct i4b_tel_tones {
|
||||
int frequency[I4B_TEL_MAXTONES];
|
||||
int duration[I4B_TEL_MAXTONES];
|
||||
};
|
||||
|
||||
#define I4B_TEL_TONES _IOR('A', 4, struct i4b_tel_tones)
|
||||
|
||||
/*===========================================================================*
|
||||
* /dev/i4bteld<n> devices (dialer interface)
|
||||
*===========================================================================*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_trace.h - header file for trace data read device
|
||||
* ----------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_trace.h,v 1.7 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_trace.h,v 1.8 2000/03/08 16:08:18 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:07:25 1999]
|
||||
* last edit-date: [Wed Mar 8 16:41:43 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -70,8 +70,7 @@ typedef struct {
|
||||
* get/set current trace flag settings
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define I4B_TRC_GET _IOR('T', 0, int) /* get trace settings */
|
||||
#define I4B_TRC_SET _IOW('T', 1, int) /* set trace settings */
|
||||
#define I4B_TRC_SET _IOW('T', 0, int) /* set trace settings */
|
||||
|
||||
#define TRACE_OFF 0x00 /* tracing off */
|
||||
#define TRACE_I 0x01 /* trace L1 INFO's on */
|
||||
@ -87,7 +86,7 @@ typedef struct {
|
||||
int txflags; /* d and/or b channel */
|
||||
} i4b_trace_setupa_t;
|
||||
|
||||
#define I4B_TRC_SETA _IOW('T', 2, i4b_trace_setupa_t) /* set analyze mode */
|
||||
#define I4B_TRC_RESETA _IOW('T', 3, int) /* reset analyze mode */
|
||||
#define I4B_TRC_SETA _IOW('T', 1, i4b_trace_setupa_t) /* set analyze mode */
|
||||
#define I4B_TRC_RESETA _IOW('T', 2, int) /* reset analyze mode */
|
||||
|
||||
#endif /* _I4B_TRACE_H_ */
|
||||
|
@ -30,11 +30,11 @@
|
||||
* i4b_bsdi_ibc.c - isdn4bsd kernel BSD/OS point to point driver
|
||||
* -------------------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_bsdi_ibc.c,v 1.1 1999/04/23 08:35:07 hm Exp $
|
||||
* $Id: i4b_bsdi_ibc.c,v 1.3 2000/08/21 07:21:07 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Tue Dec 14 21:55:37 1999]
|
||||
* last edit-date: [Tue Dec 14 21:55:24 1999]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -184,7 +184,11 @@ ibcattach(void *dummy)
|
||||
sc->sc_loutb = 0;
|
||||
sc->sc_fn = 1;
|
||||
#endif
|
||||
#if defined(__FreeBSD_version) && ((__FreeBSD_version >= 500009) || (410000 <= __FreeBSD_version && __FreeBSD_version < 500000))
|
||||
ether_ifattach(ifp, 0);
|
||||
#else
|
||||
if_attach(ifp);
|
||||
#endif
|
||||
p2p_attach(&sc->sc_p2pcom);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_ctl.c - i4b system control port driver
|
||||
* ------------------------------------------
|
||||
*
|
||||
* $Id: i4b_ctl.c,v 1.30 1999/12/13 21:25:23 hm Exp $
|
||||
* $Id: i4b_ctl.c,v 1.37 2000/05/31 08:04:43 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:38:15 1999]
|
||||
* last edit-date: [Wed May 31 09:59:01 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -61,6 +61,18 @@
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ == 3
|
||||
#include "opt_devfs.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
#endif
|
||||
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -76,7 +88,8 @@
|
||||
|
||||
#include <i4b/include/i4b_global.h>
|
||||
#include <i4b/include/i4b_mbuf.h>
|
||||
#include <i4b/layer1/i4b_l1.h>
|
||||
#include <i4b/include/i4b_l3l4.h>
|
||||
|
||||
#include <i4b/layer2/i4b_l2.h>
|
||||
|
||||
static int openflag = 0;
|
||||
@ -126,6 +139,9 @@ PSEUDO_SET(i4bctlattach, i4b_i4bctldrv);
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ == 3
|
||||
#ifdef DEVFS
|
||||
static void *devfs_token;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
@ -204,6 +220,11 @@ i4bctlattach()
|
||||
#if defined(__FreeBSD__)
|
||||
#if __FreeBSD__ == 3
|
||||
|
||||
#ifdef DEVFS
|
||||
devfs_token = devfs_add_devswf(&i4bctl_cdevsw, 0, DV_CHR,
|
||||
UID_ROOT, GID_WHEEL, 0600,
|
||||
"i4bctl");
|
||||
#endif
|
||||
|
||||
#else
|
||||
make_dev(&i4bctl_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4bctl");
|
||||
@ -250,10 +271,12 @@ i4bctlioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
i4bctlioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
#endif
|
||||
{
|
||||
#if DO_I4B_DEBUG
|
||||
ctl_debug_t *cdbg;
|
||||
int error = 0;
|
||||
#endif
|
||||
|
||||
#ifndef DO_I4B_DEBUG
|
||||
#if !DO_I4B_DEBUG
|
||||
return(ENODEV);
|
||||
#else
|
||||
if(minor(dev))
|
||||
@ -277,63 +300,19 @@ i4bctlioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
i4b_l4_debug = cdbg->l4;
|
||||
break;
|
||||
|
||||
case I4B_CTL_GET_HSCXSTAT:
|
||||
case I4B_CTL_GET_CHIPSTAT:
|
||||
{
|
||||
hscxstat_t *hst;
|
||||
struct l1_softc *sc;
|
||||
hst = (hscxstat_t *)data;
|
||||
|
||||
if( hst->unit < 0 ||
|
||||
hst->unit > ISIC_MAXUNIT ||
|
||||
hst->chan < 0 ||
|
||||
hst->chan > 1 )
|
||||
{
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
sc = isic_find_sc(hst->unit);
|
||||
#else
|
||||
sc = &l1_sc[hst->unit];
|
||||
#endif
|
||||
hst->vfr = sc->sc_chan[hst->chan].stat_VFR;
|
||||
hst->rdo = sc->sc_chan[hst->chan].stat_RDO;
|
||||
hst->crc = sc->sc_chan[hst->chan].stat_CRC;
|
||||
hst->rab = sc->sc_chan[hst->chan].stat_RAB;
|
||||
hst->xdu = sc->sc_chan[hst->chan].stat_XDU;
|
||||
hst->rfo = sc->sc_chan[hst->chan].stat_RFO;
|
||||
struct chipstat *cst;
|
||||
cst = (struct chipstat *)data;
|
||||
(*ctrl_desc[cst->driver_unit].N_MGMT_COMMAND)(cst->driver_unit, CMR_GCST, cst);
|
||||
break;
|
||||
}
|
||||
|
||||
case I4B_CTL_CLR_HSCXSTAT:
|
||||
case I4B_CTL_CLR_CHIPSTAT:
|
||||
{
|
||||
hscxstat_t *hst;
|
||||
struct l1_softc *sc;
|
||||
hst = (hscxstat_t *)data;
|
||||
|
||||
if( hst->unit < 0 ||
|
||||
hst->unit > ISIC_MAXUNIT ||
|
||||
hst->chan < 0 ||
|
||||
hst->chan > 1 )
|
||||
{
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
sc = isic_find_sc(hst->unit);
|
||||
#else
|
||||
sc = &l1_sc[hst->unit];
|
||||
#endif
|
||||
|
||||
sc->sc_chan[hst->chan].stat_VFR = 0;
|
||||
sc->sc_chan[hst->chan].stat_RDO = 0;
|
||||
sc->sc_chan[hst->chan].stat_CRC = 0;
|
||||
sc->sc_chan[hst->chan].stat_RAB = 0;
|
||||
sc->sc_chan[hst->chan].stat_XDU = 0;
|
||||
sc->sc_chan[hst->chan].stat_RFO = 0;
|
||||
|
||||
struct chipstat *cst;
|
||||
cst = (struct chipstat *)data;
|
||||
(*ctrl_desc[cst->driver_unit].N_MGMT_COMMAND)(cst->driver_unit, CMR_CCST, cst);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -343,7 +322,7 @@ i4bctlioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
l2_softc_t *sc;
|
||||
l2s = (l2stat_t *)data;
|
||||
|
||||
if( l2s->unit < 0 || l2s->unit > ISIC_MAXUNIT)
|
||||
if( l2s->unit < 0 || l2s->unit > MAXL1UNITS)
|
||||
{
|
||||
error = EINVAL;
|
||||
break;
|
||||
@ -361,7 +340,7 @@ i4bctlioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
l2_softc_t *sc;
|
||||
up = (int *)data;
|
||||
|
||||
if( *up < 0 || *up > ISIC_MAXUNIT)
|
||||
if( *up < 0 || *up > MAXL1UNITS)
|
||||
{
|
||||
error = EINVAL;
|
||||
break;
|
||||
|
860
sys/i4b/driver/i4b_ing.c
Normal file
860
sys/i4b/driver/i4b_ing.c
Normal file
@ -0,0 +1,860 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 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.
|
||||
*
|
||||
* 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_ing.c - isdn4bsd B-channel to netgraph driver
|
||||
* -------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_ing.c,v 1.10 2000/04/27 11:35:00 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Thu Apr 27 13:33:18 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "i4bing.h"
|
||||
|
||||
#if NI4BING > 0
|
||||
|
||||
#include "opt_i4b.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ctype.h>
|
||||
#include <sys/ioccom.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netgraph/ng_message.h>
|
||||
#include <netgraph/ng_parse.h>
|
||||
#include <netgraph/netgraph.h>
|
||||
|
||||
#include <machine/i4b_ioctl.h>
|
||||
#include <machine/i4b_debug.h>
|
||||
|
||||
#include <i4b/include/i4b_global.h>
|
||||
#include <i4b/include/i4b_mbuf.h>
|
||||
#include <i4b/include/i4b_l3l4.h>
|
||||
|
||||
#include <i4b/layer4/i4b_l4.h>
|
||||
|
||||
#define I4BINGACCT 1 /* enable accounting messages */
|
||||
#define I4BINGACCTINTVL 2 /* accounting msg interval in secs */
|
||||
|
||||
#define I4BINGMAXQLEN 50 /* max queue length */
|
||||
|
||||
/* initialized by L4 */
|
||||
|
||||
static drvr_link_t ing_drvr_linktab[NI4BING];
|
||||
static isdn_link_t *isdn_linktab[NI4BING];
|
||||
|
||||
struct ing_softc {
|
||||
int sc_unit; /* unit number */
|
||||
int sc_state; /* state of the interface */
|
||||
call_desc_t *sc_cdp; /* ptr to call descriptor */
|
||||
int sc_updown; /* soft state of interface */
|
||||
struct ifqueue sc_fastq; /* interactive traffic */
|
||||
int sc_dialresp; /* dialresponse */
|
||||
int sc_lastdialresp;/* last dialresponse */
|
||||
|
||||
#if I4BINGACCT
|
||||
struct callout_handle sc_callout;
|
||||
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
|
||||
|
||||
int sc_inpkt; /* incoming packets */
|
||||
int sc_outpkt; /* outgoing packets */
|
||||
|
||||
struct ifqueue xmitq_hipri; /* hi-priority transmit queue */
|
||||
struct ifqueue xmitq; /* transmit queue */
|
||||
|
||||
node_p node; /* back pointer to node */
|
||||
char nodename[NG_NODELEN + 1]; /* store our node name */
|
||||
hook_p debughook;
|
||||
hook_p hook;
|
||||
|
||||
u_int packets_in; /* packets in from downstream */
|
||||
u_int packets_out; /* packets out towards downstream */
|
||||
u_int32_t flags;
|
||||
|
||||
} ing_softc[NI4BING];
|
||||
|
||||
enum ing_states {
|
||||
ST_IDLE, /* initialized, ready, idle */
|
||||
ST_DIALING, /* dialling out to remote */
|
||||
ST_CONNECTED /* connected to remote */
|
||||
};
|
||||
|
||||
static void i4bingattach(void *);
|
||||
|
||||
PSEUDO_SET(i4bingattach, i4b_ing);
|
||||
|
||||
static void ing_init_linktab(int unit);
|
||||
static void ing_tx_queue_empty(int unit);
|
||||
|
||||
/* ========= NETGRAPH ============= */
|
||||
|
||||
#define NG_ING_NODE_TYPE "i4bing" /* node type name */
|
||||
#define NGM_ING_COOKIE 947513046 /* node type cookie */
|
||||
|
||||
/* Hook names */
|
||||
#define NG_ING_HOOK_DEBUG "debug"
|
||||
#define NG_ING_HOOK_RAW "rawdata"
|
||||
|
||||
/* Netgraph commands understood by this node type */
|
||||
enum {
|
||||
NGM_ING_SET_FLAG = 1,
|
||||
NGM_ING_GET_STATUS,
|
||||
};
|
||||
|
||||
/* This structure is returned by the NGM_ING_GET_STATUS command */
|
||||
struct ngingstat {
|
||||
u_int packets_in; /* packets in from downstream */
|
||||
u_int packets_out; /* packets out towards downstream */
|
||||
};
|
||||
|
||||
/*
|
||||
* This is used to define the 'parse type' for a struct ngingstat, which
|
||||
* is bascially a description of how to convert a binary struct ngingstat
|
||||
* to an ASCII string and back. See ng_parse.h for more info.
|
||||
*
|
||||
* This needs to be kept in sync with the above structure definition
|
||||
*/
|
||||
#define NG_ING_STATS_TYPE_INFO { \
|
||||
{ \
|
||||
{ "packets_in", &ng_parse_int32_type }, \
|
||||
{ "packets_out", &ng_parse_int32_type }, \
|
||||
{ NULL }, \
|
||||
} \
|
||||
}
|
||||
|
||||
/*
|
||||
* This section contains the netgraph method declarations for the
|
||||
* sample node. These methods define the netgraph 'type'.
|
||||
*/
|
||||
|
||||
static ng_constructor_t ng_ing_constructor;
|
||||
static ng_rcvmsg_t ng_ing_rcvmsg;
|
||||
static ng_shutdown_t ng_ing_rmnode;
|
||||
static ng_newhook_t ng_ing_newhook;
|
||||
static ng_connect_t ng_ing_connect;
|
||||
static ng_rcvdata_t ng_ing_rcvdata;
|
||||
static ng_disconnect_t ng_ing_disconnect;
|
||||
|
||||
/* Parse type for struct ngingstat */
|
||||
static const struct
|
||||
ng_parse_struct_info ng_ing_stat_type_info = NG_ING_STATS_TYPE_INFO;
|
||||
|
||||
static const struct ng_parse_type ng_ing_stat_type = {
|
||||
&ng_parse_struct_type,
|
||||
&ng_ing_stat_type_info
|
||||
};
|
||||
|
||||
/* List of commands and how to convert arguments to/from ASCII */
|
||||
|
||||
static const struct ng_cmdlist ng_ing_cmdlist[] = {
|
||||
{
|
||||
NGM_ING_COOKIE,
|
||||
NGM_ING_GET_STATUS,
|
||||
"getstatus",
|
||||
NULL,
|
||||
&ng_ing_stat_type,
|
||||
},
|
||||
{
|
||||
NGM_ING_COOKIE,
|
||||
NGM_ING_SET_FLAG,
|
||||
"setflag",
|
||||
&ng_parse_int32_type,
|
||||
NULL
|
||||
},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* Netgraph node type descriptor */
|
||||
static struct ng_type typestruct = {
|
||||
NG_VERSION,
|
||||
NG_ING_NODE_TYPE,
|
||||
NULL,
|
||||
ng_ing_constructor,
|
||||
ng_ing_rcvmsg,
|
||||
ng_ing_rmnode,
|
||||
ng_ing_newhook,
|
||||
NULL,
|
||||
ng_ing_connect,
|
||||
ng_ing_rcvdata,
|
||||
ng_ing_rcvdata,
|
||||
ng_ing_disconnect,
|
||||
ng_ing_cmdlist
|
||||
};
|
||||
|
||||
NETGRAPH_INIT(ing, &typestruct);
|
||||
|
||||
/*===========================================================================*
|
||||
* DEVICE DRIVER ROUTINES
|
||||
*===========================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* interface attach routine at kernel boot time
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
i4bingattach(void *dummy)
|
||||
{
|
||||
struct ing_softc *sc = ing_softc;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
printf("i4bing: %d i4b NetGraph ISDN B-channel device(s) attached\n", NI4BING);
|
||||
|
||||
for(i=0; i < NI4BING; sc++, i++)
|
||||
{
|
||||
sc->sc_unit = i;
|
||||
|
||||
ing_init_linktab(i);
|
||||
|
||||
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
|
||||
|
||||
sc->sc_state = ST_IDLE;
|
||||
|
||||
sc->sc_fastq.ifq_maxlen = I4BINGMAXQLEN;
|
||||
|
||||
#if I4BINGACCT
|
||||
callout_handle_init(&sc->sc_callout);
|
||||
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
|
||||
|
||||
sc->sc_inpkt = 0;
|
||||
sc->sc_outpkt = 0;
|
||||
|
||||
sc->sc_updown = SOFT_ENA; /* soft enabled */
|
||||
|
||||
sc->sc_dialresp = DSTAT_NONE; /* no response */
|
||||
sc->sc_lastdialresp = DSTAT_NONE;
|
||||
|
||||
/* setup a netgraph node */
|
||||
|
||||
if ((ret = ng_make_node_common(&typestruct, &sc->node)))
|
||||
{
|
||||
printf("ing: ng_make_node_common, ret = %d\n!", ret);
|
||||
}
|
||||
|
||||
sc->node->private = sc;
|
||||
|
||||
sc->xmitq.ifq_maxlen = IFQ_MAXLEN;
|
||||
sc->xmitq_hipri.ifq_maxlen = IFQ_MAXLEN;
|
||||
|
||||
/* name the netgraph node */
|
||||
|
||||
sprintf(sc->nodename, "%s%d", NG_ING_NODE_TYPE, sc->sc_unit);
|
||||
|
||||
if(ng_name_node(sc->node, sc->nodename))
|
||||
{
|
||||
ng_rmnode(sc->node);
|
||||
ng_unref(sc->node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef I4BINGACCT
|
||||
/*---------------------------------------------------------------------------*
|
||||
* accounting timeout routine
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
ing_timeout(struct ing_softc *sc)
|
||||
{
|
||||
bchan_statistics_t bs;
|
||||
int unit = sc->sc_unit;
|
||||
|
||||
/* get # of bytes in and out from the HSCX driver */
|
||||
|
||||
(*isdn_linktab[unit]->bch_stat)
|
||||
(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
|
||||
|
||||
sc->sc_ioutb += bs.outbytes;
|
||||
sc->sc_iinb += bs.inbytes;
|
||||
|
||||
if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
|
||||
{
|
||||
int ri = (sc->sc_iinb - sc->sc_linb)/I4BINGACCTINTVL;
|
||||
int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BINGACCTINTVL;
|
||||
|
||||
if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb))
|
||||
sc->sc_fn = 0;
|
||||
else
|
||||
sc->sc_fn = 1;
|
||||
|
||||
sc->sc_linb = sc->sc_iinb;
|
||||
sc->sc_loutb = sc->sc_ioutb;
|
||||
|
||||
i4b_l4_accounting(BDRV_ING, unit, ACCT_DURING,
|
||||
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_ioutb, sc->sc_iinb);
|
||||
}
|
||||
|
||||
sc->sc_callout = timeout((TIMEOUT_FUNC_T)ing_timeout,
|
||||
(void *)sc, I4BINGACCTINTVL*hz);
|
||||
}
|
||||
#endif /* I4BINGACCT */
|
||||
|
||||
#if 0
|
||||
/*---------------------------------------------------------------------------*
|
||||
* clear the interface's send queues
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
ingclearqueue(struct ifqueue *iq)
|
||||
{
|
||||
int x;
|
||||
struct mbuf *m;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
x = splimp();
|
||||
IF_DEQUEUE(iq, m);
|
||||
splx(x);
|
||||
|
||||
if(m)
|
||||
m_freem(m);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*===========================================================================*
|
||||
* ISDN INTERFACE ROUTINES
|
||||
*===========================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* this routine is called from L4 handler at connect time
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
ing_connect(int unit, void *cdp)
|
||||
{
|
||||
struct ing_softc *sc = &ing_softc[unit];
|
||||
int s;
|
||||
|
||||
sc->sc_cdp = (call_desc_t *)cdp;
|
||||
|
||||
s = SPLI4B();
|
||||
|
||||
NDBGL4(L4_DIALST, "ing%d: setting dial state to ST_CONNECTED", unit);
|
||||
|
||||
sc->sc_dialresp = DSTAT_NONE;
|
||||
sc->sc_lastdialresp = DSTAT_NONE;
|
||||
|
||||
#if I4BINGACCT
|
||||
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_callout = timeout((TIMEOUT_FUNC_T)ing_timeout,
|
||||
(void *)sc, I4BINGACCTINTVL*hz);
|
||||
#endif
|
||||
|
||||
sc->sc_state = ST_CONNECTED;
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* this routine is called from L4 handler at disconnect time
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
ing_disconnect(int unit, void *cdp)
|
||||
{
|
||||
call_desc_t *cd = (call_desc_t *)cdp;
|
||||
struct ing_softc *sc = &ing_softc[unit];
|
||||
|
||||
/* new stuff to check that the active channel is being closed */
|
||||
|
||||
if (cd != sc->sc_cdp)
|
||||
{
|
||||
NDBGL4(L4_INGDBG, "ing%d: channel %d not active",
|
||||
cd->driver_unit, cd->channelid);
|
||||
return;
|
||||
}
|
||||
|
||||
#if I4BINGACCT
|
||||
untimeout((TIMEOUT_FUNC_T)ing_timeout,
|
||||
(void *)sc, sc->sc_callout);
|
||||
#endif
|
||||
|
||||
i4b_l4_accounting(BDRV_ING, cd->driver_unit, ACCT_FINAL,
|
||||
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
|
||||
|
||||
sc->sc_cdp = (call_desc_t *)0;
|
||||
|
||||
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
|
||||
|
||||
sc->sc_dialresp = DSTAT_NONE;
|
||||
sc->sc_lastdialresp = DSTAT_NONE;
|
||||
|
||||
sc->sc_state = ST_IDLE;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* this routine is used to give a feedback from userland daemon
|
||||
* in case of dial problems
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
ing_dialresponse(int unit, int status, cause_t cause)
|
||||
{
|
||||
struct ing_softc *sc = &ing_softc[unit];
|
||||
sc->sc_dialresp = status;
|
||||
|
||||
NDBGL4(L4_INGDBG, "ing%d: last=%d, this=%d",
|
||||
unit, sc->sc_lastdialresp, sc->sc_dialresp);
|
||||
|
||||
if(status != DSTAT_NONE)
|
||||
{
|
||||
NDBGL4(L4_INGDBG, "ing%d: clearing queues", unit);
|
||||
/* ingclearqueues(sc); */
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* interface soft up/down
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
ing_updown(int unit, int updown)
|
||||
{
|
||||
struct ing_softc *sc = &ing_softc[unit];
|
||||
sc->sc_updown = updown;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* this routine is called from the HSCX interrupt handler
|
||||
* when a new frame (mbuf) has been received and was put on
|
||||
* the rx queue. It is assumed that this routines runs at
|
||||
* pri level splimp() ! Keep it short !
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
ing_rx_data_rdy(int unit)
|
||||
{
|
||||
register struct ing_softc *sc = &ing_softc[unit];
|
||||
register struct mbuf *m;
|
||||
|
||||
if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
|
||||
return;
|
||||
|
||||
#if I4BINGACCT
|
||||
sc->sc_inb += m->m_pkthdr.len;
|
||||
#endif
|
||||
|
||||
m->m_pkthdr.rcvif = NULL;
|
||||
|
||||
sc->sc_inpkt++;
|
||||
|
||||
ng_queue_data(sc->hook, m, NULL);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* 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
|
||||
ing_tx_queue_empty(int unit)
|
||||
{
|
||||
register struct ing_softc *sc = &ing_softc[unit];
|
||||
register struct mbuf *m;
|
||||
int x = 0;
|
||||
|
||||
if(sc->sc_state != ST_CONNECTED)
|
||||
return;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
IF_DEQUEUE(&sc->xmitq_hipri, m);
|
||||
|
||||
if(m == NULL)
|
||||
{
|
||||
IF_DEQUEUE(&sc->xmitq, m);
|
||||
if(m == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
#if I4BINGACCT
|
||||
sc->sc_outb += m->m_pkthdr.len;
|
||||
#endif
|
||||
|
||||
x = 1;
|
||||
|
||||
if(IF_QFULL(isdn_linktab[unit]->tx_queue))
|
||||
{
|
||||
NDBGL4(L4_INGDBG, "ing%d: tx queue full!", unit);
|
||||
m_freem(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m);
|
||||
}
|
||||
}
|
||||
|
||||
if(x)
|
||||
(*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* 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
|
||||
ing_activity(int unit, int rxtx)
|
||||
{
|
||||
ing_softc[unit].sc_cdp->last_active_time = SECOND;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* return this drivers linktab address
|
||||
*---------------------------------------------------------------------------*/
|
||||
drvr_link_t *
|
||||
ing_ret_linktab(int unit)
|
||||
{
|
||||
return(&ing_drvr_linktab[unit]);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* setup the isdn_linktab for this driver
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
ing_set_linktab(int unit, isdn_link_t *ilt)
|
||||
{
|
||||
isdn_linktab[unit] = ilt;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* initialize this drivers linktab
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
ing_init_linktab(int unit)
|
||||
{
|
||||
ing_drvr_linktab[unit].unit = unit;
|
||||
ing_drvr_linktab[unit].bch_rx_data_ready = ing_rx_data_rdy;
|
||||
ing_drvr_linktab[unit].bch_tx_queue_empty = ing_tx_queue_empty;
|
||||
ing_drvr_linktab[unit].bch_activity = ing_activity;
|
||||
ing_drvr_linktab[unit].line_connected = ing_connect;
|
||||
ing_drvr_linktab[unit].line_disconnected = ing_disconnect;
|
||||
ing_drvr_linktab[unit].dial_response = ing_dialresponse;
|
||||
ing_drvr_linktab[unit].updown_ind = ing_updown;
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* NETGRAPH INTERFACE ROUTINES
|
||||
*===========================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* It is not possible or allowable to create a node of this type.
|
||||
* If the hardware exists, it will already have created it.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
ng_ing_constructor(node_p *nodep)
|
||||
{
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Give our ok for a hook to be added...
|
||||
* Add the hook's private info to the hook structure.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
ng_ing_newhook(node_p node, hook_p hook, const char *name)
|
||||
{
|
||||
struct ing_softc *sc = node->private;
|
||||
|
||||
/*
|
||||
* check if it's our friend the debug hook
|
||||
*/
|
||||
if(strcmp(name, NG_ING_HOOK_DEBUG) == 0)
|
||||
{
|
||||
hook->private = NULL; /* paranoid */
|
||||
sc->debughook = hook;
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Check for raw mode hook.
|
||||
*/
|
||||
if(strcmp(name, NG_ING_HOOK_RAW) == 0)
|
||||
{
|
||||
hook->private = sc;
|
||||
sc->hook = hook;
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Get a netgraph control message.
|
||||
* Check it is one we understand. If needed, send a response.
|
||||
* We could save the address for an async action later, but don't here.
|
||||
* Always free the message.
|
||||
* The response should be in a malloc'd region that the caller can 'free'.
|
||||
* A response is not required.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
ng_ing_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
|
||||
struct ng_mesg **rptr)
|
||||
{
|
||||
struct ing_softc *sc = node->private;
|
||||
|
||||
struct ng_mesg *resp = NULL;
|
||||
int error = 0;
|
||||
|
||||
if(msg->header.typecookie == NGM_GENERIC_COOKIE)
|
||||
{
|
||||
switch(msg->header.cmd)
|
||||
{
|
||||
case NGM_TEXT_STATUS:
|
||||
{
|
||||
char *arg;
|
||||
char *p;
|
||||
int pos = 0;
|
||||
|
||||
NG_MKRESPONSE(resp, msg, sizeof(struct ng_mesg) + NG_TEXTRESPONSE, M_NOWAIT);
|
||||
|
||||
if (resp == NULL)
|
||||
{
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
arg = (char *) resp->data;
|
||||
|
||||
switch(sc->sc_state)
|
||||
{
|
||||
case ST_IDLE:
|
||||
p = "idle";
|
||||
break;
|
||||
case ST_DIALING:
|
||||
p = "dialing";
|
||||
break;
|
||||
case ST_CONNECTED:
|
||||
p = "connected";
|
||||
break;
|
||||
default:
|
||||
p = "???";
|
||||
break;
|
||||
}
|
||||
|
||||
pos = sprintf(arg, "state = %s (%d)\n", p, sc->sc_state);
|
||||
#if I4BINGACCT
|
||||
pos += sprintf(arg + pos, "%d bytes in, %d bytes out\n", sc->sc_inb, sc->sc_outb);
|
||||
#endif
|
||||
pos += sprintf(arg + pos, "%d pkts in, %d pkts out\n", sc->sc_inpkt, sc->sc_outpkt);
|
||||
|
||||
resp->header.arglen = pos + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(msg->header.typecookie == NGM_ING_COOKIE)
|
||||
{
|
||||
switch (msg->header.cmd)
|
||||
{
|
||||
case NGM_ING_GET_STATUS:
|
||||
{
|
||||
struct ngingstat *stats;
|
||||
|
||||
NG_MKRESPONSE(resp, msg, sizeof(*stats), M_NOWAIT);
|
||||
|
||||
if (!resp)
|
||||
{
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
||||
stats = (struct ngingstat *) resp->data;
|
||||
stats->packets_in = sc->packets_in;
|
||||
stats->packets_out = sc->packets_out;
|
||||
break;
|
||||
}
|
||||
|
||||
case NGM_ING_SET_FLAG:
|
||||
if (msg->header.arglen != sizeof(u_int32_t))
|
||||
{
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
sc->flags = *((u_int32_t *) msg->data);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL; /* unknown command */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = EINVAL; /* unknown cookie type */
|
||||
}
|
||||
|
||||
/* Take care of synchronous response, if any */
|
||||
|
||||
if (rptr)
|
||||
*rptr = resp;
|
||||
else if (resp)
|
||||
FREE(resp, M_NETGRAPH);
|
||||
|
||||
/* Free the message and return */
|
||||
|
||||
FREE(msg, M_NETGRAPH);
|
||||
return(error);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* get data from another node and transmit it out on a B-channel
|
||||
*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
ng_ing_rcvdata(hook_p hook, struct mbuf *m, meta_p meta)
|
||||
{
|
||||
struct ing_softc *sc = hook->node->private;
|
||||
struct ifqueue *xmitq_p;
|
||||
int s;
|
||||
|
||||
if(hook->private == NULL)
|
||||
{
|
||||
NG_FREE_DATA(m, meta);
|
||||
return(ENETDOWN);
|
||||
}
|
||||
|
||||
if(sc->sc_state == ST_IDLE || sc->sc_state == ST_DIALING)
|
||||
{
|
||||
i4b_l4_dialout(BDRV_ING, sc->sc_unit);
|
||||
sc->sc_state = ST_DIALING;
|
||||
}
|
||||
|
||||
sc->sc_outpkt++;
|
||||
|
||||
/*
|
||||
* Now queue the data for when it can be sent
|
||||
*/
|
||||
|
||||
if (meta && meta->priority > 0)
|
||||
{
|
||||
xmitq_p = (&sc->xmitq_hipri);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmitq_p = (&sc->xmitq);
|
||||
}
|
||||
|
||||
s = splimp();
|
||||
|
||||
if (IF_QFULL(xmitq_p))
|
||||
{
|
||||
IF_DROP(xmitq_p);
|
||||
splx(s);
|
||||
NG_FREE_DATA(m, meta);
|
||||
return(ENOBUFS);
|
||||
}
|
||||
|
||||
IF_ENQUEUE(xmitq_p, m);
|
||||
|
||||
ing_tx_queue_empty(sc->sc_unit);
|
||||
|
||||
splx(s);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Do local shutdown processing..
|
||||
* If we are a persistant device, we might refuse to go away, and
|
||||
* we'd only remove our links and reset ourself.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
ng_ing_rmnode(node_p node)
|
||||
{
|
||||
struct ing_softc *sc = node->private;
|
||||
|
||||
node->flags |= NG_INVALID;
|
||||
ng_cutlinks(node);
|
||||
|
||||
sc->packets_in = 0; /* reset stats */
|
||||
sc->packets_out = 0;
|
||||
|
||||
node->flags &= ~NG_INVALID; /* reset invalid flag */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* This is called once we've already connected a new hook to the other node.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
ng_ing_connect(hook_p hook)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dook disconnection
|
||||
*
|
||||
* For this type, removal of the last link destroys the node
|
||||
*/
|
||||
static int
|
||||
ng_ing_disconnect(hook_p hook)
|
||||
{
|
||||
struct ing_softc *sc = hook->node->private;
|
||||
int s;
|
||||
|
||||
if(hook->private)
|
||||
{
|
||||
s = splimp();
|
||||
splx(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
sc->debughook = NULL;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#endif /* NI4BING > 0 */
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_ipr.c - isdn4bsd IP over raw HDLC ISDN network driver
|
||||
* ---------------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_ipr.c,v 1.55 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_ipr.c,v 1.59 2000/08/28 07:24:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:38:51 1999]
|
||||
* last edit-date: [Fri Aug 25 20:25:21 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*
|
||||
*
|
||||
@ -80,6 +80,11 @@
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/protosw.h>
|
||||
|
||||
@ -193,6 +198,13 @@ struct ipr_softc {
|
||||
int sc_fn; /* flag, first null acct */
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
struct callout sc_callout;
|
||||
#endif
|
||||
#if defined(__FreeBSD__)
|
||||
struct callout_handle sc_callout;
|
||||
#endif
|
||||
|
||||
#ifdef I4BIPRADJFRXP
|
||||
int sc_first_pkt; /* flag, first rxd packet */
|
||||
#endif
|
||||
@ -279,7 +291,7 @@ i4biprattach()
|
||||
{
|
||||
ipr_init_linktab(i);
|
||||
|
||||
DBGL4(L4_DIALST, "i4biprattach", ("setting dial state to ST_IDLE\n"));
|
||||
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
|
||||
|
||||
sc->sc_state = ST_IDLE;
|
||||
|
||||
@ -304,6 +316,10 @@ i4biprattach()
|
||||
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_SIMPLEX;
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
callout_init(&sc->sc_callout);
|
||||
#endif
|
||||
|
||||
sc->sc_if.if_mtu = I4BIPRMTU;
|
||||
sc->sc_if.if_type = IFT_ISDNBASIC;
|
||||
sc->sc_if.if_ioctl = i4biprioctl;
|
||||
@ -360,7 +376,12 @@ i4biprattach()
|
||||
sc->sc_dialresp = DSTAT_NONE; /* no response */
|
||||
sc->sc_lastdialresp = DSTAT_NONE;
|
||||
|
||||
#if defined(__FreeBSD_version) && ((__FreeBSD_version >= 500009) || (410000 <= __FreeBSD_version && __FreeBSD_version < 500000))
|
||||
/* do not call bpfattach in ether_ifattach */
|
||||
ether_ifattach(&sc->sc_if, 0);
|
||||
#else
|
||||
if_attach(&sc->sc_if);
|
||||
#endif
|
||||
|
||||
#if NBPFILTER > 0 || NBPF > 0
|
||||
#ifdef __FreeBSD__
|
||||
@ -411,7 +432,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
||||
|
||||
if(!(ifp->if_flags & IFF_UP))
|
||||
{
|
||||
DBGL4(L4_IPRDBG, "i4biproutput", ("ipr%d: interface is DOWN!\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: interface is DOWN!", unit);
|
||||
m_freem(m);
|
||||
splx(s);
|
||||
sc->sc_if.if_oerrors++;
|
||||
@ -427,7 +448,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
||||
switch(sc->sc_dialresp)
|
||||
{
|
||||
case DSTAT_TFAIL: /* transient failure */
|
||||
DBGL4(L4_IPRDBG, "i4biproutput", ("ipr%d: transient dial failure!\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: transient dial failure!", unit);
|
||||
m_freem(m);
|
||||
iprclearqueues(sc);
|
||||
sc->sc_dialresp = DSTAT_NONE;
|
||||
@ -437,7 +458,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
||||
break;
|
||||
|
||||
case DSTAT_PFAIL: /* permanent failure */
|
||||
DBGL4(L4_IPRDBG, "i4biproutput", ("ipr%d: permanent dial failure!\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: permanent dial failure!", unit);
|
||||
m_freem(m);
|
||||
iprclearqueues(sc);
|
||||
sc->sc_dialresp = DSTAT_NONE;
|
||||
@ -447,7 +468,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
||||
break;
|
||||
|
||||
case DSTAT_INONLY: /* no dialout allowed*/
|
||||
DBGL4(L4_IPRDBG, "i4biproutput", ("ipr%d: dialout not allowed failure!\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: dialout not allowed failure!", unit);
|
||||
m_freem(m);
|
||||
iprclearqueues(sc);
|
||||
sc->sc_dialresp = DSTAT_NONE;
|
||||
@ -458,8 +479,8 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
||||
}
|
||||
#endif
|
||||
|
||||
DBGL4(L4_IPRDBG, "i4biproutput", ("ipr%d: send dial request message!\n", unit));
|
||||
DBGL4(L4_DIALST, "i4biproutput", ("ipr%d: setting dial state to ST_DIALING\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: send dial request message!", unit);
|
||||
NDBGL4(L4_DIALST, "ipr%d: setting dial state to ST_DIALING", unit);
|
||||
i4b_l4_dialout(BDRV_IPR, unit);
|
||||
sc->sc_state = ST_DIALING;
|
||||
}
|
||||
@ -493,7 +514,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
||||
|
||||
if(IF_QFULL(ifq))
|
||||
{
|
||||
DBGL4(L4_IPRDBG, "i4biproutput", ("ipr%d: send queue full!\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: send queue full!", unit);
|
||||
IF_DROP(ifq);
|
||||
m_freem(m);
|
||||
splx(s);
|
||||
@ -501,7 +522,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
||||
return(ENOBUFS);
|
||||
}
|
||||
|
||||
DBGL4(L4_IPRDBG, "i4biproutput", ("ipr%d: add packet to send queue!\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: add packet to send queue!", unit);
|
||||
|
||||
IF_ENQUEUE(ifq, m);
|
||||
|
||||
@ -747,7 +768,7 @@ ipr_connect(int unit, void *cdp)
|
||||
|
||||
s = SPLI4B();
|
||||
|
||||
DBGL4(L4_DIALST, "ipr_connect", ("ipr%d: setting dial state to ST_CONNECTED\n", unit));
|
||||
NDBGL4(L4_DIALST, "ipr%d: setting dial state to ST_CONNECTED", unit);
|
||||
|
||||
sc->sc_if.if_flags |= IFF_RUNNING;
|
||||
sc->sc_state = ST_CONNECTED_W;
|
||||
@ -782,7 +803,16 @@ ipr_connect(int unit, void *cdp)
|
||||
|
||||
if(sc->sc_cdp->isdntxdelay > 0)
|
||||
{
|
||||
timeout((TIMEOUT_FUNC_T)i4bipr_connect_startio, (void *)sc, sc->sc_cdp->isdntxdelay /* hz*1 */);
|
||||
int delay;
|
||||
|
||||
if (hz == 100) {
|
||||
delay = sc->sc_cdp->isdntxdelay; /* avoid any rounding */
|
||||
} else {
|
||||
delay = sc->sc_cdp->isdntxdelay*hz;
|
||||
delay /= 100;
|
||||
}
|
||||
|
||||
START_TIMER(sc->sc_callout, (TIMEOUT_FUNC_T)i4bipr_connect_startio, (void *)sc, delay);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -809,8 +839,8 @@ ipr_disconnect(int unit, void *cdp)
|
||||
|
||||
if (cd != sc->sc_cdp)
|
||||
{
|
||||
DBGL4(L4_IPRDBG, "ipr_disconnect", ("ipr%d: channel %d not active\n",
|
||||
cd->driver_unit, cd->channelid));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: channel %d not active",
|
||||
cd->driver_unit, cd->channelid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -827,7 +857,7 @@ ipr_disconnect(int unit, void *cdp)
|
||||
|
||||
sc->sc_cdp = (call_desc_t *)0;
|
||||
|
||||
DBGL4(L4_DIALST, "ipr_disconnect", ("setting dial state to ST_IDLE\n"));
|
||||
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
|
||||
|
||||
sc->sc_dialresp = DSTAT_NONE;
|
||||
sc->sc_lastdialresp = DSTAT_NONE;
|
||||
@ -846,12 +876,12 @@ ipr_dialresponse(int unit, int status, cause_t cause)
|
||||
struct ipr_softc *sc = &ipr_softc[unit];
|
||||
sc->sc_dialresp = status;
|
||||
|
||||
DBGL4(L4_IPRDBG, "ipr_dialresponse", ("ipr%d: last=%d, this=%d\n",
|
||||
unit, sc->sc_lastdialresp, sc->sc_dialresp));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: last=%d, this=%d",
|
||||
unit, sc->sc_lastdialresp, sc->sc_dialresp);
|
||||
|
||||
if(status != DSTAT_NONE)
|
||||
{
|
||||
DBGL4(L4_IPRDBG, "ipr_dialresponse", ("ipr%d: clearing queues\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: clearing queues", unit);
|
||||
iprclearqueues(sc);
|
||||
}
|
||||
}
|
||||
@ -1045,7 +1075,7 @@ ipr_rx_data_rdy(int unit)
|
||||
|
||||
if(IF_QFULL(&ipintrq))
|
||||
{
|
||||
DBGL4(L4_IPRDBG, "ipr_rx_data_rdy", ("ipr%d: ipintrq full!\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: ipintrq full!", unit);
|
||||
|
||||
IF_DROP(&ipintrq);
|
||||
sc->sc_if.if_ierrors++;
|
||||
@ -1130,7 +1160,7 @@ ipr_tx_queue_empty(int unit)
|
||||
|
||||
if(IF_QFULL(isdn_linktab[unit]->tx_queue))
|
||||
{
|
||||
DBGL4(L4_IPRDBG, "ipr_rx_data_rdy", ("ipr%d: tx queue full!\n", unit));
|
||||
NDBGL4(L4_IPRDBG, "ipr%d: tx queue full!", unit);
|
||||
m_freem(m);
|
||||
}
|
||||
else
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -34,18 +34,32 @@
|
||||
* the "cx" driver for Cronyx's HDLC-in-hardware device). This driver
|
||||
* is only the glue between sppp and i4b.
|
||||
*
|
||||
* $Id: i4b_isppp.c,v 1.35 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_isppp.c,v 1.44 2000/08/31 07:07:26 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:39:06 1999]
|
||||
* last edit-date: [Thu Aug 31 09:02:27 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef __NetBSD__
|
||||
#define USE_ISPPP
|
||||
#endif
|
||||
#include "i4bisppp.h"
|
||||
|
||||
#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>
|
||||
@ -71,9 +85,13 @@
|
||||
#include <net/slcompress.h>
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#ifndef USE_ISPPP
|
||||
#include <net/if_sppp.h>
|
||||
#else
|
||||
#include <i4b/sppp/if_sppp.h>
|
||||
#include <machine/i4b_isppp.h>
|
||||
#endif /* USE_ISPPP */
|
||||
#else
|
||||
#include <net/if_sppp.h>
|
||||
#endif
|
||||
|
||||
|
||||
@ -135,7 +153,7 @@
|
||||
PDEVSTATIC void i4bispppattach(void *);
|
||||
PSEUDO_SET(i4bispppattach, i4b_isppp);
|
||||
#else
|
||||
PDEVSTATIC void i4bispppattach __P((void));
|
||||
PDEVSTATIC void i4bispppattach(void);
|
||||
#endif
|
||||
|
||||
#define I4BISPPPACCT 1 /* enable accounting messages */
|
||||
@ -199,6 +217,7 @@ 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);
|
||||
time_t i4bisppp_idletime(int unit);
|
||||
|
||||
/* initialized by L4 */
|
||||
|
||||
@ -222,7 +241,7 @@ PDEVSTATIC void
|
||||
#ifdef __FreeBSD__
|
||||
i4bispppattach(void *dummy)
|
||||
#else
|
||||
i4bispppattach(void)
|
||||
i4bispppattach()
|
||||
#endif
|
||||
{
|
||||
struct i4bisppp_softc *sc = i4bisppp_softc;
|
||||
@ -253,7 +272,14 @@ i4bispppattach(void)
|
||||
#endif
|
||||
|
||||
sc->sc_if.if_mtu = PP_MTU;
|
||||
|
||||
#ifdef __NetBSD__
|
||||
sc->sc_if.if_flags = IFF_SIMPLEX | IFF_POINTOPOINT |
|
||||
IFF_MULTICAST;
|
||||
#else
|
||||
sc->sc_if.if_flags = IFF_SIMPLEX | IFF_POINTOPOINT;
|
||||
#endif
|
||||
|
||||
sc->sc_if.if_type = IFT_ISDNBASIC;
|
||||
sc->sc_state = ST_IDLE;
|
||||
|
||||
@ -297,8 +323,17 @@ i4bispppattach(void)
|
||||
sc->sc_if_un.scu_sp.pp_con = i4bisppp_negotiation_complete;
|
||||
sc->sc_if_un.scu_sp.pp_chg = i4bisppp_state_changed;
|
||||
|
||||
#ifndef USE_ISPPP
|
||||
sppp_attach(&sc->sc_if);
|
||||
#else
|
||||
isppp_attach(&sc->sc_if);
|
||||
#endif
|
||||
#if defined(__FreeBSD_version) && ((__FreeBSD_version >= 500009) || (410000 <= __FreeBSD_version && __FreeBSD_version < 500000))
|
||||
/* do not call bpfattach in ether_ifattach */
|
||||
ether_ifattach(&sc->sc_if, 0);
|
||||
#else
|
||||
if_attach(&sc->sc_if);
|
||||
#endif
|
||||
|
||||
#if NBPFILTER > 0 || NBPF > 0
|
||||
#ifdef __FreeBSD__
|
||||
@ -327,7 +362,11 @@ i4bisppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data)
|
||||
|
||||
int error;
|
||||
|
||||
#ifndef USE_ISPPP
|
||||
error = sppp_ioctl(&sc->sc_if, cmd, data);
|
||||
#else
|
||||
error = isppp_ioctl(&sc->sc_if, cmd, data);
|
||||
#endif
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
@ -356,7 +395,11 @@ i4bisppp_start(struct ifnet *ifp)
|
||||
/* int s; */
|
||||
int unit = IFP2UNIT(ifp);
|
||||
|
||||
#ifndef USE_ISPPP
|
||||
if (sppp_isempty(ifp))
|
||||
#else
|
||||
if (isppp_isempty(ifp))
|
||||
#endif
|
||||
return;
|
||||
|
||||
if(sc->sc_state != ST_CONNECTED)
|
||||
@ -368,7 +411,11 @@ i4bisppp_start(struct ifnet *ifp)
|
||||
* splx(s);
|
||||
*/
|
||||
|
||||
#ifndef USE_ISPPP
|
||||
while ((m = sppp_dequeue(&sc->sc_if)) != NULL)
|
||||
#else
|
||||
while ((m = isppp_dequeue(&sc->sc_if)) != NULL)
|
||||
#endif
|
||||
{
|
||||
|
||||
#if NBPFILTER > 0 || NBPF > 0
|
||||
@ -387,14 +434,15 @@ i4bisppp_start(struct ifnet *ifp)
|
||||
|
||||
if(IF_QFULL(isdn_linktab[unit]->tx_queue))
|
||||
{
|
||||
DBGL4(L4_ISPDBG, "i4bisppp_start", ("isp%d, tx queue full!\n", unit));
|
||||
NDBGL4(L4_ISPDBG, "isp%d, tx queue full!", unit);
|
||||
m_freem(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m);
|
||||
|
||||
#if 0
|
||||
sc->sc_if.if_obytes += m->m_pkthdr.len;
|
||||
#endif
|
||||
sc->sc_outb += m->m_pkthdr.len;
|
||||
sc->sc_if.if_opackets++;
|
||||
}
|
||||
@ -554,7 +602,9 @@ i4bisppp_connect(int unit, void *cdp)
|
||||
#endif
|
||||
|
||||
sp->pp_up(sp); /* tell PPP we are ready */
|
||||
|
||||
#ifndef __NetBSD__
|
||||
sp->pp_last_sent = sp->pp_last_recv = SECOND;
|
||||
#endif
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -573,7 +623,7 @@ i4bisppp_disconnect(int unit, void *cdp)
|
||||
/* new stuff to check that the active channel is being closed */
|
||||
if (cd != sc->sc_cdp)
|
||||
{
|
||||
DBGL4(L4_ISPDBG, "i4bisppp_disconnect", ("isp%d, channel%d not active!\n", unit, cd->channelid));
|
||||
NDBGL4(L4_ISPDBG, "isp%d, channel%d not active!", unit, cd->channelid);
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
@ -608,17 +658,25 @@ i4bisppp_dialresponse(int unit, int status, cause_t cause)
|
||||
{
|
||||
struct i4bisppp_softc *sc = &i4bisppp_softc[unit];
|
||||
|
||||
DBGL4(L4_ISPDBG, "i4bisppp_dialresponse", ("isp%d: status=%d, cause=%d\n", unit, status, cause));
|
||||
NDBGL4(L4_ISPDBG, "isp%d: status=%d, cause=%d", unit, status, cause);
|
||||
|
||||
if(status != DSTAT_NONE)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
DBGL4(L4_ISPDBG, "i4bisppp_dialresponse", ("isp%d: clearing queues\n", unit));
|
||||
NDBGL4(L4_ISPDBG, "isp%d: clearing queues", unit);
|
||||
|
||||
#ifndef USE_ISPPP
|
||||
if(!(sppp_isempty(&sc->sc_if)))
|
||||
#else
|
||||
if(!(isppp_isempty(&sc->sc_if)))
|
||||
#endif
|
||||
{
|
||||
#ifndef USE_ISPPP
|
||||
while((m = sppp_dequeue(&sc->sc_if)) != NULL)
|
||||
#else
|
||||
while((m = isppp_dequeue(&sc->sc_if)) != NULL)
|
||||
#endif
|
||||
m_freem(m);
|
||||
}
|
||||
}
|
||||
@ -654,7 +712,9 @@ i4bisppp_rx_data_rdy(int unit)
|
||||
microtime(&sc->sc_if.if_lastchange);
|
||||
|
||||
sc->sc_if.if_ipackets++;
|
||||
#if 0
|
||||
sc->sc_if.if_ibytes += m->m_pkthdr.len;
|
||||
#endif
|
||||
|
||||
#if I4BISPPPACCT
|
||||
sc->sc_inb += m->m_pkthdr.len;
|
||||
@ -680,7 +740,11 @@ i4bisppp_rx_data_rdy(int unit)
|
||||
|
||||
s = splimp();
|
||||
|
||||
#ifndef USE_ISPPP
|
||||
sppp_input(&sc->sc_if, m);
|
||||
#else
|
||||
isppp_input(&sc->sc_if, m);
|
||||
#endif
|
||||
|
||||
splx(s);
|
||||
}
|
||||
@ -696,6 +760,28 @@ i4bisppp_tx_queue_empty(int unit)
|
||||
i4bisppp_start(&i4bisppp_softc[unit].sc_if);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* 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
|
||||
i4bisppp_idletime(int unit)
|
||||
{
|
||||
#ifdef __NetBSD__
|
||||
return(i4bisppp_softc[unit].sc_cdp->last_active_time);
|
||||
#else
|
||||
struct sppp *sp;
|
||||
sp = (struct sppp *) &i4bisppp_softc[unit];
|
||||
|
||||
return((sp->pp_last_recv < sp->pp_last_sent) ?
|
||||
sp->pp_last_sent : sp->pp_last_recv);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* this routine is called from the HSCX interrupt handler
|
||||
* each time a packet is received or transmitted. It should
|
||||
|
4612
sys/i4b/driver/i4b_ispppsubr.c
Normal file
4612
sys/i4b/driver/i4b_ispppsubr.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_rbch.c - device driver for raw B channel data
|
||||
* ---------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_rbch.c,v 1.48 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_rbch.c,v 1.52 2000/10/06 08:37:43 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:39:15 1999]
|
||||
* last edit-date: [Mon Oct 2 10:13:09 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -51,14 +51,29 @@
|
||||
#include <sys/proc.h>
|
||||
#include <sys/tty.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#if defined (__NetBSD__) || defined (__OpenBSD__)
|
||||
extern cc_t ttydefchars;
|
||||
#define termioschars(t) memcpy((t)->c_cc, &ttydefchars, sizeof((t)->c_cc))
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ == 3
|
||||
#include "opt_devfs.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
#endif
|
||||
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <sys/filio.h>
|
||||
#define bootverbose 0
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
@ -79,8 +94,6 @@ extern cc_t ttydefchars;
|
||||
|
||||
#ifdef __bsdi__
|
||||
#include <sys/device.h>
|
||||
/* XXX FIXME */
|
||||
int bootverbose = 0;
|
||||
#endif
|
||||
|
||||
#ifdef OS_USES_POLL
|
||||
@ -125,12 +138,19 @@ static struct rbch_softc {
|
||||
struct selinfo selp; /* select / poll */
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ == 3
|
||||
#ifdef DEVFS
|
||||
void *devfs_token; /* device filesystem */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if I4BRBCHACCT
|
||||
#if defined(__FreeBSD__)
|
||||
struct callout_handle sc_callout;
|
||||
#endif
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
struct callout sc_callout;
|
||||
#endif
|
||||
|
||||
int sc_iinb; /* isdn driver # of inbytes */
|
||||
int sc_ioutb; /* isdn driver # of outbytes */
|
||||
int sc_linb; /* last # of bytes rx'd */
|
||||
@ -283,6 +303,12 @@ i4brbchattach()
|
||||
#if defined(__FreeBSD__)
|
||||
#if __FreeBSD__ == 3
|
||||
|
||||
#ifdef DEVFS
|
||||
rbch_softc[i].devfs_token =
|
||||
devfs_add_devswf(&i4brbch_cdevsw, i, DV_CHR,
|
||||
UID_ROOT, GID_WHEEL, 0600,
|
||||
"i4brbch%d", i);
|
||||
#endif
|
||||
|
||||
#else
|
||||
make_dev(&i4brbch_cdevsw, i,
|
||||
@ -293,6 +319,9 @@ i4brbchattach()
|
||||
#if I4BRBCHACCT
|
||||
#if defined(__FreeBSD__)
|
||||
callout_handle_init(&rbch_softc[i].sc_callout);
|
||||
#endif
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
callout_init(&rbch_softc[i].sc_callout);
|
||||
#endif
|
||||
rbch_softc[i].sc_fn = 1;
|
||||
#endif
|
||||
@ -313,7 +342,7 @@ i4brbchopen(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
{
|
||||
int unit = minor(dev);
|
||||
|
||||
if(unit > NI4BRBCH)
|
||||
if(unit >= NI4BRBCH)
|
||||
return(ENXIO);
|
||||
|
||||
if(rbch_softc[unit].sc_devstate & ST_ISOPEN)
|
||||
@ -325,7 +354,7 @@ i4brbchopen(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
|
||||
rbch_softc[unit].sc_devstate |= ST_ISOPEN;
|
||||
|
||||
DBGL4(L4_RBCHDBG, "i4brbchopen", ("unit %d, open\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, open", unit);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -346,7 +375,7 @@ i4brbchclose(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
|
||||
rbch_clrq(unit);
|
||||
|
||||
DBGL4(L4_RBCHDBG, "i4brbclose", ("unit %d, closed\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, closed", unit);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -365,38 +394,45 @@ i4brbchread(dev_t dev, struct uio *uio, int ioflag)
|
||||
|
||||
CRIT_VAR;
|
||||
|
||||
DBGL4(L4_RBCHDBG, "i4brbchread", ("unit %d, enter read\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, enter read", unit);
|
||||
|
||||
CRIT_BEG;
|
||||
if(!(sc->sc_devstate & ST_ISOPEN))
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchread", ("unit %d, read while not open\n", unit));
|
||||
CRIT_END;
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, read while not open", unit);
|
||||
return(EIO);
|
||||
}
|
||||
|
||||
if((sc->sc_devstate & ST_NOBLOCK))
|
||||
{
|
||||
if(!(sc->sc_devstate & ST_CONNECTED))
|
||||
if(!(sc->sc_devstate & ST_CONNECTED)) {
|
||||
CRIT_END;
|
||||
return(EWOULDBLOCK);
|
||||
}
|
||||
|
||||
if(sc->sc_bprot == BPROT_RHDLC)
|
||||
iqp = &sc->sc_hdlcq;
|
||||
else
|
||||
iqp = isdn_linktab[unit]->rx_queue;
|
||||
|
||||
if(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN))
|
||||
if(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN)) {
|
||||
CRIT_END;
|
||||
return(EWOULDBLOCK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(!(sc->sc_devstate & ST_CONNECTED))
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchread", ("unit %d, wait read init\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, wait read init", unit);
|
||||
|
||||
if((error = tsleep((caddr_t) &rbch_softc[unit],
|
||||
TTIPRI | PCATCH,
|
||||
"rrrbch", 0 )) != 0)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchread", ("unit %d, error %d tsleep\n", unit, error));
|
||||
CRIT_END;
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep", unit, error);
|
||||
return(error);
|
||||
}
|
||||
}
|
||||
@ -408,28 +444,25 @@ i4brbchread(dev_t dev, struct uio *uio, int ioflag)
|
||||
|
||||
while(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN))
|
||||
{
|
||||
CRIT_BEG;
|
||||
sc->sc_devstate |= ST_RDWAITDATA;
|
||||
CRIT_END;
|
||||
|
||||
DBGL4(L4_RBCHDBG, "i4brbchread", ("unit %d, wait read data\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, wait read data", unit);
|
||||
|
||||
if((error = tsleep((caddr_t) &isdn_linktab[unit]->rx_queue,
|
||||
TTIPRI | PCATCH,
|
||||
"rrbch", 0 )) != 0)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchread", ("unit %d, error %d tsleep read\n", unit, error));
|
||||
CRIT_END;
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep read", unit, error);
|
||||
sc->sc_devstate &= ~ST_RDWAITDATA;
|
||||
return(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CRIT_BEG;
|
||||
|
||||
IF_DEQUEUE(iqp, m);
|
||||
|
||||
DBGL4(L4_RBCHDBG, "i4brbchread", ("unit %d, read %d bytes\n", unit, m->m_len));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, read %d bytes", unit, m->m_len);
|
||||
|
||||
if(m && m->m_len)
|
||||
{
|
||||
@ -437,7 +470,7 @@ i4brbchread(dev_t dev, struct uio *uio, int ioflag)
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchread", ("unit %d, error %d uiomove\n", unit, error));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, error %d uiomove", unit, error);
|
||||
error = EIO;
|
||||
}
|
||||
|
||||
@ -462,40 +495,50 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag)
|
||||
|
||||
CRIT_VAR;
|
||||
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, write\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, write", unit);
|
||||
|
||||
CRIT_BEG;
|
||||
if(!(sc->sc_devstate & ST_ISOPEN))
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, write while not open\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, write while not open", unit);
|
||||
CRIT_END;
|
||||
return(EIO);
|
||||
}
|
||||
|
||||
if((sc->sc_devstate & ST_NOBLOCK))
|
||||
{
|
||||
if(!(sc->sc_devstate & ST_CONNECTED))
|
||||
if(!(sc->sc_devstate & ST_CONNECTED)) {
|
||||
CRIT_END;
|
||||
return(EWOULDBLOCK);
|
||||
if(IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN))
|
||||
}
|
||||
if(IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) {
|
||||
CRIT_END;
|
||||
return(EWOULDBLOCK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(!(sc->sc_devstate & ST_CONNECTED))
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, write wait init\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, write wait init", unit);
|
||||
|
||||
error = tsleep((caddr_t) &rbch_softc[unit],
|
||||
TTIPRI | PCATCH,
|
||||
"wrrbch", 0 );
|
||||
if(error == ERESTART)
|
||||
if(error == ERESTART) {
|
||||
CRIT_END;
|
||||
return (ERESTART);
|
||||
}
|
||||
else if(error == EINTR)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, EINTR during wait init\n", unit));
|
||||
CRIT_END;
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait init", unit);
|
||||
return(EINTR);
|
||||
}
|
||||
else if(error)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, error %d tsleep init\n", unit, error));
|
||||
CRIT_END;
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep init", unit, error);
|
||||
return(error);
|
||||
}
|
||||
tsleep((caddr_t) &rbch_softc[unit], TTIPRI | PCATCH, "xrbch", (hz*1));
|
||||
@ -503,11 +546,9 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag)
|
||||
|
||||
while(IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN))
|
||||
{
|
||||
CRIT_BEG;
|
||||
sc->sc_devstate |= ST_WRWAITEMPTY;
|
||||
CRIT_END;
|
||||
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, write queue full\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, write queue full", unit);
|
||||
|
||||
if ((error = tsleep((caddr_t) &isdn_linktab[unit]->tx_queue,
|
||||
TTIPRI | PCATCH,
|
||||
@ -515,27 +556,28 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag)
|
||||
sc->sc_devstate &= ~ST_WRWAITEMPTY;
|
||||
if(error == ERESTART)
|
||||
{
|
||||
CRIT_END;
|
||||
return(ERESTART);
|
||||
}
|
||||
else if(error == EINTR)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, EINTR during wait write\n", unit));
|
||||
CRIT_END;
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait write", unit);
|
||||
return(error);
|
||||
}
|
||||
else if(error)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, error %d tsleep write\n", unit, error));
|
||||
CRIT_END;
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep write", unit, error);
|
||||
return(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CRIT_BEG;
|
||||
|
||||
if(!(sc->sc_devstate & ST_ISOPEN))
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, not open anymore\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, not open anymore", unit);
|
||||
CRIT_END;
|
||||
return(EIO);
|
||||
}
|
||||
@ -544,7 +586,7 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag)
|
||||
{
|
||||
m->m_len = min(BCH_MAX_DATALEN, uio->uio_resid);
|
||||
|
||||
DBGL4(L4_RBCHDBG, "i4brbchwrite", ("unit %d, write %d bytes\n", unit, m->m_len));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, write %d bytes", unit, m->m_len);
|
||||
|
||||
error = uiomove(m->m_data, m->m_len, uio);
|
||||
|
||||
@ -580,23 +622,23 @@ i4brbchioctl(dev_t dev, IOCTL_CMD_T cmd, caddr_t data, int flag, struct proc *p)
|
||||
case FIOASYNC: /* Set async mode */
|
||||
if (*(int *)data)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchioctl", ("unit %d, setting async mode\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, setting async mode", unit);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchioctl", ("unit %d, clearing async mode\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, clearing async mode", unit);
|
||||
}
|
||||
break;
|
||||
|
||||
case FIONBIO:
|
||||
if (*(int *)data)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchioctl", ("unit %d, setting non-blocking mode\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, setting non-blocking mode", unit);
|
||||
sc->sc_devstate |= ST_NOBLOCK;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchioctl", ("unit %d, clearing non-blocking mode\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, clearing non-blocking mode", unit);
|
||||
sc->sc_devstate &= ~ST_NOBLOCK;
|
||||
}
|
||||
break;
|
||||
@ -604,7 +646,7 @@ i4brbchioctl(dev_t dev, IOCTL_CMD_T cmd, caddr_t data, int flag, struct proc *p)
|
||||
case TIOCCDTR: /* Clear DTR */
|
||||
if(sc->sc_devstate & ST_CONNECTED)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchioctl", ("unit %d, disconnecting for DTR down\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, disconnecting for DTR down", unit);
|
||||
i4b_l4_drvrdisc(BDRV_RBCH, unit);
|
||||
}
|
||||
break;
|
||||
@ -617,7 +659,7 @@ i4brbchioctl(dev_t dev, IOCTL_CMD_T cmd, caddr_t data, int flag, struct proc *p)
|
||||
;
|
||||
if (l)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "i4brbchioctl", ("unit %d, attempting dialout to %s\n", unit, (char *)data));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, attempting dialout to %s", unit, (char *)data);
|
||||
i4b_l4_dialoutnumber(BDRV_RBCH, unit, l, (char *)data);
|
||||
break;
|
||||
}
|
||||
@ -625,7 +667,7 @@ i4brbchioctl(dev_t dev, IOCTL_CMD_T cmd, caddr_t data, int flag, struct proc *p)
|
||||
}
|
||||
|
||||
case TIOCSDTR: /* Set DTR */
|
||||
DBGL4(L4_RBCHDBG, "i4brbchioctl", ("unit %d, attempting dialout (DTR)\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, attempting dialout (DTR)", unit);
|
||||
i4b_l4_dialout(BDRV_RBCH, unit);
|
||||
break;
|
||||
|
||||
@ -655,7 +697,7 @@ i4brbchioctl(dev_t dev, IOCTL_CMD_T cmd, caddr_t data, int flag, struct proc *p)
|
||||
}
|
||||
|
||||
default: /* Unknown stuff */
|
||||
DBGL4(L4_RBCHDBG, "i4brbchioctl", ("unit %d, ioctl, unknown cmd %lx\n", unit, (u_long)cmd));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, ioctl, unknown cmd %lx", unit, (u_long)cmd);
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -737,7 +779,7 @@ i4brbchselect(dev_t dev, int rw, struct proc *p)
|
||||
if(!(sc->sc_devstate & ST_ISOPEN))
|
||||
{
|
||||
splx(s);
|
||||
DBGL4(L4_RBCHDBG, "i4brbchselect", ("unit %d, not open anymore\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, not open anymore", unit);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@ -814,11 +856,7 @@ rbch_timeout(struct rbch_softc *sc)
|
||||
i4b_l4_accounting(BDRV_RBCH, unit, ACCT_DURING,
|
||||
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_ioutb, sc->sc_iinb);
|
||||
}
|
||||
#if defined(__FreeBSD__)
|
||||
sc->sc_callout =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)rbch_timeout,
|
||||
(void *)sc, I4BRBCHACCTINTVL*hz);
|
||||
START_TIMER(sc->sc_callout, rbch_timeout, sc, I4BRBCHACCTINTVL*hz);
|
||||
}
|
||||
#endif /* I4BRBCHACCT */
|
||||
|
||||
@ -845,16 +883,12 @@ rbch_connect(int unit, void *cdp)
|
||||
sc->sc_linb = 0;
|
||||
sc->sc_loutb = 0;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
sc->sc_callout =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)rbch_timeout,
|
||||
(void *)sc, I4BRBCHACCTINTVL*hz);
|
||||
START_TIMER(sc->sc_callout, rbch_timeout, sc, I4BRBCHACCTINTVL*hz);
|
||||
}
|
||||
#endif
|
||||
if(!(sc->sc_devstate & ST_CONNECTED))
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "rbch_connect", ("unit %d, wakeup\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
|
||||
sc->sc_devstate |= ST_CONNECTED;
|
||||
sc->sc_cd = cdp;
|
||||
wakeup((caddr_t)sc);
|
||||
@ -874,14 +908,14 @@ rbch_disconnect(int unit, void *cdp)
|
||||
|
||||
if(cd != sc->sc_cd)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "rbch_disconnect", ("rbch%d: channel %d not active\n",
|
||||
cd->driver_unit, cd->channelid));
|
||||
NDBGL4(L4_RBCHDBG, "rbch%d: channel %d not active",
|
||||
cd->driver_unit, cd->channelid);
|
||||
return;
|
||||
}
|
||||
|
||||
CRIT_BEG;
|
||||
|
||||
DBGL4(L4_RBCHDBG, "rbch_disconnect", ("unit %d, disconnect\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, disconnect", unit);
|
||||
|
||||
sc->sc_devstate &= ~ST_CONNECTED;
|
||||
|
||||
@ -891,13 +925,7 @@ rbch_disconnect(int unit, void *cdp)
|
||||
i4b_l4_accounting(BDRV_RBCH, unit, ACCT_FINAL,
|
||||
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_ioutb, sc->sc_iinb);
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)rbch_timeout,
|
||||
(void *)sc, sc->sc_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)rbch_timeout, (void *)sc);
|
||||
#endif
|
||||
|
||||
STOP_TIMER(sc->sc_callout, rbch_timeout, sc);
|
||||
#endif
|
||||
CRIT_END;
|
||||
}
|
||||
@ -937,7 +965,7 @@ rbch_rx_data_rdy(int unit)
|
||||
|
||||
if(IF_QFULL(&(rbch_softc[unit].sc_hdlcq)))
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "rbch_rx_data_rdy", ("unit %d: hdlc rx queue full!\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d: hdlc rx queue full!", unit);
|
||||
m_freem(m);
|
||||
}
|
||||
else
|
||||
@ -948,13 +976,13 @@ rbch_rx_data_rdy(int unit)
|
||||
|
||||
if(rbch_softc[unit].sc_devstate & ST_RDWAITDATA)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "rbch_rx_data_rdy", ("unit %d, wakeup\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
|
||||
rbch_softc[unit].sc_devstate &= ~ST_RDWAITDATA;
|
||||
wakeup((caddr_t) &isdn_linktab[unit]->rx_queue);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "rbch_rx_data_rdy", ("unit %d, NO wakeup\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit);
|
||||
}
|
||||
selwakeup(&rbch_softc[unit].selp);
|
||||
}
|
||||
@ -969,13 +997,13 @@ rbch_tx_queue_empty(int unit)
|
||||
{
|
||||
if(rbch_softc[unit].sc_devstate & ST_WRWAITEMPTY)
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "rbch_tx_queue_empty", ("unit %d, wakeup\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
|
||||
rbch_softc[unit].sc_devstate &= ~ST_WRWAITEMPTY;
|
||||
wakeup((caddr_t) &isdn_linktab[unit]->tx_queue);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL4(L4_RBCHDBG, "rbch_tx_queue_empty", ("unit %d, NO wakeup\n", unit));
|
||||
NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit);
|
||||
}
|
||||
selwakeup(&rbch_softc[unit].selp);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,9 +27,9 @@
|
||||
* i4btrc - device driver for trace data read device
|
||||
* ---------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_trace.c,v 1.24 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_trace.c,v 1.27 2000/06/02 16:14:35 hm Exp $
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:39:35 1999]
|
||||
* last edit-date: [Fri Jun 2 17:48:19 2000]
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
@ -41,17 +41,6 @@
|
||||
|
||||
#if NI4BTRC > 0
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include "isic.h" /* 'isic' is no pseudo-device on non FreeBSD -
|
||||
* so we just can't count it at compile time,
|
||||
* we're doing an attach-time check instead. */
|
||||
|
||||
#if NI4BTRC < NISIC
|
||||
#error "number of trace devices != number of passive ISDN controllers !"
|
||||
#error "change number of i4btrc to be equal to number of isic devices !"
|
||||
#endif
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
@ -72,6 +61,9 @@
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
#endif
|
||||
|
||||
#include <machine/i4b_trace.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -98,6 +90,9 @@ static int device_state[NI4BTRC];
|
||||
#define ST_WAITDATA 0x02
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ == 3
|
||||
#ifdef DEVFS
|
||||
static void *devfs_token[NI4BTRC];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static int analyzemode = 0;
|
||||
@ -238,6 +233,12 @@ i4btrcattach()
|
||||
#if defined(__FreeBSD__)
|
||||
#if __FreeBSD__ < 4
|
||||
|
||||
#ifdef DEVFS
|
||||
devfs_token[i]
|
||||
= devfs_add_devswf(&i4btrc_cdevsw, i, DV_CHR,
|
||||
UID_ROOT, GID_WHEEL, 0600,
|
||||
"i4btrc%d", i);
|
||||
#endif
|
||||
|
||||
#else
|
||||
make_dev(&i4btrc_cdevsw, i,
|
||||
@ -361,7 +362,7 @@ i4btrcopen(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
int x;
|
||||
int unit = minor(dev);
|
||||
|
||||
if(unit > NI4BTRC)
|
||||
if(unit >= NI4BTRC)
|
||||
return(ENXIO);
|
||||
|
||||
if(device_state[unit] & ST_ISOPEN)
|
||||
@ -386,11 +387,13 @@ PDEVSTATIC int
|
||||
i4btrcclose(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
{
|
||||
int unit = minor(dev);
|
||||
int i, x, cno = -1;
|
||||
int i, x;
|
||||
int cno = -1;
|
||||
|
||||
for(i = 0; i < nctrl; i++)
|
||||
for(i=0; i < nctrl; i++)
|
||||
{
|
||||
if(ctrl_desc[i].N_SET_TRACE)
|
||||
if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) &&
|
||||
(ctrl_desc[i].unit == unit))
|
||||
{
|
||||
cno = i;
|
||||
break;
|
||||
@ -404,8 +407,8 @@ i4btrcclose(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
|
||||
if(cno >= 0)
|
||||
{
|
||||
ctrl_desc[cno].N_SET_TRACE(rxunit, TRACE_OFF);
|
||||
ctrl_desc[cno].N_SET_TRACE(txunit, TRACE_OFF);
|
||||
(*ctrl_desc[cno].N_MGMT_COMMAND)(rxunit, CMR_SETTRACE, TRACE_OFF);
|
||||
(*ctrl_desc[cno].N_MGMT_COMMAND)(txunit, CMR_SETTRACE, TRACE_OFF);
|
||||
}
|
||||
rxunit = -1;
|
||||
txunit = -1;
|
||||
@ -413,7 +416,7 @@ i4btrcclose(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
|
||||
if(cno >= 0)
|
||||
{
|
||||
ctrl_desc[cno].N_SET_TRACE(unit, TRACE_OFF);
|
||||
(*ctrl_desc[cno].N_MGMT_COMMAND)(ctrl_desc[cno].unit, CMR_SETTRACE, TRACE_OFF);
|
||||
}
|
||||
|
||||
x = SPLI4B();
|
||||
@ -494,33 +497,27 @@ i4btrcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
int error = 0;
|
||||
int unit = minor(dev);
|
||||
i4b_trace_setupa_t *tsa;
|
||||
int i, cno = -1;
|
||||
int i;
|
||||
int cno = -1;
|
||||
|
||||
/* find the first passive controller to get at the set/get function
|
||||
pointers. Would be better if we had the controller class virtual
|
||||
function table separate from the port registry... */
|
||||
/* find the first passive controller matching our unit no */
|
||||
|
||||
for(i=0; i < nctrl; i++)
|
||||
{
|
||||
if(ctrl_desc[i].N_SET_TRACE)
|
||||
if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) &&
|
||||
(ctrl_desc[i].unit == unit))
|
||||
{
|
||||
cno = i; /* one suitable controller, might not */
|
||||
break; /* be related to the trace unit at all, but */
|
||||
} /* has the right function pointers */
|
||||
cno = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(cmd)
|
||||
{
|
||||
case I4B_TRC_GET:
|
||||
if(cno < 0)
|
||||
return ENOTTY;
|
||||
*(int *)data = ctrl_desc[cno].N_GET_TRACE(unit);
|
||||
break;
|
||||
|
||||
case I4B_TRC_SET:
|
||||
if(cno < 0)
|
||||
return ENOTTY;
|
||||
ctrl_desc[cno].N_SET_TRACE(unit, *(int *)data);
|
||||
(*ctrl_desc[cno].N_MGMT_COMMAND)(ctrl_desc[cno].unit, CMR_SETTRACE, (void *)*(unsigned int *)data);
|
||||
break;
|
||||
|
||||
case I4B_TRC_SETA:
|
||||
@ -549,8 +546,8 @@ i4btrcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
|
||||
outunit = unit;
|
||||
analyzemode = 1;
|
||||
ctrl_desc[cno].N_SET_TRACE(rxunit, tsa->rxflags & (TRACE_I | TRACE_D_RX | TRACE_B_RX));
|
||||
ctrl_desc[cno].N_SET_TRACE(txunit, tsa->txflags & (TRACE_I | TRACE_D_RX | TRACE_B_RX));
|
||||
(*ctrl_desc[cno].N_MGMT_COMMAND)(rxunit, CMR_SETTRACE, (int *)(tsa->rxflags & (TRACE_I | TRACE_D_RX | TRACE_B_RX)));
|
||||
(*ctrl_desc[cno].N_MGMT_COMMAND)(txunit, CMR_SETTRACE, (int *)(tsa->txflags & (TRACE_I | TRACE_D_RX | TRACE_B_RX)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_cause.h - causes and cause handling for i4b
|
||||
* -----------------------------------------------
|
||||
*
|
||||
* $Id: i4b_cause.h,v 1.11 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_cause.h,v 1.13 2000/02/06 19:01:14 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:51 1999]
|
||||
* last edit-date: [Sun Feb 6 19:46:41 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -70,7 +70,8 @@
|
||||
#define CAUSE_I4B_L1ERROR 7 /* L1 error / persistent deact */
|
||||
#define CAUSE_I4B_LLDIAL 8 /* no dialout on leased line */
|
||||
#define CAUSE_I4B_MAX 9
|
||||
/* NOTE: update isdnd/pcause.c when adding causes !!!!! */
|
||||
/* NOTE: update isdnd/pcause.c when adding causes !!!!! */
|
||||
/* NOTE: update layer3/i4b_q931.c when adding causes !!!!! */
|
||||
|
||||
/* CAUSET_Q850 - causes defined in Q.850 */
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,58 +27,52 @@
|
||||
* i4b_debug.h - i4b debug header file
|
||||
* -----------------------------------
|
||||
*
|
||||
* $Id: i4b_debug.h,v 1.20 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_debug.h,v 1.32 2000/07/24 12:22:08 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:59 1999]
|
||||
* last edit-date: [Wed May 31 09:51:34 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define DO_I4B_DEBUG /* enable debugging code inclusion */
|
||||
#if !defined DO_I4B_DEBUG
|
||||
# define DO_I4B_DEBUG 1 /* default = include debugging code */
|
||||
#elif DO_I4B_DEBUG != 0
|
||||
# undef DO_I4B_DEBUG
|
||||
# define DO_I4B_DEBUG 1
|
||||
#endif
|
||||
|
||||
#undef DO_I4B_MAXDEBUG /* enable ALL debug messages by default */
|
||||
#undef DO_I4B_MAXDEBUG /* default = disable ALL debug messages */
|
||||
|
||||
#ifdef DO_I4B_DEBUG
|
||||
#if DO_I4B_DEBUG
|
||||
|
||||
extern unsigned int i4b_l1_debug;
|
||||
extern unsigned int i4b_l2_debug;
|
||||
extern unsigned int i4b_l3_debug;
|
||||
extern unsigned int i4b_l4_debug;
|
||||
|
||||
#define DBGL1(bits, routine, what) \
|
||||
if(bits & i4b_l1_debug) \
|
||||
{ \
|
||||
printf("i4b-L1-%s: ", routine); \
|
||||
printf what ; \
|
||||
}
|
||||
#define NDBGL1(bits, fmt, args...) \
|
||||
if(bits & i4b_l1_debug) \
|
||||
{ printf("i4b-L1 %s: " fmt "\n", __FUNCTION__ , ##args ); }
|
||||
|
||||
#define DBGL2(bits, routine, what) \
|
||||
if(bits & i4b_l2_debug) \
|
||||
{ \
|
||||
printf("i4b-L2-%s: ", routine); \
|
||||
printf what ; \
|
||||
}
|
||||
|
||||
#define DBGL3(bits, routine, what) \
|
||||
if(bits & i4b_l3_debug) \
|
||||
{ \
|
||||
printf("i4b-L3-%s: ", routine); \
|
||||
printf what ; \
|
||||
}
|
||||
|
||||
#define DBGL4(bits, routine, what) \
|
||||
if(bits & i4b_l4_debug) \
|
||||
{ \
|
||||
printf("i4b-L4-%s: ", routine); \
|
||||
printf what ; \
|
||||
}
|
||||
#define NDBGL2(bits, fmt, args...) \
|
||||
if(bits & i4b_l2_debug) \
|
||||
{ printf("i4b-L2 %s: " fmt "\n", __FUNCTION__ , ##args ); }
|
||||
|
||||
#define NDBGL3(bits, fmt, args...) \
|
||||
if(bits & i4b_l3_debug) \
|
||||
{ printf("i4b-L3 %s: " fmt "\n", __FUNCTION__ , ##args ); }
|
||||
|
||||
#define NDBGL4(bits, fmt, args...) \
|
||||
if(bits & i4b_l4_debug) \
|
||||
{ printf("i4b-L4 %s: " fmt "\n", __FUNCTION__ , ##args ); }
|
||||
|
||||
#else /* !DO_I4B_DEBUG */
|
||||
|
||||
#define DBGL1(bits, routine, what);
|
||||
#define DBGL2(bits, routine, what);
|
||||
#define DBGL3(bits, routine, what);
|
||||
#define DBGL4(bits, routine, what);
|
||||
#define NDBGL1(bits, fmt, args...);
|
||||
#define NDBGL2(bits, fmt, args...);
|
||||
#define NDBGL3(bits, fmt, args...);
|
||||
#define NDBGL4(bits, fmt, args...);
|
||||
|
||||
#endif /* DO_I4B_DEBUG */
|
||||
|
||||
@ -98,9 +92,11 @@ extern unsigned int i4b_l4_debug;
|
||||
#define L1_T_ERR 0x0800 /* Timer error messages */
|
||||
#define L1_H_XFRERR 0x1000 /* HSCX data xfer error */
|
||||
#define L1_I_CICO 0x2000 /* ISAC command in/out */
|
||||
#define L1_S_MSG 0x4000 /* silent messages (soft-HDLC) */
|
||||
#define L1_S_ERR 0x8000 /* error messages (soft-HDLC) */
|
||||
|
||||
#define L1_DEBUG_MAX 0x3fef /* all messages on except IRQ! */
|
||||
#define L1_DEBUG_ERR (L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR)
|
||||
#define L1_DEBUG_MAX 0xffef /* all messages on except IRQ! */
|
||||
#define L1_DEBUG_ERR (L1_S_ERR | L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR)
|
||||
|
||||
#ifndef L1_DEBUG_DEFAULT
|
||||
#ifdef DO_I4B_MAXDEBUG
|
||||
@ -176,8 +172,9 @@ extern unsigned int i4b_l4_debug;
|
||||
#define L4_TINADBG 0x0100 /* tina driver debug messages */
|
||||
#define L4_TINAMSG 0x0200 /* tina driver messages */
|
||||
#define L4_TINAERR 0x0400 /* tina driver error messages */
|
||||
#define L4_INGDBG 0x0800 /* ing driver debug messages */
|
||||
|
||||
#define L4_DEBUG_MAX 0x07ff /* all messages on */
|
||||
#define L4_DEBUG_MAX 0x0fff /* all messages on */
|
||||
#define L4_DEBUG_ERR (L4_ERR | L4_TINADBG | L4_TINAMSG | L4_TINAERR)
|
||||
|
||||
#ifndef L4_DEBUG_DEFAULT
|
||||
@ -205,9 +202,23 @@ typedef struct {
|
||||
#define I4B_CTL_SET_DEBUG _IOW('C', 1, ctl_debug_t)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* get hscx statistics
|
||||
* generic get chipset statistics
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/* for the ihfc-driver: structure for HFC-1/S/SP statistics */
|
||||
|
||||
typedef struct {
|
||||
int txframes;
|
||||
int rxframes;
|
||||
int xdu;
|
||||
int rdo;
|
||||
int crc;
|
||||
int rab;
|
||||
} hfcstat_t;
|
||||
|
||||
|
||||
/* for the isic-driver: structure for HSCX statistics */
|
||||
|
||||
typedef struct {
|
||||
int unit; /* controller number */
|
||||
int chan; /* channel number */
|
||||
@ -218,44 +229,61 @@ typedef struct {
|
||||
int xdu;
|
||||
int rfo;
|
||||
} hscxstat_t;
|
||||
|
||||
#define I4B_CTL_GET_HSCXSTAT _IOWR('C', 2, hscxstat_t)
|
||||
|
||||
#define I4B_CTL_CLR_HSCXSTAT _IOW('C', 3, hscxstat_t)
|
||||
/* generic statistics structure */
|
||||
|
||||
struct chipstat {
|
||||
int driver_type; /* type, L1DRVR_XXXX */
|
||||
int driver_unit; /* the unit number */
|
||||
int driver_bchannel; /* the B-channel */
|
||||
union stats { /* union for all drivers */
|
||||
hfcstat_t hfcstat; /* for ihfc driver, L1DRVR_IHFC */
|
||||
hscxstat_t hscxstat; /* for isic driver, L1DRVR_ISIC */
|
||||
} stats;
|
||||
};
|
||||
|
||||
/* get statistics */
|
||||
|
||||
#define I4B_CTL_GET_CHIPSTAT _IOWR('C', 2, struct chipstat)
|
||||
|
||||
/* clear statistics */
|
||||
|
||||
#define I4B_CTL_CLR_CHIPSTAT _IOW('C', 3, struct chipstat)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* get LAPD/Q.921 statistics
|
||||
*---------------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
/* transmit */
|
||||
|
||||
u_long tx_i; /* I */
|
||||
u_long tx_rr; /* RR */
|
||||
u_long tx_rnr; /* RNR */
|
||||
u_long tx_rej; /* REJ */
|
||||
/* transmit */
|
||||
|
||||
u_long tx_i; /* I */
|
||||
u_long tx_rr; /* RR */
|
||||
u_long tx_rnr; /* RNR */
|
||||
u_long tx_rej; /* REJ */
|
||||
u_long tx_sabme; /* SABME*/
|
||||
u_long tx_dm; /* DM */
|
||||
u_long tx_dm; /* DM */
|
||||
u_long tx_disc; /* DISC */
|
||||
u_long tx_ua; /* UA */
|
||||
u_long tx_ua; /* UA */
|
||||
u_long tx_frmr; /* FRMR */
|
||||
u_long tx_tei; /* TEI */
|
||||
u_long tx_tei; /* TEI */
|
||||
|
||||
/* receive */
|
||||
/* receive */
|
||||
|
||||
u_long rx_i; /* I */
|
||||
u_long rx_rr; /* RR */
|
||||
u_long rx_rnr; /* RNR */
|
||||
u_long rx_rej; /* REJ */
|
||||
u_long rx_i; /* I */
|
||||
u_long rx_rr; /* RR */
|
||||
u_long rx_rnr; /* RNR */
|
||||
u_long rx_rej; /* REJ */
|
||||
u_long rx_sabme; /* SABME*/
|
||||
u_long rx_tei; /* TEI */
|
||||
u_long rx_ui; /* UI */
|
||||
u_long rx_tei; /* TEI */
|
||||
u_long rx_ui; /* UI */
|
||||
u_long rx_disc; /* DISC */
|
||||
u_long rx_xid; /* XID */
|
||||
u_long rx_dm; /* DM */
|
||||
u_long rx_ua; /* UA */
|
||||
u_long rx_xid; /* XID */
|
||||
u_long rx_dm; /* DM */
|
||||
u_long rx_ua; /* UA */
|
||||
u_long rx_frmr; /* FRMR */
|
||||
|
||||
/* errors */
|
||||
/* errors */
|
||||
|
||||
u_long err_rx_len; /* incorrect length */
|
||||
u_long err_rx_badf; /* bad frame type */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_global.h - i4b global include file
|
||||
* --------------------------------------
|
||||
*
|
||||
* $Id: i4b_global.h,v 1.23 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_global.h,v 1.27 2000/08/28 07:24:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:44:17 1999]
|
||||
* last edit-date: [Thu Aug 24 12:38:50 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -77,6 +77,29 @@
|
||||
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
/*----------------*/
|
||||
/* timer handling */
|
||||
/*----------------*/
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
|
||||
#if __NetBSD_Version__ >= 104230000
|
||||
#define START_TIMER(XHANDLE, XF, XSC, XTIME) callout_reset(&XHANDLE, XTIME, (TIMEOUT_FUNC_T)XF, (void*)XSC)
|
||||
#define STOP_TIMER(XHANDLE, XF, XSC) callout_stop(&XHANDLE)
|
||||
#else
|
||||
#define START_TIMER(XHANDLE, XF, XSC, XTIME) timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME)
|
||||
#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC)
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define START_TIMER(XHANDLE, XF, XSC, XTIME) XHANDLE = timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME)
|
||||
#ifdef __FreeBSD__
|
||||
#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XHANDLE)
|
||||
#else
|
||||
#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*----------------------*/
|
||||
/* poll/select handling */
|
||||
/*----------------------*/
|
||||
@ -110,28 +133,19 @@
|
||||
|
||||
/* definitions for the STATUS indications L1 -> L2 -> L3 */
|
||||
|
||||
#define STI_ATTACH 0 /* attach at boot time */
|
||||
#define STI_L1STAT 1 /* layer 1 status */
|
||||
#define STI_L2STAT 2 /* layer 2 status */
|
||||
#define STI_TEIASG 3 /* TEI assignments */
|
||||
#define STI_ATTACH 0 /* attach at boot time */
|
||||
#define STI_L1STAT 1 /* layer 1 status */
|
||||
#define STI_L2STAT 2 /* layer 2 status */
|
||||
#define STI_TEIASG 3 /* TEI assignments */
|
||||
#define STI_PDEACT 4 /* Layer 1 T4 expired = persistent deactivation */
|
||||
#define STI_NOL1ACC 5 /* no outgoing L1 access possible */
|
||||
#define STI_NOL1ACC 5 /* no outgoing L1 access possible */
|
||||
|
||||
/* definitions for the COMMAND requests L3 -> L2 -> L1 */
|
||||
|
||||
#define CMR_DOPEN 0 /* daemon opened /dev/i4b */
|
||||
#define CMR_DCLOSE 1 /* daemon closed /dev/i4b */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Number of max supported passive card units
|
||||
*
|
||||
* Teles/Creatix/Neuhaus cards have a hardware limitation
|
||||
* as one is able to set 3 (sometimes 4) different configurations by
|
||||
* jumpers so a maximum of 3 (4) cards per ISA bus is possible.
|
||||
* (Note: there are multiple ISA buses on some architectures)
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define ISIC_MAXUNIT 3 /* max no of supported units 0..3 */
|
||||
#define CMR_DOPEN 0 /* daemon opened /dev/i4b */
|
||||
#define CMR_DCLOSE 1 /* daemon closed /dev/i4b */
|
||||
#define CMR_SETTRACE 2 /* set D-channel and B-channel trace */
|
||||
#define CMR_GCST 3 /* get chipset statistics */
|
||||
#define CMR_CCST 4 /* clear chipset statistics */
|
||||
|
||||
#endif /* _I4B_GLOBAL_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_ioctl.h - messages kernel <--> userland
|
||||
* -------------------------------------------
|
||||
*
|
||||
* $Id: i4b_ioctl.h,v 1.150 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_ioctl.h,v 1.196 2000/10/09 11:17:07 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:12:16 1999]
|
||||
* last edit-date: [Mon Oct 9 13:17:34 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -48,8 +48,8 @@
|
||||
* version and release number for isdn4bsd package
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define VERSION 0 /* version number */
|
||||
#define REL 90 /* release number */
|
||||
#define STEP 1 /* release step */
|
||||
#define REL 95 /* release number */
|
||||
#define STEP 04 /* release step */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* date/time format in i4b log messages
|
||||
@ -86,6 +86,20 @@
|
||||
#define CTRL_AVMB1 4 /* AVM B1 active card */
|
||||
#define CTRL_NUMTYPES 5 /* number of controller types */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* CTRL_PASSIVE: driver types
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define MAXL1UNITS 8 /* max number of units */
|
||||
|
||||
#define L1DRVR_ISIC 0 /* isic - driver */
|
||||
#define L1DRVR_IWIC 1 /* iwic - driver */
|
||||
#define L1DRVR_IFPI 2 /* ifpi - driver */
|
||||
#define L1DRVR_IHFC 3 /* ihfc - driver */
|
||||
#define L1DRVR_IFPNP 4 /* ifpnp - driver */
|
||||
|
||||
/* MAXL1DRVR MUST be updated when more passive drivers are added !!! */
|
||||
#define MAXL1DRVR (L1DRVR_IFPNP + 1)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* card types for CTRL_PASSIVE
|
||||
*---------------------------------------------------------------------------*/
|
||||
@ -114,16 +128,21 @@
|
||||
#define CARD_TYPEP_AVM_PNP 21 /* AVM FRITZ!CARD PnP */
|
||||
#define CARD_TYPEP_SIE_ISURF2 22 /* Siemens I-Surf 2 PnP */
|
||||
#define CARD_TYPEP_ASUSCOMIPAC 23 /* Asuscom ISDNlink 128 K PnP */
|
||||
#define CARD_TYPEP_WINB6692 24 /* Winbond W6692 based */
|
||||
#define CARD_TYPEP_16_3C 25 /* Teles S0/16.3c PnP (HFC-S/SP */
|
||||
#define CARD_TYPEP_ACERP10 26 /* Acer ISDN P10 (HFC-S) */
|
||||
#define CARD_TYPEP_TELEINT_NO_1 27 /* TELEINT ISDN SPEED No. 1 (HFC-1) */
|
||||
|
||||
/*
|
||||
* in case you add support for more cards, please update:
|
||||
*
|
||||
* isdnd: support.c, name_of_controller()
|
||||
* isdnd: controller.c, name_of_controller()
|
||||
* diehl/diehlctl: main.c, listall()
|
||||
*
|
||||
* and adjust CARD_TYPEP_MAX below.
|
||||
*/
|
||||
|
||||
#define CARD_TYPEP_MAX 23 /* max type */
|
||||
#define CARD_TYPEP_MAX 27 /* max type */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* card types for CTRL_DAIC
|
||||
@ -162,6 +181,7 @@
|
||||
#define BDRV_IPR 2 /* IP over raw HDLC interface driver */
|
||||
#define BDRV_ISPPP 3 /* sync Kernel PPP interface driver */
|
||||
#define BDRV_IBC 4 /* BSD/OS point to point driver */
|
||||
#define BDRV_ING 5 /* NetGraph ing driver */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* B channel protocol
|
||||
@ -311,6 +331,12 @@ typedef struct {
|
||||
#define SCR_USR_PASS 2 /* screening user provided, verified & passed */
|
||||
#define SCR_USR_FAIL 3 /* screening user provided, verified & failed */
|
||||
#define SCR_NET 4 /* screening network provided */
|
||||
int prs_ind;/* presentation indicator */
|
||||
#define PRS_NONE 0 /* no presentation indicator transmitted*/
|
||||
#define PRS_ALLOWED 1 /* presentation allowed */
|
||||
#define PRS_RESTRICT 2 /* presentation restricted */
|
||||
#define PRS_NNINTERW 3 /* number not available due to interworking */
|
||||
#define PRS_RESERVED 4 /* reserved */
|
||||
char display[DISPLAY_MAX]; /* content of display IE*/
|
||||
} msg_connect_ind_t;
|
||||
|
||||
|
@ -27,11 +27,11 @@
|
||||
* i4b_isdnq931.h - DSS1 layer 3 message types
|
||||
* -------------------------------------------
|
||||
*
|
||||
* $Id: i4b_isdnq931.h,v 1.6 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_isdnq931.h,v 1.7 2000/04/27 07:42:43 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:44:28 1999]
|
||||
* last edit-date: [Thu Apr 27 09:46:13 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
#define IEI_LLCOMPAT 0x7c /* low layer compatibility */
|
||||
#define IEI_HLCOMPAT 0x7d /* high layer compatibility */
|
||||
#define IEI_USERUSER 0x7e /* user-user */
|
||||
#define IEI_ESACPE 0x7f /* escape for extension */
|
||||
#define IEI_ESCAPE 0x7f /* escape for extension */
|
||||
|
||||
/* Q.932 variable length information element identifiers */
|
||||
|
||||
|
@ -27,11 +27,11 @@
|
||||
* i4b_l1l2.h - i4b layer 1 / layer 2 interactions
|
||||
* ---------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l1l2.h,v 1.9 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_l1l2.h,v 1.11 2000/06/02 16:14:35 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:44:39 1999]
|
||||
* last edit-date: [Fri Jun 2 14:35:03 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -67,11 +67,6 @@ struct i4b_l1l2_func
|
||||
/* =================== */
|
||||
|
||||
int (*PH_DATA_REQ) (int, struct mbuf *, int);
|
||||
|
||||
/* 3rd ph_data_req parameter */
|
||||
#define MBUF_DONTFREE 0
|
||||
#define MBUF_FREE 1
|
||||
|
||||
int (*PH_ACTIVATE_REQ) (int);
|
||||
|
||||
#define PH_Data_Req(unit, data, freeflag) \
|
||||
@ -89,7 +84,7 @@ struct i4b_l1l2_func
|
||||
/* L1/L2 management command and status information */
|
||||
/* =============================================== */
|
||||
int (*MPH_STATUS_IND) (int, int, int);
|
||||
int (*MPH_COMMAND_REQ) (int, int, int);
|
||||
int (*MPH_COMMAND_REQ) (int, int, void *);
|
||||
|
||||
#define MPH_Status_Ind(unit, status, parm) \
|
||||
((*i4b_l1l2_func.MPH_STATUS_IND)(unit, status, parm))
|
||||
|
@ -27,11 +27,11 @@
|
||||
* i4b_l2l3.h - i4b layer 2 / layer 3 interactions
|
||||
* -----------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l2l3.h,v 1.7 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_l2l3.h,v 1.8 2000/06/02 16:14:35 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:44:47 1999]
|
||||
* last edit-date: [Fri Jun 2 14:33:34 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -108,7 +108,7 @@ struct i4b_l2l3_func
|
||||
/* Layer 3 --> Layer 2 management */
|
||||
/* ============================== */
|
||||
|
||||
int (*MDL_COMMAND_REQ) (int, int, int); /* L3 --> L2 command */
|
||||
int (*MDL_COMMAND_REQ) (int, int, void *); /* L3 --> L2 command */
|
||||
|
||||
#define MDL_Command_Req(unit, command, parm) \
|
||||
((*i4b_l2l3_func.MDL_COMMAND_REQ)(unit, command, parm))
|
||||
|
@ -27,11 +27,11 @@
|
||||
* i4b_l3l4.h - layer 3 / layer 4 interface
|
||||
* ------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l3l4.h,v 1.27 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_l3l4.h,v 1.32 2000/08/24 11:48:57 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:44:56 1999]
|
||||
* last edit-date: [Fri Jun 2 14:29:35 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -121,6 +121,12 @@ drvr_link_t *ibc_ret_linktab(int unit);
|
||||
void ibc_set_linktab(int unit, isdn_link_t *ilt);
|
||||
#endif
|
||||
|
||||
/* global linktab functions for ING network driver */
|
||||
|
||||
drvr_link_t *ing_ret_linktab(int unit);
|
||||
void ing_set_linktab(int unit, isdn_link_t *ilt);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* this structure describes one call/connection on one B-channel
|
||||
* and all its parameters
|
||||
@ -150,7 +156,9 @@ typedef struct
|
||||
|
||||
u_char dst_telno[TELNO_MAX]; /* destination number */
|
||||
u_char src_telno[TELNO_MAX]; /* source number */
|
||||
|
||||
int scr_ind; /* screening ind for incoming call */
|
||||
int prs_ind; /* presentation ind for incoming call */
|
||||
|
||||
int Q931state; /* Q.931 state for call */
|
||||
int event; /* event to be processed */
|
||||
@ -194,6 +202,17 @@ typedef struct
|
||||
struct callout_handle T400_callout;
|
||||
int callouts_inited; /* must init before use */
|
||||
#endif
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
struct callout idle_timeout_handle;
|
||||
struct callout T303_callout;
|
||||
struct callout T305_callout;
|
||||
struct callout T308_callout;
|
||||
struct callout T309_callout;
|
||||
struct callout T310_callout;
|
||||
struct callout T313_callout;
|
||||
struct callout T400_callout;
|
||||
int callouts_inited; /* must init before use */
|
||||
#endif
|
||||
|
||||
int idletime_state; /* wait for idle_time begin */
|
||||
#define IST_IDLE 0 /* shorthold mode disabled */
|
||||
@ -257,11 +276,9 @@ typedef struct
|
||||
void (*N_CONNECT_RESPONSE) (unsigned int, int, int);
|
||||
void (*N_DISCONNECT_REQUEST) (unsigned int, int);
|
||||
void (*N_ALERT_REQUEST) (unsigned int);
|
||||
void (*N_SET_TRACE) (int unit, int val);
|
||||
int (*N_GET_TRACE) (int unit);
|
||||
int (*N_DOWNLOAD) (int unit, int numprotos, struct isdn_dr_prot *protocols);
|
||||
int (*N_DIAGNOSTICS) (int unit, struct isdn_diagnostic_request*);
|
||||
void (*N_MGMT_COMMAND) (int unit, int cmd, int parm);
|
||||
void (*N_MGMT_COMMAND) (int unit, int cmd, void *);
|
||||
} ctrl_desc_t;
|
||||
|
||||
extern ctrl_desc_t ctrl_desc[MAX_CONTROLLERS];
|
||||
|
@ -27,17 +27,21 @@
|
||||
* i4b - mbuf handling support routines
|
||||
* --------------------------------------
|
||||
*
|
||||
* $Id: i4b_mbuf.h,v 1.8 1999/12/13 21:25:24 hm Exp $
|
||||
* $Id: i4b_mbuf.h,v 1.9 2000/03/07 14:21:18 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 21:45:05 1999]
|
||||
* last edit-date: [Fri Mar 3 14:30:09 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _I4B_MBUF_H_
|
||||
#define _I4B_MBUF_H_
|
||||
|
||||
/* layer 1 / layer 2 comunication: 3rd ph_data_req parameter */
|
||||
#define MBUF_DONTFREE 0
|
||||
#define MBUF_FREE 1
|
||||
|
||||
#define IF_QEMPTY(ifq) ((ifq)->ifq_len == 0)
|
||||
|
||||
struct mbuf *i4b_Dgetmbuf( int );
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_tel_ioctl.h telephony interface ioctls
|
||||
* ------------------------------------------
|
||||
*
|
||||
* $Id: i4b_tel_ioctl.h,v 1.11 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_tel_ioctl.h,v 1.13 2000/01/12 14:49:36 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:07:18 1999]
|
||||
* last edit-date: [Wed Jan 12 15:47:11 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -62,6 +62,19 @@
|
||||
|
||||
#define I4B_TEL_VR_REQ _IOR('A', 3, msg_vr_req_t)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* send tones out of the tel interface
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define I4B_TEL_MAXTONES 32
|
||||
|
||||
struct i4b_tel_tones {
|
||||
int frequency[I4B_TEL_MAXTONES];
|
||||
int duration[I4B_TEL_MAXTONES];
|
||||
};
|
||||
|
||||
#define I4B_TEL_TONES _IOR('A', 4, struct i4b_tel_tones)
|
||||
|
||||
/*===========================================================================*
|
||||
* /dev/i4bteld<n> devices (dialer interface)
|
||||
*===========================================================================*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_trace.h - header file for trace data read device
|
||||
* ----------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_trace.h,v 1.7 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_trace.h,v 1.8 2000/03/08 16:08:18 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:07:25 1999]
|
||||
* last edit-date: [Wed Mar 8 16:41:43 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -70,8 +70,7 @@ typedef struct {
|
||||
* get/set current trace flag settings
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define I4B_TRC_GET _IOR('T', 0, int) /* get trace settings */
|
||||
#define I4B_TRC_SET _IOW('T', 1, int) /* set trace settings */
|
||||
#define I4B_TRC_SET _IOW('T', 0, int) /* set trace settings */
|
||||
|
||||
#define TRACE_OFF 0x00 /* tracing off */
|
||||
#define TRACE_I 0x01 /* trace L1 INFO's on */
|
||||
@ -87,7 +86,7 @@ typedef struct {
|
||||
int txflags; /* d and/or b channel */
|
||||
} i4b_trace_setupa_t;
|
||||
|
||||
#define I4B_TRC_SETA _IOW('T', 2, i4b_trace_setupa_t) /* set analyze mode */
|
||||
#define I4B_TRC_RESETA _IOW('T', 3, int) /* reset analyze mode */
|
||||
#define I4B_TRC_SETA _IOW('T', 1, i4b_trace_setupa_t) /* set analyze mode */
|
||||
#define I4B_TRC_RESETA _IOW('T', 2, int) /* reset analyze mode */
|
||||
|
||||
#endif /* _I4B_TRACE_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_iframe.c - i frame handling routines
|
||||
* ------------------------------------------
|
||||
*
|
||||
* $Id: i4b_iframe.c,v 1.22 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_iframe.c,v 1.25 2000/08/24 11:48:57 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:03:16 1999]
|
||||
* last edit-date: [Thu Aug 24 12:49:18 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,18 +43,16 @@
|
||||
#if NI4BQ921 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -98,7 +96,7 @@ i4b_rxd_i_frame(int unit, struct mbuf *m)
|
||||
if((l2sc->Q921_state != ST_MULTIFR) && (l2sc->Q921_state != ST_TIMREC))
|
||||
{
|
||||
i4b_Dfreembuf(m);
|
||||
DBGL2(L2_I_ERR, "i4b_rxd_i_frame", ("ERROR, state != (MF || TR)!\n"));
|
||||
NDBGL2(L2_I_ERR, "ERROR, state != (MF || TR)!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -223,12 +221,12 @@ i4b_i_frame_queued_up(l2_softc_t *l2sc)
|
||||
{
|
||||
if(l2sc->peer_busy)
|
||||
{
|
||||
DBGL2(L2_I_MSG, "i4b_i_frame_queued_up", ("regen IFQUP, cause: peer busy!\n"));
|
||||
NDBGL2(L2_I_MSG, "regen IFQUP, cause: peer busy!");
|
||||
}
|
||||
|
||||
if(l2sc->vs == ((l2sc->va + MAX_K_VALUE) & 127))
|
||||
{
|
||||
DBGL2(L2_I_MSG, "i4b_i_frame_queued_up", ("regen IFQUP, cause: vs=va+k!\n"));
|
||||
NDBGL2(L2_I_MSG, "regen IFQUP, cause: vs=va+k!");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -238,13 +236,8 @@ i4b_i_frame_queued_up(l2_softc_t *l2sc)
|
||||
|
||||
if(!(IF_QEMPTY(&l2sc->i_queue)))
|
||||
{
|
||||
DBGL2(L2_I_MSG, "i4b_i_frame_queued_up", ("re-scheduling IFQU call!\n"));
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
l2sc->IFQU_callout = timeout((TIMEOUT_FUNC_T)i4b_i_frame_queued_up, (void *)l2sc, IFQU_DLY);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)i4b_i_frame_queued_up, (void *)l2sc, IFQU_DLY);
|
||||
#endif
|
||||
NDBGL2(L2_I_MSG, "re-scheduling IFQU call!");
|
||||
START_TIMER(l2sc->IFQU_callout, i4b_i_frame_queued_up, l2sc, IFQU_DLY);
|
||||
}
|
||||
CRIT_END;
|
||||
return;
|
||||
@ -254,7 +247,7 @@ i4b_i_frame_queued_up(l2_softc_t *l2sc)
|
||||
|
||||
if(!m)
|
||||
{
|
||||
DBGL2(L2_I_ERR, "i4b_i_frame_queued_up", ("ERROR, mbuf NULL after IF_DEQUEUE\n"));
|
||||
NDBGL2(L2_I_ERR, "ERROR, mbuf NULL after IF_DEQUEUE");
|
||||
CRIT_END;
|
||||
return;
|
||||
}
|
||||
@ -275,7 +268,7 @@ i4b_i_frame_queued_up(l2_softc_t *l2sc)
|
||||
|
||||
if(l2sc->ua_num != UA_EMPTY) /* failsafe */
|
||||
{
|
||||
DBGL2(L2_I_ERR, "i4b_i_frame_queued_up", ("ERROR, l2sc->ua_num: %d != UA_EMPTY\n", l2sc->ua_num));
|
||||
NDBGL2(L2_I_ERR, "ERROR, l2sc->ua_num: %d != UA_EMPTY", l2sc->ua_num);
|
||||
i4b_print_l2var(l2sc);
|
||||
i4b_Dfreembuf(l2sc->ua_frame);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l2.c - ISDN layer 2 (Q.921)
|
||||
* -------------------------------
|
||||
*
|
||||
* $Id: i4b_l2.c,v 1.30 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l2.c,v 1.35 2000/08/24 11:48:57 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:03:23 1999]
|
||||
* last edit-date: [Thu Aug 24 13:40:35 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ921 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -78,11 +77,10 @@ int i4b_dl_release_cnf(int);
|
||||
int i4b_dl_data_ind(int, struct mbuf *);
|
||||
int i4b_dl_unit_data_ind(int, struct mbuf *);
|
||||
|
||||
static int i4b_mdl_command_req(int, int, int);
|
||||
static int i4b_mdl_command_req(int, int, void *);
|
||||
|
||||
/* from layer 2 */
|
||||
|
||||
extern int i4b_mdl_attach_ind(int, int);
|
||||
extern int i4b_mdl_status_ind(int, int, int);
|
||||
|
||||
/* this layers debug level */
|
||||
@ -113,7 +111,7 @@ struct i4b_l2l3_func i4b_l2l3_func = {
|
||||
|
||||
/* Layer 3 --> Layer 2 management */
|
||||
|
||||
(int (*)(int, int, int)) i4b_mdl_command_req
|
||||
(int (*)(int, int, void *)) i4b_mdl_command_req
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -123,7 +121,7 @@ int i4b_dl_establish_req(int unit)
|
||||
{
|
||||
l2_softc_t *l2sc = &l2_softc[unit];
|
||||
|
||||
DBGL2(L2_PRIM, "DL-ESTABLISH-REQ", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "unit %d",unit);
|
||||
i4b_l1_activate(l2sc);
|
||||
i4b_next_l2state(l2sc, EV_DLESTRQ);
|
||||
return(0);
|
||||
@ -136,7 +134,7 @@ int i4b_dl_release_req(int unit)
|
||||
{
|
||||
l2_softc_t *l2sc = &l2_softc[unit];
|
||||
|
||||
DBGL2(L2_PRIM, "DL-RELEASE-REQ", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "unit %d",unit);
|
||||
i4b_next_l2state(l2sc, EV_DLRELRQ);
|
||||
return(0);
|
||||
}
|
||||
@ -147,7 +145,7 @@ int i4b_dl_release_req(int unit)
|
||||
int i4b_dl_unit_data_req(int unit, struct mbuf *m)
|
||||
{
|
||||
#ifdef NOTDEF
|
||||
DBGL2(L2_PRIM, "DL-UNIT-DATA-REQ", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "unit %d",unit);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
@ -160,7 +158,7 @@ int i4b_dl_data_req(int unit, struct mbuf *m)
|
||||
l2_softc_t *l2sc = &l2_softc[unit];
|
||||
|
||||
#ifdef NOTDEF
|
||||
DBGL2(L2_PRIM, "DL-DATA-REQ", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "unit %d",unit);
|
||||
#endif
|
||||
switch(l2sc->Q921_state)
|
||||
{
|
||||
@ -170,7 +168,7 @@ int i4b_dl_data_req(int unit, struct mbuf *m)
|
||||
|
||||
if(IF_QFULL(&l2sc->i_queue))
|
||||
{
|
||||
DBGL2(L2_ERROR, "i4b_dl_data_req", ("i_queue full!!\n"));
|
||||
NDBGL2(L2_ERROR, "i_queue full!!");
|
||||
i4b_Dfreembuf(m);
|
||||
}
|
||||
else
|
||||
@ -186,7 +184,7 @@ int i4b_dl_data_req(int unit, struct mbuf *m)
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL2(L2_ERROR, "i4b_dl_data_req", ("unit %d ERROR in state [%s], freeing mbuf\n", unit, i4b_print_l2state(l2sc)));
|
||||
NDBGL2(L2_ERROR, "unit %d ERROR in state [%s], freeing mbuf", unit, i4b_print_l2state(l2sc));
|
||||
i4b_Dfreembuf(m);
|
||||
break;
|
||||
}
|
||||
@ -201,7 +199,7 @@ i4b_ph_activate_ind(int unit)
|
||||
{
|
||||
l2_softc_t *l2sc = &l2_softc[unit];
|
||||
|
||||
DBGL1(L1_PRIM, "PH-ACTIVATE-IND", ("unit %d\n",unit));
|
||||
NDBGL1(L1_PRIM, "unit %d",unit);
|
||||
l2sc->ph_active = PH_ACTIVE;
|
||||
return(0);
|
||||
}
|
||||
@ -214,7 +212,7 @@ i4b_ph_deactivate_ind(int unit)
|
||||
{
|
||||
l2_softc_t *l2sc = &l2_softc[unit];
|
||||
|
||||
DBGL1(L1_PRIM, "PH-DEACTIVATE-IND", ("unit %d\n",unit));
|
||||
NDBGL1(L1_PRIM, "unit %d",unit);
|
||||
l2sc->ph_active = PH_INACTIVE;
|
||||
return(0);
|
||||
}
|
||||
@ -275,7 +273,7 @@ i4b_mph_status_ind(int unit, int status, int parm)
|
||||
|
||||
CRIT_BEG;
|
||||
|
||||
DBGL1(L1_PRIM, "MPH-STATUS-IND", ("unit %d, status=%d, parm=%d\n", unit, status, parm));
|
||||
NDBGL1(L1_PRIM, "unit %d, status=%d, parm=%d", unit, status, parm);
|
||||
|
||||
switch(status)
|
||||
{
|
||||
@ -293,6 +291,14 @@ i4b_mph_status_ind(int unit, int status, int parm)
|
||||
callout_handle_init(&l2sc->T203_callout);
|
||||
callout_handle_init(&l2sc->IFQU_callout);
|
||||
#endif
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
/* initialize the callout handles for timeout routines */
|
||||
callout_init(&l2sc->T200_callout);
|
||||
callout_init(&l2sc->T202_callout);
|
||||
callout_init(&l2sc->T203_callout);
|
||||
callout_init(&l2sc->IFQU_callout);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
case STI_L1STAT: /* state of layer 1 */
|
||||
@ -302,7 +308,7 @@ i4b_mph_status_ind(int unit, int status, int parm)
|
||||
/*XXX*/ if((l2sc->Q921_state >= ST_AW_EST) &&
|
||||
(l2sc->Q921_state <= ST_TIMREC))
|
||||
{
|
||||
DBGL2(L2_ERROR, "i4b_mph_status_ind", ("unit %d, persistent deactivation!\n", unit));
|
||||
NDBGL2(L2_ERROR, "unit %d, persistent deactivation!", unit);
|
||||
i4b_l2_unit_init(unit);
|
||||
}
|
||||
else
|
||||
@ -313,11 +319,11 @@ i4b_mph_status_ind(int unit, int status, int parm)
|
||||
|
||||
case STI_NOL1ACC:
|
||||
i4b_l2_unit_init(unit);
|
||||
DBGL2(L2_ERROR, "i4b_mph_status_ind", ("unit %d, cannot access S0 bus!\n", unit));
|
||||
NDBGL2(L2_ERROR, "unit %d, cannot access S0 bus!", unit);
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL2(L2_ERROR, "i4b_mph_status_ind", ("ERROR, unit %d, unknown status message!\n", unit));
|
||||
NDBGL2(L2_ERROR, "ERROR, unit %d, unknown status message!", unit);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -332,9 +338,9 @@ i4b_mph_status_ind(int unit, int status, int parm)
|
||||
/*---------------------------------------------------------------------------*
|
||||
* MDL_COMMAND_REQ from layer 3
|
||||
*---------------------------------------------------------------------------*/
|
||||
int i4b_mdl_command_req(int unit, int command, int parm)
|
||||
int i4b_mdl_command_req(int unit, int command, void * parm)
|
||||
{
|
||||
DBGL2(L2_PRIM, "MDL-COMMAND-REQ", ("unit %d, command=%d, parm=%d\n", unit, command, parm));
|
||||
NDBGL2(L2_PRIM, "unit %d, command=%d, parm=%d", unit, command, (unsigned int)parm);
|
||||
|
||||
switch(command)
|
||||
{
|
||||
@ -356,7 +362,7 @@ i4b_ph_data_ind(int unit, struct mbuf *m)
|
||||
{
|
||||
l2_softc_t *l2sc = &l2_softc[unit];
|
||||
#ifdef NOTDEF
|
||||
DBGL1(L1_PRIM, "PH-DATA-IND", ("unit %d\n", unit));
|
||||
NDBGL1(L1_PRIM, "unit %d", unit);
|
||||
#endif
|
||||
u_char *ptr = m->m_data;
|
||||
|
||||
@ -365,7 +371,7 @@ i4b_ph_data_ind(int unit, struct mbuf *m)
|
||||
if(m->m_len < 4) /* 6 oct - 2 chksum oct */
|
||||
{
|
||||
l2sc->stat.err_rx_len++;
|
||||
DBGL2(L2_ERROR, "i4b_ph_data_ind", ("ERROR, I-frame < 6 octetts!\n"));
|
||||
NDBGL2(L2_ERROR, "ERROR, I-frame < 6 octetts!");
|
||||
i4b_Dfreembuf(m);
|
||||
return(0);
|
||||
}
|
||||
@ -376,7 +382,7 @@ i4b_ph_data_ind(int unit, struct mbuf *m)
|
||||
if(m->m_len < 4) /* 6 oct - 2 chksum oct */
|
||||
{
|
||||
l2sc->stat.err_rx_len++;
|
||||
DBGL2(L2_ERROR, "i4b_ph_data_ind", ("ERROR, S-frame < 6 octetts!\n"));
|
||||
NDBGL2(L2_ERROR, "ERROR, S-frame < 6 octetts!");
|
||||
i4b_Dfreembuf(m);
|
||||
return(0);
|
||||
}
|
||||
@ -387,7 +393,7 @@ i4b_ph_data_ind(int unit, struct mbuf *m)
|
||||
if(m->m_len < 3) /* 5 oct - 2 chksum oct */
|
||||
{
|
||||
l2sc->stat.err_rx_len++;
|
||||
DBGL2(L2_ERROR, "i4b_ph_data_ind", ("ERROR, U-frame < 5 octetts!\n"));
|
||||
NDBGL2(L2_ERROR, "ERROR, U-frame < 5 octetts!");
|
||||
i4b_Dfreembuf(m);
|
||||
return(0);
|
||||
}
|
||||
@ -396,7 +402,7 @@ i4b_ph_data_ind(int unit, struct mbuf *m)
|
||||
else
|
||||
{
|
||||
l2sc->stat.err_rx_badf++;
|
||||
DBGL2(L2_ERROR, "i4b_ph_data_ind", ("ERROR, bad frame rx'd - "));
|
||||
NDBGL2(L2_ERROR, "ERROR, bad frame rx'd - ");
|
||||
i4b_print_frame(m->m_len, m->m_data);
|
||||
i4b_Dfreembuf(m);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l2.h - ISDN layer 2 (Q.921) definitions
|
||||
* ---------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l2.h,v 1.20 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l2.h,v 1.23 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:03:29 1999]
|
||||
* last edit-date: [Sat Mar 18 10:28:22 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -69,6 +69,12 @@ typedef struct {
|
||||
struct callout_handle T203_callout;
|
||||
struct callout_handle IFQU_callout;
|
||||
#endif
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
struct callout T200_callout;
|
||||
struct callout T202_callout;
|
||||
struct callout T203_callout;
|
||||
struct callout IFQU_callout;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* i4b_iframe.c, i4b_i_frame_queued_up(): value of IFQU_DLY
|
||||
@ -314,7 +320,6 @@ extern int i4b_l2_nr_ok ( int nr, int va, int vs );
|
||||
extern void i4b_make_rand_ri ( l2_softc_t *l2sc );
|
||||
extern void i4b_mdl_assign_ind ( l2_softc_t *l2sc );
|
||||
extern void i4b_mdl_error_ind ( l2_softc_t *l2sc, char *where, int errorcode );
|
||||
extern int i4b_mph_attach_ind ( int unit, int type );
|
||||
extern int i4b_mph_status_ind ( int unit, int status, int parm );
|
||||
extern void i4b_next_l2state ( l2_softc_t *l2sc, int event );
|
||||
extern void i4b_nr_error_recovery ( l2_softc_t *l2sc );
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l2fsm.c - layer 2 FSM
|
||||
* -------------------------
|
||||
*
|
||||
* $Id: i4b_l2fsm.c,v 1.17 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l2fsm.c,v 1.22 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:03:36 1999]
|
||||
* last edit-date: [Tue May 30 15:48:20 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ921 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -71,8 +70,9 @@
|
||||
#include <i4b/layer2/i4b_l2.h>
|
||||
#include <i4b/layer2/i4b_l2fsm.h>
|
||||
|
||||
l2_softc_t l2_softc[ISIC_MAXUNIT];
|
||||
l2_softc_t l2_softc[MAXL1UNITS];
|
||||
|
||||
#if DO_I4B_DEBUG
|
||||
static char *l2state_text[N_STATES] = {
|
||||
"ST_TEI_UNAS",
|
||||
"ST_ASG_AW_TEI",
|
||||
@ -111,6 +111,7 @@ static char *l2event_text[N_EVENTS] = {
|
||||
"EV_RXFRMR",
|
||||
"Illegal Event"
|
||||
};
|
||||
#endif
|
||||
|
||||
static void F_TU01 __P((l2_softc_t *));
|
||||
static void F_TU03 __P((l2_softc_t *));
|
||||
@ -193,7 +194,7 @@ static void F_NCNA __P((l2_softc_t *));
|
||||
static void
|
||||
F_ILL(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_ERR, "F_ILL", ("FSM function F_ILL executing\n"));
|
||||
NDBGL2(L2_F_ERR, "FSM function F_ILL executing");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -202,7 +203,7 @@ F_ILL(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_NCNA(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_NCNA", ("FSM function F_NCNA executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_NCNA executing");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -261,10 +262,10 @@ void i4b_next_l2state(l2_softc_t *l2sc, int event)
|
||||
|
||||
if(newstate != ST_SUBSET)
|
||||
{ /* state function does NOT set new state */
|
||||
DBGL2(L2_F_MSG, "i4b_next_l2state", ("FSM event [%s]: [%s/%d => %s/%d]\n",
|
||||
NDBGL2(L2_F_MSG, "FSM event [%s]: [%s/%d => %s/%d]",
|
||||
l2event_text[event],
|
||||
l2state_text[currstate], currstate,
|
||||
l2state_text[newstate], newstate));
|
||||
l2state_text[newstate], newstate);
|
||||
}
|
||||
|
||||
/* execute state transition function */
|
||||
@ -272,9 +273,9 @@ void i4b_next_l2state(l2_softc_t *l2sc, int event)
|
||||
|
||||
if(newstate == ST_SUBSET)
|
||||
{ /* state function DOES set new state */
|
||||
DBGL2(L2_F_MSG, "i4b_next_l2state", ("FSM S-event [%s]: [%s => %s]\n", l2event_text[event],
|
||||
NDBGL2(L2_F_MSG, "FSM S-event [%s]: [%s => %s]", l2event_text[event],
|
||||
l2state_text[currstate],
|
||||
l2state_text[l2sc->Q921_state]));
|
||||
l2state_text[l2sc->Q921_state]);
|
||||
}
|
||||
|
||||
/* check for illegal new state */
|
||||
@ -282,9 +283,9 @@ void i4b_next_l2state(l2_softc_t *l2sc, int event)
|
||||
if(newstate == ST_ILL)
|
||||
{
|
||||
newstate = currstate;
|
||||
DBGL2(L2_F_ERR, "i4b_next_l2state", ("FSM illegal state, state = %s, event = %s!\n",
|
||||
NDBGL2(L2_F_ERR, "FSM illegal state, state = %s, event = %s!",
|
||||
l2state_text[currstate],
|
||||
l2event_text[event]));
|
||||
l2event_text[event]);
|
||||
}
|
||||
|
||||
/* check if state machine function has to set new state */
|
||||
@ -294,7 +295,7 @@ void i4b_next_l2state(l2_softc_t *l2sc, int event)
|
||||
|
||||
if(l2sc->postfsmfunc != NULL)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "i4b_next_l2state", ("FSM executing postfsmfunc!\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM executing postfsmfunc!");
|
||||
/* try to avoid an endless loop */
|
||||
savpostfsmfunc = l2sc->postfsmfunc;
|
||||
l2sc->postfsmfunc = NULL;
|
||||
@ -302,6 +303,7 @@ void i4b_next_l2state(l2_softc_t *l2sc, int event)
|
||||
}
|
||||
}
|
||||
|
||||
#if DO_I4B_DEBUG
|
||||
/*---------------------------------------------------------------------------*
|
||||
* return pointer to current state description
|
||||
*---------------------------------------------------------------------------*/
|
||||
@ -309,6 +311,7 @@ char *i4b_print_l2state(l2_softc_t *l2sc)
|
||||
{
|
||||
return((char *) l2state_text[l2sc->Q921_state]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* FSM state ST_TEI_UNAS event dl establish request
|
||||
@ -316,7 +319,7 @@ char *i4b_print_l2state(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TU01(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TU01", ("FSM function F_TU01 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TU01 executing");
|
||||
i4b_mdl_assign_ind(l2sc);
|
||||
}
|
||||
|
||||
@ -326,7 +329,7 @@ F_TU01(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TU03(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TU03", ("FSM function F_TU03 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TU03 executing");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -335,7 +338,7 @@ F_TU03(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TA03(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TA03", ("FSM function F_TA03 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TA03 executing");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -344,7 +347,7 @@ F_TA03(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TA04(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TA04", ("FSM function F_TA04 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TA04 executing");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -353,7 +356,7 @@ F_TA04(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TA05(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TA05", ("FSM function F_TA05 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TA05 executing");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -362,7 +365,7 @@ F_TA05(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TE03(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TE03", ("FSM function F_TE03 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TE03 executing");
|
||||
i4b_establish_data_link(l2sc);
|
||||
l2sc->l3initiated = 1;
|
||||
}
|
||||
@ -373,7 +376,7 @@ F_TE03(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TE04(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TE04", ("FSM function F_TE04 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TE04 executing");
|
||||
l2sc->postfsmarg = l2sc->unit;
|
||||
l2sc->postfsmfunc = DL_Rel_Ind_A;
|
||||
}
|
||||
@ -384,7 +387,7 @@ F_TE04(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TE05(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TE05", ("FSM function F_TE05 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TE05 executing");
|
||||
l2sc->postfsmarg = l2sc->unit;
|
||||
l2sc->postfsmfunc = DL_Rel_Ind_A;
|
||||
}
|
||||
@ -395,7 +398,7 @@ F_TE05(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_T01(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_T01", ("FSM function F_T01 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_T01 executing");
|
||||
i4b_establish_data_link(l2sc);
|
||||
l2sc->l3initiated = 1;
|
||||
}
|
||||
@ -406,7 +409,7 @@ F_T01(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_T05(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_T05", ("FSM function F_T05 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_T05 executing");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -415,7 +418,7 @@ F_T05(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_T06(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_T06", ("FSM function F_T06 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_T06 executing");
|
||||
/*XXX*/ i4b_mdl_assign_ind(l2sc);
|
||||
}
|
||||
|
||||
@ -425,7 +428,7 @@ F_T06(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_T07(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_T07", ("FSM function F_T07 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_T07 executing");
|
||||
|
||||
/* XXX */
|
||||
#ifdef NOTDEF
|
||||
@ -461,7 +464,7 @@ F_T07(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_T08(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_T08", ("FSM function F_T08 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_T08 executing");
|
||||
MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE);
|
||||
i4b_tx_ua(l2sc, l2sc->rxd_PF);
|
||||
}
|
||||
@ -472,7 +475,7 @@ F_T08(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_T09(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_T09", ("FSM function F_T09 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_T09 executing");
|
||||
i4b_mdl_error_ind(l2sc, "F_T09", MDL_ERR_C);
|
||||
i4b_mdl_error_ind(l2sc, "F_T09", MDL_ERR_D);
|
||||
}
|
||||
@ -483,7 +486,7 @@ F_T09(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_T10(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_T10", ("FSM function F_T10 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_T10 executing");
|
||||
|
||||
if(l2sc->rxd_PF)
|
||||
{
|
||||
@ -512,7 +515,7 @@ F_T10(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_T13(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_T13", ("FSM function F_T13 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_T13 executing");
|
||||
l2sc->postfsmarg = l2sc->unit;
|
||||
l2sc->postfsmfunc = DL_Rel_Cnf_A;
|
||||
}
|
||||
@ -523,7 +526,7 @@ F_T13(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AE01(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AE01", ("FSM function F_AE01 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AE01 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -536,7 +539,7 @@ F_AE01(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AE05(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AE05", ("FSM function F_AE05 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AE05 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -552,7 +555,7 @@ F_AE05(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AE06(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AE06", ("FSM function F_AE06 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AE06 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -570,7 +573,7 @@ F_AE06(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AE07(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AE07", ("FSM function F_AE07 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AE07 executing");
|
||||
MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE);
|
||||
i4b_tx_ua(l2sc, l2sc->rxd_PF);
|
||||
}
|
||||
@ -581,7 +584,7 @@ F_AE07(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AE08(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AE08", ("FSM function F_AE08 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AE08 executing");
|
||||
i4b_tx_dm(l2sc, l2sc->rxd_PF);
|
||||
}
|
||||
|
||||
@ -591,7 +594,7 @@ F_AE08(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AE09(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AE09", ("FSM function F_AE09 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AE09 executing");
|
||||
|
||||
if(l2sc->rxd_PF == 0)
|
||||
{
|
||||
@ -635,7 +638,7 @@ F_AE09(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AE10(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AE10", ("FSM function F_AE10 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AE10 executing");
|
||||
|
||||
if(l2sc->rxd_PF == 0)
|
||||
{
|
||||
@ -660,7 +663,7 @@ F_AE10(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AE11(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AE11", ("FSM function F_AE11 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AE11 executing");
|
||||
|
||||
if(l2sc->RC >= N200)
|
||||
{
|
||||
@ -691,7 +694,7 @@ F_AE11(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AE12(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AE12", ("FSM function F_AE12 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AE12 executing");
|
||||
|
||||
if(l2sc->l3initiated == 0)
|
||||
{
|
||||
@ -705,7 +708,7 @@ F_AE12(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AR05(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AR05", ("FSM function F_AR05 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AR05 executing");
|
||||
|
||||
l2sc->postfsmarg = l2sc->unit;
|
||||
l2sc->postfsmfunc = DL_Rel_Cnf_A;
|
||||
@ -719,7 +722,7 @@ F_AR05(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AR06(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AR06", ("FSM function F_AR06 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AR06 executing");
|
||||
|
||||
l2sc->postfsmarg = l2sc->unit;
|
||||
l2sc->postfsmfunc = DL_Rel_Cnf_A;
|
||||
@ -735,7 +738,7 @@ F_AR06(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AR07(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AR07", ("FSM function F_AR07 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AR07 executing");
|
||||
i4b_tx_dm(l2sc, l2sc->rxd_PF);
|
||||
}
|
||||
|
||||
@ -745,7 +748,7 @@ F_AR07(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AR08(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AR08", ("FSM function F_AR08 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AR08 executing");
|
||||
MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE);
|
||||
i4b_tx_ua(l2sc, l2sc->rxd_PF);
|
||||
}
|
||||
@ -756,7 +759,7 @@ F_AR08(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AR09(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AR09", ("FSM function F_AR09 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AR09 executing");
|
||||
|
||||
if(l2sc->rxd_PF)
|
||||
{
|
||||
@ -781,7 +784,7 @@ F_AR09(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AR10(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AR10", ("FSM function F_AR10 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AR10 executing");
|
||||
|
||||
if(l2sc->rxd_PF)
|
||||
{
|
||||
@ -804,7 +807,7 @@ F_AR10(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_AR11(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_AR11", ("FSM function F_AR11 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_AR11 executing");
|
||||
|
||||
if(l2sc->RC >= N200)
|
||||
{
|
||||
@ -833,7 +836,7 @@ F_AR11(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF01(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF01", ("FSM function F_MF01 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF01 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -848,7 +851,7 @@ F_MF01(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF05(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF05", ("FSM function F_MF05 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF05 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -865,7 +868,7 @@ F_MF05(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF06(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF06", ("FSM function F_MF06 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF06 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -884,7 +887,7 @@ F_MF06(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF07(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF07", ("FSM function F_MF07 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF07 executing");
|
||||
|
||||
i4b_clear_exception_conditions(l2sc);
|
||||
|
||||
@ -916,7 +919,7 @@ F_MF07(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF08(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF08", ("FSM function F_MF08 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF08 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE);
|
||||
@ -935,7 +938,7 @@ F_MF08(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF09(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF09", ("FSM function F_MF09 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF09 executing");
|
||||
if(l2sc->rxd_PF)
|
||||
i4b_mdl_error_ind(l2sc, "F_MF09", MDL_ERR_C);
|
||||
else
|
||||
@ -948,7 +951,7 @@ F_MF09(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF10(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF10", ("FSM function F_MF10 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF10 executing");
|
||||
|
||||
if(l2sc->rxd_PF)
|
||||
{
|
||||
@ -974,7 +977,7 @@ F_MF10(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF11(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF11", ("FSM function F_MF11 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF11 executing");
|
||||
|
||||
l2sc->RC = 0;
|
||||
|
||||
@ -989,7 +992,7 @@ F_MF11(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF12(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF12", ("FSM function F_MF12 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF12 executing");
|
||||
|
||||
i4b_i_frame_queued_up(l2sc);
|
||||
}
|
||||
@ -1000,7 +1003,7 @@ F_MF12(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF13(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF13", ("FSM function F_MF13 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF13 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -1018,7 +1021,7 @@ F_MF13(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF14(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF14", ("FSM function F_MF14 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF14 executing");
|
||||
|
||||
i4b_transmit_enquire(l2sc);
|
||||
|
||||
@ -1031,7 +1034,7 @@ F_MF14(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF15(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF15", ("FSM function F_MF15 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF15 executing");
|
||||
|
||||
if(l2sc->own_busy == 0)
|
||||
{
|
||||
@ -1049,7 +1052,7 @@ F_MF15(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF16(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF16", ("FSM function F_MF16 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF16 executing");
|
||||
|
||||
if(l2sc->own_busy != 0)
|
||||
{
|
||||
@ -1067,7 +1070,7 @@ F_MF16(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF17(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF17", ("FSM function F_MF17 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF17 executing");
|
||||
|
||||
l2sc->peer_busy = 0;
|
||||
|
||||
@ -1114,7 +1117,7 @@ F_MF17(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF18(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF18", ("FSM function F_MF18 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF18 executing");
|
||||
|
||||
l2sc->peer_busy = 0;
|
||||
|
||||
@ -1154,7 +1157,7 @@ F_MF18(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF19(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF19", ("FSM function F_MF19 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF19 executing");
|
||||
|
||||
l2sc->peer_busy = 1;
|
||||
|
||||
@ -1193,7 +1196,7 @@ F_MF19(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_MF20(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_MF20", ("FSM function F_MF20 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_MF20 executing");
|
||||
|
||||
i4b_mdl_error_ind(l2sc, "F_MF20", MDL_ERR_K);
|
||||
|
||||
@ -1208,7 +1211,7 @@ F_MF20(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR01(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR01", ("FSM function F_TR01 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR01 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -1223,7 +1226,7 @@ F_TR01(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR05(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR05", ("FSM function F_TR05 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR05 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -1239,7 +1242,7 @@ F_TR05(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR06(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR06", ("FSM function F_TR06 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR06 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -1257,7 +1260,7 @@ F_TR06(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR07(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR07", ("FSM function F_TR07 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR07 executing");
|
||||
|
||||
i4b_clear_exception_conditions(l2sc);
|
||||
|
||||
@ -1289,7 +1292,7 @@ F_TR07(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR08(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR08", ("FSM function F_TR08 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR08 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE);
|
||||
@ -1307,7 +1310,7 @@ F_TR08(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR09(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR09", ("FSM function F_TR09 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR09 executing");
|
||||
if(l2sc->rxd_PF)
|
||||
i4b_mdl_error_ind(l2sc, "F_TR09", MDL_ERR_C);
|
||||
else
|
||||
@ -1320,7 +1323,7 @@ F_TR09(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR10(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR10", ("FSM function F_TR10 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR10 executing");
|
||||
|
||||
if(l2sc->rxd_PF)
|
||||
{
|
||||
@ -1342,7 +1345,7 @@ F_TR10(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR11(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR11", ("FSM function F_TR11 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR11 executing");
|
||||
|
||||
if(l2sc->RC >= N200)
|
||||
{
|
||||
@ -1370,7 +1373,7 @@ F_TR11(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR12(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR12", ("FSM function F_TR12 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR12 executing");
|
||||
|
||||
i4b_i_frame_queued_up(l2sc);
|
||||
}
|
||||
@ -1381,7 +1384,7 @@ F_TR12(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR13(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR13", ("FSM function F_TR13 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR13 executing");
|
||||
|
||||
i4b_Dcleanifq(&l2sc->i_queue);
|
||||
|
||||
@ -1398,7 +1401,7 @@ F_TR13(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR15(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR15", ("FSM function F_TR15 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR15 executing");
|
||||
|
||||
if(l2sc->own_busy == 0)
|
||||
{
|
||||
@ -1416,7 +1419,7 @@ F_TR15(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR16(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR16", ("FSM function F_TR16 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR16 executing");
|
||||
|
||||
if(l2sc->own_busy != 0)
|
||||
{
|
||||
@ -1434,7 +1437,7 @@ F_TR16(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR17(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR17", ("FSM function F_TR17 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR17 executing");
|
||||
|
||||
l2sc->peer_busy = 0;
|
||||
|
||||
@ -1485,7 +1488,7 @@ F_TR17(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR18(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR18", ("FSM function F_TR18 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR18 executing");
|
||||
|
||||
l2sc->peer_busy = 0;
|
||||
|
||||
@ -1536,7 +1539,7 @@ F_TR18(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR19(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR19", ("FSM function F_TR19 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR19 executing");
|
||||
|
||||
l2sc->peer_busy = 0;
|
||||
|
||||
@ -1586,7 +1589,7 @@ F_TR19(l2_softc_t *l2sc)
|
||||
static void
|
||||
F_TR20(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_F_MSG, "F_TR20", ("FSM function F_TR20 executing\n"));
|
||||
NDBGL2(L2_F_MSG, "FSM function F_TR20 executing");
|
||||
|
||||
i4b_mdl_error_ind(l2sc, "F_TR20", MDL_ERR_K);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l2fsm.h - layer 2 FSM
|
||||
* -------------------------
|
||||
*
|
||||
* $Id: i4b_l2fsm.h,v 1.5 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l2fsm.h,v 1.6 2000/03/18 09:33:48 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:03:48 1999]
|
||||
* last edit-date: [Sat Mar 18 10:28:37 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l2timer.c - layer 2 timer handling
|
||||
* --------------------------------------
|
||||
*
|
||||
* $Id: i4b_l2timer.c,v 1.17 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l2timer.c,v 1.20 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:03:56 1999]
|
||||
* last edit-date: [Thu Aug 24 12:48:52 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ921 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -77,7 +76,7 @@
|
||||
static void
|
||||
i4b_T200_timeout(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_T_ERR, "i4b_T200_timeout", ("unit %d, RC = %d\n", l2sc->unit, l2sc->RC));
|
||||
NDBGL2(L2_T_ERR, "unit %d, RC = %d", l2sc->unit, l2sc->RC);
|
||||
i4b_next_l2state(l2sc, EV_T200EXP);
|
||||
}
|
||||
|
||||
@ -90,14 +89,10 @@ i4b_T200_start(l2_softc_t *l2sc)
|
||||
if(l2sc->T200 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL2(L2_T_MSG, "i4b_T200_start", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_T_MSG, "unit %d", l2sc->unit);
|
||||
l2sc->T200 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
l2sc->T200_callout = timeout((TIMEOUT_FUNC_T)i4b_T200_timeout, (void *)l2sc, T200DEF);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)i4b_T200_timeout, (void *)l2sc, T200DEF);
|
||||
#endif
|
||||
START_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc, T200DEF);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -110,15 +105,11 @@ i4b_T200_stop(l2_softc_t *l2sc)
|
||||
CRIT_BEG;
|
||||
if(l2sc->T200 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T200_timeout, (void *)l2sc, l2sc->T200_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T200_timeout, (void *)l2sc);
|
||||
#endif
|
||||
STOP_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc);
|
||||
l2sc->T200 = TIMER_IDLE;
|
||||
}
|
||||
CRIT_END;
|
||||
DBGL2(L2_T_MSG, "i4b_T200_stop", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_T_MSG, "unit %d", l2sc->unit);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -131,24 +122,16 @@ i4b_T200_restart(l2_softc_t *l2sc)
|
||||
CRIT_BEG;
|
||||
if(l2sc->T200 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T200_timeout, (void *)l2sc, l2sc->T200_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T200_timeout, (void *)l2sc);
|
||||
#endif
|
||||
STOP_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc);
|
||||
}
|
||||
else
|
||||
{
|
||||
l2sc->T200 = TIMER_ACTIVE;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
l2sc->T200_callout = timeout((TIMEOUT_FUNC_T)i4b_T200_timeout, (void *)l2sc, T200DEF);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)i4b_T200_timeout, (void *)l2sc, T200DEF);
|
||||
#endif
|
||||
START_TIMER(l2sc->T200_callout, i4b_T200_timeout, l2sc, T200DEF);
|
||||
CRIT_END;
|
||||
DBGL2(L2_T_MSG, "i4b_T200_restart", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_T_MSG, "unit %d", l2sc->unit);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -157,7 +140,7 @@ i4b_T200_restart(l2_softc_t *l2sc)
|
||||
static void
|
||||
i4b_T202_timeout(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_T_ERR, "i4b_T202_timeout", ("unit %d, N202 = %d\n", l2sc->unit, l2sc->N202));
|
||||
NDBGL2(L2_T_ERR, "unit %d, N202 = %d", l2sc->unit, l2sc->N202);
|
||||
|
||||
if(--(l2sc->N202))
|
||||
{
|
||||
@ -174,15 +157,11 @@ i4b_T202_start(l2_softc_t *l2sc)
|
||||
if (l2sc->N202 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL2(L2_T_MSG, "i4b_T202_start", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_T_MSG, "unit %d", l2sc->unit);
|
||||
l2sc->N202 = N202DEF;
|
||||
l2sc->T202 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
l2sc->T202_callout = timeout((TIMEOUT_FUNC_T)i4b_T202_timeout, (void *)l2sc, T202DEF);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)i4b_T202_timeout, (void *)l2sc, T202DEF);
|
||||
#endif
|
||||
START_TIMER(l2sc->T202_callout, i4b_T202_timeout, l2sc, T202DEF);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -195,15 +174,11 @@ i4b_T202_stop(l2_softc_t *l2sc)
|
||||
CRIT_BEG;
|
||||
if(l2sc->T202 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T202_timeout, (void *)l2sc, l2sc->T202_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T202_timeout, (void *)l2sc);
|
||||
#endif
|
||||
STOP_TIMER(l2sc->T202_callout, i4b_T202_timeout, l2sc);
|
||||
l2sc->T202 = TIMER_IDLE;
|
||||
}
|
||||
CRIT_END;
|
||||
DBGL2(L2_T_MSG, "i4b_T202_stop", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_T_MSG, "unit %d", l2sc->unit);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -213,7 +188,7 @@ i4b_T202_stop(l2_softc_t *l2sc)
|
||||
static void
|
||||
i4b_T203_timeout(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_T_ERR, "i4b_T203_timeout", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_T_ERR, "unit %d", l2sc->unit);
|
||||
i4b_next_l2state(l2sc, EV_T203EXP);
|
||||
}
|
||||
#endif
|
||||
@ -228,14 +203,10 @@ i4b_T203_start(l2_softc_t *l2sc)
|
||||
if (l2sc->T203 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL2(L2_T_MSG, "i4b_T203_start", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_T_MSG, "unit %d", l2sc->unit);
|
||||
l2sc->T203 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
l2sc->T203_callout = timeout((TIMEOUT_FUNC_T)i4b_T203_timeout, (void *)l2sc, T203DEF);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)i4b_T203_timeout, (void *)l2sc, T203DEF);
|
||||
#endif
|
||||
START_TIMER(l2sc->T203_callout, i4b_T203_timeout, l2sc, T203DEF);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -250,15 +221,11 @@ i4b_T203_stop(l2_softc_t *l2sc)
|
||||
CRIT_BEG;
|
||||
if(l2sc->T203 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T203_timeout, (void *)l2sc, l2sc->T203_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T203_timeout, (void *)l2sc);
|
||||
#endif
|
||||
STOP_TIMER(l2sc->T203_callout, i4b_T203_timeout, l2sc);
|
||||
l2sc->T203 = TIMER_IDLE;
|
||||
}
|
||||
CRIT_END;
|
||||
DBGL2(L2_T_MSG, "i4b_T203_stop", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_T_MSG, "unit %d", l2sc->unit);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -274,24 +241,16 @@ i4b_T203_restart(l2_softc_t *l2sc)
|
||||
|
||||
if(l2sc->T203 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T203_timeout, (void *)l2sc, l2sc->T203_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_T203_timeout, (void *)l2sc);
|
||||
#endif
|
||||
STOP_TIMER(l2sc->T203_callout, i4b_T203_timerout, l2sc);
|
||||
}
|
||||
else
|
||||
{
|
||||
l2sc->T203 = TIMER_ACTIVE;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
l2sc->T203_callout = timeout((TIMEOUT_FUNC_T)i4b_T203_timeout, (void *)l2sc, T203DEF);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)i4b_T203_timeout, (void *)l2sc, T203DEF);
|
||||
#endif
|
||||
|
||||
START_TIMER(l2sc->T203_callout, i4b_T203_timerout, l2sc, T203DEF);
|
||||
CRIT_END;
|
||||
DBGL2(L2_T_MSG, "i4b_T203_restart", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_T_MSG, "unit %d", l2sc->unit);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_lme.c - layer management entity
|
||||
* -------------------------------------
|
||||
*
|
||||
* $Id: i4b_lme.c,v 1.11 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_lme.c,v 1.15 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:04:03 1999]
|
||||
* last edit-date: [Mon May 29 16:55:12 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ921 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -76,7 +75,7 @@
|
||||
void
|
||||
i4b_mdl_assign_ind(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_PRIM, "MDL-ASSIGN-IND", ("unit %d\n", l2sc->unit));
|
||||
NDBGL2(L2_PRIM, "unit %d", l2sc->unit);
|
||||
|
||||
i4b_l1_activate(l2sc);
|
||||
|
||||
@ -100,6 +99,7 @@ i4b_mdl_assign_ind(l2_softc_t *l2sc)
|
||||
void
|
||||
i4b_mdl_error_ind(l2_softc_t *l2sc, char *where, int errorcode)
|
||||
{
|
||||
#if DO_I4B_DEBUG
|
||||
static char *error_text[] = {
|
||||
"MDL_ERR_A: rx'd unsolicited response - supervisory (F=1)",
|
||||
"MDL_ERR_B: rx'd unsolicited response - DM (F=1)",
|
||||
@ -118,12 +118,13 @@ i4b_mdl_error_ind(l2_softc_t *l2sc, char *where, int errorcode)
|
||||
"MDL_ERR_O: other error - N201 error",
|
||||
"MDL_ERR_MAX: i4b_mdl_error_ind called with wrong parameter!!!"
|
||||
};
|
||||
#endif
|
||||
|
||||
if(errorcode > MDL_ERR_MAX)
|
||||
errorcode = MDL_ERR_MAX;
|
||||
|
||||
DBGL2(L2_ERROR, "i4b_mdl_error_ind", ("unit = %d, location = %s\n", l2sc->unit, where));
|
||||
DBGL2(L2_ERROR, "i4b_mdl_error_ind", ("error = %s\n", error_text[errorcode]));
|
||||
NDBGL2(L2_ERROR, "unit = %d, location = %s", l2sc->unit, where);
|
||||
NDBGL2(L2_ERROR, "error = %s", error_text[errorcode]);
|
||||
|
||||
switch(errorcode)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,26 +27,21 @@
|
||||
* i4b - mbuf handling support routines
|
||||
* ------------------------------------
|
||||
*
|
||||
* $Id: i4b_mbuf.c,v 1.13 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_mbuf.c,v 1.15 2000/05/29 15:41:42 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:04:10 1999]
|
||||
* last edit-date: [Mon May 29 16:55:18 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/tty.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_sframe.c - s frame handling routines
|
||||
* ----------------------------------------
|
||||
*
|
||||
* $Id: i4b_sframe.c,v 1.12 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_sframe.c,v 1.15 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:04:17 1999]
|
||||
* last edit-date: [Mon May 29 16:55:23 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ921 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -96,25 +95,25 @@ i4b_rxd_s_frame(int unit, struct mbuf *m)
|
||||
{
|
||||
case RR:
|
||||
l2sc->stat.rx_rr++; /* update statistics */
|
||||
DBGL2(L2_S_MSG, "i4b_rxd_s_frame", ("rx'd RR, N(R) = %d\n", l2sc->rxd_NR));
|
||||
NDBGL2(L2_S_MSG, "rx'd RR, N(R) = %d", l2sc->rxd_NR);
|
||||
i4b_next_l2state(l2sc, EV_RXRR);
|
||||
break;
|
||||
|
||||
case RNR:
|
||||
l2sc->stat.rx_rnr++; /* update statistics */
|
||||
DBGL2(L2_S_MSG, "i4b_rxd_s_frame", ("rx'd RNR, N(R) = %d\n", l2sc->rxd_NR));
|
||||
NDBGL2(L2_S_MSG, "rx'd RNR, N(R) = %d", l2sc->rxd_NR);
|
||||
i4b_next_l2state(l2sc, EV_RXRNR);
|
||||
break;
|
||||
|
||||
case REJ:
|
||||
l2sc->stat.rx_rej++; /* update statistics */
|
||||
DBGL2(L2_S_MSG, "i4b_rxd_s_frame", ("rx'd REJ, N(R) = %d\n", l2sc->rxd_NR));
|
||||
NDBGL2(L2_S_MSG, "rx'd REJ, N(R) = %d", l2sc->rxd_NR);
|
||||
i4b_next_l2state(l2sc, EV_RXREJ);
|
||||
break;
|
||||
|
||||
default:
|
||||
l2sc->stat.err_rx_bads++; /* update statistics */
|
||||
DBGL2(L2_S_ERR, "i4b_rxd_s_frame", ("ERROR, unknown code, frame = \n"));
|
||||
NDBGL2(L2_S_ERR, "ERROR, unknown code, frame = ");
|
||||
i4b_print_frame(m->m_len, m->m_data);
|
||||
break;
|
||||
}
|
||||
@ -129,7 +128,7 @@ i4b_tx_rr_command(l2_softc_t *l2sc, pbit_t pbit)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
DBGL2(L2_S_MSG, "i4b_tx_rr_command", ("tx RR, unit = %d\n", l2sc->unit));
|
||||
NDBGL2(L2_S_MSG, "tx RR, unit = %d", l2sc->unit);
|
||||
|
||||
m = i4b_build_s_frame(l2sc, CR_CMD_TO_NT, pbit, RR);
|
||||
|
||||
@ -146,7 +145,7 @@ i4b_tx_rr_response(l2_softc_t *l2sc, fbit_t fbit)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
DBGL2(L2_S_MSG, "i4b_tx_rr_response", ("tx RR, unit = %d\n", l2sc->unit));
|
||||
NDBGL2(L2_S_MSG, "tx RR, unit = %d", l2sc->unit);
|
||||
|
||||
m = i4b_build_s_frame(l2sc, CR_RSP_TO_NT, fbit, RR);
|
||||
|
||||
@ -163,7 +162,7 @@ i4b_tx_rnr_command(l2_softc_t *l2sc, pbit_t pbit)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
DBGL2(L2_S_MSG, "i4b_tx_rnr_command", ("tx RNR, unit = %d\n", l2sc->unit));
|
||||
NDBGL2(L2_S_MSG, "tx RNR, unit = %d", l2sc->unit);
|
||||
|
||||
m = i4b_build_s_frame(l2sc, CR_CMD_TO_NT, pbit, RNR);
|
||||
|
||||
@ -180,7 +179,7 @@ i4b_tx_rnr_response(l2_softc_t *l2sc, fbit_t fbit)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
DBGL2(L2_S_MSG, "i4b_tx_rnr_response", ("tx RNR, unit = %d\n", l2sc->unit));
|
||||
NDBGL2(L2_S_MSG, "tx RNR, unit = %d", l2sc->unit);
|
||||
|
||||
m = i4b_build_s_frame(l2sc, CR_RSP_TO_NT, fbit, RNR);
|
||||
|
||||
@ -197,7 +196,7 @@ i4b_tx_rej_response(l2_softc_t *l2sc, fbit_t fbit)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
DBGL2(L2_S_MSG, "i4b_tx_rej_response", ("tx REJ, unit = %d\n", l2sc->unit));
|
||||
NDBGL2(L2_S_MSG, "tx REJ, unit = %d", l2sc->unit);
|
||||
|
||||
m = i4b_build_s_frame(l2sc, CR_RSP_TO_NT, fbit, REJ);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_tei.c - tei handling procedures
|
||||
* -----------------------------------
|
||||
*
|
||||
* $Id: i4b_tei.c,v 1.17 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_tei.c,v 1.25 2000/09/01 14:11:51 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:04:24 1999]
|
||||
* last edit-date: [Fri Sep 1 16:04:58 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,19 +43,25 @@
|
||||
#if NI4BQ921 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <sys/random.h>
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined (__FreeBSD_version) && __FreeBSD_version <= 400000
|
||||
#include <machine/random.h>
|
||||
#else
|
||||
#include <sys/random.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -98,7 +104,7 @@ i4b_tei_rxframe(int unit, struct mbuf *m)
|
||||
|
||||
log(LOG_INFO, "i4b: unit %d, assigned TEI = %d = 0x%02x\n", l2sc->unit, l2sc->tei, l2sc->tei);
|
||||
|
||||
DBGL2(L2_TEI_MSG, "i4b_tei_rx_frame", ("TEI ID Assign - TEI = %d\n", l2sc->tei));
|
||||
NDBGL2(L2_TEI_MSG, "TEI ID Assign - TEI = %d", l2sc->tei);
|
||||
|
||||
i4b_next_l2state(l2sc, EV_MDASGRQ);
|
||||
}
|
||||
@ -114,12 +120,12 @@ i4b_tei_rxframe(int unit, struct mbuf *m)
|
||||
if(l2sc->tei == GROUP_TEI)
|
||||
{
|
||||
log(LOG_WARNING, "i4b: unit %d, denied TEI, no TEI values available from exchange!\n", l2sc->unit);
|
||||
DBGL2(L2_TEI_ERR, "i4b_tei_rx_frame", ("TEI ID Denied, No TEI values available from exchange!\n"));
|
||||
NDBGL2(L2_TEI_ERR, "TEI ID Denied, No TEI values available from exchange!");
|
||||
}
|
||||
else
|
||||
{
|
||||
log(LOG_WARNING, "i4b: unit %d, denied TEI = %d = 0x%02x\n", l2sc->unit, l2sc->tei, l2sc->tei);
|
||||
DBGL2(L2_TEI_ERR, "i4b_tei_rx_frame", ("TEI ID Denied - TEI = %d\n", l2sc->tei));
|
||||
NDBGL2(L2_TEI_ERR, "TEI ID Denied - TEI = %d", l2sc->tei);
|
||||
}
|
||||
MDL_Status_Ind(l2sc->unit, STI_TEIASG, -1);
|
||||
i4b_next_l2state(l2sc, EV_MDERRRS);
|
||||
@ -135,7 +141,7 @@ i4b_tei_rxframe(int unit, struct mbuf *m)
|
||||
|
||||
if(l2sc->tei != lasttei)
|
||||
{
|
||||
DBGL2(L2_TEI_MSG, "i4b_tei_rx_frame", ("TEI ID Check Req - TEI = %d\n", l2sc->tei));
|
||||
NDBGL2(L2_TEI_MSG, "TEI ID Check Req - TEI = %d", l2sc->tei);
|
||||
lasttei = l2sc->tei;
|
||||
}
|
||||
|
||||
@ -154,14 +160,14 @@ i4b_tei_rxframe(int unit, struct mbuf *m)
|
||||
l2sc->tei = GET_TEIFROMAI(*(ptr+OFF_AI));
|
||||
|
||||
log(LOG_INFO, "i4b: unit %d, removed TEI = %d = 0x%02x\n", l2sc->unit, l2sc->tei, l2sc->tei);
|
||||
DBGL2(L2_TEI_MSG, "i4b_tei_rx_frame", ("TEI ID Remove - TEI = %d\n", l2sc->tei));
|
||||
NDBGL2(L2_TEI_MSG, "TEI ID Remove - TEI = %d", l2sc->tei);
|
||||
MDL_Status_Ind(l2sc->unit, STI_TEIASG, -1);
|
||||
i4b_next_l2state(l2sc, EV_MDREMRQ);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL2(L2_TEI_ERR, "i4b_tei_rx_frame", ("UNKNOWN TEI MGMT Frame, type = 0x%x\n", *(ptr + OFF_MT)));
|
||||
NDBGL2(L2_TEI_ERR, "UNKNOWN TEI MGMT Frame, type = 0x%x", *(ptr + OFF_MT));
|
||||
i4b_print_frame(m->m_len, m->m_data);
|
||||
break;
|
||||
}
|
||||
@ -225,7 +231,7 @@ i4b_tei_assign(l2_softc_t *l2sc)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
DBGL2(L2_TEI_MSG, "i4b_tei_assign", ("tx TEI ID_Request\n"));
|
||||
NDBGL2(L2_TEI_MSG, "tx TEI ID_Request");
|
||||
|
||||
m = build_tei_mgmt_frame(l2sc, MT_ID_REQEST);
|
||||
|
||||
@ -246,7 +252,7 @@ i4b_tei_verify(l2_softc_t *l2sc)
|
||||
{
|
||||
struct mbuf *m;
|
||||
|
||||
DBGL2(L2_TEI_MSG, "i4b_tei_verify", ("tx TEI ID_Verify\n"));
|
||||
NDBGL2(L2_TEI_MSG, "tx TEI ID_Verify");
|
||||
|
||||
m = build_tei_mgmt_frame(l2sc, MT_ID_VERIFY);
|
||||
|
||||
@ -270,7 +276,7 @@ i4b_tei_chkresp(l2_softc_t *l2sc)
|
||||
if(l2sc->tei != lasttei)
|
||||
{
|
||||
lasttei = l2sc->tei;
|
||||
DBGL2(L2_TEI_MSG, "i4b_tei_chkresp", ("tx TEI ID_Check_Response\n"));
|
||||
NDBGL2(L2_TEI_MSG, "tx TEI ID_Check_Response");
|
||||
}
|
||||
|
||||
m = build_tei_mgmt_frame(l2sc, MT_ID_CHK_RSP);
|
||||
@ -291,7 +297,12 @@ i4b_make_rand_ri(l2_softc_t *l2sc)
|
||||
#if defined(__FreeBSD__)
|
||||
|
||||
u_short val;
|
||||
read_random((char *)&val, sizeof(val));
|
||||
|
||||
#ifdef RANDOMDEV
|
||||
read_random((char *)&val, sizeof(val));
|
||||
#else
|
||||
val = (u_short)random();
|
||||
#endif /* RANDOMDEV */
|
||||
|
||||
#else
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_uframe.c - routines for handling U-frames
|
||||
* -----------------------------------------------
|
||||
*
|
||||
* $Id: i4b_uframe.c,v 1.10 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_uframe.c,v 1.13 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:04:30 1999]
|
||||
* last edit-date: [Mon May 29 16:55:30 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ921 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -92,7 +91,7 @@ i4b_rxd_u_frame(int unit, struct mbuf *m)
|
||||
(l2sc->tei == GETTEI(*(ptr+OFF_TEI))))
|
||||
{
|
||||
l2sc->stat.rx_sabme++;
|
||||
DBGL2(L2_U_MSG, "i4b_rxd_u_frame", ("SABME, sapi = %d, tei = %d\n", sapi, tei));
|
||||
NDBGL2(L2_U_MSG, "SABME, sapi = %d, tei = %d", sapi, tei);
|
||||
l2sc->rxd_PF = pfbit;
|
||||
i4b_next_l2state(l2sc, EV_RXSABME);
|
||||
}
|
||||
@ -120,7 +119,7 @@ i4b_rxd_u_frame(int unit, struct mbuf *m)
|
||||
else
|
||||
{
|
||||
l2sc->stat.err_rx_badui++;
|
||||
DBGL2(L2_U_ERR, "i4b_rxd_u_frame", ("unknown UI frame!\n"));
|
||||
NDBGL2(L2_U_ERR, "unknown UI frame!");
|
||||
i4b_Dfreembuf(m);
|
||||
}
|
||||
break;
|
||||
@ -130,7 +129,7 @@ i4b_rxd_u_frame(int unit, struct mbuf *m)
|
||||
(l2sc->tei == GETTEI(*(ptr+OFF_TEI))))
|
||||
{
|
||||
l2sc->stat.rx_disc++;
|
||||
DBGL2(L2_U_MSG, "i4b_rxd_u_frame", ("DISC, sapi = %d, tei = %d\n", sapi, tei));
|
||||
NDBGL2(L2_U_MSG, "DISC, sapi = %d, tei = %d", sapi, tei);
|
||||
l2sc->rxd_PF = pfbit;
|
||||
i4b_next_l2state(l2sc, EV_RXDISC);
|
||||
}
|
||||
@ -142,7 +141,7 @@ i4b_rxd_u_frame(int unit, struct mbuf *m)
|
||||
(l2sc->tei == GETTEI(*(ptr+OFF_TEI))))
|
||||
{
|
||||
l2sc->stat.rx_xid++;
|
||||
DBGL2(L2_U_MSG, "i4b_rxd_u_frame", ("XID, sapi = %d, tei = %d\n", sapi, tei));
|
||||
NDBGL2(L2_U_MSG, "XID, sapi = %d, tei = %d", sapi, tei);
|
||||
}
|
||||
i4b_Dfreembuf(m);
|
||||
break;
|
||||
@ -154,7 +153,7 @@ i4b_rxd_u_frame(int unit, struct mbuf *m)
|
||||
(l2sc->tei == GETTEI(*(ptr+OFF_TEI))))
|
||||
{
|
||||
l2sc->stat.rx_dm++;
|
||||
DBGL2(L2_U_MSG, "i4b_rxd_u_frame", ("DM, sapi = %d, tei = %d\n", sapi, tei));
|
||||
NDBGL2(L2_U_MSG, "DM, sapi = %d, tei = %d", sapi, tei);
|
||||
i4b_print_frame(m->m_len, m->m_data);
|
||||
l2sc->rxd_PF = pfbit;
|
||||
i4b_next_l2state(l2sc, EV_RXDM);
|
||||
@ -167,7 +166,7 @@ i4b_rxd_u_frame(int unit, struct mbuf *m)
|
||||
(l2sc->tei == GETTEI(*(ptr+OFF_TEI))))
|
||||
{
|
||||
l2sc->stat.rx_ua++;
|
||||
DBGL2(L2_U_MSG, "i4b_rxd_u_frame", ("UA, sapi = %d, tei = %d\n", sapi, tei));
|
||||
NDBGL2(L2_U_MSG, "UA, sapi = %d, tei = %d", sapi, tei);
|
||||
l2sc->rxd_PF = pfbit;
|
||||
i4b_next_l2state(l2sc, EV_RXUA);
|
||||
}
|
||||
@ -179,7 +178,7 @@ i4b_rxd_u_frame(int unit, struct mbuf *m)
|
||||
(l2sc->tei == GETTEI(*(ptr+OFF_TEI))))
|
||||
{
|
||||
l2sc->stat.rx_frmr++;
|
||||
DBGL2(L2_U_MSG, "i4b_rxd_u_frame", ("FRMR, sapi = %d, tei = %d\n", sapi, tei));
|
||||
NDBGL2(L2_U_MSG, "FRMR, sapi = %d, tei = %d", sapi, tei);
|
||||
l2sc->rxd_PF = pfbit;
|
||||
i4b_next_l2state(l2sc, EV_RXFRMR);
|
||||
}
|
||||
@ -190,12 +189,12 @@ i4b_rxd_u_frame(int unit, struct mbuf *m)
|
||||
if((l2sc->tei_valid == TEI_VALID) &&
|
||||
(l2sc->tei == GETTEI(*(ptr+OFF_TEI))))
|
||||
{
|
||||
DBGL2(L2_U_ERR, "i4b_rxd_u_frame", ("UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei));
|
||||
NDBGL2(L2_U_ERR, "UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei);
|
||||
i4b_print_frame(m->m_len, m->m_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL2(L2_U_ERR, "i4b_rxd_u_frame", ("not mine - UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei));
|
||||
NDBGL2(L2_U_ERR, "not mine - UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei);
|
||||
i4b_print_frame(m->m_len, m->m_data);
|
||||
}
|
||||
l2sc->stat.err_rx_badui++;
|
||||
@ -236,7 +235,7 @@ i4b_tx_sabme(l2_softc_t *l2sc, pbit_t pbit)
|
||||
struct mbuf *m;
|
||||
|
||||
l2sc->stat.tx_sabme++;
|
||||
DBGL2(L2_U_MSG, "i4b_tx_sabme", ("tx SABME, tei = %d\n", l2sc->tei));
|
||||
NDBGL2(L2_U_MSG, "tx SABME, tei = %d", l2sc->tei);
|
||||
m = i4b_build_u_frame(l2sc, CR_CMD_TO_NT, pbit, SABME);
|
||||
PH_Data_Req(l2sc->unit, m, MBUF_FREE);
|
||||
}
|
||||
@ -250,7 +249,7 @@ i4b_tx_dm(l2_softc_t *l2sc, fbit_t fbit)
|
||||
struct mbuf *m;
|
||||
|
||||
l2sc->stat.tx_dm++;
|
||||
DBGL2(L2_U_MSG, "i4b_tx_dm", ("tx DM, tei = %d\n", l2sc->tei));
|
||||
NDBGL2(L2_U_MSG, "tx DM, tei = %d", l2sc->tei);
|
||||
m = i4b_build_u_frame(l2sc, CR_RSP_TO_NT, fbit, DM);
|
||||
PH_Data_Req(l2sc->unit, m, MBUF_FREE);
|
||||
}
|
||||
@ -264,7 +263,7 @@ i4b_tx_disc(l2_softc_t *l2sc, pbit_t pbit)
|
||||
struct mbuf *m;
|
||||
|
||||
l2sc->stat.tx_disc++;
|
||||
DBGL2(L2_U_MSG, "i4b_tx_disc", ("tx DISC, tei = %d\n", l2sc->tei));
|
||||
NDBGL2(L2_U_MSG, "tx DISC, tei = %d", l2sc->tei);
|
||||
m = i4b_build_u_frame(l2sc, CR_CMD_TO_NT, pbit, DISC);
|
||||
PH_Data_Req(l2sc->unit, m, MBUF_FREE);
|
||||
}
|
||||
@ -278,7 +277,7 @@ i4b_tx_ua(l2_softc_t *l2sc, fbit_t fbit)
|
||||
struct mbuf *m;
|
||||
|
||||
l2sc->stat.tx_ua++;
|
||||
DBGL2(L2_U_MSG, "i4b_tx_ua", ("tx UA, tei = %d\n", l2sc->tei));
|
||||
NDBGL2(L2_U_MSG, "tx UA, tei = %d", l2sc->tei);
|
||||
m = i4b_build_u_frame(l2sc, CR_RSP_TO_NT, fbit, UA);
|
||||
PH_Data_Req(l2sc->unit, m, MBUF_FREE);
|
||||
}
|
||||
@ -292,7 +291,7 @@ i4b_tx_frmr(l2_softc_t *l2sc, fbit_t fbit)
|
||||
struct mbuf *m;
|
||||
|
||||
l2sc->stat.tx_frmr++;
|
||||
DBGL2(L2_U_MSG, "i4b_tx_frmr", ("tx FRMR, tei = %d\n", l2sc->tei));
|
||||
NDBGL2(L2_U_MSG, "tx FRMR, tei = %d", l2sc->tei);
|
||||
m = i4b_build_u_frame(l2sc, CR_RSP_TO_NT, fbit, FRMR);
|
||||
PH_Data_Req(l2sc->unit, m, MBUF_FREE);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_util.c - layer 2 utility routines
|
||||
* -------------------------------------
|
||||
*
|
||||
* $Id: i4b_util.c,v 1.22 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_util.c,v 1.26 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:04:37 1999]
|
||||
* last edit-date: [Mon May 29 16:55:35 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ921 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -176,11 +175,11 @@ i4b_invoke_retransmission(l2_softc_t *l2sc, int nr)
|
||||
|
||||
CRIT_BEG;
|
||||
|
||||
DBGL2(L2_ERROR, "i4b_invoke_retransmission", ("nr = %d\n", nr ));
|
||||
NDBGL2(L2_ERROR, "nr = %d", nr );
|
||||
|
||||
while(l2sc->vs != nr)
|
||||
{
|
||||
DBGL2(L2_ERROR, "i4b_invoke_retransmission", ("nr(%d) != vs(%d)\n", nr, l2sc->vs));
|
||||
NDBGL2(L2_ERROR, "nr(%d) != vs(%d)", nr, l2sc->vs);
|
||||
|
||||
M128DEC(l2sc->vs);
|
||||
|
||||
@ -190,7 +189,7 @@ i4b_invoke_retransmission(l2_softc_t *l2sc, int nr)
|
||||
{
|
||||
if(IF_QFULL(&l2sc->i_queue))
|
||||
{
|
||||
DBGL2(L2_ERROR, "i4b_invoke_retransmission", ("ERROR, I-queue full!\n"));
|
||||
NDBGL2(L2_ERROR, "ERROR, I-queue full!");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -200,7 +199,7 @@ i4b_invoke_retransmission(l2_softc_t *l2sc, int nr)
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL2(L2_ERROR, "i4b_invoke_retransmission", ("ERROR, l2sc->vs = %d, l2sc->ua_num = %d \n",l2sc->vs, l2sc->ua_num));
|
||||
NDBGL2(L2_ERROR, "ERROR, l2sc->vs = %d, l2sc->ua_num = %d ",l2sc->vs, l2sc->ua_num);
|
||||
}
|
||||
|
||||
/* XXXXXXXXXXXXXXXXX */
|
||||
@ -230,7 +229,7 @@ i4b_acknowledge_pending(l2_softc_t *l2sc)
|
||||
void
|
||||
i4b_print_frame(int len, u_char *buf)
|
||||
{
|
||||
#ifdef DO_I4B_DEBUG
|
||||
#if DO_I4B_DEBUG
|
||||
int i;
|
||||
|
||||
if (!(i4b_l2_debug & L2_ERROR)) /* XXXXXXXXXXXXXXXXXXXXX */
|
||||
@ -248,14 +247,14 @@ i4b_print_frame(int len, u_char *buf)
|
||||
void
|
||||
i4b_print_l2var(l2_softc_t *l2sc)
|
||||
{
|
||||
DBGL2(L2_ERROR, "i4b_print_l2var", ("unit%d V(R)=%d, V(S)=%d, V(A)=%d,ACKP=%d,PBSY=%d,OBSY=%d\n",
|
||||
NDBGL2(L2_ERROR, "unit%d V(R)=%d, V(S)=%d, V(A)=%d,ACKP=%d,PBSY=%d,OBSY=%d",
|
||||
l2sc->unit,
|
||||
l2sc->vr,
|
||||
l2sc->vs,
|
||||
l2sc->va,
|
||||
l2sc->ack_pend,
|
||||
l2sc->peer_busy,
|
||||
l2sc->own_busy));
|
||||
l2sc->own_busy);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -266,12 +265,12 @@ i4b_rxd_ack(l2_softc_t *l2sc, int nr)
|
||||
{
|
||||
|
||||
#ifdef NOTDEF
|
||||
DBGL2(L2_ERROR, "i4b_rxd_ack", ("N(R)=%d, UA=%d, V(R)=%d, V(S)=%d, V(A)=%d\n",
|
||||
NDBGL2(L2_ERROR, "N(R)=%d, UA=%d, V(R)=%d, V(S)=%d, V(A)=%d",
|
||||
nr,
|
||||
l2sc->ua_num,
|
||||
l2sc->vr,
|
||||
l2sc->vs,
|
||||
l2sc->va));
|
||||
l2sc->va);
|
||||
#endif
|
||||
|
||||
if(l2sc->ua_num != UA_EMPTY)
|
||||
@ -283,7 +282,7 @@ i4b_rxd_ack(l2_softc_t *l2sc, int nr)
|
||||
M128DEC(nr);
|
||||
|
||||
if(l2sc->ua_num != nr)
|
||||
DBGL2(L2_ERROR, "i4b_rxd_ack", ("((N(R)-1)=%d) != (UA=%d) !!!\n", nr, l2sc->ua_num));
|
||||
NDBGL2(L2_ERROR, "((N(R)-1)=%d) != (UA=%d) !!!", nr, l2sc->ua_num);
|
||||
|
||||
i4b_Dfreembuf(l2sc->ua_frame);
|
||||
l2sc->ua_num = UA_EMPTY;
|
||||
@ -315,13 +314,13 @@ i4b_l2_nr_ok(int nr, int va, int vs)
|
||||
{
|
||||
if((va > nr) && ((nr != 0) || (va != 127)))
|
||||
{
|
||||
DBGL2(L2_ERROR, "i4b_l2_nr_ok", ("ERROR, va = %d, nr = %d, vs = %d [1]\n", va, nr, vs));
|
||||
NDBGL2(L2_ERROR, "ERROR, va = %d, nr = %d, vs = %d [1]", va, nr, vs);
|
||||
return 0; /* fail */
|
||||
}
|
||||
|
||||
if((nr > vs) && ((vs != 0) || (nr != 127)))
|
||||
{
|
||||
DBGL2(L2_ERROR, "i4b_l2_nr_ok", ("ERROR, va = %d, nr = %d, vs = %d [2]\n", va, nr, vs));
|
||||
NDBGL2(L2_ERROR, "ERROR, va = %d, nr = %d, vs = %d [2]", va, nr, vs);
|
||||
return 0; /* fail */
|
||||
}
|
||||
return 1; /* good */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l2if.c - Layer 3 interface to Layer 2
|
||||
* -------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l2if.c,v 1.18 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l2if.c,v 1.23 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:04:48 1999]
|
||||
* last edit-date: [Mon May 29 16:56:22 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ931 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -142,7 +141,7 @@ i4b_dl_establish_ind(int unit)
|
||||
int i;
|
||||
int found = 0;
|
||||
|
||||
DBGL2(L2_PRIM, "DL-ESTABLISH-IND", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "DL-ESTABLISH-IND unit %d",unit);
|
||||
|
||||
/* first set DL up in controller descriptor */
|
||||
|
||||
@ -151,7 +150,7 @@ i4b_dl_establish_ind(int unit)
|
||||
if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) &&
|
||||
(ctrl_desc[i].unit == unit))
|
||||
{
|
||||
DBGL3(L3_MSG, "i4b_dl_establish_ind", ("unit=%d DL established!\n",unit));
|
||||
NDBGL3(L3_MSG, "unit=%d DL established!",unit);
|
||||
ctrl_desc[i].dl_est = DL_UP;
|
||||
found = 1;
|
||||
}
|
||||
@ -159,7 +158,7 @@ i4b_dl_establish_ind(int unit)
|
||||
|
||||
if(found == 0)
|
||||
{
|
||||
DBGL3(L3_ERR, "i4b_dl_establish_ind", ("ERROR, controller not found for unit=%d!\n",unit));
|
||||
NDBGL3(L3_ERR, "ERROR, controller not found for unit=%d!",unit);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -173,8 +172,8 @@ i4b_dl_establish_ind(int unit)
|
||||
(ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) &&
|
||||
(ctrl_desc[call_desc[i].controller].unit == unit))
|
||||
{
|
||||
DBGL3(L3_MSG, "i4b_dl_establish_ind", ("unit=%d, index=%d cdid=%u cr=%d\n",
|
||||
unit, i, call_desc[i].cdid, call_desc[i].cr));
|
||||
NDBGL3(L3_MSG, "unit=%d, index=%d cdid=%u cr=%d",
|
||||
unit, i, call_desc[i].cdid, call_desc[i].cr);
|
||||
next_l3state(&call_desc[i], EV_DLESTIN);
|
||||
found++;
|
||||
}
|
||||
@ -182,7 +181,7 @@ i4b_dl_establish_ind(int unit)
|
||||
|
||||
if(found == 0)
|
||||
{
|
||||
DBGL3(L3_ERR, "i4b_dl_establish_ind", ("ERROR, no cdid for unit %d found!\n", unit));
|
||||
NDBGL3(L3_ERR, "ERROR, no cdid for unit %d found!", unit);
|
||||
return(-1);
|
||||
}
|
||||
else
|
||||
@ -200,7 +199,7 @@ i4b_dl_establish_cnf(int unit)
|
||||
int i;
|
||||
int found = 0;
|
||||
|
||||
DBGL2(L2_PRIM, "DL-ESTABLISH-CONF", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "DL-ESTABLISH-CONF unit %d",unit);
|
||||
|
||||
for(i=0; i < N_CALL_DESC; i++)
|
||||
{
|
||||
@ -210,8 +209,8 @@ i4b_dl_establish_cnf(int unit)
|
||||
{
|
||||
ctrl_desc[call_desc[i].controller].dl_est = DL_UP;
|
||||
|
||||
DBGL3(L3_MSG, "i4b_dl_establish_cnf", ("unit=%d, index=%d cdid=%u cr=%d\n",
|
||||
unit, i, call_desc[i].cdid, call_desc[i].cr));
|
||||
NDBGL3(L3_MSG, "unit=%d, index=%d cdid=%u cr=%d",
|
||||
unit, i, call_desc[i].cdid, call_desc[i].cr);
|
||||
|
||||
next_l3state(&call_desc[i], EV_DLESTCF);
|
||||
found++;
|
||||
@ -220,7 +219,7 @@ i4b_dl_establish_cnf(int unit)
|
||||
|
||||
if(found == 0)
|
||||
{
|
||||
DBGL3(L3_ERR, "i4b_dl_establish_cnf", ("ERROR, no cdid for unit %d found!\n", unit));
|
||||
NDBGL3(L3_ERR, "ERROR, no cdid for unit %d found!", unit);
|
||||
return(-1);
|
||||
}
|
||||
else
|
||||
@ -238,7 +237,7 @@ i4b_dl_release_ind(int unit)
|
||||
int i;
|
||||
int found = 0;
|
||||
|
||||
DBGL2(L2_PRIM, "DL-RELEASE-IND", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "DL-RELEASE-IND unit %d",unit);
|
||||
|
||||
/* first set controller to down */
|
||||
|
||||
@ -247,7 +246,7 @@ i4b_dl_release_ind(int unit)
|
||||
if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) &&
|
||||
(ctrl_desc[i].unit == unit))
|
||||
{
|
||||
DBGL3(L3_MSG, "i4b_dl_release_ind", ("unit=%d DL released!\n",unit));
|
||||
NDBGL3(L3_MSG, "unit=%d DL released!",unit);
|
||||
ctrl_desc[i].dl_est = DL_DOWN;
|
||||
found = 1;
|
||||
}
|
||||
@ -255,7 +254,7 @@ i4b_dl_release_ind(int unit)
|
||||
|
||||
if(found == 0)
|
||||
{
|
||||
DBGL3(L3_ERR, "i4b_dl_release_ind", ("ERROR, controller not found for unit=%d!\n",unit));
|
||||
NDBGL3(L3_ERR, "ERROR, controller not found for unit=%d!",unit);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -269,8 +268,8 @@ i4b_dl_release_ind(int unit)
|
||||
(ctrl_desc[call_desc[i].controller].ctrl_type == CTRL_PASSIVE) &&
|
||||
(ctrl_desc[call_desc[i].controller].unit == unit))
|
||||
{
|
||||
DBGL3(L3_MSG, "i4b_dl_release_ind", ("unit=%d, index=%d cdid=%u cr=%d\n",
|
||||
unit, i, call_desc[i].cdid, call_desc[i].cr));
|
||||
NDBGL3(L3_MSG, "unit=%d, index=%d cdid=%u cr=%d",
|
||||
unit, i, call_desc[i].cdid, call_desc[i].cr);
|
||||
next_l3state(&call_desc[i], EV_DLRELIN);
|
||||
found++;
|
||||
}
|
||||
@ -279,7 +278,7 @@ i4b_dl_release_ind(int unit)
|
||||
if(found == 0)
|
||||
{
|
||||
/* this is not an error since it might be a normal call end */
|
||||
DBGL3(L3_MSG, "i4b_dl_release_ind", ("no cdid for unit %d found\n", unit));
|
||||
NDBGL3(L3_MSG, "no cdid for unit %d found", unit);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@ -292,19 +291,19 @@ i4b_dl_release_cnf(int unit)
|
||||
{
|
||||
int i;
|
||||
|
||||
DBGL2(L2_PRIM, "DL-RELEASE-CONF", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "DL-RELEASE-CONF unit %d",unit);
|
||||
|
||||
for(i=0; i < nctrl; i++)
|
||||
{
|
||||
if((ctrl_desc[i].ctrl_type == CTRL_PASSIVE) &&
|
||||
(ctrl_desc[i].unit == unit))
|
||||
{
|
||||
DBGL3(L3_MSG, "i4b_dl_release_cnf", ("unit=%d DL released!\n",unit));
|
||||
NDBGL3(L3_MSG, "unit=%d DL released!",unit);
|
||||
ctrl_desc[i].dl_est = DL_DOWN;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
DBGL3(L3_ERR, "i4b_dl_release_cnf", ("ERROR, controller not found for unit=%d!\n",unit));
|
||||
NDBGL3(L3_ERR, "ERROR, controller not found for unit=%d!",unit);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -315,7 +314,7 @@ int
|
||||
i4b_dl_data_ind(int unit, struct mbuf *m)
|
||||
{
|
||||
#ifdef NOTDEF
|
||||
DBGL2(L2_PRIM, "DL-DATA-IND", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "DL-DATA-IND unit %d",unit);
|
||||
#endif
|
||||
i4b_decode_q931(unit, m->m_len, m->m_data);
|
||||
i4b_Dfreembuf(m);
|
||||
@ -329,7 +328,7 @@ int
|
||||
i4b_dl_unit_data_ind(int unit, struct mbuf *m)
|
||||
{
|
||||
#ifdef NOTDEF
|
||||
DBGL2(L2_PRIM, "DL-UNIT-DATA-IND", ("unit %d\n",unit));
|
||||
NDBGL2(L2_PRIM, "DL-UNIT-DATA-IND unit %d",unit);
|
||||
#endif
|
||||
i4b_decode_q931(unit, m->m_len, m->m_data);
|
||||
i4b_Dfreembuf(m);
|
||||
@ -345,7 +344,7 @@ i4b_l3_tx_connect(call_desc_t *cd)
|
||||
struct mbuf *m;
|
||||
u_char *ptr;
|
||||
|
||||
DBGL3(L3_PRIM, "tx CONNECT", ("unit %d, cr = 0x%02x\n", ctrl_desc[cd->controller].unit, cd->cr));
|
||||
NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr);
|
||||
|
||||
if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_CONNECT_LEN)) == NULL)
|
||||
panic("i4b_l3_tx_connect: can't allocate mbuf\n");
|
||||
@ -369,12 +368,19 @@ i4b_l3_tx_release_complete(call_desc_t *cd, int send_cause_flag)
|
||||
struct mbuf *m;
|
||||
u_char *ptr;
|
||||
int len = I_FRAME_HDRLEN + MSG_RELEASE_COMPLETE_LEN;
|
||||
|
||||
DBGL3(L3_PRIM, "tx RELEASE-COMPLETE", ("unit %d, cr = 0x%02x\n", ctrl_desc[cd->controller].unit, cd->cr));
|
||||
|
||||
if(send_cause_flag == 0)
|
||||
{
|
||||
len -= 4;
|
||||
|
||||
NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x",
|
||||
ctrl_desc[cd->controller].unit, cd->cr);
|
||||
}
|
||||
else
|
||||
{
|
||||
NDBGL3(L3_PRIM, "unit=%d, cr=0x%02x, cause=0x%x",
|
||||
ctrl_desc[cd->controller].unit, cd->cr, cd->cause_out);
|
||||
}
|
||||
|
||||
if((m = i4b_Dgetmbuf(len)) == NULL)
|
||||
panic("i4b_l3_tx_release_complete: can't allocate mbuf\n");
|
||||
|
||||
@ -405,7 +411,7 @@ i4b_l3_tx_disconnect(call_desc_t *cd)
|
||||
struct mbuf *m;
|
||||
u_char *ptr;
|
||||
|
||||
DBGL3(L3_PRIM, "tx DISCONNECT", ("unit %d, cr = 0x%02x\n", ctrl_desc[cd->controller].unit, cd->cr));
|
||||
NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr);
|
||||
|
||||
if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_DISCONNECT_LEN)) == NULL)
|
||||
panic("i4b_l3_tx_disconnect: can't allocate mbuf\n");
|
||||
@ -443,7 +449,7 @@ i4b_l3_tx_setup(call_desc_t *cd)
|
||||
* mechanism should be used in future. (-hm)
|
||||
*/
|
||||
|
||||
DBGL3(L3_PRIM, "tx SETUP", ("unit %d, cr = 0x%02x\n", ctrl_desc[cd->controller].unit, cd->cr));
|
||||
NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr);
|
||||
|
||||
if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_SETUP_LEN + slen + dlen +
|
||||
(cd->bprot == BPROT_NONE ? 1 : 0))) == NULL)
|
||||
@ -533,7 +539,7 @@ i4b_l3_tx_connect_ack(call_desc_t *cd)
|
||||
struct mbuf *m;
|
||||
u_char *ptr;
|
||||
|
||||
DBGL3(L3_PRIM, "tx CONNECT-ACK", ("unit %d, cr = 0x%02x\n", ctrl_desc[cd->controller].unit, cd->cr));
|
||||
NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr);
|
||||
|
||||
if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_CONNECT_ACK_LEN)) == NULL)
|
||||
panic("i4b_l3_tx_connect_ack: can't allocate mbuf\n");
|
||||
@ -557,7 +563,7 @@ i4b_l3_tx_status(call_desc_t *cd, u_char q850cause)
|
||||
struct mbuf *m;
|
||||
u_char *ptr;
|
||||
|
||||
DBGL3(L3_PRIM, "tx STATUS", ("unit %d, cr = 0x%02x\n", ctrl_desc[cd->controller].unit, cd->cr));
|
||||
NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr);
|
||||
|
||||
if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_STATUS_LEN)) == NULL)
|
||||
panic("i4b_l3_tx_status: can't allocate mbuf\n");
|
||||
@ -591,7 +597,7 @@ i4b_l3_tx_release(call_desc_t *cd, int send_cause_flag)
|
||||
u_char *ptr;
|
||||
int len = I_FRAME_HDRLEN + MSG_RELEASE_LEN;
|
||||
|
||||
DBGL3(L3_PRIM, "tx RELEASE", ("unit %d, cr = 0x%02x\n", ctrl_desc[cd->controller].unit, cd->cr));
|
||||
NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr);
|
||||
|
||||
if(send_cause_flag == 0)
|
||||
len -= 4;
|
||||
@ -629,7 +635,7 @@ i4b_l3_tx_alert(call_desc_t *cd)
|
||||
if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_ALERT_LEN)) == NULL)
|
||||
panic("i4b_l3_tx_alert: can't allocate mbuf\n");
|
||||
|
||||
DBGL3(L3_PRIM, "tx ALERT", ("unit %d, cr = 0x%02x\n", ctrl_desc[cd->controller].unit, cd->cr));
|
||||
NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr);
|
||||
|
||||
ptr = m->m_data + I_FRAME_HDRLEN;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l3.h - layer 3 header file
|
||||
* ------------------------------
|
||||
*
|
||||
* $Id: i4b_l3.h,v 1.10 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l3.h,v 1.11 2000/04/27 09:25:21 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:04:55 1999]
|
||||
* last edit-date: [Thu Apr 27 11:07:01 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l3fsm.c - layer 3 FSM
|
||||
* -------------------------
|
||||
*
|
||||
* $Id: i4b_l3fsm.c,v 1.18 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l3fsm.c,v 1.22 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:05:02 1999]
|
||||
* last edit-date: [Mon May 29 16:56:30 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ931 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -114,6 +113,7 @@ static void F_309TO(call_desc_t *cd), F_DECF(call_desc_t *cd), F_FCTY(call_desc_
|
||||
static void F_DECF1(call_desc_t *cd), F_DECF2(call_desc_t *cd), F_DECF3(call_desc_t *cd);
|
||||
static void F_DLRI(call_desc_t *cd), F_DLRIA(call_desc_t *cd), F_DECF4(call_desc_t *cd);
|
||||
|
||||
#if DO_I4B_DEBUG
|
||||
static char *l3state_text[N_STATES] = {
|
||||
"ST_U0 - Null",
|
||||
"ST_U1 - Out Init",
|
||||
@ -176,6 +176,7 @@ static char *l3event_text[N_EVENTS] = {
|
||||
|
||||
"EV_ILL - Illegal event!!" /* Illegal */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* layer 3 state transition table
|
||||
@ -247,10 +248,10 @@ void next_l3state(call_desc_t *cd, int event)
|
||||
if(newstate > N_STATES)
|
||||
panic("i4b_l3fsm.c: newstate > N_STATES\n");
|
||||
|
||||
DBGL3(L3_F_MSG, "next_l3state", ("L3 FSM event [%s]: [%s => %s]\n",
|
||||
NDBGL3(L3_F_MSG, "L3 FSM event [%s]: [%s => %s]",
|
||||
l3event_text[event],
|
||||
l3state_text[currstate],
|
||||
l3state_text[newstate]));
|
||||
l3state_text[newstate]);
|
||||
|
||||
/* execute function */
|
||||
|
||||
@ -259,29 +260,31 @@ void next_l3state(call_desc_t *cd, int event)
|
||||
if(newstate == ST_ILL)
|
||||
{
|
||||
newstate = currstate;
|
||||
DBGL3(L3_F_ERR, "next_l3state", ("FSM illegal state, state = %s, event = %s!\n",
|
||||
NDBGL3(L3_F_ERR, "FSM illegal state, state = %s, event = %s!",
|
||||
l3state_text[newstate],
|
||||
l3event_text[event]));
|
||||
l3event_text[event]);
|
||||
}
|
||||
|
||||
if(newstate != ST_SUSE)
|
||||
cd->Q931state = newstate;
|
||||
}
|
||||
|
||||
#if DO_I4B_DEBUG
|
||||
/*---------------------------------------------------------------------------*
|
||||
* resturn pointer to current state description
|
||||
* return pointer to current state description
|
||||
*---------------------------------------------------------------------------*/
|
||||
char *print_l3state(call_desc_t *cd)
|
||||
{
|
||||
return((char *) l3state_text[cd->Q931state]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* L3 FSM state U0 event L4 setup req
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_00A(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_00A", ("FSM function F_00A executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_00A executing");
|
||||
|
||||
if(i4b_get_dl_stat(cd) == DL_DOWN)
|
||||
{
|
||||
@ -303,7 +306,7 @@ static void F_00A(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_00H(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_00H", ("FSM function F_00H executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_00H executing");
|
||||
i4b_l4_connect_ind(cd); /* tell l4 we have an incoming setup */
|
||||
}
|
||||
|
||||
@ -312,7 +315,7 @@ static void F_00H(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_00I(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_00I", ("FSM function F_00I executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_00I executing");
|
||||
|
||||
if(cd->call_state != 0)
|
||||
{
|
||||
@ -327,7 +330,7 @@ static void F_00I(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_00J(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_00J", ("FSM function F_00J executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_00J executing");
|
||||
i4b_l3_tx_release_complete(cd, 0); /* 0 = don't send cause */
|
||||
}
|
||||
|
||||
@ -336,7 +339,7 @@ static void F_00J(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_01B(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_01B", ("FSM function F_01B executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_01B executing");
|
||||
/* cause from L4 */
|
||||
i4b_l3_tx_disconnect(cd);
|
||||
T303_stop(cd);
|
||||
@ -348,7 +351,7 @@ static void F_01B(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_01K(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_01K", ("FSM function F_01K executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_01K executing");
|
||||
T303_stop(cd);
|
||||
i4b_l4_disconnect_ind(cd); /* tell l4 we were rejected */
|
||||
freecd_by_cd(cd);
|
||||
@ -359,7 +362,7 @@ static void F_01K(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_01L(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_01L", ("FSM function F_01L executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_01L executing");
|
||||
T303_stop(cd);
|
||||
|
||||
/*
|
||||
@ -379,7 +382,7 @@ static void F_01L(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_01M(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_01M", ("FSM function F_01M executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_01M executing");
|
||||
T303_stop(cd);
|
||||
T310_start(cd);
|
||||
i4b_l4_proceeding_ind(cd);
|
||||
@ -390,7 +393,7 @@ static void F_01M(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_01N(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_01N", ("FSM function F_01N executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_01N executing");
|
||||
T303_stop(cd);
|
||||
i4b_l4_alert_ind(cd);
|
||||
}
|
||||
@ -400,7 +403,7 @@ static void F_01N(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_01O(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_01O", ("FSM function F_01O executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_01O executing");
|
||||
T303_stop(cd);
|
||||
i4b_l3_tx_connect_ack(cd);
|
||||
i4b_l4_connect_active_ind(cd);
|
||||
@ -411,7 +414,7 @@ static void F_01O(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_01U(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_01U", ("FSM function F_01U executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_01U executing");
|
||||
if(cd->T303_first_to == 1)
|
||||
{
|
||||
cd->T303_first_to = 0;
|
||||
@ -432,7 +435,7 @@ static void F_01U(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_03C(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_03C", ("FSM function F_03C executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_03C executing");
|
||||
T310_stop(cd);
|
||||
cd->cause_out = 6;
|
||||
i4b_l3_tx_release(cd, 1); /* 0 = don't send cause */
|
||||
@ -445,7 +448,7 @@ static void F_03C(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_03N(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_03N", ("FSM function F_03N executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_03N executing");
|
||||
T310_stop(cd);
|
||||
i4b_l4_alert_ind(cd);
|
||||
}
|
||||
@ -455,7 +458,7 @@ static void F_03N(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_03O(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_03O", ("FSM function F_03O executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_03O executing");
|
||||
T310_stop(cd);
|
||||
i4b_l3_tx_connect_ack(cd); /* CONNECT ACK to network */
|
||||
i4b_l4_connect_active_ind(cd);
|
||||
@ -466,7 +469,7 @@ static void F_03O(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_03P(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_03P", ("FSM function F_03P executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_03P executing");
|
||||
T310_stop(cd);
|
||||
#ifdef NOTDEF
|
||||
i4b_l4_progress_ind(cd);
|
||||
@ -478,7 +481,7 @@ static void F_03P(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_03Y(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_03Y", ("FSM function F_03Y executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_03Y executing");
|
||||
cd->cause_out = 102; /* recovery on timer expiry */
|
||||
i4b_l3_tx_disconnect(cd);
|
||||
T305_start(cd);
|
||||
@ -490,7 +493,7 @@ static void F_03Y(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_04O(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_04O", ("FSM function F_04O executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_04O executing");
|
||||
i4b_l3_tx_connect_ack(cd); /* CONNECT ACK to network */
|
||||
i4b_l4_connect_active_ind(cd);
|
||||
}
|
||||
@ -500,7 +503,7 @@ static void F_04O(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_06D(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_06D", ("FSM function F_06D executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_06D executing");
|
||||
|
||||
if(i4b_get_dl_stat(cd) == DL_DOWN)
|
||||
{
|
||||
@ -519,7 +522,7 @@ static void F_06D(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_06E(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_06E", ("FSM function F_06E executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_06E executing");
|
||||
|
||||
if(i4b_get_dl_stat(cd) == DL_DOWN)
|
||||
{
|
||||
@ -539,7 +542,7 @@ static void F_06E(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_06F(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_06F", ("FSM function F_06F executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_06F executing");
|
||||
|
||||
if(i4b_get_dl_stat(cd) == DL_DOWN)
|
||||
{
|
||||
@ -561,7 +564,7 @@ static void F_06F(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_06G(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_06G", ("FSM function F_06G executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_06G executing");
|
||||
freecd_by_cd(cd);
|
||||
}
|
||||
|
||||
@ -570,7 +573,7 @@ static void F_06G(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_06J(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_06J", ("FSM function F_06J executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_06J executing");
|
||||
i4b_l3_tx_release_complete(cd, 0);
|
||||
i4b_l4_disconnect_ind(cd);
|
||||
freecd_by_cd(cd);
|
||||
@ -581,7 +584,7 @@ static void F_06J(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_06Q(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_06Q", ("FSM function F_06Q executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_06Q executing");
|
||||
i4b_l4_disconnect_ind(cd);
|
||||
}
|
||||
|
||||
@ -590,7 +593,7 @@ static void F_06Q(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_07E(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_07E", ("FSM function F_07E executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_07E executing");
|
||||
i4b_l3_tx_connect(cd);
|
||||
T313_start(cd);
|
||||
}
|
||||
@ -600,7 +603,7 @@ static void F_07E(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_07F(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_07F", ("FSM function F_07F executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_07F executing");
|
||||
i4b_l3_tx_release_complete(cd, 1);
|
||||
freecd_by_cd(cd);
|
||||
}
|
||||
@ -610,7 +613,7 @@ static void F_07F(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_07G(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_07G", ("FSM function F_07G executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_07G executing");
|
||||
freecd_by_cd(cd);
|
||||
}
|
||||
|
||||
@ -619,7 +622,7 @@ static void F_07G(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_08R(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_08R", ("FSM function F_08R executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_08R executing");
|
||||
T313_stop(cd);
|
||||
i4b_l4_connect_active_ind(cd);
|
||||
}
|
||||
@ -629,7 +632,7 @@ static void F_08R(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_08Z(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_08Z", ("FSM function F_08Z executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_08Z executing");
|
||||
cd->cause_out = 102; /* recovery on timer expiry */
|
||||
i4b_l3_tx_disconnect(cd);
|
||||
T305_start(cd);
|
||||
@ -641,7 +644,7 @@ static void F_08Z(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_09D(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_09D", ("FSM function F_09D executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_09D executing");
|
||||
i4b_l3_tx_alert(cd);
|
||||
}
|
||||
|
||||
@ -650,7 +653,7 @@ static void F_09D(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_09E(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_09E", ("FSM function F_09E executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_09E executing");
|
||||
i4b_l3_tx_connect(cd);
|
||||
T313_start(cd);
|
||||
}
|
||||
@ -660,7 +663,7 @@ static void F_09E(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_09F(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_09F", ("FSM function F_09F executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_09F executing");
|
||||
i4b_l3_tx_release_complete(cd, 1);
|
||||
freecd_by_cd(cd);
|
||||
}
|
||||
@ -669,7 +672,7 @@ static void F_09F(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_09G(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_09G", ("FSM function F_09G executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_09G executing");
|
||||
freecd_by_cd(cd);
|
||||
}
|
||||
|
||||
@ -678,7 +681,7 @@ static void F_09G(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_11J(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_11J", ("FSM function F_11J executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_11J executing");
|
||||
T305_stop(cd);
|
||||
i4b_l3_tx_release_complete(cd, 0);
|
||||
i4b_l4_disconnect_ind(cd);
|
||||
@ -690,7 +693,7 @@ static void F_11J(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_11Q(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_11Q", ("FSM function F_11Q executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_11Q executing");
|
||||
T305_stop(cd);
|
||||
i4b_l3_tx_release(cd, 0);
|
||||
cd->T308_first_to = 1;
|
||||
@ -702,7 +705,7 @@ static void F_11Q(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_11V(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_11V", ("FSM function F_11V executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_11V executing");
|
||||
cd->cause_out = 102;
|
||||
i4b_l3_tx_release(cd, 1);
|
||||
cd->T308_first_to = 1;
|
||||
@ -714,7 +717,7 @@ static void F_11V(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_12C(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_12C", ("FSM function F_12C executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_12C executing");
|
||||
i4b_l3_tx_release(cd, 1);
|
||||
cd->T308_first_to = 1;
|
||||
T308_start(cd);
|
||||
@ -725,7 +728,7 @@ static void F_12C(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_12J(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_12J", ("FSM function F_12J executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_12J executing");
|
||||
i4b_l3_tx_release_complete(cd, 0);
|
||||
i4b_l4_disconnect_ind(cd);
|
||||
freecd_by_cd(cd);
|
||||
@ -736,7 +739,7 @@ static void F_12J(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_19I(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_19I", ("FSM function F_19I executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_19I executing");
|
||||
|
||||
if(cd->call_state == 0)
|
||||
{
|
||||
@ -755,7 +758,7 @@ static void F_19I(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_19J(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_19J", ("FSM function F_19J executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_19J executing");
|
||||
T308_stop(cd);
|
||||
i4b_l4_disconnect_ind(cd);
|
||||
freecd_by_cd(cd);
|
||||
@ -766,7 +769,7 @@ static void F_19J(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_19K(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_19K", ("FSM function F_19K executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_19K executing");
|
||||
T308_stop(cd);
|
||||
i4b_l4_disconnect_ind(cd);
|
||||
freecd_by_cd(cd);
|
||||
@ -777,7 +780,7 @@ static void F_19K(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_19W(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_19W", ("FSM function F_19W executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_19W executing");
|
||||
if(cd->T308_first_to == 0)
|
||||
{
|
||||
cd->T308_first_to = 1;
|
||||
@ -806,7 +809,7 @@ static void F_NCNA(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_STENQ(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_STENQ", ("FSM function F_STENQ executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_STENQ executing");
|
||||
i4b_l3_tx_status(cd, CAUSE_Q850_STENQRSP); /* 30, resonse to stat enq */
|
||||
}
|
||||
|
||||
@ -815,7 +818,7 @@ static void F_STENQ(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_STAT(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_STAT", ("FSM function F_STAT executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_STAT executing");
|
||||
if(cd->call_state == 0)
|
||||
{
|
||||
i4b_l4_status_ind(cd);
|
||||
@ -839,7 +842,7 @@ static void F_STAT(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_INFO(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_INFO", ("FSM function F_INFO executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_INFO executing");
|
||||
i4b_l4_info_ind(cd);
|
||||
/* remain in current state */
|
||||
}
|
||||
@ -849,7 +852,7 @@ static void F_INFO(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_RELCP(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_RELCP", ("FSM function F_RELCP executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_RELCP executing");
|
||||
i4b_l3_stop_all_timers(cd);
|
||||
i4b_l4_disconnect_ind(cd);
|
||||
freecd_by_cd(cd);
|
||||
@ -860,7 +863,7 @@ static void F_RELCP(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_REL(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_REL", ("FSM function F_REL executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_REL executing");
|
||||
i4b_l3_stop_all_timers(cd);
|
||||
i4b_l3_tx_release_complete(cd, 0);
|
||||
i4b_l4_disconnect_ind(cd);
|
||||
@ -872,7 +875,7 @@ static void F_REL(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DISC(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DISC", ("FSM function F_DISC executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DISC executing");
|
||||
i4b_l3_stop_all_timers(cd);
|
||||
|
||||
/*
|
||||
@ -891,7 +894,7 @@ static void F_DISC(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DCRQ(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DCRQ", ("FSM function F_DCRQ executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DCRQ executing");
|
||||
|
||||
/* stop T310 in case this is the result of an incoming call for a */
|
||||
/* calledback connection */
|
||||
@ -910,7 +913,7 @@ static void F_DCRQ(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_UEM(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_ERR, "F_UEM", ("FSM function F_UEM executing, state = %s\n", print_l3state(cd)));
|
||||
NDBGL3(L3_F_ERR, "FSM function F_UEM executing, state = %s", print_l3state(cd));
|
||||
i4b_l3_tx_status(cd, CAUSE_Q850_MSGNCWCS); /* 101, message not compatible with call state */
|
||||
}
|
||||
|
||||
@ -919,7 +922,7 @@ static void F_UEM(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_SIGN(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_ERR, "F_SIGN", ("FSM function F_SIGN executing\n"));
|
||||
NDBGL3(L3_F_ERR, "FSM function F_SIGN executing");
|
||||
|
||||
/* XXX */ /* freecd_by_cd(cd); ?????????? XXX */
|
||||
}
|
||||
@ -929,7 +932,7 @@ static void F_SIGN(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DLEI(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DLEI", ("FSM function F_DLEI executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DLEI executing");
|
||||
|
||||
/* XXX */
|
||||
|
||||
@ -941,7 +944,7 @@ static void F_DLEI(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_ILL(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_ILL", ("FSM function F_ILL executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_ILL executing");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -949,7 +952,7 @@ static void F_ILL(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_309TO(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_ERR, "F_309TO", ("FSM function F_309TO executing\n"));
|
||||
NDBGL3(L3_F_ERR, "FSM function F_309TO executing");
|
||||
|
||||
/* XXX */
|
||||
|
||||
@ -965,7 +968,7 @@ static void F_309TO(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_FCTY(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_FCTY", ("FSM function F_FCTY executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_FCTY executing");
|
||||
/* ST_SUSE, no change in state ! */
|
||||
}
|
||||
|
||||
@ -974,7 +977,7 @@ static void F_FCTY(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DECF1(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DECF1", ("FSM function F_DECF1 executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DECF1 executing");
|
||||
i4b_l3_tx_setup(cd);
|
||||
}
|
||||
|
||||
@ -983,7 +986,7 @@ static void F_DECF1(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DECF2(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DECF2", ("FSM function F_DECF2 executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DECF2 executing");
|
||||
i4b_l3_tx_connect(cd);
|
||||
}
|
||||
|
||||
@ -992,7 +995,7 @@ static void F_DECF2(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DECF3(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DECF3", ("FSM function F_DECF3 executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DECF3 executing");
|
||||
i4b_l3_tx_release_complete(cd, 1);
|
||||
freecd_by_cd(cd);
|
||||
}
|
||||
@ -1002,7 +1005,7 @@ static void F_DECF3(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DECF4(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DECF4", ("FSM function F_DECF4 executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DECF4 executing");
|
||||
i4b_l3_tx_alert(cd);
|
||||
}
|
||||
|
||||
@ -1012,7 +1015,7 @@ static void F_DECF4(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DECF(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DECF", ("FSM function F_DECF executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DECF executing");
|
||||
T309_stop(cd);
|
||||
i4b_l3_tx_status(cd, CAUSE_Q850_NORMUNSP); /* 31, normal unspecified */
|
||||
}
|
||||
@ -1022,7 +1025,7 @@ static void F_DECF(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DLRI(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DLRI", ("FSM function F_DLRI executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DLRI executing");
|
||||
i4b_l3_stop_all_timers(cd);
|
||||
i4b_l4_disconnect_ind(cd);
|
||||
freecd_by_cd(cd);
|
||||
@ -1033,7 +1036,7 @@ static void F_DLRI(call_desc_t *cd)
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void F_DLRIA(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_F_MSG, "F_DLRIA", ("FSM function F_DLRIA executing\n"));
|
||||
NDBGL3(L3_F_MSG, "FSM function F_DLRIA executing");
|
||||
|
||||
if(cd->T309 == TIMER_IDLE)
|
||||
T309_start(cd);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l3fsm.c - layer 3 FSM
|
||||
* -------------------------
|
||||
*
|
||||
* $Id: i4b_l3fsm.h,v 1.7 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l3fsm.h,v 1.8 2000/04/27 09:25:22 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:05:09 1999]
|
||||
* last edit-date: [Thu Apr 27 11:07:16 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l3timer.c - timer and timeout handling for layer 3
|
||||
* ------------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l3timer.c,v 1.14 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l3timer.c,v 1.17 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:05:18 1999]
|
||||
* last edit-date: [Thu Aug 24 12:49:50 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,18 +43,16 @@
|
||||
#if NI4BQ931 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -94,7 +92,7 @@ void i4b_l3_stop_all_timers(call_desc_t *cd)
|
||||
static void
|
||||
T303_timeout(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_T_ERR, "T303_timeout", ("SETUP not answered, cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_ERR, "SETUP not answered, cr = %d", cd->cr);
|
||||
next_l3state(cd, EV_T303EXP);
|
||||
}
|
||||
|
||||
@ -107,14 +105,10 @@ T303_start(call_desc_t *cd)
|
||||
if (cd->T303 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL3(L3_T_MSG, "T303_start", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
cd->T303 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
cd->T303_callout = timeout((TIMEOUT_FUNC_T)T303_timeout, (void *)cd, T303VAL);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)T303_timeout, (void *)cd, T303VAL);
|
||||
#endif
|
||||
START_TIMER(cd->T303_callout, T303_timeout, cd, T303VAL);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -128,15 +122,11 @@ T303_stop(call_desc_t *cd)
|
||||
|
||||
if(cd->T303 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)T303_timeout, (void *)cd, cd->T303_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)T303_timeout, (void *)cd);
|
||||
#endif
|
||||
STOP_TIMER(cd->T303_callout, T303_timeout, cd);
|
||||
cd->T303 = TIMER_IDLE;
|
||||
}
|
||||
CRIT_END;
|
||||
DBGL3(L3_T_MSG, "T303_stop", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -145,7 +135,7 @@ T303_stop(call_desc_t *cd)
|
||||
static void
|
||||
T305_timeout(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_T_ERR, "T305_timeout", ("DISC not answered, cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_ERR, "DISC not answered, cr = %d", cd->cr);
|
||||
next_l3state(cd, EV_T305EXP);
|
||||
}
|
||||
|
||||
@ -158,14 +148,10 @@ T305_start(call_desc_t *cd)
|
||||
if (cd->T305 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL3(L3_T_MSG, "T305_start", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
cd->T305 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
cd->T305_callout = timeout((TIMEOUT_FUNC_T)T305_timeout, (void *)cd, T305VAL);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)T305_timeout, (void *)cd, T305VAL);
|
||||
#endif
|
||||
START_TIMER(cd->T305_callout, T305_timeout, cd, T305VAL);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -179,16 +165,12 @@ T305_stop(call_desc_t *cd)
|
||||
|
||||
if(cd->T305 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)T305_timeout, (void *)cd, cd->T305_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)T305_timeout, (void *)cd);
|
||||
#endif
|
||||
STOP_TIMER(cd->T305_callout, T305_timeout, cd);
|
||||
cd->T305 = TIMER_IDLE;
|
||||
}
|
||||
CRIT_END;
|
||||
|
||||
DBGL3(L3_T_MSG, "T305_stop", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -197,7 +179,7 @@ T305_stop(call_desc_t *cd)
|
||||
static void
|
||||
T308_timeout(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_T_ERR, "T308_timeout", ("REL not answered, cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_ERR, "REL not answered, cr = %d", cd->cr);
|
||||
next_l3state(cd, EV_T308EXP);
|
||||
}
|
||||
|
||||
@ -210,14 +192,10 @@ T308_start(call_desc_t *cd)
|
||||
if(cd->T308 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL3(L3_T_MSG, "T308_start", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
cd->T308 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
cd->T308_callout = timeout((TIMEOUT_FUNC_T)T308_timeout, (void *)cd, T308VAL);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)T308_timeout, (void *)cd, T308VAL);
|
||||
#endif
|
||||
START_TIMER(cd->T308_callout, T308_timeout, cd, T308VAL);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -231,16 +209,12 @@ T308_stop(call_desc_t *cd)
|
||||
|
||||
if(cd->T308 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)T308_timeout, (void *)cd, cd->T308_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)T308_timeout, (void *)cd);
|
||||
#endif
|
||||
STOP_TIMER(cd->T308_callout, T308_timeout, cd);
|
||||
cd->T308 = TIMER_IDLE;
|
||||
}
|
||||
CRIT_END;
|
||||
|
||||
DBGL3(L3_T_MSG, "T308_stop", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -249,7 +223,7 @@ T308_stop(call_desc_t *cd)
|
||||
static void
|
||||
T309_timeout(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_T_ERR, "T309_timeout", ("datalink not reconnected, cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_ERR, "datalink not reconnected, cr = %d", cd->cr);
|
||||
next_l3state(cd, EV_T309EXP);
|
||||
}
|
||||
|
||||
@ -262,14 +236,10 @@ T309_start(call_desc_t *cd)
|
||||
if (cd->T309 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL3(L3_T_MSG, "T309_start", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
cd->T309 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
cd->T309_callout = timeout((TIMEOUT_FUNC_T)T309_timeout, (void *)cd, T309VAL);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)T309_timeout, (void *)cd, T309VAL);
|
||||
#endif
|
||||
START_TIMER(cd->T309_callout, T309_timeout, cd, T309VAL);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -283,16 +253,12 @@ T309_stop(call_desc_t *cd)
|
||||
|
||||
if(cd->T309 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)T309_timeout, (void *)cd, cd->T309_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)T309_timeout, (void *)cd);
|
||||
#endif
|
||||
STOP_TIMER(cd->T309_callout, T309_timeout, cd);
|
||||
cd->T309 = TIMER_IDLE;
|
||||
}
|
||||
CRIT_END;
|
||||
|
||||
DBGL3(L3_T_MSG, "T309_stop", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -301,7 +267,7 @@ T309_stop(call_desc_t *cd)
|
||||
static void
|
||||
T310_timeout(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_T_ERR, "T310_timeout", ("CALL PROC timeout, cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_ERR, "CALL PROC timeout, cr = %d", cd->cr);
|
||||
next_l3state(cd, EV_T310EXP);
|
||||
}
|
||||
|
||||
@ -314,14 +280,10 @@ T310_start(call_desc_t *cd)
|
||||
if (cd->T310 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL3(L3_T_MSG, "T310_start", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
cd->T310 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
cd->T310_callout = timeout((TIMEOUT_FUNC_T)T310_timeout, (void *)cd, T310VAL);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)T310_timeout, (void *)cd, T310VAL);
|
||||
#endif
|
||||
START_TIMER(cd->T310_callout, T310_timeout, cd, T310VAL);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -335,16 +297,12 @@ T310_stop(call_desc_t *cd)
|
||||
|
||||
if(cd->T310 != TIMER_IDLE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)T310_timeout, (void *)cd, cd->T310_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)T310_timeout, (void *)cd);
|
||||
#endif
|
||||
STOP_TIMER(cd->T310_callout, T310_timeout, cd);
|
||||
cd->T310 = TIMER_IDLE;
|
||||
}
|
||||
CRIT_END;
|
||||
|
||||
DBGL3(L3_T_MSG, "T310_stop", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -353,7 +311,7 @@ T310_stop(call_desc_t *cd)
|
||||
static void
|
||||
T313_timeout(call_desc_t *cd)
|
||||
{
|
||||
DBGL3(L3_T_ERR, "T313_timeout", ("CONN ACK not received, cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_ERR, "CONN ACK not received, cr = %d", cd->cr);
|
||||
next_l3state(cd, EV_T313EXP);
|
||||
}
|
||||
|
||||
@ -366,14 +324,10 @@ T313_start(call_desc_t *cd)
|
||||
if (cd->T313 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL3(L3_T_MSG, "T313_start", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
cd->T313 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
cd->T313_callout = timeout((TIMEOUT_FUNC_T)T313_timeout, (void *)cd, T313VAL);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)T313_timeout, (void *)cd, T313VAL);
|
||||
#endif
|
||||
START_TIMER(cd->T313_callout, T313_timeout, cd, T313VAL);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -388,15 +342,11 @@ T313_stop(call_desc_t *cd)
|
||||
if(cd->T313 != TIMER_IDLE)
|
||||
{
|
||||
cd->T313 = TIMER_IDLE;
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)T313_timeout, (void *)cd, cd->T313_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)T313_timeout, (void *)cd);
|
||||
#endif
|
||||
STOP_TIMER(cd->T313_callout, T313_timeout, cd);
|
||||
}
|
||||
CRIT_END;
|
||||
|
||||
DBGL3(L3_T_MSG, "T313_stop", ("cr = %d\n", cd->cr));
|
||||
NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
|
||||
}
|
||||
|
||||
#endif /* NI4BQ931 > 0 */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l4if.c - Layer 3 interface to Layer 4
|
||||
* -------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4if.c,v 1.22 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_l4if.c,v 1.27 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:05:25 1999]
|
||||
* last edit-date: [Fri Jun 2 14:32:19 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ931 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -83,7 +82,7 @@ static void n_connect_request(u_int cdid);
|
||||
static void n_connect_response(u_int cdid, int response, int cause);
|
||||
static void n_disconnect_request(u_int cdid, int cause);
|
||||
static void n_alert_request(u_int cdid);
|
||||
static void n_mgmt_command(int unit, int cmd, int parm);
|
||||
static void n_mgmt_command(int unit, int cmd, void *parm);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* i4b_mdl_status_ind - status indication from lower layers
|
||||
@ -94,12 +93,12 @@ i4b_mdl_status_ind(int unit, int status, int parm)
|
||||
int sendup;
|
||||
int i;
|
||||
|
||||
DBGL3(L3_MSG, "i4b_mdl_status_ind", ("unit = %d, status = %d, parm = %d\n", unit, status, parm));
|
||||
NDBGL3(L3_MSG, "unit = %d, status = %d, parm = %d", unit, status, parm);
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case STI_ATTACH:
|
||||
DBGL3(L3_MSG, "i4b_mdl_status_ind", ("STI_ATTACH: attaching unit %d to controller %d\n", unit, nctrl));
|
||||
NDBGL3(L3_MSG, "STI_ATTACH: attaching unit %d to controller %d", unit, nctrl);
|
||||
|
||||
/* init function pointers */
|
||||
|
||||
@ -107,8 +106,6 @@ i4b_mdl_status_ind(int unit, int status, int parm)
|
||||
ctrl_desc[nctrl].N_CONNECT_RESPONSE = n_connect_response;
|
||||
ctrl_desc[nctrl].N_DISCONNECT_REQUEST = n_disconnect_request;
|
||||
ctrl_desc[nctrl].N_ALERT_REQUEST = n_alert_request;
|
||||
ctrl_desc[nctrl].N_SET_TRACE = isic_settrace;
|
||||
ctrl_desc[nctrl].N_GET_TRACE = isic_gettrace;
|
||||
ctrl_desc[nctrl].N_DOWNLOAD = NULL; /* only used by active cards */
|
||||
ctrl_desc[nctrl].N_DIAGNOSTICS = NULL; /* only used by active cards */
|
||||
ctrl_desc[nctrl].N_MGMT_COMMAND = n_mgmt_command;
|
||||
@ -138,22 +135,22 @@ i4b_mdl_status_ind(int unit, int status, int parm)
|
||||
|
||||
case STI_L1STAT:
|
||||
i4b_l4_l12stat(unit, 1, parm);
|
||||
DBGL3(L3_MSG, "i4b_mdl_status_ind", ("STI_L1STAT: unit %d layer 1 = %s\n", unit, status ? "up" : "down"));
|
||||
NDBGL3(L3_MSG, "STI_L1STAT: unit %d layer 1 = %s", unit, status ? "up" : "down");
|
||||
break;
|
||||
|
||||
case STI_L2STAT:
|
||||
i4b_l4_l12stat(unit, 2, parm);
|
||||
DBGL3(L3_MSG, "i4b_mdl_status_ind", ("STI_L2STAT: unit %d layer 2 = %s\n", unit, status ? "up" : "down"));
|
||||
NDBGL3(L3_MSG, "STI_L2STAT: unit %d layer 2 = %s", unit, status ? "up" : "down");
|
||||
break;
|
||||
|
||||
case STI_TEIASG:
|
||||
ctrl_desc[unit].tei = parm;
|
||||
i4b_l4_teiasg(unit, parm);
|
||||
DBGL3(L3_MSG, "i4b_mdl_status_ind", ("STI_TEIASG: unit %d TEI = %d = 0x%02x\n", unit, parm, parm));
|
||||
NDBGL3(L3_MSG, "STI_TEIASG: unit %d TEI = %d = 0x%02x", unit, parm, parm);
|
||||
break;
|
||||
|
||||
case STI_PDEACT: /* L1 T4 timeout */
|
||||
DBGL3(L3_ERR, "i4b_mdl_status_ind", ("STI_PDEACT: unit %d TEI = %d = 0x%02x\n", unit, parm, parm));
|
||||
NDBGL3(L3_ERR, "STI_PDEACT: unit %d TEI = %d = 0x%02x", unit, parm, parm);
|
||||
|
||||
sendup = 0;
|
||||
|
||||
@ -181,7 +178,7 @@ i4b_mdl_status_ind(int unit, int status, int parm)
|
||||
break;
|
||||
|
||||
case STI_NOL1ACC: /* no outgoing access to S0 */
|
||||
DBGL3(L3_ERR, "i4b_mdl_status_ind", ("STI_NOL1ACC: unit %d no outgoing access to S0\n", unit));
|
||||
NDBGL3(L3_ERR, "STI_NOL1ACC: unit %d no outgoing access to S0", unit);
|
||||
|
||||
for(i=0; i < N_CALL_DESC; i++)
|
||||
{
|
||||
@ -204,7 +201,7 @@ i4b_mdl_status_ind(int unit, int status, int parm)
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL3(L3_ERR, "i4b_mdl_status_ind", ("ERROR, unit %d, unknown status value %d!\n", unit, status));
|
||||
NDBGL3(L3_ERR, "ERROR, unit %d, unknown status value %d!", unit, status);
|
||||
break;
|
||||
}
|
||||
return(0);
|
||||
@ -214,14 +211,14 @@ i4b_mdl_status_ind(int unit, int status, int parm)
|
||||
* send command to the lower layers
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
n_mgmt_command(int unit, int cmd, int parm)
|
||||
n_mgmt_command(int unit, int cmd, void *parm)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch(cmd)
|
||||
{
|
||||
case CMR_DOPEN:
|
||||
DBGL3(L3_MSG, "n_mgmt_command", ("CMR_DOPEN for unit %d\n", unit));
|
||||
NDBGL3(L3_MSG, "CMR_DOPEN for unit %d", unit);
|
||||
|
||||
for(i=0; i < N_CALL_DESC; i++)
|
||||
{
|
||||
@ -239,12 +236,16 @@ n_mgmt_command(int unit, int cmd, int parm)
|
||||
break;
|
||||
|
||||
case CMR_DCLOSE:
|
||||
DBGL3(L3_MSG, "n_mgmt_command", ("CMR_DCLOSE for unit %d\n", unit));
|
||||
NDBGL3(L3_MSG, "CMR_DCLOSE for unit %d", unit);
|
||||
break;
|
||||
|
||||
case CMR_SETTRACE:
|
||||
NDBGL3(L3_MSG, "CMR_SETTRACE for unit %d", unit);
|
||||
break;
|
||||
|
||||
default:
|
||||
NDBGL3(L3_MSG, "unknown cmd %d for unit %d", cmd, unit);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
MDL_Command_Req(unit, cmd, parm);
|
||||
@ -300,7 +301,7 @@ n_connect_response(u_int cdid, int response, int cause)
|
||||
default: /* failsafe */
|
||||
next_l3state(cd, EV_SETDCRS);
|
||||
chstate = BCH_ST_FREE;
|
||||
DBGL3(L3_ERR, "n_connect_response", ("unknown response, doing SETUP_RESP_DNTCRE"));
|
||||
NDBGL3(L3_ERR, "unknown response, doing SETUP_RESP_DNTCRE");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -310,7 +311,7 @@ n_connect_response(u_int cdid, int response, int cause)
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL3(L3_MSG, "n_connect_response", ("Warning, invalid channelid %d, response = %d\n", cd->channelid, response));
|
||||
NDBGL3(L3_MSG, "Warning, invalid channelid %d, response = %d\n", cd->channelid, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_q931.c - Q931 received messages handling
|
||||
* --------------------------------------------
|
||||
*
|
||||
* $Id: i4b_q931.c,v 1.23 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_q931.c,v 1.32 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:05:33 1999]
|
||||
* last edit-date: [Mon May 29 16:56:52 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -44,17 +44,16 @@
|
||||
#if NI4BQ931 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -97,6 +96,8 @@ unsigned char cause_tab_q931[CAUSE_I4B_MAX] = {
|
||||
CAUSE_Q850_CALLREJ, /* CAUSE_I4B_REJECT -> call rejected */
|
||||
CAUSE_Q850_DSTOOORDR, /* CAUSE_I4B_OOO -> destination out of order */
|
||||
CAUSE_Q850_TMPFAIL, /* CAUSE_I4B_TMPFAIL -> temporary failure */
|
||||
CAUSE_Q850_USRBSY, /* CAUSE_I4B_L1ERROR -> L1 error / persistent deact XXX */
|
||||
CAUSE_Q850_USRBSY, /* CAUSE_I4B_LLDIAL -> no dialout on leased line XXX */
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -134,9 +135,16 @@ i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr)
|
||||
|
||||
if(*msg_ptr != PD_Q931)
|
||||
{
|
||||
DBGL3(L3_P_ERR, "i4b_decode_q931", ("protocol discriminator 0x%x != Q.931\n", *msg_ptr));
|
||||
static int protoflag = -1; /* print only once .. */
|
||||
|
||||
if(*msg_ptr != protoflag)
|
||||
{
|
||||
NDBGL3(L3_P_ERR, "unknown protocol discriminator 0x%x!", *msg_ptr);
|
||||
protoflag = *msg_ptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
msg_ptr++;
|
||||
msg_len--;
|
||||
|
||||
@ -168,7 +176,7 @@ i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr)
|
||||
crflag = 0;
|
||||
}
|
||||
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931", ("Call Ref, len %d, val %d, flag %d\n", crlen, crval, crflag));
|
||||
NDBGL3(L3_P_MSG, "Call Ref, len %d, val %d, flag %d", crlen, crval, crflag);
|
||||
|
||||
/* find or allocate calldescriptor */
|
||||
|
||||
@ -190,7 +198,7 @@ i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr)
|
||||
{
|
||||
/*XXX*/ if(crval != 0) /* ignore global call references */
|
||||
{
|
||||
DBGL3(L3_P_ERR, "i4b_decode_q931", ("cannot find calldescriptor for cr = 0x%x, crflag = 0x%x, msg = 0x%x, frame = ", crval, crflag, *msg_ptr));
|
||||
NDBGL3(L3_P_ERR, "cannot find calldescriptor for cr = 0x%x, crflag = 0x%x, msg = 0x%x, frame = ", crval, crflag, *msg_ptr);
|
||||
i4b_print_frame(msg_len, msg_ptr);
|
||||
}
|
||||
splx(s);
|
||||
@ -223,7 +231,7 @@ i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr)
|
||||
if((shift_flag != SHIFTED) &&
|
||||
(codeset <= old_codeset))
|
||||
{
|
||||
DBGL3(L3_P_ERR, "i4b_decode_q931", ("Q.931 lockingshift proc violation, shift %d -> %d\n", old_codeset, codeset));
|
||||
NDBGL3(L3_P_ERR, "Q.931 lockingshift proc violation, shift %d -> %d", old_codeset, codeset);
|
||||
codeset = old_codeset;
|
||||
}
|
||||
msg_len--;
|
||||
@ -241,7 +249,7 @@ i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr)
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL3(L3_P_ERR, "i4b_decode_q931", ("unknown codeset %d, ", codeset));
|
||||
NDBGL3(L3_P_ERR, "unknown codeset %d, ", codeset);
|
||||
i4b_print_frame(msg_len, msg_ptr);
|
||||
msg_len = 0;
|
||||
break;
|
||||
@ -269,15 +277,23 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
|
||||
|
||||
switch(*msg_ptr)
|
||||
{
|
||||
|
||||
/*********/
|
||||
/* Q.931 */
|
||||
/*********/
|
||||
/* single byte IE's */
|
||||
|
||||
case IEI_SENDCOMPL:
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_SENDCOMPL\n"));
|
||||
NDBGL3(L3_P_MSG, "IEI_SENDCOMPL");
|
||||
return(1);
|
||||
break;
|
||||
|
||||
/* multi byte IE's */
|
||||
|
||||
case IEI_SEGMMSG: /* segmented message */
|
||||
NDBGL3(L3_P_MSG, "IEI_SEGMENTED_MESSAGE");
|
||||
break;
|
||||
|
||||
case IEI_BEARERCAP: /* bearer capability */
|
||||
switch(msg_ptr[2])
|
||||
{
|
||||
@ -285,17 +301,17 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
|
||||
case 0x89: /* restricted digital info */
|
||||
case 0x90: /* 3.1KHz audio */
|
||||
/* XXX */ cd->bprot = BPROT_NONE;
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_BEARERCAP - Telephony\n"));
|
||||
NDBGL3(L3_P_MSG, "IEI_BEARERCAP - Telephony");
|
||||
break;
|
||||
|
||||
case 0x88: /* unrestricted digital info */
|
||||
/* XXX */ cd->bprot = BPROT_RHDLC;
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_BEARERCAP - Raw HDLC\n"));
|
||||
NDBGL3(L3_P_MSG, "IEI_BEARERCAP - Raw HDLC");
|
||||
break;
|
||||
|
||||
default:
|
||||
/* XXX */ cd->bprot = BPROT_NONE;
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_BEARERCAP - No Protocol\n"));
|
||||
NDBGL3(L3_P_ERR, "IEI_BEARERCAP - Unsupported B-Protocol 0x%x", msg_ptr[2]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -304,20 +320,29 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
|
||||
if(msg_ptr[2] & 0x80)
|
||||
{
|
||||
cd->cause_in = msg_ptr[3] & 0x7f;
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_CAUSE = %d\n", msg_ptr[3] & 0x7f));
|
||||
NDBGL3(L3_P_MSG, "IEI_CAUSE = %d", msg_ptr[3] & 0x7f);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->cause_in = msg_ptr[4] & 0x7f;
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_CAUSE = %d\n", msg_ptr[4] & 0x7f));
|
||||
NDBGL3(L3_P_MSG, "IEI_CAUSE = %d", msg_ptr[4] & 0x7f);
|
||||
}
|
||||
break;
|
||||
|
||||
case IEI_CALLID: /* call identity */
|
||||
NDBGL3(L3_P_MSG, "IEI_CALL_IDENTITY");
|
||||
break;
|
||||
|
||||
case IEI_CALLSTATE: /* call state */
|
||||
cd->call_state = msg_ptr[2] & 0x3f;
|
||||
NDBGL3(L3_P_MSG, "IEI_CALLSTATE = %d", cd->call_state);
|
||||
break;
|
||||
|
||||
case IEI_CHANNELID: /* channel id */
|
||||
if((msg_ptr[2] & 0xf4) != 0x80)
|
||||
{
|
||||
cd->channelid = CHAN_NO;
|
||||
DBGL3(L3_P_ERR, "i4b_decode_q931_cs0_ie", ("IEI_CHANNELID, unsupported value 0x%x\n", msg_ptr[2]));
|
||||
NDBGL3(L3_P_ERR, "IEI_CHANNELID, unsupported value 0x%x", msg_ptr[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -338,7 +363,7 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
|
||||
}
|
||||
cd->channelexcl = (msg_ptr[2] & 0x08) >> 3;
|
||||
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_CHANNELID - channel %d, exclusive = %d\n", cd->channelid, cd->channelexcl));
|
||||
NDBGL3(L3_P_MSG, "IEI_CHANNELID - channel %d, exclusive = %d", cd->channelid, cd->channelexcl);
|
||||
|
||||
/* if this is a setup message, reserve channel */
|
||||
|
||||
@ -349,56 +374,36 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
|
||||
if(ctrl_desc[cd->controller].bch_state[cd->channelid] == BCH_ST_FREE)
|
||||
ctrl_desc[cd->controller].bch_state[cd->channelid] = BCH_ST_RSVD;
|
||||
else
|
||||
DBGL3(L3_P_ERR, "i4b_decode_q931_cs0_ie", ("IE ChannelID, Channel NOT free!!\n"));
|
||||
NDBGL3(L3_P_ERR, "IE ChannelID, Channel NOT free!!");
|
||||
}
|
||||
else if(cd->channelid == CHAN_NO)
|
||||
{
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IE ChannelID, SETUP with channel = No channel (CW)\n"));
|
||||
NDBGL3(L3_P_MSG, "IE ChannelID, SETUP with channel = No channel (CW)");
|
||||
}
|
||||
else /* cd->channelid == CHAN_ANY */
|
||||
{
|
||||
DBGL3(L3_P_ERR, "i4b_decode_q931_cs0_ie", ("ERROR: IE ChannelID, SETUP with channel = Any channel!\n"));
|
||||
NDBGL3(L3_P_ERR, "ERROR: IE ChannelID, SETUP with channel = Any channel!");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IEI_CALLINGPN: /* calling party no */
|
||||
if(msg_ptr[2] & 0x80) /* no presentation/screening indicator ? */
|
||||
{
|
||||
memcpy(cd->src_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1));
|
||||
cd->src_telno[min(TELNO_MAX, msg_ptr[1] - 1)] = '\0';
|
||||
cd->scr_ind = SCR_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(cd->src_telno, &msg_ptr[4], min(TELNO_MAX, msg_ptr[1]-2));
|
||||
cd->src_telno[min(TELNO_MAX, msg_ptr[1] - 2)] = '\0';
|
||||
cd->scr_ind = (msg_ptr[3] & 0x03) + SCR_USR_NOSC;
|
||||
}
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_CALLINGPN = %s\n", cd->src_telno));
|
||||
break;
|
||||
|
||||
case IEI_CALLEDPN: /* called party number */
|
||||
memcpy(cd->dst_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1));
|
||||
cd->dst_telno[min(TELNO_MAX, msg_ptr [1] - 1)] = '\0';
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_CALLED = %s\n", cd->dst_telno));
|
||||
break;
|
||||
|
||||
case IEI_CALLSTATE: /* call state */
|
||||
cd->call_state = msg_ptr[2] & 0x3f;
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_CALLSTATE = %d\n", cd->call_state));
|
||||
case IEI_PROGRESSI: /* progress indicator */
|
||||
NDBGL3(L3_P_MSG, "IEI_PROGRESSINDICATOR");
|
||||
break;
|
||||
|
||||
case IEI_PROGRESSI: /* progress indicator */
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_PROGRESSINDICATOR\n"));
|
||||
case IEI_NETSPCFAC: /* network specific fac */
|
||||
NDBGL3(L3_P_MSG, "IEI_NETSPCFAC");
|
||||
break;
|
||||
|
||||
case IEI_NOTIFIND: /* notification indicator */
|
||||
NDBGL3(L3_P_MSG, "IEI_NOTIFICATION_INDICATOR");
|
||||
break;
|
||||
|
||||
case IEI_DISPLAY: /* display */
|
||||
/* CHANGED BY <chris@medis.de> */
|
||||
memcpy(cd->display, &msg_ptr[2], min(DISPLAY_MAX, msg_ptr[1]));
|
||||
cd->display[min(DISPLAY_MAX, msg_ptr[1])] = '\0';
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_DISPLAY = %s\n", cd->display));
|
||||
NDBGL3(L3_P_MSG, "IEI_DISPLAY = %s", cd->display);
|
||||
break;
|
||||
|
||||
case IEI_DATETIME: /* date/time */
|
||||
@ -410,41 +415,108 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
|
||||
for(j = msg_ptr[1]; j > 0; j--, i++)
|
||||
sprintf(p+strlen(p), "%02d", msg_ptr[i]);
|
||||
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_DATETIME = %s\n", cd->datetime));
|
||||
NDBGL3(L3_P_MSG, "IEI_DATETIME = %s", cd->datetime);
|
||||
break;
|
||||
|
||||
case IEI_KEYPAD: /* keypad facility */
|
||||
NDBGL3(L3_P_MSG, "IEI_KEYPAD_FACILITY");
|
||||
break;
|
||||
|
||||
case IEI_SIGNAL: /* signal type */
|
||||
NDBGL3(L3_P_MSG, "IEI_SIGNAL = %d", msg_ptr[2]);
|
||||
break;
|
||||
|
||||
case IEI_INFRATE: /* information rate */
|
||||
NDBGL3(L3_P_MSG, "IEI_INFORMATION_RATE");
|
||||
break;
|
||||
|
||||
case IEI_ETETDEL: /* end to end transit delay */
|
||||
NDBGL3(L3_P_MSG, "IEI_END_TO_END_TRANSIT_DELAY");
|
||||
break;
|
||||
|
||||
case IEI_CUG: /* closed user group */
|
||||
NDBGL3(L3_P_MSG, "IEI_CLOSED_USER_GROUP");
|
||||
break;
|
||||
|
||||
case IEI_CALLINGPN: /* calling party no */
|
||||
if(msg_ptr[2] & 0x80) /* no presentation/screening indicator ? */
|
||||
{
|
||||
memcpy(cd->src_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1));
|
||||
cd->src_telno[min(TELNO_MAX, msg_ptr[1] - 1)] = '\0';
|
||||
cd->scr_ind = SCR_NONE;
|
||||
cd->prs_ind = PRS_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(cd->src_telno, &msg_ptr[4], min(TELNO_MAX, msg_ptr[1]-2));
|
||||
cd->src_telno[min(TELNO_MAX, msg_ptr[1] - 2)] = '\0';
|
||||
cd->scr_ind = (msg_ptr[3] & 0x03) + SCR_USR_NOSC;
|
||||
cd->prs_ind = ((msg_ptr[3] >> 5) & 0x03) + PRS_ALLOWED;
|
||||
}
|
||||
NDBGL3(L3_P_MSG, "IEI_CALLINGPN = %s", cd->src_telno);
|
||||
break;
|
||||
|
||||
case IEI_CALLINGPS: /* calling party subaddress */
|
||||
NDBGL3(L3_P_MSG, "IEI_CALLINGPS");
|
||||
break;
|
||||
|
||||
case IEI_CALLEDPN: /* called party number */
|
||||
memcpy(cd->dst_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1));
|
||||
cd->dst_telno[min(TELNO_MAX, msg_ptr [1] - 1)] = '\0';
|
||||
NDBGL3(L3_P_MSG, "IEI_CALLED = %s", cd->dst_telno);
|
||||
break;
|
||||
|
||||
case IEI_CALLEDPS: /* called party subaddress */
|
||||
NDBGL3(L3_P_MSG, "IEI_CALLEDPS");
|
||||
break;
|
||||
|
||||
case IEI_REDIRNO: /* redirecting number */
|
||||
NDBGL3(L3_P_MSG, "IEI_REDIRECTING_NUMBER");
|
||||
break;
|
||||
|
||||
case IEI_TRNSEL: /* transit network selection */
|
||||
NDBGL3(L3_P_MSG, "IEI_TRANSIT_NETWORK_SELECTION");
|
||||
break;
|
||||
|
||||
case IEI_RESTARTI: /* restart indicator */
|
||||
NDBGL3(L3_P_MSG, "IEI_RESTART_INDICATOR");
|
||||
break;
|
||||
|
||||
case IEI_LLCOMPAT: /* low layer compat */
|
||||
NDBGL3(L3_P_MSG, "IEI_LLCOMPAT");
|
||||
break;
|
||||
|
||||
case IEI_HLCOMPAT: /* high layer compat */
|
||||
NDBGL3(L3_P_MSG, "IEI_HLCOMPAT");
|
||||
break;
|
||||
|
||||
case IEI_USERUSER: /* user-user */
|
||||
NDBGL3(L3_P_MSG, "IEI_USER_USER");
|
||||
break;
|
||||
|
||||
case IEI_ESCAPE: /* escape for extension */
|
||||
NDBGL3(L3_P_MSG, "IEI_ESCAPE");
|
||||
break;
|
||||
|
||||
/*********/
|
||||
/* Q.932 */
|
||||
/*********/
|
||||
case IEI_FACILITY: /* facility */
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_FACILITY\n"));
|
||||
NDBGL3(L3_P_MSG, "IEI_FACILITY");
|
||||
if(i4b_aoc(msg_ptr, cd) > -1)
|
||||
i4b_l4_charging_ind(cd);
|
||||
break;
|
||||
|
||||
/*********/
|
||||
/* Q.95x */
|
||||
/*********/
|
||||
case IEI_CONCTDNO: /* connected number */
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_CONCTDNO\n"));
|
||||
NDBGL3(L3_P_MSG, "IEI_CONCTDNO");
|
||||
break;
|
||||
|
||||
case IEI_NETSPCFAC: /* network specific fac */
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_NETSPCFAC\n"));
|
||||
break;
|
||||
|
||||
case IEI_LLCOMPAT: /* low layer compat */
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_LLCOMPAT\n"));
|
||||
break;
|
||||
|
||||
case IEI_HLCOMPAT: /* high layer compat */
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_HLCOMPAT\n"));
|
||||
break;
|
||||
|
||||
case IEI_CALLINGPS: /* calling party subaddress */
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_CALLINGPS\n"));
|
||||
break;
|
||||
|
||||
case IEI_CALLEDPS: /* called party subaddress */
|
||||
DBGL3(L3_P_MSG, "i4b_decode_q931_cs0_ie", ("IEI_CALLEDPS\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL3(L3_P_ERR, "i4b_decode_q931_cs0_ie", ("Unknown IE %d - ", *msg_ptr));
|
||||
NDBGL3(L3_P_ERR, "Unknown IE %d - ", *msg_ptr);
|
||||
i4b_print_frame(msg_ptr[1]+2, msg_ptr);
|
||||
break;
|
||||
}
|
||||
@ -457,29 +529,31 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
|
||||
void
|
||||
i4b_decode_q931_message(int unit, call_desc_t *cd, u_char message_type)
|
||||
{
|
||||
cd->event = EV_ILL;
|
||||
char *m = NULL;
|
||||
|
||||
cd->event = EV_ILL;
|
||||
|
||||
switch(message_type)
|
||||
{
|
||||
/* call establishment */
|
||||
|
||||
case ALERT:
|
||||
cd->event = EV_ALERT;
|
||||
DBGL3(L3_PRIM, "rx ALERT", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "ALERT";
|
||||
break;
|
||||
|
||||
case CALL_PROCEEDING:
|
||||
cd->event = EV_CALLPRC;
|
||||
DBGL3(L3_PRIM, "rx CALL-PROC", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "CALL_PROCEEDING";
|
||||
break;
|
||||
|
||||
case PROGRESS:
|
||||
cd->event = EV_PROGIND;
|
||||
DBGL3(L3_PRIM, "rx PROGRESS", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "PROGRESS";
|
||||
break;
|
||||
|
||||
case SETUP:
|
||||
DBGL3(L3_PRIM, "rx SETUP", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "SETUP";
|
||||
cd->bprot = BPROT_NONE;
|
||||
cd->cause_in = 0;
|
||||
cd->cause_out = 0;
|
||||
@ -493,142 +567,146 @@ i4b_decode_q931_message(int unit, call_desc_t *cd, u_char message_type)
|
||||
break;
|
||||
|
||||
case CONNECT:
|
||||
DBGL3(L3_PRIM, "rx CONNECT", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "CONNECT";
|
||||
cd->datetime[0] = '\0';
|
||||
cd->event = EV_CONNECT;
|
||||
break;
|
||||
|
||||
case SETUP_ACKNOWLEDGE:
|
||||
DBGL3(L3_PRIM, "rx SETUP-ACK", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "SETUP_ACKNOWLEDGE";
|
||||
cd->event = EV_SETUPAK;
|
||||
break;
|
||||
|
||||
case CONNECT_ACKNOWLEDGE:
|
||||
DBGL3(L3_PRIM, "rx CONNECT-ACK", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "CONNECT_ACKNOWLEDGE";
|
||||
cd->event = EV_CONACK;
|
||||
break;
|
||||
|
||||
/* call information */
|
||||
|
||||
case USER_INFORMATION:
|
||||
DBGL3(L3_PRIM, "rx USER-INFO", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "USER_INFORMATION";
|
||||
break;
|
||||
|
||||
case SUSPEND_REJECT:
|
||||
DBGL3(L3_PRIM, "rx SUSPEND-REJ", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "SUSPEND_REJECT";
|
||||
break;
|
||||
|
||||
case RESUME_REJECT:
|
||||
DBGL3(L3_PRIM, "rx RESUME-REJ", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RESUME_REJECT";
|
||||
break;
|
||||
|
||||
case HOLD:
|
||||
DBGL3(L3_PRIM, "rx HOLD", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "HOLD";
|
||||
break;
|
||||
|
||||
case SUSPEND:
|
||||
DBGL3(L3_PRIM, "rx SUSPEND", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "SUSPEND";
|
||||
break;
|
||||
|
||||
case RESUME:
|
||||
DBGL3(L3_PRIM, "rx RESUME", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RESUME";
|
||||
break;
|
||||
|
||||
case HOLD_ACKNOWLEDGE:
|
||||
DBGL3(L3_PRIM, "rx HOLD-ACK", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "HOLD_ACKNOWLEDGE";
|
||||
break;
|
||||
|
||||
case SUSPEND_ACKNOWLEDGE:
|
||||
DBGL3(L3_PRIM, "rx SUSPEND-ACK", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "SUSPEND_ACKNOWLEDGE";
|
||||
break;
|
||||
|
||||
case RESUME_ACKNOWLEDGE:
|
||||
DBGL3(L3_PRIM, "rx RESUME-ACK", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RESUME_ACKNOWLEDGE";
|
||||
break;
|
||||
|
||||
case HOLD_REJECT:
|
||||
DBGL3(L3_PRIM, "rx HOLD-REJ", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "HOLD_REJECT";
|
||||
break;
|
||||
|
||||
case RETRIEVE:
|
||||
DBGL3(L3_PRIM, "rx RETRIEVE", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RETRIEVE";
|
||||
break;
|
||||
|
||||
case RETRIEVE_ACKNOWLEDGE:
|
||||
DBGL3(L3_PRIM, "rx RETRIEVE-ACK", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RETRIEVE_ACKNOWLEDGE";
|
||||
break;
|
||||
|
||||
case RETRIEVE_REJECT:
|
||||
DBGL3(L3_PRIM, "rx RETRIEVE-REJ", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RETRIEVE_REJECT";
|
||||
break;
|
||||
|
||||
/* call clearing */
|
||||
|
||||
case DISCONNECT:
|
||||
DBGL3(L3_PRIM, "rx DISCONNECT", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "DISCONNECT";
|
||||
cd->event = EV_DISCONN;
|
||||
break;
|
||||
|
||||
case RESTART:
|
||||
DBGL3(L3_PRIM, "rx RESTART", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RESTART";
|
||||
break;
|
||||
|
||||
case RELEASE:
|
||||
DBGL3(L3_PRIM, "rx RELEASE", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RELEASE";
|
||||
cd->event = EV_RELEASE;
|
||||
break;
|
||||
|
||||
case RESTART_ACKNOWLEDGE:
|
||||
DBGL3(L3_PRIM, "rx RESTART-ACK", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RESTART_ACKNOWLEDGE";
|
||||
break;
|
||||
|
||||
case RELEASE_COMPLETE:
|
||||
DBGL3(L3_PRIM, "rx RELEASE-COMPLETE", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "RELEASE_COMPLETE";
|
||||
cd->event = EV_RELCOMP;
|
||||
break;
|
||||
|
||||
/* misc messages */
|
||||
|
||||
case SEGMENT:
|
||||
DBGL3(L3_PRIM, "rx SEGMENT", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "SEGMENT";
|
||||
break;
|
||||
|
||||
case FACILITY:
|
||||
DBGL3(L3_PRIM, "rx FACILITY", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "FACILITY";
|
||||
cd->event = EV_FACILITY;
|
||||
break;
|
||||
|
||||
case REGISTER:
|
||||
DBGL3(L3_PRIM, "rx REGISTER", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "REGISTER";
|
||||
break;
|
||||
|
||||
case NOTIFY:
|
||||
DBGL3(L3_PRIM, "rx NOTIFY", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "NOTIFY";
|
||||
break;
|
||||
|
||||
case STATUS_ENQUIRY:
|
||||
DBGL3(L3_PRIM, "rx STATUS-ENQ", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "STATUS_ENQUIRY";
|
||||
cd->event = EV_STATENQ;
|
||||
break;
|
||||
|
||||
case CONGESTION_CONTROL:
|
||||
DBGL3(L3_PRIM, "rx CONGESTION-CONTROL", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "CONGESTION_CONTROL";
|
||||
break;
|
||||
|
||||
case INFORMATION:
|
||||
DBGL3(L3_PRIM, "rx INFORMATION", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "INFORMATION";
|
||||
cd->event = EV_INFO;
|
||||
break;
|
||||
|
||||
case STATUS:
|
||||
DBGL3(L3_PRIM, "rx STATUS", ("unit %d, cr = 0x%02x\n", unit, cd->cr));
|
||||
m = "STATUS";
|
||||
cd->event = EV_STATUS;
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL3(L3_P_ERR, "rx UNKNOWN msg", ("unit %d, cr = 0x%02x, msg = 0x%02x\n", unit, cd->cr, message_type));
|
||||
NDBGL3(L3_P_ERR, "unit %d, cr = 0x%02x, msg = 0x%02x", unit, cd->cr, message_type);
|
||||
break;
|
||||
}
|
||||
if(m)
|
||||
{
|
||||
NDBGL3(L3_PRIM, "%s: unit %d, cr = 0x%02x\n", m, unit, cd->cr);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* NI4BQ931 > 0 */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_q931.h - Q931 handling header file
|
||||
* --------------------------------------
|
||||
*
|
||||
* $Id: i4b_q931.h,v 1.8 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_q931.h,v 1.9 2000/04/27 09:25:22 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:05:44 1999]
|
||||
* last edit-date: [Thu Apr 27 11:07:37 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_q932fac.c - Q932 facility handling
|
||||
* --------------------------------------
|
||||
*
|
||||
* $Id: i4b_q932fac.c,v 1.8 1999/12/13 21:25:27 hm Exp $
|
||||
* $Id: i4b_q932fac.c,v 1.11 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:05:51 1999]
|
||||
* last edit-date: [Mon May 29 16:57:04 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -43,17 +43,16 @@
|
||||
#if NI4BQ931 > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -105,24 +104,24 @@ i4b_aoc(unsigned char *buf, call_desc_t *cd)
|
||||
{
|
||||
case FAC_PROTO_ROP:
|
||||
break;
|
||||
|
||||
|
||||
case FAC_PROTO_CMIP:
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("CMIP Protocol (Q.941), UNSUPPORTED\n"));
|
||||
NDBGL3(L3_A_MSG, "CMIP Protocol (Q.941), UNSUPPORTED");
|
||||
return(-1);
|
||||
break;
|
||||
|
||||
case FAC_PROTO_ACSE:
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("ACSE Protocol (X.217/X.227), UNSUPPORTED!\n"));
|
||||
NDBGL3(L3_A_MSG, "ACSE Protocol (X.217/X.227), UNSUPPORTED!");
|
||||
return(-1);
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL3(L3_A_ERR, "i4b_facility", ("Unknown Protocol, UNSUPPORTED!\n"));
|
||||
NDBGL3(L3_A_ERR, "Unknown Protocol, UNSUPPORTED!");
|
||||
return(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("Remote Operations Protocol\n"));
|
||||
NDBGL3(L3_A_MSG, "Remote Operations Protocol");
|
||||
|
||||
/* next byte */
|
||||
|
||||
@ -382,7 +381,7 @@ F_2(int val)
|
||||
{
|
||||
if(val != -1)
|
||||
{
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("Invoke ID = %d\n", val));
|
||||
NDBGL3(L3_A_MSG, "Invoke ID = %d", val);
|
||||
state = ST_EXP_OP_VAL;
|
||||
}
|
||||
}
|
||||
@ -395,7 +394,7 @@ F_3(int val)
|
||||
{
|
||||
if(val != -1)
|
||||
{
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("Operation Value = %d\n", val));
|
||||
NDBGL3(L3_A_MSG, "Operation Value = %d", val);
|
||||
|
||||
operation_value = val;
|
||||
|
||||
@ -429,7 +428,7 @@ F_4_1(int val)
|
||||
{
|
||||
if(val == -1)
|
||||
{
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("Free of Charge\n"));
|
||||
NDBGL3(L3_A_MSG, "Free of Charge");
|
||||
/* units = 0; XXXX */
|
||||
state = ST_EXP_NIX;
|
||||
}
|
||||
@ -443,7 +442,7 @@ F_4_2(int val)
|
||||
{
|
||||
if(val == -1)
|
||||
{
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("Charge not available\n"));
|
||||
NDBGL3(L3_A_MSG, "Charge not available");
|
||||
/* units = -1; XXXXXX ??? */
|
||||
state = ST_EXP_NIX;
|
||||
}
|
||||
@ -477,7 +476,7 @@ F_7(int val)
|
||||
{
|
||||
if(val != -1)
|
||||
{
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("Number of Units = %d\n", val));
|
||||
NDBGL3(L3_A_MSG, "Number of Units = %d", val);
|
||||
units = val;
|
||||
state = ST_EXP_TOCI;
|
||||
}
|
||||
@ -491,7 +490,7 @@ F_8(int val)
|
||||
{
|
||||
if(val != -1)
|
||||
{
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("Subtotal/Total = %d\n", val));
|
||||
NDBGL3(L3_A_MSG, "Subtotal/Total = %d", val);
|
||||
/* type_of_charge = val; */
|
||||
state = ST_EXP_DBID;
|
||||
}
|
||||
@ -505,7 +504,7 @@ F_9(int val)
|
||||
{
|
||||
if(val != -1)
|
||||
{
|
||||
DBGL3(L3_A_MSG, "i4b_facility", ("Billing ID = %d\n", val));
|
||||
NDBGL3(L3_A_MSG, "Billing ID = %d", val);
|
||||
/* billing_id = val; */
|
||||
state = ST_EXP_NIX;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_q932fac.h - Q932 facility handling header file
|
||||
* --------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_q932fac.h,v 1.7 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_q932fac.h,v 1.8 2000/04/27 09:25:22 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:00 1999]
|
||||
* last edit-date: [Thu Apr 27 11:07:52 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_i4bdrv.c - i4b userland interface driver
|
||||
* --------------------------------------------
|
||||
*
|
||||
* $Id: i4b_i4bdrv.c,v 1.52 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_i4bdrv.c,v 1.59 2000/10/06 08:37:43 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:11 1999]
|
||||
* last edit-date: [Mon Oct 2 09:55:28 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -39,11 +39,6 @@
|
||||
#include "i4bipr.h"
|
||||
#include "i4btel.h"
|
||||
|
||||
#ifdef __bsdi__
|
||||
#include "ibc.h"
|
||||
#else
|
||||
#include "i4bisppp.h"
|
||||
#endif
|
||||
|
||||
#if NI4B > 1
|
||||
#error "only 1 (one) i4b device possible!"
|
||||
@ -71,6 +66,36 @@
|
||||
#include <sys/select.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include "i4bing.h"
|
||||
#endif
|
||||
|
||||
#ifdef __bsdi__
|
||||
#include "ibc.h"
|
||||
#else
|
||||
#ifdef __FreeBSD__
|
||||
#include "i4bisppp.h"
|
||||
#else
|
||||
#include <net/if_sppp.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ == 3
|
||||
#include "opt_devfs.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
#endif
|
||||
|
||||
#endif /* __FreeBSD__*/
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -99,6 +124,9 @@ static int selflag = 0;
|
||||
static int readflag = 0;
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ == 3
|
||||
#ifdef DEVFS
|
||||
static void *devfs_token;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
@ -240,6 +268,11 @@ i4battach()
|
||||
#if defined(__FreeBSD__)
|
||||
#if __FreeBSD__ == 3
|
||||
|
||||
#ifdef DEVFS
|
||||
devfs_token = devfs_add_devswf(&i4b_cdevsw, 0, DV_CHR,
|
||||
UID_ROOT, GID_WHEEL, 0600,
|
||||
"i4b");
|
||||
#endif
|
||||
|
||||
#else
|
||||
make_dev(&i4b_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4b");
|
||||
@ -296,16 +329,17 @@ i4bread(dev_t dev, struct uio *uio, int ioflag)
|
||||
if(minor(dev))
|
||||
return(ENODEV);
|
||||
|
||||
x = splimp();
|
||||
while(IF_QEMPTY(&i4b_rdqueue))
|
||||
{
|
||||
x = splimp();
|
||||
readflag = 1;
|
||||
error = tsleep((caddr_t) &i4b_rdqueue, (PZERO + 1) | PCATCH, "bird", 0);
|
||||
if (error != 0) {
|
||||
splx(x);
|
||||
tsleep((caddr_t) &i4b_rdqueue, (PZERO + 1) | PCATCH, "bird", 0);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
x = splimp();
|
||||
|
||||
IF_DEQUEUE(&i4b_rdqueue, m);
|
||||
|
||||
splx(x);
|
||||
@ -361,7 +395,7 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
|
||||
if((cd = cd_by_cdid(mcr->cdid)) == NULL)/* get cd */
|
||||
{
|
||||
DBGL4(L4_ERR, "i4bioctl", ("I4B_CONNECT_REQ ioctl, cdid not found!\n"));
|
||||
NDBGL4(L4_ERR, "I4B_CONNECT_REQ ioctl, cdid not found!");
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -399,9 +433,9 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
|
||||
cd->dir = DIR_OUTGOING;
|
||||
|
||||
DBGL4(L4_TIMO, "i4bioctl", ("I4B_CONNECT_REQ times, algorithm=%ld unitlen=%ld idle=%ld earlyhup=%ld\n",
|
||||
NDBGL4(L4_TIMO, "I4B_CONNECT_REQ times, algorithm=%ld unitlen=%ld idle=%ld earlyhup=%ld",
|
||||
(long)cd->shorthold_data.shorthold_algorithm, (long)cd->shorthold_data.unitlen_time,
|
||||
(long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time));
|
||||
(long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time);
|
||||
|
||||
strcpy(cd->dst_telno, mcr->dst_telno);
|
||||
strcpy(cd->src_telno, mcr->src_telno);
|
||||
@ -460,7 +494,7 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
|
||||
if((cd = cd_by_cdid(mcrsp->cdid)) == NULL)/* get cd */
|
||||
{
|
||||
DBGL4(L4_ERR, "i4bioctl", ("I4B_CONNECT_RESP ioctl, cdid not found!\n"));
|
||||
NDBGL4(L4_ERR, "I4B_CONNECT_RESP ioctl, cdid not found!");
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -478,7 +512,7 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
|
||||
cd->isdntxdelay = mcrsp->txdelay;
|
||||
|
||||
DBGL4(L4_TIMO, "i4bioctl", ("I4B_CONNECT_RESP max_idle_time set to %ld seconds\n", (long)cd->max_idle_time));
|
||||
NDBGL4(L4_TIMO, "I4B_CONNECT_RESP max_idle_time set to %ld seconds", (long)cd->max_idle_time);
|
||||
|
||||
(*ctrl_desc[cd->controller].N_CONNECT_RESPONSE)(mcrsp->cdid, mcrsp->response, mcrsp->cause);
|
||||
break;
|
||||
@ -494,7 +528,7 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
|
||||
if((cd = cd_by_cdid(mdr->cdid)) == NULL)/* get cd */
|
||||
{
|
||||
DBGL4(L4_ERR, "i4bioctl", ("I4B_DISCONNECT_REQ ioctl, cdid not found!\n"));
|
||||
NDBGL4(L4_ERR, "I4B_DISCONNECT_REQ ioctl, cdid not found!");
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -569,6 +603,12 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
dlt = ibc_ret_linktab(mdrsp->driver_unit);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NI4BING > 0
|
||||
case BDRV_ING:
|
||||
dlt = ing_ret_linktab(mdrsp->driver_unit);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(dlt != NULL)
|
||||
@ -585,13 +625,13 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
|
||||
mtu = (msg_timeout_upd_t *)data;
|
||||
|
||||
DBGL4(L4_TIMO, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, alg %d, unit %d, idle %d, early %d!\n",
|
||||
NDBGL4(L4_TIMO, "I4B_TIMEOUT_UPD ioctl, alg %d, unit %d, idle %d, early %d!",
|
||||
mtu->shorthold_data.shorthold_algorithm, mtu->shorthold_data.unitlen_time,
|
||||
mtu->shorthold_data.idle_time, mtu->shorthold_data.earlyhup_time ));
|
||||
mtu->shorthold_data.idle_time, mtu->shorthold_data.earlyhup_time);
|
||||
|
||||
if((cd = cd_by_cdid(mtu->cdid)) == NULL)/* get cd */
|
||||
{
|
||||
DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, cdid not found!\n"));
|
||||
NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, cdid not found!");
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -608,7 +648,7 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
mtu->shorthold_data.idle_time >= 0 &&
|
||||
mtu->shorthold_data.earlyhup_time >= 0))
|
||||
{
|
||||
DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, invalid args for fix unit algorithm!\n"));
|
||||
NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid args for fix unit algorithm!");
|
||||
error = EINVAL;
|
||||
}
|
||||
break;
|
||||
@ -625,13 +665,13 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
mtu->shorthold_data.idle_time >= 0 &&
|
||||
mtu->shorthold_data.earlyhup_time == 0))
|
||||
{
|
||||
DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, invalid args for var unit algorithm!\n"));
|
||||
NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid args for var unit algorithm!");
|
||||
error = EINVAL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, invalid algorithm!\n"));
|
||||
NDBGL4(L4_ERR, "I4B_TIMEOUT_UPD ioctl, invalid algorithm!");
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -681,7 +721,7 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
|
||||
if((cd = cd_by_cdid(mar->cdid)) == NULL)
|
||||
{
|
||||
DBGL4(L4_ERR, "i4bioctl", ("I4B_ALERT_REQ ioctl, cdid not found!\n"));
|
||||
NDBGL4(L4_ERR, "I4B_ALERT_REQ ioctl, cdid not found!");
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -945,7 +985,7 @@ i4bputqueue(struct mbuf *m)
|
||||
struct mbuf *m1;
|
||||
IF_DEQUEUE(&i4b_rdqueue, m1);
|
||||
i4b_Dfreembuf(m1);
|
||||
DBGL4(L4_ERR, "i4bputqueue", ("ERROR, queue full, removing entry!\n"));
|
||||
NDBGL4(L4_ERR, "ERROR, queue full, removing entry!");
|
||||
}
|
||||
|
||||
IF_ENQUEUE(&i4b_rdqueue, m);
|
||||
@ -986,7 +1026,7 @@ i4bputqueue_hipri(struct mbuf *m)
|
||||
struct mbuf *m1;
|
||||
IF_DEQUEUE(&i4b_rdqueue, m1);
|
||||
i4b_Dfreembuf(m1);
|
||||
DBGL4(L4_ERR, "i4bputqueue", ("ERROR, queue full, removing entry!\n"));
|
||||
NDBGL4(L4_ERR, "ERROR, queue full, removing entry!");
|
||||
}
|
||||
|
||||
IF_PREPEND(&i4b_rdqueue, m);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,32 +27,20 @@
|
||||
* i4b_l4.c - kernel interface to userland
|
||||
* -----------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4.c,v 1.45 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_l4.c,v 1.54 2000/08/28 07:24:59 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:17 1999]
|
||||
* last edit-date: [Sun Aug 27 14:53:42 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "i4b.h"
|
||||
#include "i4bipr.h"
|
||||
#ifdef __bsdi__
|
||||
#define NI4BISPPP 0
|
||||
#include "ibc.h"
|
||||
#else
|
||||
#include "i4bisppp.h"
|
||||
#endif
|
||||
#include "i4brbch.h"
|
||||
#include "i4btel.h"
|
||||
|
||||
#if NI4B > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
@ -62,6 +50,28 @@
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include "i4bing.h"
|
||||
#endif
|
||||
|
||||
#ifdef __bsdi__
|
||||
#define NI4BISPPP 0
|
||||
#include "ibc.h"
|
||||
#else
|
||||
#include "i4bisppp.h"
|
||||
#endif
|
||||
|
||||
#include "i4brbch.h"
|
||||
#include "i4btel.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -93,6 +103,10 @@ static void i4b_idle_check_fix_unit(call_desc_t *cd);
|
||||
static void i4b_idle_check_var_unit(call_desc_t *cd);
|
||||
static void i4b_l4_setup_timeout_fix_unit(call_desc_t *cd);
|
||||
static void i4b_l4_setup_timeout_var_unit(call_desc_t *cd);
|
||||
static time_t i4b_get_idletime(call_desc_t *cd);
|
||||
#if NI4BISPPP > 0
|
||||
extern time_t i4bisppp_idletime(int);
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* send MSG_PDEACT_IND message to userland
|
||||
@ -114,11 +128,7 @@ i4b_l4_pdeact(int controller, int numactive)
|
||||
|
||||
if(cd->timeout_active)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, cd->idle_timeout_handle);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd);
|
||||
#endif
|
||||
STOP_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd);
|
||||
}
|
||||
|
||||
if(cd->dlt != NULL)
|
||||
@ -370,6 +380,7 @@ i4b_l4_connect_ind(call_desc_t *cd)
|
||||
strcpy(mp->display, cd->display);
|
||||
|
||||
mp->scr_ind = cd->scr_ind;
|
||||
mp->prs_ind = cd->prs_ind;
|
||||
|
||||
T400_start(cd);
|
||||
|
||||
@ -390,7 +401,7 @@ i4b_l4_connect_active_ind(call_desc_t *cd)
|
||||
|
||||
cd->last_active_time = cd->connect_time = SECOND;
|
||||
|
||||
DBGL4(L4_TIMO, "i4b_l4_connect_active_ind", ("last_active/connect_time=%ld\n", (long)cd->connect_time));
|
||||
NDBGL4(L4_TIMO, "last_active/connect_time=%ld", (long)cd->connect_time);
|
||||
|
||||
i4b_link_bchandrvr(cd);
|
||||
|
||||
@ -425,11 +436,7 @@ i4b_l4_disconnect_ind(call_desc_t *cd)
|
||||
struct mbuf *m;
|
||||
|
||||
if(cd->timeout_active)
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, cd->idle_timeout_handle);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd);
|
||||
#endif
|
||||
STOP_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd);
|
||||
|
||||
if(cd->dlt != NULL)
|
||||
{
|
||||
@ -444,7 +451,7 @@ i4b_l4_disconnect_ind(call_desc_t *cd)
|
||||
else
|
||||
{
|
||||
/* no error, might be hunting call for callback */
|
||||
DBGL4(L4_MSG, "i4b_l4_disconnect_ind", ("channel free not B1/B2 but %d!\n", cd->channelid));
|
||||
NDBGL4(L4_MSG, "channel free not B1/B2 but %d!", cd->channelid);
|
||||
}
|
||||
|
||||
if((m = i4b_Dgetmbuf(sizeof(msg_disconnect_ind_t))) != NULL)
|
||||
@ -634,6 +641,12 @@ i4b_link_bchandrvr(call_desc_t *cd)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NI4BING > 0
|
||||
case BDRV_ING:
|
||||
cd->dlt = ing_ret_linktab(cd->driver_unit);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
cd->dlt = NULL;
|
||||
break;
|
||||
@ -681,6 +694,13 @@ i4b_link_bchandrvr(call_desc_t *cd)
|
||||
ibc_set_linktab(cd->driver_unit, cd->ilt);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if NI4BING > 0
|
||||
case BDRV_ING:
|
||||
ing_set_linktab(cd->driver_unit, cd->ilt);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return(0);
|
||||
break;
|
||||
@ -688,8 +708,7 @@ i4b_link_bchandrvr(call_desc_t *cd)
|
||||
|
||||
/* activate B channel */
|
||||
|
||||
(*cd->ilt->bch_config)(ctrl_desc[cd->controller].unit,
|
||||
cd->channelid, cd->bprot, 1);
|
||||
(*cd->ilt->bch_config)(cd->ilt->unit, cd->ilt->channel, cd->bprot, 1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -716,8 +735,7 @@ i4b_unlink_bchandrvr(call_desc_t *cd)
|
||||
|
||||
/* deactivate B channel */
|
||||
|
||||
(*cd->ilt->bch_config)(ctrl_desc[cd->controller].unit,
|
||||
cd->channelid, cd->bprot, 0);
|
||||
(*cd->ilt->bch_config)(cd->ilt->unit, cd->ilt->channel, cd->bprot, 0);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
@ -762,14 +780,28 @@ idletime_state: IST_NONCHK IST_CHECK IST_SAFE
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
static time_t
|
||||
i4b_get_idletime(call_desc_t *cd)
|
||||
{
|
||||
switch (cd->driver) {
|
||||
#if NI4BISPPP > 0
|
||||
case BDRV_ISPPP:
|
||||
return i4bisppp_idletime(cd->driver_unit);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return cd->last_active_time;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*
|
||||
* B channel idle check timeout setup
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
i4b_l4_setup_timeout(call_desc_t *cd)
|
||||
{
|
||||
DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: direction %d, shorthold algorithm %d\n",
|
||||
(long)SECOND, cd->dir, cd->shorthold_data.shorthold_algorithm ));
|
||||
NDBGL4(L4_TIMO, "%ld: direction %d, shorthold algorithm %d",
|
||||
(long)SECOND, cd->dir, cd->shorthold_data.shorthold_algorithm);
|
||||
|
||||
cd->timeout_active = 0;
|
||||
cd->idletime_state = IST_IDLE;
|
||||
@ -778,12 +810,9 @@ i4b_l4_setup_timeout(call_desc_t *cd)
|
||||
{
|
||||
/* incoming call: simple max idletime check */
|
||||
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2);
|
||||
cd->timeout_active = 1;
|
||||
DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: incoming-call, setup max_idle_time to %ld\n", (long)SECOND, (long)cd->max_idle_time));
|
||||
NDBGL4(L4_TIMO, "%ld: incoming-call, setup max_idle_time to %ld", (long)SECOND, (long)cd->max_idle_time);
|
||||
}
|
||||
else if((cd->dir == DIR_OUTGOING) && (cd->shorthold_data.idle_time > 0))
|
||||
{
|
||||
@ -801,7 +830,7 @@ i4b_l4_setup_timeout(call_desc_t *cd)
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("no idle_timeout configured\n"));
|
||||
NDBGL4(L4_TIMO, "no idle_timeout configured");
|
||||
}
|
||||
}
|
||||
|
||||
@ -817,26 +846,20 @@ i4b_l4_setup_timeout_fix_unit(call_desc_t *cd)
|
||||
{
|
||||
/* outgoing call: simple max idletime check */
|
||||
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2);
|
||||
cd->timeout_active = 1;
|
||||
DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, setup idle_time to %ld\n",
|
||||
(long)SECOND, (long)cd->shorthold_data.idle_time));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, setup idle_time to %ld",
|
||||
(long)SECOND, (long)cd->shorthold_data.idle_time);
|
||||
}
|
||||
else if((cd->shorthold_data.unitlen_time > 0) && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)))
|
||||
{
|
||||
/* outgoing call: full shorthold mode check */
|
||||
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)));
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)));
|
||||
cd->timeout_active = 1;
|
||||
cd->idletime_state = IST_NONCHK;
|
||||
DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, start %ld sec nocheck window\n",
|
||||
(long)SECOND, (long)(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, start %ld sec nocheck window",
|
||||
(long)SECOND, (long)(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)));
|
||||
|
||||
if(cd->aocd_flag == 0)
|
||||
{
|
||||
@ -849,8 +872,8 @@ i4b_l4_setup_timeout_fix_unit(call_desc_t *cd)
|
||||
{
|
||||
/* parms somehow got wrong .. */
|
||||
|
||||
DBGL4(L4_ERR, "i4b_l4_setup_timeout", ("%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!\n",
|
||||
(long)SECOND, (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time, (long)cd->shorthold_data.unitlen_time));
|
||||
NDBGL4(L4_ERR, "%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!",
|
||||
(long)SECOND, (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time, (long)cd->shorthold_data.unitlen_time);
|
||||
}
|
||||
}
|
||||
|
||||
@ -869,13 +892,10 @@ i4b_l4_setup_timeout_var_unit(call_desc_t *cd)
|
||||
*/
|
||||
cd->idletime_state = IST_CHECK; /* move directly to the checking state */
|
||||
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz * (cd->shorthold_data.unitlen_time - 1) );
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz * (cd->shorthold_data.unitlen_time - 1) );
|
||||
cd->timeout_active = 1;
|
||||
DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, var idle time - setup to %ld\n",
|
||||
(long)SECOND, (long)cd->shorthold_data.unitlen_time));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle time - setup to %ld",
|
||||
(long)SECOND, (long)cd->shorthold_data.unitlen_time);
|
||||
}
|
||||
|
||||
|
||||
@ -896,7 +916,7 @@ i4b_idle_check(call_desc_t *cd)
|
||||
|
||||
if(cd->timeout_active == 0)
|
||||
{
|
||||
DBGL4(L4_ERR, "i4b_idle_check", ("ERROR: timeout_active == 0 !!!\n"));
|
||||
NDBGL4(L4_ERR, "ERROR: timeout_active == 0 !!!");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -907,21 +927,18 @@ i4b_idle_check(call_desc_t *cd)
|
||||
|
||||
if(cd->dir == DIR_INCOMING)
|
||||
{
|
||||
if((cd->last_active_time + cd->max_idle_time) <= SECOND)
|
||||
if((i4b_get_idletime(cd) + cd->max_idle_time) <= SECOND)
|
||||
{
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: incoming-call, line idle timeout, disconnecting!\n", (long)SECOND));
|
||||
NDBGL4(L4_TIMO, "%ld: incoming-call, line idle timeout, disconnecting!", (long)SECOND);
|
||||
(*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid,
|
||||
(CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
|
||||
i4b_l4_idle_timeout_ind(cd);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: incoming-call, activity, last_active=%ld, max_idle=%ld\n", (long)SECOND, (long)cd->last_active_time, (long)cd->max_idle_time));
|
||||
NDBGL4(L4_TIMO, "%ld: incoming-call, activity, last_active=%ld, max_idle=%ld", (long)SECOND, (long)i4b_get_idletime(cd), (long)cd->max_idle_time);
|
||||
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2);
|
||||
cd->timeout_active = 1;
|
||||
}
|
||||
}
|
||||
@ -939,8 +956,8 @@ i4b_idle_check(call_desc_t *cd)
|
||||
i4b_idle_check_var_unit( cd );
|
||||
break;
|
||||
default:
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: bad value for shorthold_algorithm of %d\n",
|
||||
(long)SECOND, cd->shorthold_data.shorthold_algorithm ));
|
||||
NDBGL4(L4_TIMO, "%ld: bad value for shorthold_algorithm of %d",
|
||||
(long)SECOND, cd->shorthold_data.shorthold_algorithm);
|
||||
i4b_idle_check_fix_unit( cd );
|
||||
break;
|
||||
}
|
||||
@ -959,20 +976,17 @@ i4b_idle_check_fix_unit(call_desc_t *cd)
|
||||
|
||||
if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0))
|
||||
{
|
||||
if((cd->last_active_time + cd->shorthold_data.idle_time) <= SECOND)
|
||||
if((i4b_get_idletime(cd) + cd->shorthold_data.idle_time) <= SECOND)
|
||||
{
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, idle timeout, disconnecting!\n", (long)SECOND));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call-st, idle timeout, disconnecting!", (long)SECOND);
|
||||
(*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
|
||||
i4b_l4_idle_timeout_ind(cd);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld\n",
|
||||
(long)SECOND, (long)cd->last_active_time, (long)cd->shorthold_data.idle_time));
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld",
|
||||
(long)SECOND, (long)i4b_get_idletime(cd), (long)cd->shorthold_data.idle_time);
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz/2);
|
||||
cd->timeout_active = 1;
|
||||
}
|
||||
}
|
||||
@ -987,31 +1001,25 @@ i4b_idle_check_fix_unit(call_desc_t *cd)
|
||||
|
||||
case IST_NONCHK: /* end of non-check time */
|
||||
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.idle_time));
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.idle_time));
|
||||
cd->idletimechk_start = SECOND;
|
||||
cd->idletime_state = IST_CHECK;
|
||||
cd->timeout_active = 1;
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idletime check window reached!\n", (long)SECOND));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, idletime check window reached!", (long)SECOND);
|
||||
break;
|
||||
|
||||
case IST_CHECK: /* end of idletime chk */
|
||||
if((cd->last_active_time > cd->idletimechk_start) &&
|
||||
(cd->last_active_time <= SECOND))
|
||||
if((i4b_get_idletime(cd) > cd->idletimechk_start) &&
|
||||
(i4b_get_idletime(cd) <= SECOND))
|
||||
{ /* activity detected */
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.earlyhup_time));
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.earlyhup_time));
|
||||
cd->timeout_active = 1;
|
||||
cd->idletime_state = IST_SAFE;
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, activity at %ld, wait earlyhup-end\n", (long)SECOND, (long)cd->last_active_time));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, activity at %ld, wait earlyhup-end", (long)SECOND, (long)i4b_get_idletime(cd));
|
||||
}
|
||||
else
|
||||
{ /* no activity, hangup */
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idle timeout, last activity at %ld\n", (long)SECOND, (long)cd->last_active_time));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, idle timeout, last activity at %ld", (long)SECOND, (long)i4b_get_idletime(cd));
|
||||
(*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
|
||||
i4b_l4_idle_timeout_ind(cd);
|
||||
cd->idletime_state = IST_IDLE;
|
||||
@ -1020,10 +1028,7 @@ i4b_idle_check_fix_unit(call_desc_t *cd)
|
||||
|
||||
case IST_SAFE: /* end of earlyhup time */
|
||||
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time+cd->shorthold_data.earlyhup_time)));
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time+cd->shorthold_data.earlyhup_time)));
|
||||
cd->timeout_active = 1;
|
||||
cd->idletime_state = IST_NONCHK;
|
||||
|
||||
@ -1034,11 +1039,11 @@ i4b_idle_check_fix_unit(call_desc_t *cd)
|
||||
i4b_l4_charging_ind(cd);
|
||||
}
|
||||
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, earlyhup end, wait for idletime start\n", (long)SECOND));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, earlyhup end, wait for idletime start", (long)SECOND);
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL4(L4_ERR, "i4b_idle_check", ("outgoing-call: invalid idletime_state value!\n"));
|
||||
NDBGL4(L4_ERR, "outgoing-call: invalid idletime_state value!");
|
||||
cd->idletime_state = IST_IDLE;
|
||||
break;
|
||||
}
|
||||
@ -1056,20 +1061,20 @@ i4b_idle_check_var_unit(call_desc_t *cd)
|
||||
|
||||
/* see if there has been any activity within the last idle_time seconds */
|
||||
case IST_CHECK:
|
||||
if( cd->last_active_time > (SECOND - cd->shorthold_data.idle_time))
|
||||
if( i4b_get_idletime(cd) > (SECOND - cd->shorthold_data.idle_time))
|
||||
{ /* activity detected */
|
||||
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
|
||||
cd->idle_timeout_handle =
|
||||
#endif
|
||||
/* check again in one second */
|
||||
timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz );
|
||||
START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz);
|
||||
cd->timeout_active = 1;
|
||||
cd->idletime_state = IST_CHECK;
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, var idle timeout - activity at %ld, continuing\n", (long)SECOND, (long)cd->last_active_time));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - activity at %ld, continuing", (long)SECOND, (long)i4b_get_idletime(cd));
|
||||
}
|
||||
else
|
||||
{ /* no activity, hangup */
|
||||
DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, var idle timeout - last activity at %ld\n", (long)SECOND, (long)cd->last_active_time));
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - last activity at %ld", (long)SECOND, (long)i4b_get_idletime(cd));
|
||||
(*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
|
||||
i4b_l4_idle_timeout_ind(cd);
|
||||
cd->idletime_state = IST_IDLE;
|
||||
@ -1077,7 +1082,7 @@ i4b_idle_check_var_unit(call_desc_t *cd)
|
||||
break;
|
||||
|
||||
default:
|
||||
DBGL4(L4_ERR, "i4b_idle_check", ("outgoing-call: var idle timeout invalid idletime_state value!\n"));
|
||||
NDBGL4(L4_ERR, "outgoing-call: var idle timeout invalid idletime_state value!");
|
||||
cd->idletime_state = IST_IDLE;
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l4.h - kernel interface to userland header file
|
||||
* ---------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4.h,v 1.17 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_l4.h,v 1.18 2000/04/27 11:35:01 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:24 1999]
|
||||
* last edit-date: [Thu Apr 27 13:28:01 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l4mgmt.c - layer 4 calldescriptor management utilites
|
||||
* -----------------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4mgmt.c,v 1.26 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_l4mgmt.c,v 1.34 2000/09/01 14:11:51 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:32 1999]
|
||||
* last edit-date: [Fri Sep 1 16:06:44 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -40,18 +40,24 @@
|
||||
#if NI4B > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <sys/random.h>
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined (__FreeBSD_version) && __FreeBSD_version <= 400000
|
||||
#include <machine/random.h>
|
||||
#else
|
||||
#include <sys/random.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -74,8 +80,8 @@ static unsigned int get_cdid(void);
|
||||
|
||||
int nctrl; /* number of attached controllers */
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
void init_callout(call_desc_t *);
|
||||
#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
|
||||
void i4b_init_callout(call_desc_t *);
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -146,8 +152,8 @@ reserve_cd(void)
|
||||
bzero(&call_desc[i], sizeof(call_desc_t)); /* clear it */
|
||||
call_desc[i].cdid = get_cdid(); /* fill in new cdid */
|
||||
cd = &(call_desc[i]); /* get pointer to descriptor */
|
||||
DBGL4(L4_MSG, "reserve_cd", ("found free cd - index=%d cdid=%u\n",
|
||||
i, call_desc[i].cdid));
|
||||
NDBGL4(L4_MSG, "found free cd - index=%d cdid=%u",
|
||||
i, call_desc[i].cdid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -157,8 +163,8 @@ reserve_cd(void)
|
||||
if(cd == NULL)
|
||||
panic("reserve_cd: no free call descriptor available!");
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
init_callout(cd);
|
||||
#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
|
||||
i4b_init_callout(cd);
|
||||
#endif
|
||||
|
||||
return(cd);
|
||||
@ -181,8 +187,8 @@ freecd_by_cd(call_desc_t *cd)
|
||||
if( (call_desc[i].cdid != CDID_UNUSED) &&
|
||||
(&(call_desc[i]) == cd) )
|
||||
{
|
||||
DBGL4(L4_MSG, "freecd_by_cd", ("releasing cd - index=%d cdid=%u cr=%d\n",
|
||||
i, call_desc[i].cdid, cd->cr));
|
||||
NDBGL4(L4_MSG, "releasing cd - index=%d cdid=%u cr=%d",
|
||||
i, call_desc[i].cdid, cd->cr);
|
||||
call_desc[i].cdid = CDID_UNUSED;
|
||||
break;
|
||||
}
|
||||
@ -210,10 +216,10 @@ cd_by_cdid(unsigned int cdid)
|
||||
{
|
||||
if(call_desc[i].cdid == cdid)
|
||||
{
|
||||
DBGL4(L4_MSG, "cd_by_cdid", ("found cdid - index=%d cdid=%u cr=%d\n",
|
||||
i, call_desc[i].cdid, call_desc[i].cr));
|
||||
#if defined(__FreeBSD__)
|
||||
init_callout(&call_desc[i]);
|
||||
NDBGL4(L4_MSG, "found cdid - index=%d cdid=%u cr=%d",
|
||||
i, call_desc[i].cdid, call_desc[i].cr);
|
||||
#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
|
||||
i4b_init_callout(&call_desc[i]);
|
||||
#endif
|
||||
return(&(call_desc[i]));
|
||||
}
|
||||
@ -241,10 +247,10 @@ cd_by_unitcr(int unit, int cr, int crf)
|
||||
(call_desc[i].cr == cr) &&
|
||||
(call_desc[i].crflag == crf) )
|
||||
{
|
||||
DBGL4(L4_MSG, "cd_by_unitcr", ("found cd, index=%d cdid=%u cr=%d\n",
|
||||
i, call_desc[i].cdid, call_desc[i].cr));
|
||||
#if defined(__FreeBSD__)
|
||||
init_callout(&call_desc[i]);
|
||||
NDBGL4(L4_MSG, "found cd, index=%d cdid=%u cr=%d",
|
||||
i, call_desc[i].cdid, call_desc[i].cr);
|
||||
#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
|
||||
i4b_init_callout(&call_desc[i]);
|
||||
#endif
|
||||
return(&(call_desc[i]));
|
||||
}
|
||||
@ -269,7 +275,13 @@ get_rand_cr(int unit)
|
||||
int found = 1;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
|
||||
#ifdef RANDOMDEV
|
||||
read_random((char *)&val, sizeof(val));
|
||||
#else
|
||||
val = (u_char)random();
|
||||
#endif /* RANDOMDEV */
|
||||
|
||||
#else
|
||||
val |= unit+i;
|
||||
val <<= i;
|
||||
@ -302,12 +314,13 @@ get_rand_cr(int unit)
|
||||
/*---------------------------------------------------------------------------*
|
||||
* initialize the callout handles for FreeBSD
|
||||
*---------------------------------------------------------------------------*/
|
||||
#if defined(__FreeBSD__)
|
||||
#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
|
||||
void
|
||||
init_callout(call_desc_t *cd)
|
||||
i4b_init_callout(call_desc_t *cd)
|
||||
{
|
||||
if(cd->callouts_inited == 0)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
callout_handle_init(&cd->idle_timeout_handle);
|
||||
callout_handle_init(&cd->T303_callout);
|
||||
callout_handle_init(&cd->T305_callout);
|
||||
@ -316,6 +329,16 @@ init_callout(call_desc_t *cd)
|
||||
callout_handle_init(&cd->T310_callout);
|
||||
callout_handle_init(&cd->T313_callout);
|
||||
callout_handle_init(&cd->T400_callout);
|
||||
#else
|
||||
callout_init(&cd->idle_timeout_handle);
|
||||
callout_init(&cd->T303_callout);
|
||||
callout_init(&cd->T305_callout);
|
||||
callout_init(&cd->T308_callout);
|
||||
callout_init(&cd->T309_callout);
|
||||
callout_init(&cd->T310_callout);
|
||||
callout_init(&cd->T313_callout);
|
||||
callout_init(&cd->T400_callout);
|
||||
#endif
|
||||
cd->callouts_inited = 1;
|
||||
}
|
||||
}
|
||||
@ -335,8 +358,7 @@ i4b_l4_daemon_attached(void)
|
||||
{
|
||||
/*XXX*/ if(ctrl_desc[i].ctrl_type == CTRL_PASSIVE)
|
||||
{
|
||||
DBGL4(L4_MSG, "i4b_l4_daemon_attached", ("CMR_DOPEN sent to unit %d\n", ctrl_desc[i].unit));
|
||||
|
||||
NDBGL4(L4_MSG, "CMR_DOPEN sent to unit %d", ctrl_desc[i].unit);
|
||||
(*ctrl_desc[i].N_MGMT_COMMAND)(ctrl_desc[i].unit, CMR_DOPEN, 0);
|
||||
}
|
||||
}
|
||||
@ -357,8 +379,7 @@ i4b_l4_daemon_detached(void)
|
||||
{
|
||||
/*XXX*/ if(ctrl_desc[i].ctrl_type == CTRL_PASSIVE)
|
||||
{
|
||||
DBGL4(L4_MSG, "i4b_l4_daemon_detached", ("CMR_DCLOSE sent to unit %d\n", ctrl_desc[i].unit));
|
||||
|
||||
NDBGL4(L4_MSG, "CMR_DCLOSE sent to unit %d", ctrl_desc[i].unit);
|
||||
(*ctrl_desc[i].N_MGMT_COMMAND)(ctrl_desc[i].unit, CMR_DCLOSE, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999 Hellmuth Michaelis. 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
|
||||
@ -27,11 +27,11 @@
|
||||
* i4b_l4timer.c - timer and timeout handling for layer 4
|
||||
* --------------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4timer.c,v 1.15 1999/12/13 21:25:28 hm Exp $
|
||||
* $Id: i4b_l4timer.c,v 1.18 2000/08/24 11:48:58 hm Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Mon Dec 13 22:06:39 1999]
|
||||
* last edit-date: [Thu Aug 24 12:50:17 2000]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -40,18 +40,16 @@
|
||||
#if NI4B > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/i4b_debug.h>
|
||||
#include <machine/i4b_ioctl.h>
|
||||
@ -72,7 +70,7 @@
|
||||
static void
|
||||
T400_timeout(call_desc_t *cd)
|
||||
{
|
||||
DBGL4(L4_ERR, "T400_timeout", ("cr = %d\n", cd->cr));
|
||||
NDBGL4(L4_ERR, "cr = %d", cd->cr);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -84,14 +82,10 @@ T400_start(call_desc_t *cd)
|
||||
if (cd->T400 == TIMER_ACTIVE)
|
||||
return;
|
||||
|
||||
DBGL4(L4_MSG, "T400_start", ("cr = %d\n", cd->cr));
|
||||
NDBGL4(L4_MSG, "cr = %d", cd->cr);
|
||||
cd->T400 = TIMER_ACTIVE;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
cd->T400_callout = timeout((TIMEOUT_FUNC_T)T400_timeout, (void *)cd, T400DEF);
|
||||
#else
|
||||
timeout((TIMEOUT_FUNC_T)T400_timeout, (void *)cd, T400DEF);
|
||||
#endif
|
||||
START_TIMER(cd->T400_callout, T400_timeout, cd, T400DEF);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -105,15 +99,11 @@ T400_stop(call_desc_t *cd)
|
||||
|
||||
if(cd->T400 == TIMER_ACTIVE)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
untimeout((TIMEOUT_FUNC_T)T400_timeout, (void *)cd, cd->T400_callout);
|
||||
#else
|
||||
untimeout((TIMEOUT_FUNC_T)T400_timeout, (void *)cd);
|
||||
#endif
|
||||
STOP_TIMER(cd->T400_callout, T400_timeout, cd);
|
||||
cd->T400 = TIMER_IDLE;
|
||||
}
|
||||
CRIT_END;
|
||||
DBGL4(L4_MSG, "T400_stop", ("cr = %d\n", cd->cr));
|
||||
NDBGL4(L4_MSG, "cr = %d", cd->cr);
|
||||
}
|
||||
|
||||
#endif /* NI4B > 0 */
|
||||
|
Loading…
Reference in New Issue
Block a user