xref: /titanic_44/usr/src/cmd/bnu/pk.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 
31*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #define OLDPACKSIZE	128
34*7c478bd9Sstevel@tonic-gate 
35*7c478bd9Sstevel@tonic-gate #define	PACKSIZE	64
36*7c478bd9Sstevel@tonic-gate #define MINPACKSIZE	32
37*7c478bd9Sstevel@tonic-gate #define MAXPACKSIZE   4096
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #define	WINDOWS		7
40*7c478bd9Sstevel@tonic-gate #define	MINWINDOWS	1
41*7c478bd9Sstevel@tonic-gate #define	MAXWINDOWS	7
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate struct header {
45*7c478bd9Sstevel@tonic-gate 	char	sync;
46*7c478bd9Sstevel@tonic-gate 	char	ksize;
47*7c478bd9Sstevel@tonic-gate 	unsigned short sum;
48*7c478bd9Sstevel@tonic-gate 	char	cntl;
49*7c478bd9Sstevel@tonic-gate 	char	ccntl;
50*7c478bd9Sstevel@tonic-gate };
51*7c478bd9Sstevel@tonic-gate #define	HDRSIZ	6
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate struct pack {
54*7c478bd9Sstevel@tonic-gate 	short	p_state;	/* line state */
55*7c478bd9Sstevel@tonic-gate 	short	p_bits;		/* mask for getepack */
56*7c478bd9Sstevel@tonic-gate 	short	p_rsize;	/* input packet size */
57*7c478bd9Sstevel@tonic-gate 	short	p_xsize;	/* output packet size */
58*7c478bd9Sstevel@tonic-gate 	struct	header p_ihbuf;	/* input header */
59*7c478bd9Sstevel@tonic-gate 	struct	header p_ohbuf; /* output header */
60*7c478bd9Sstevel@tonic-gate 	char	*p_rptr;
61*7c478bd9Sstevel@tonic-gate 	char	**p_ipool;
62*7c478bd9Sstevel@tonic-gate 	char	p_xcount;	/* # active output buffers */
63*7c478bd9Sstevel@tonic-gate 	char	p_rcount;
64*7c478bd9Sstevel@tonic-gate 	char	p_nout,p_tout;
65*7c478bd9Sstevel@tonic-gate 	char	p_lpsize;	/* log(psize/32) */
66*7c478bd9Sstevel@tonic-gate 	char	p_timer;
67*7c478bd9Sstevel@tonic-gate 	char	p_obusy;
68*7c478bd9Sstevel@tonic-gate 	char	p_srxmit;
69*7c478bd9Sstevel@tonic-gate 	char	p_rwindow;	/* window size */
70*7c478bd9Sstevel@tonic-gate 	char	p_swindow;
71*7c478bd9Sstevel@tonic-gate 	char	p_msg;		/* control msg */
72*7c478bd9Sstevel@tonic-gate 	char	p_rmsg;		/* repeated control msg */
73*7c478bd9Sstevel@tonic-gate 	char	p_ps,p_pr;	/* last packet sent, recv'd */
74*7c478bd9Sstevel@tonic-gate 	char	p_rpr;
75*7c478bd9Sstevel@tonic-gate 	char	p_nxtps;	/* next output seq number */
76*7c478bd9Sstevel@tonic-gate 	char	p_imap;		/* bit map of input buffers */
77*7c478bd9Sstevel@tonic-gate 	char	p_pscopy;	/* newest output packet */
78*7c478bd9Sstevel@tonic-gate 	char	*p_ob[8];	/* output buffers */
79*7c478bd9Sstevel@tonic-gate 	char	*p_ib[8];	/* input buffers */
80*7c478bd9Sstevel@tonic-gate 	char	p_os[8];	/* output buffer status */
81*7c478bd9Sstevel@tonic-gate 	char	p_is[8];	/* input buffer status */
82*7c478bd9Sstevel@tonic-gate 	short	p_osum[8];	/* output checksums */
83*7c478bd9Sstevel@tonic-gate 	short	p_isum[8];	/* input checksums */
84*7c478bd9Sstevel@tonic-gate 	int	p_ifn, p_ofn;
85*7c478bd9Sstevel@tonic-gate };
86*7c478bd9Sstevel@tonic-gate #define	CHECK	0125252
87*7c478bd9Sstevel@tonic-gate #define	SYN	020
88*7c478bd9Sstevel@tonic-gate #define	MOD8	7
89*7c478bd9Sstevel@tonic-gate #define	ISCNTL(a)	((a & 0300)==0)
90*7c478bd9Sstevel@tonic-gate #ifndef MIN
91*7c478bd9Sstevel@tonic-gate #define	MIN(a,b)	((a<b)? a:b)
92*7c478bd9Sstevel@tonic-gate #endif
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate extern char	next[8];
95*7c478bd9Sstevel@tonic-gate extern char	mask[8];
96*7c478bd9Sstevel@tonic-gate extern int	npbits;
97*7c478bd9Sstevel@tonic-gate extern int	pkactive;
98*7c478bd9Sstevel@tonic-gate extern int	pkdebug;
99*7c478bd9Sstevel@tonic-gate extern int	pksizes[];
100*7c478bd9Sstevel@tonic-gate extern struct pack *Pk;
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate /*
103*7c478bd9Sstevel@tonic-gate  * driver state
104*7c478bd9Sstevel@tonic-gate  */
105*7c478bd9Sstevel@tonic-gate #define	DEAD	0
106*7c478bd9Sstevel@tonic-gate #define	INITa	1
107*7c478bd9Sstevel@tonic-gate #define	INITb	2
108*7c478bd9Sstevel@tonic-gate #define	INITab	3
109*7c478bd9Sstevel@tonic-gate #define	LIVE	010
110*7c478bd9Sstevel@tonic-gate #define	RXMIT	020
111*7c478bd9Sstevel@tonic-gate #define	RREJ	040
112*7c478bd9Sstevel@tonic-gate #define PDEBUG	0200
113*7c478bd9Sstevel@tonic-gate #define	DRAINO	0400
114*7c478bd9Sstevel@tonic-gate #define	WAITO	01000
115*7c478bd9Sstevel@tonic-gate #define	DOWN	02000
116*7c478bd9Sstevel@tonic-gate #define	RCLOSE	04000
117*7c478bd9Sstevel@tonic-gate #define	BADFRAME 020000
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate /*
120*7c478bd9Sstevel@tonic-gate  * io buffer states
121*7c478bd9Sstevel@tonic-gate  */
122*7c478bd9Sstevel@tonic-gate #define	B_NULL	0
123*7c478bd9Sstevel@tonic-gate #define	B_READY	1
124*7c478bd9Sstevel@tonic-gate #define	B_SENT	2
125*7c478bd9Sstevel@tonic-gate #define	B_RESID	010
126*7c478bd9Sstevel@tonic-gate #define	B_COPY	020
127*7c478bd9Sstevel@tonic-gate #define	B_MARK	040
128*7c478bd9Sstevel@tonic-gate #define	B_SHORT	0100
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate /*
131*7c478bd9Sstevel@tonic-gate  * control messages
132*7c478bd9Sstevel@tonic-gate  */
133*7c478bd9Sstevel@tonic-gate #define	CLOSE	1
134*7c478bd9Sstevel@tonic-gate #define	RJ	2
135*7c478bd9Sstevel@tonic-gate /* #define	SRJ	3 */	/* not supported */
136*7c478bd9Sstevel@tonic-gate #define	RR	4
137*7c478bd9Sstevel@tonic-gate #define	INITC	5
138*7c478bd9Sstevel@tonic-gate #define	INITB	6
139*7c478bd9Sstevel@tonic-gate #define	INITA	7
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate #define	M_RJ	4
142*7c478bd9Sstevel@tonic-gate /* #define	M_SRJ	010 */	/* not used */
143*7c478bd9Sstevel@tonic-gate #define	M_RR	020
144*7c478bd9Sstevel@tonic-gate #define	M_INITC	040
145*7c478bd9Sstevel@tonic-gate #define	M_CLOSE	2
146*7c478bd9Sstevel@tonic-gate #define	M_INITA	0200
147*7c478bd9Sstevel@tonic-gate #define	M_INITB	0100
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate /*
150*7c478bd9Sstevel@tonic-gate  * packet ioctl buf
151*7c478bd9Sstevel@tonic-gate  */
152*7c478bd9Sstevel@tonic-gate struct	piocb {
153*7c478bd9Sstevel@tonic-gate 	unsigned t;
154*7c478bd9Sstevel@tonic-gate 	short	psize;
155*7c478bd9Sstevel@tonic-gate 	short	mode;
156*7c478bd9Sstevel@tonic-gate 	short	state;
157*7c478bd9Sstevel@tonic-gate 	char	window;
158*7c478bd9Sstevel@tonic-gate };
159