xref: /original-bsd/usr.bin/uucp/uucico/pk.h (revision c3e32dec)
1 /*-
2  * Copyright (c) 1985, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  *
7  *	@(#)pk.h	8.1 (Berkeley) 06/06/93
8  */
9 
10 struct header {
11 	char	sync;
12 	char	ksize;
13 	unsigned short sum;
14 	char	cntl;
15 	char	ccntl;
16 };
17 
18 #define	HDRSIZ		6	/* Packet header size */
19 #define	PACKSIZE	64	/* Standard packet size */
20 #define WINDOWS		7	/* number of outstanding un-ack'd packets */
21 
22 struct pack {
23 	short	p_state;	/* line state */
24 	short	p_bits;		/* mask for getepack */
25 	short	p_rsize;	/* input packet size */
26 	short	p_xsize;	/* output packet size */
27 	struct	header p_ihbuf;	/* input header */
28 	struct	header p_ohbuf; /* output header */
29 	char	*p_rptr;
30 	char	**p_ipool;
31 	char	p_xcount;	/* # active output buffers */
32 	char	p_rcount;
33 	char	p_lpsize;	/* log(psize/32) */
34 	char	p_obusy;	/* output busy? for reentrant pkoutput() */
35 	char	p_srxmit;
36 	char	p_rwindow;	/* window size */
37 	char	p_swindow;
38 	char	p_msg;		/* control msg */
39 	char	p_rmsg;		/* repeated control msg */
40 	char	p_ps,p_pr;	/* last packet sent, recv'd */
41 	char	p_rpr;
42 	char	p_nxtps;	/* next output seq number */
43 	char	p_imap;		/* bit map of input buffers */
44 	char	p_pscopy;	/* newest output packet */
45 	char	*p_ob[8];	/* output buffers */
46 	char	*p_ib[8];	/* input buffers */
47 	char	p_os[8];	/* output buffer status */
48 	char	p_is[8];	/* input buffer status */
49 	short	p_osum[8];	/* output checksums */
50 	short	p_isum[8];	/* input checksums */
51 	int p_ifn, p_ofn;
52 };
53 
54 #define	CHECK	0125252
55 #define	SYN	020
56 #define	MOD8	7
57 #define	ISCNTL(a)	((a & 0300)==0)
58 /* MIN may have been defined in <sys/param.h> */
59 #undef	MIN
60 #define	MIN(a,b)	((a<b)? a:b)
61 
62 extern char	next[8];
63 extern char	mask[8];
64 
65 /*
66  * driver state
67  */
68 #define	DEAD	0
69 #define	INITa	1
70 #define	INITb	2
71 #define	INITab	3
72 #define	LIVE	010
73 #define	RXMIT	020
74 #define	RREJ	040
75 #define PDEBUG	0200
76 #define	DRAINO	0400
77 #define	WAITO	01000
78 #define	DOWN	02000
79 #define	RCLOSE	04000
80 #define	BADFRAME 020000
81 
82 /*
83  * io buffer states
84  */
85 #define	B_NULL	0
86 #define	B_READY	1
87 #define	B_SENT	2
88 #define	B_RESID	010
89 #define	B_COPY	020
90 #define	B_MARK	040
91 #define	B_SHORT	0100
92 
93 /* read or write */
94 
95 #define B_WRITE	0
96 #define B_READ	1
97 
98 /*
99  * control messages
100  */
101 #define	CLOSE	1
102 #define	RJ	2
103 #define	SRJ	3
104 #define	RR	4
105 #define	INITC	5
106 #define	INITB	6
107 #define	INITA	7
108 
109 #define	M_CLOSE	002
110 #define	M_RJ	004
111 #define	M_SRJ	010
112 #define	M_RR	020
113 #define	M_INITC	040
114 #define	M_INITA	0200
115 #define	M_INITB	0100
116 
117 #define	NPLINES	2
118 
119 extern int pksizes[];
120