xref: /illumos-gate/usr/src/cmd/bnu/pk.h (revision 2a8bcb4e)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1992 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #define OLDPACKSIZE	128
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #define	PACKSIZE	64
33*7c478bd9Sstevel@tonic-gate #define MINPACKSIZE	32
34*7c478bd9Sstevel@tonic-gate #define MAXPACKSIZE   4096
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #define	WINDOWS		7
37*7c478bd9Sstevel@tonic-gate #define	MINWINDOWS	1
38*7c478bd9Sstevel@tonic-gate #define	MAXWINDOWS	7
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate struct header {
42*7c478bd9Sstevel@tonic-gate 	char	sync;
43*7c478bd9Sstevel@tonic-gate 	char	ksize;
44*7c478bd9Sstevel@tonic-gate 	unsigned short sum;
45*7c478bd9Sstevel@tonic-gate 	char	cntl;
46*7c478bd9Sstevel@tonic-gate 	char	ccntl;
47*7c478bd9Sstevel@tonic-gate };
48*7c478bd9Sstevel@tonic-gate #define	HDRSIZ	6
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate struct pack {
51*7c478bd9Sstevel@tonic-gate 	short	p_state;	/* line state */
52*7c478bd9Sstevel@tonic-gate 	short	p_bits;		/* mask for getepack */
53*7c478bd9Sstevel@tonic-gate 	short	p_rsize;	/* input packet size */
54*7c478bd9Sstevel@tonic-gate 	short	p_xsize;	/* output packet size */
55*7c478bd9Sstevel@tonic-gate 	struct	header p_ihbuf;	/* input header */
56*7c478bd9Sstevel@tonic-gate 	struct	header p_ohbuf; /* output header */
57*7c478bd9Sstevel@tonic-gate 	char	*p_rptr;
58*7c478bd9Sstevel@tonic-gate 	char	**p_ipool;
59*7c478bd9Sstevel@tonic-gate 	char	p_xcount;	/* # active output buffers */
60*7c478bd9Sstevel@tonic-gate 	char	p_rcount;
61*7c478bd9Sstevel@tonic-gate 	char	p_nout,p_tout;
62*7c478bd9Sstevel@tonic-gate 	char	p_lpsize;	/* log(psize/32) */
63*7c478bd9Sstevel@tonic-gate 	char	p_timer;
64*7c478bd9Sstevel@tonic-gate 	char	p_obusy;
65*7c478bd9Sstevel@tonic-gate 	char	p_srxmit;
66*7c478bd9Sstevel@tonic-gate 	char	p_rwindow;	/* window size */
67*7c478bd9Sstevel@tonic-gate 	char	p_swindow;
68*7c478bd9Sstevel@tonic-gate 	char	p_msg;		/* control msg */
69*7c478bd9Sstevel@tonic-gate 	char	p_rmsg;		/* repeated control msg */
70*7c478bd9Sstevel@tonic-gate 	char	p_ps,p_pr;	/* last packet sent, recv'd */
71*7c478bd9Sstevel@tonic-gate 	char	p_rpr;
72*7c478bd9Sstevel@tonic-gate 	char	p_nxtps;	/* next output seq number */
73*7c478bd9Sstevel@tonic-gate 	char	p_imap;		/* bit map of input buffers */
74*7c478bd9Sstevel@tonic-gate 	char	p_pscopy;	/* newest output packet */
75*7c478bd9Sstevel@tonic-gate 	char	*p_ob[8];	/* output buffers */
76*7c478bd9Sstevel@tonic-gate 	char	*p_ib[8];	/* input buffers */
77*7c478bd9Sstevel@tonic-gate 	char	p_os[8];	/* output buffer status */
78*7c478bd9Sstevel@tonic-gate 	char	p_is[8];	/* input buffer status */
79*7c478bd9Sstevel@tonic-gate 	short	p_osum[8];	/* output checksums */
80*7c478bd9Sstevel@tonic-gate 	short	p_isum[8];	/* input checksums */
81*7c478bd9Sstevel@tonic-gate 	int	p_ifn, p_ofn;
82*7c478bd9Sstevel@tonic-gate };
83*7c478bd9Sstevel@tonic-gate #define	CHECK	0125252
84*7c478bd9Sstevel@tonic-gate #define	SYN	020
85*7c478bd9Sstevel@tonic-gate #define	MOD8	7
86*7c478bd9Sstevel@tonic-gate #define	ISCNTL(a)	((a & 0300)==0)
87*7c478bd9Sstevel@tonic-gate #ifndef MIN
88*7c478bd9Sstevel@tonic-gate #define	MIN(a,b)	((a<b)? a:b)
89*7c478bd9Sstevel@tonic-gate #endif
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate extern char	next[8];
92*7c478bd9Sstevel@tonic-gate extern char	mask[8];
93*7c478bd9Sstevel@tonic-gate extern int	npbits;
94*7c478bd9Sstevel@tonic-gate extern int	pkactive;
95*7c478bd9Sstevel@tonic-gate extern int	pkdebug;
96*7c478bd9Sstevel@tonic-gate extern int	pksizes[];
97*7c478bd9Sstevel@tonic-gate extern struct pack *Pk;
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate /*
100*7c478bd9Sstevel@tonic-gate  * driver state
101*7c478bd9Sstevel@tonic-gate  */
102*7c478bd9Sstevel@tonic-gate #define	DEAD	0
103*7c478bd9Sstevel@tonic-gate #define	INITa	1
104*7c478bd9Sstevel@tonic-gate #define	INITb	2
105*7c478bd9Sstevel@tonic-gate #define	INITab	3
106*7c478bd9Sstevel@tonic-gate #define	LIVE	010
107*7c478bd9Sstevel@tonic-gate #define	RXMIT	020
108*7c478bd9Sstevel@tonic-gate #define	RREJ	040
109*7c478bd9Sstevel@tonic-gate #define PDEBUG	0200
110*7c478bd9Sstevel@tonic-gate #define	DRAINO	0400
111*7c478bd9Sstevel@tonic-gate #define	WAITO	01000
112*7c478bd9Sstevel@tonic-gate #define	DOWN	02000
113*7c478bd9Sstevel@tonic-gate #define	RCLOSE	04000
114*7c478bd9Sstevel@tonic-gate #define	BADFRAME 020000
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate /*
117*7c478bd9Sstevel@tonic-gate  * io buffer states
118*7c478bd9Sstevel@tonic-gate  */
119*7c478bd9Sstevel@tonic-gate #define	B_NULL	0
120*7c478bd9Sstevel@tonic-gate #define	B_READY	1
121*7c478bd9Sstevel@tonic-gate #define	B_SENT	2
122*7c478bd9Sstevel@tonic-gate #define	B_RESID	010
123*7c478bd9Sstevel@tonic-gate #define	B_COPY	020
124*7c478bd9Sstevel@tonic-gate #define	B_MARK	040
125*7c478bd9Sstevel@tonic-gate #define	B_SHORT	0100
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate /*
128*7c478bd9Sstevel@tonic-gate  * control messages
129*7c478bd9Sstevel@tonic-gate  */
130*7c478bd9Sstevel@tonic-gate #define	CLOSE	1
131*7c478bd9Sstevel@tonic-gate #define	RJ	2
132*7c478bd9Sstevel@tonic-gate /* #define	SRJ	3 */	/* not supported */
133*7c478bd9Sstevel@tonic-gate #define	RR	4
134*7c478bd9Sstevel@tonic-gate #define	INITC	5
135*7c478bd9Sstevel@tonic-gate #define	INITB	6
136*7c478bd9Sstevel@tonic-gate #define	INITA	7
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate #define	M_RJ	4
139*7c478bd9Sstevel@tonic-gate /* #define	M_SRJ	010 */	/* not used */
140*7c478bd9Sstevel@tonic-gate #define	M_RR	020
141*7c478bd9Sstevel@tonic-gate #define	M_INITC	040
142*7c478bd9Sstevel@tonic-gate #define	M_CLOSE	2
143*7c478bd9Sstevel@tonic-gate #define	M_INITA	0200
144*7c478bd9Sstevel@tonic-gate #define	M_INITB	0100
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate /*
147*7c478bd9Sstevel@tonic-gate  * packet ioctl buf
148*7c478bd9Sstevel@tonic-gate  */
149*7c478bd9Sstevel@tonic-gate struct	piocb {
150*7c478bd9Sstevel@tonic-gate 	unsigned t;
151*7c478bd9Sstevel@tonic-gate 	short	psize;
152*7c478bd9Sstevel@tonic-gate 	short	mode;
153*7c478bd9Sstevel@tonic-gate 	short	state;
154*7c478bd9Sstevel@tonic-gate 	char	window;
155*7c478bd9Sstevel@tonic-gate };
156