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