xref: /original-bsd/sys/netccitt/hd_var.h (revision 3705696b)
1 /*
2  * Copyright (c) University of British Columbia, 1984
3  * Copyright (c) 1990, 1993
4  *	The Regents of the University of California.  All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * the Laboratory for Computation Vision and the Computer Science Department
8  * of the University of British Columbia.
9  *
10  * %sccs.include.redist.c%
11  *
12  *	@(#)hd_var.h	8.1 (Berkeley) 06/10/93
13  */
14 
15 /*
16  *
17  * hdlc control block
18  *
19  */
20 
21 struct	hdtxq {
22 	struct	mbuf *head;
23 	struct	mbuf *tail;
24 };
25 
26 struct	hdcb {
27 	struct	hdcb *hd_next;	/* pointer to next hdlc control block */
28 	char	hd_state;	/* link state */
29 	char	hd_vs;		/* send state variable */
30 	char	hd_vr;		/* receive state variable */
31 	char	hd_lastrxnr;	/* last received N(R) */
32 	char	hd_lasttxnr;	/* last transmitted N(R) */
33 	char	hd_condition;
34 #define TIMER_RECOVERY_CONDITION        0x01
35 #define REJ_CONDITION                   0x02
36 #define REMOTE_RNR_CONDITION            0X04
37 	char	hd_retxcnt;
38 	char	hd_xx;
39 	struct	hdtxq hd_txq;
40 	struct	mbuf *hd_retxq[MODULUS];
41 	char	hd_retxqi;
42 	char	hd_rrtimer;
43 	char	hd_timer;
44 #define SET_TIMER(hdp)		hdp->hd_timer = hd_t1
45 #define KILL_TIMER(hdp)		hdp->hd_timer = 0
46 	char	hd_dontcopy;	/* if-driver doesn't free I-frames */
47 	struct	ifnet *hd_ifp;	/* device's network visible interface */
48 	struct	ifaddr *hd_ifa;	/* device's X.25 network address */
49 	struct	x25config *hd_xcp;
50 	caddr_t	hd_pkp;		/* Level III junk */
51 	int	(*hd_output)();	/* separate entry for HDLC direct output */
52 
53 	/* link statistics */
54 
55 	long	hd_iframes_in;
56 	long	hd_iframes_out;
57 	long	hd_rrs_in;
58 	long	hd_rrs_out;
59 	short	hd_rejs_in;
60 	short	hd_rejs_out;
61 	long	hd_window_condition;
62 	short	hd_invalid_ns;
63 	short	hd_invalid_nr;
64 	short	hd_timeouts;
65 	short	hd_resets;
66 	short	hd_unknown;
67 	short	hd_frmrs_in;
68 	short	hd_frmrs_out;
69 	short	hd_rnrs_in;
70 	short	hd_rnrs_out;
71 };
72 
73 #ifdef KERNEL
74 struct	hdcb *hdcbhead;		/* head of linked list of hdcb's */
75 struct	Frmr_frame hd_frmr;	/* rejected frame diagnostic info */
76 struct	ifqueue hdintrq;	/* hdlc packet input queue */
77 
78 int	hd_t1;			/* timer T1 value */
79 int	hd_t3;			/* RR send timer */
80 int	hd_n2;			/* frame retransmission limit */
81 #endif
82