xref: /original-bsd/sys/netccitt/hd_var.h (revision 35274bea)
13bb6c0c9Ssklower /*
23bb6c0c9Ssklower  * Copyright (c) University of British Columbia, 1984
3*35274beaSbostic  * Copyright (c) 1990, 1993
4*35274beaSbostic  *	The Regents of the University of California.  All rights reserved.
53bb6c0c9Ssklower  *
63bb6c0c9Ssklower  * This code is derived from software contributed to Berkeley by
73bb6c0c9Ssklower  * the Laboratory for Computation Vision and the Computer Science Department
83bb6c0c9Ssklower  * of the University of British Columbia.
93bb6c0c9Ssklower  *
103bb6c0c9Ssklower  * %sccs.include.redist.c%
113bb6c0c9Ssklower  *
12*35274beaSbostic  *	@(#)hd_var.h	8.1 (Berkeley) 06/10/93
133bb6c0c9Ssklower  */
1455ef4af5Ssklower 
1555ef4af5Ssklower /*
1655ef4af5Ssklower  *
1755ef4af5Ssklower  * hdlc control block
1855ef4af5Ssklower  *
1955ef4af5Ssklower  */
2055ef4af5Ssklower 
2155ef4af5Ssklower struct	hdtxq {
2255ef4af5Ssklower 	struct	mbuf *head;
2355ef4af5Ssklower 	struct	mbuf *tail;
2455ef4af5Ssklower };
2555ef4af5Ssklower 
2655ef4af5Ssklower struct	hdcb {
2755ef4af5Ssklower 	struct	hdcb *hd_next;	/* pointer to next hdlc control block */
2855ef4af5Ssklower 	char	hd_state;	/* link state */
2955ef4af5Ssklower 	char	hd_vs;		/* send state variable */
3055ef4af5Ssklower 	char	hd_vr;		/* receive state variable */
3155ef4af5Ssklower 	char	hd_lastrxnr;	/* last received N(R) */
3255ef4af5Ssklower 	char	hd_lasttxnr;	/* last transmitted N(R) */
3355ef4af5Ssklower 	char	hd_condition;
3455ef4af5Ssklower #define TIMER_RECOVERY_CONDITION        0x01
3555ef4af5Ssklower #define REJ_CONDITION                   0x02
3655ef4af5Ssklower #define REMOTE_RNR_CONDITION            0X04
3755ef4af5Ssklower 	char	hd_retxcnt;
3855ef4af5Ssklower 	char	hd_xx;
3955ef4af5Ssklower 	struct	hdtxq hd_txq;
4055ef4af5Ssklower 	struct	mbuf *hd_retxq[MODULUS];
4155ef4af5Ssklower 	char	hd_retxqi;
4255ef4af5Ssklower 	char	hd_rrtimer;
4355ef4af5Ssklower 	char	hd_timer;
4455ef4af5Ssklower #define SET_TIMER(hdp)		hdp->hd_timer = hd_t1
4555ef4af5Ssklower #define KILL_TIMER(hdp)		hdp->hd_timer = 0
4655ef4af5Ssklower 	char	hd_dontcopy;	/* if-driver doesn't free I-frames */
4755ef4af5Ssklower 	struct	ifnet *hd_ifp;	/* device's network visible interface */
48bd072f0aSsklower 	struct	ifaddr *hd_ifa;	/* device's X.25 network address */
49fb528591Ssklower 	struct	x25config *hd_xcp;
50fb528591Ssklower 	caddr_t	hd_pkp;		/* Level III junk */
51bd072f0aSsklower 	int	(*hd_output)();	/* separate entry for HDLC direct output */
5255ef4af5Ssklower 
5355ef4af5Ssklower 	/* link statistics */
5455ef4af5Ssklower 
5555ef4af5Ssklower 	long	hd_iframes_in;
5655ef4af5Ssklower 	long	hd_iframes_out;
5755ef4af5Ssklower 	long	hd_rrs_in;
5855ef4af5Ssklower 	long	hd_rrs_out;
5955ef4af5Ssklower 	short	hd_rejs_in;
6055ef4af5Ssklower 	short	hd_rejs_out;
6155ef4af5Ssklower 	long	hd_window_condition;
6255ef4af5Ssklower 	short	hd_invalid_ns;
6355ef4af5Ssklower 	short	hd_invalid_nr;
6455ef4af5Ssklower 	short	hd_timeouts;
6555ef4af5Ssklower 	short	hd_resets;
6655ef4af5Ssklower 	short	hd_unknown;
6755ef4af5Ssklower 	short	hd_frmrs_in;
6855ef4af5Ssklower 	short	hd_frmrs_out;
6955ef4af5Ssklower 	short	hd_rnrs_in;
7055ef4af5Ssklower 	short	hd_rnrs_out;
7155ef4af5Ssklower };
7255ef4af5Ssklower 
7355ef4af5Ssklower #ifdef KERNEL
7455ef4af5Ssklower struct	hdcb *hdcbhead;		/* head of linked list of hdcb's */
7555ef4af5Ssklower struct	Frmr_frame hd_frmr;	/* rejected frame diagnostic info */
7655ef4af5Ssklower struct	ifqueue hdintrq;	/* hdlc packet input queue */
7755ef4af5Ssklower 
7855ef4af5Ssklower int	hd_t1;			/* timer T1 value */
7955ef4af5Ssklower int	hd_t3;			/* RR send timer */
8055ef4af5Ssklower int	hd_n2;			/* frame retransmission limit */
8155ef4af5Ssklower #endif
82