xref: /csrg-svn/sys/netccitt/hd_var.h (revision 63216)
141705Ssklower /*
241705Ssklower  * Copyright (c) University of British Columbia, 1984
3*63216Sbostic  * Copyright (c) 1990, 1993
4*63216Sbostic  *	The Regents of the University of California.  All rights reserved.
541705Ssklower  *
641705Ssklower  * This code is derived from software contributed to Berkeley by
741705Ssklower  * the Laboratory for Computation Vision and the Computer Science Department
841705Ssklower  * of the University of British Columbia.
941705Ssklower  *
1041705Ssklower  * %sccs.include.redist.c%
1141705Ssklower  *
12*63216Sbostic  *	@(#)hd_var.h	8.1 (Berkeley) 06/10/93
1341705Ssklower  */
1441589Ssklower 
1541589Ssklower /*
1641589Ssklower  *
1741589Ssklower  * hdlc control block
1841589Ssklower  *
1941589Ssklower  */
2041589Ssklower 
2141589Ssklower struct	hdtxq {
2241589Ssklower 	struct	mbuf *head;
2341589Ssklower 	struct	mbuf *tail;
2441589Ssklower };
2541589Ssklower 
2641589Ssklower struct	hdcb {
2741589Ssklower 	struct	hdcb *hd_next;	/* pointer to next hdlc control block */
2841589Ssklower 	char	hd_state;	/* link state */
2941589Ssklower 	char	hd_vs;		/* send state variable */
3041589Ssklower 	char	hd_vr;		/* receive state variable */
3141589Ssklower 	char	hd_lastrxnr;	/* last received N(R) */
3241589Ssklower 	char	hd_lasttxnr;	/* last transmitted N(R) */
3341589Ssklower 	char	hd_condition;
3441589Ssklower #define TIMER_RECOVERY_CONDITION        0x01
3541589Ssklower #define REJ_CONDITION                   0x02
3641589Ssklower #define REMOTE_RNR_CONDITION            0X04
3741589Ssklower 	char	hd_retxcnt;
3841589Ssklower 	char	hd_xx;
3941589Ssklower 	struct	hdtxq hd_txq;
4041589Ssklower 	struct	mbuf *hd_retxq[MODULUS];
4141589Ssklower 	char	hd_retxqi;
4241589Ssklower 	char	hd_rrtimer;
4341589Ssklower 	char	hd_timer;
4441589Ssklower #define SET_TIMER(hdp)		hdp->hd_timer = hd_t1
4541589Ssklower #define KILL_TIMER(hdp)		hdp->hd_timer = 0
4641589Ssklower 	char	hd_dontcopy;	/* if-driver doesn't free I-frames */
4741589Ssklower 	struct	ifnet *hd_ifp;	/* device's network visible interface */
4843361Ssklower 	struct	ifaddr *hd_ifa;	/* device's X.25 network address */
4949927Ssklower 	struct	x25config *hd_xcp;
5049927Ssklower 	caddr_t	hd_pkp;		/* Level III junk */
5143361Ssklower 	int	(*hd_output)();	/* separate entry for HDLC direct output */
5241589Ssklower 
5341589Ssklower 	/* link statistics */
5441589Ssklower 
5541589Ssklower 	long	hd_iframes_in;
5641589Ssklower 	long	hd_iframes_out;
5741589Ssklower 	long	hd_rrs_in;
5841589Ssklower 	long	hd_rrs_out;
5941589Ssklower 	short	hd_rejs_in;
6041589Ssklower 	short	hd_rejs_out;
6141589Ssklower 	long	hd_window_condition;
6241589Ssklower 	short	hd_invalid_ns;
6341589Ssklower 	short	hd_invalid_nr;
6441589Ssklower 	short	hd_timeouts;
6541589Ssklower 	short	hd_resets;
6641589Ssklower 	short	hd_unknown;
6741589Ssklower 	short	hd_frmrs_in;
6841589Ssklower 	short	hd_frmrs_out;
6941589Ssklower 	short	hd_rnrs_in;
7041589Ssklower 	short	hd_rnrs_out;
7141589Ssklower };
7241589Ssklower 
7341589Ssklower #ifdef KERNEL
7441589Ssklower struct	hdcb *hdcbhead;		/* head of linked list of hdcb's */
7541589Ssklower struct	Frmr_frame hd_frmr;	/* rejected frame diagnostic info */
7641589Ssklower struct	ifqueue hdintrq;	/* hdlc packet input queue */
7741589Ssklower 
7841589Ssklower int	hd_t1;			/* timer T1 value */
7941589Ssklower int	hd_t3;			/* RR send timer */
8041589Ssklower int	hd_n2;			/* frame retransmission limit */
8141589Ssklower #endif
82