xref: /csrg-svn/usr.bin/uucp/uucico/pk.h (revision 62391)
148664Sbostic /*-
2*62391Sbostic  * Copyright (c) 1985, 1993
3*62391Sbostic  *	The Regents of the University of California.  All rights reserved.
448664Sbostic  *
548664Sbostic  * %sccs.include.proprietary.c%
648664Sbostic  *
7*62391Sbostic  *	@(#)pk.h	8.1 (Berkeley) 06/06/93
848664Sbostic  */
913630Ssam 
1013630Ssam struct header {
1113630Ssam 	char	sync;
1213630Ssam 	char	ksize;
1313630Ssam 	unsigned short sum;
1413630Ssam 	char	cntl;
1513630Ssam 	char	ccntl;
1613630Ssam };
1717848Sralph 
1825706Sbloom #define	HDRSIZ		6	/* Packet header size */
1925706Sbloom #define	PACKSIZE	64	/* Standard packet size */
2033954Srick #define WINDOWS		7	/* number of outstanding un-ack'd packets */
2113630Ssam 
2213630Ssam struct pack {
2313630Ssam 	short	p_state;	/* line state */
2413630Ssam 	short	p_bits;		/* mask for getepack */
2513630Ssam 	short	p_rsize;	/* input packet size */
2613630Ssam 	short	p_xsize;	/* output packet size */
2713630Ssam 	struct	header p_ihbuf;	/* input header */
2813630Ssam 	struct	header p_ohbuf; /* output header */
2913630Ssam 	char	*p_rptr;
3013630Ssam 	char	**p_ipool;
3113630Ssam 	char	p_xcount;	/* # active output buffers */
3213630Ssam 	char	p_rcount;
3313630Ssam 	char	p_lpsize;	/* log(psize/32) */
3433567Srick 	char	p_obusy;	/* output busy? for reentrant pkoutput() */
3513630Ssam 	char	p_srxmit;
3613630Ssam 	char	p_rwindow;	/* window size */
3713630Ssam 	char	p_swindow;
3813630Ssam 	char	p_msg;		/* control msg */
3913630Ssam 	char	p_rmsg;		/* repeated control msg */
4013630Ssam 	char	p_ps,p_pr;	/* last packet sent, recv'd */
4113630Ssam 	char	p_rpr;
4213630Ssam 	char	p_nxtps;	/* next output seq number */
4313630Ssam 	char	p_imap;		/* bit map of input buffers */
4413630Ssam 	char	p_pscopy;	/* newest output packet */
4513630Ssam 	char	*p_ob[8];	/* output buffers */
4613630Ssam 	char	*p_ib[8];	/* input buffers */
4713630Ssam 	char	p_os[8];	/* output buffer status */
4813630Ssam 	char	p_is[8];	/* input buffer status */
4913630Ssam 	short	p_osum[8];	/* output checksums */
5013630Ssam 	short	p_isum[8];	/* input checksums */
5117848Sralph 	int p_ifn, p_ofn;
5213630Ssam };
5317848Sralph 
5413630Ssam #define	CHECK	0125252
5513630Ssam #define	SYN	020
5613630Ssam #define	MOD8	7
5713630Ssam #define	ISCNTL(a)	((a & 0300)==0)
5813630Ssam /* MIN may have been defined in <sys/param.h> */
5913630Ssam #undef	MIN
6013630Ssam #define	MIN(a,b)	((a<b)? a:b)
6113630Ssam 
6213630Ssam extern char	next[8];
6313630Ssam extern char	mask[8];
6413630Ssam 
6513630Ssam /*
6613630Ssam  * driver state
6713630Ssam  */
6813630Ssam #define	DEAD	0
6913630Ssam #define	INITa	1
7013630Ssam #define	INITb	2
7113630Ssam #define	INITab	3
7213630Ssam #define	LIVE	010
7313630Ssam #define	RXMIT	020
7413630Ssam #define	RREJ	040
7513630Ssam #define PDEBUG	0200
7613630Ssam #define	DRAINO	0400
7713630Ssam #define	WAITO	01000
7813630Ssam #define	DOWN	02000
7913630Ssam #define	RCLOSE	04000
8013630Ssam #define	BADFRAME 020000
8113630Ssam 
8213630Ssam /*
8313630Ssam  * io buffer states
8413630Ssam  */
8513630Ssam #define	B_NULL	0
8613630Ssam #define	B_READY	1
8713630Ssam #define	B_SENT	2
8813630Ssam #define	B_RESID	010
8913630Ssam #define	B_COPY	020
9013630Ssam #define	B_MARK	040
9113630Ssam #define	B_SHORT	0100
9213630Ssam 
9318620Sralph /* read or write */
9418620Sralph 
9518620Sralph #define B_WRITE	0
9618620Sralph #define B_READ	1
9718620Sralph 
9813630Ssam /*
9913630Ssam  * control messages
10013630Ssam  */
10113630Ssam #define	CLOSE	1
10213630Ssam #define	RJ	2
10313630Ssam #define	SRJ	3
10413630Ssam #define	RR	4
10513630Ssam #define	INITC	5
10613630Ssam #define	INITB	6
10713630Ssam #define	INITA	7
10813630Ssam 
10925706Sbloom #define	M_CLOSE	002
11025706Sbloom #define	M_RJ	004
11113630Ssam #define	M_SRJ	010
11213630Ssam #define	M_RR	020
11313630Ssam #define	M_INITC	040
11413630Ssam #define	M_INITA	0200
11513630Ssam #define	M_INITB	0100
11613630Ssam 
11733954Srick #define	NPLINES	2
11813630Ssam 
11913630Ssam extern int pksizes[];
120