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