1 /* ttyproto.h - define protocol used by ttysrv and its clients
2  * vix 29may91 [written]
3  *
4  * $Id: ttyprot.h,v 1.9 2001/03/24 21:14:31 vixie Exp $
5  */
6 
7 /* Copyright (c) 1996 by Internet Software Consortium.
8  *
9  * Permission to use, copy, modify, and distribute this software for any
10  * purpose with or without fee is hereby granted, provided that the above
11  * copyright notice and this permission notice appear in all copies.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
14  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
16  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
17  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
18  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20  * SOFTWARE.
21  */
22 
23 #include <termios.h>
24 #ifdef NEED_BITYPES_H
25 # include "bitypes.h"
26 #endif
27 
28 #define TP_TYPEMASK	0x00ff
29 #define	TP_DATA		0x0001	/* inband data (query=ignored) */
30 #define	TP_BAUD		0x0002
31 #define	TP_PARITY	0x0003
32 #define	TP_WORDSIZE	0x0004
33 #define	TP_BREAK	0x0005	/* send break (query=ignored) */
34 #define	TP_WHOSON	0x0006	/* who's connected to this tty? (set=="me") */
35 #define	TP_TAIL		0x0007	/* what's happened recently? (set==ignored) */
36 #define	TP_NOTICE	0x0008	/* same as DATA but generated by server */
37 #define	TP_VERSION	0x0009	/* what's your version number? (set==ignore) */
38 #define	TP_LOGIN	0x000a
39 #define	TP_PASSWD	0x000b	/* query's "i" field is the salt (netorder) */
40 
41 #define	TP_OPTIONMASK	0xff00
42 #define TP_QUERY	0x0100
43 
44 #define	TP_FIXED	(sizeof(u_int16_t) + sizeof(u_int16_t))
45 #define	TP_MAXVAR	468	/* 512 - 40 - TP_FIXED */
46 
47 typedef struct ttyprot {
48 	u_int16_t	f;
49 	u_int16_t	i;
50 	u_char		c[TP_MAXVAR];
51 } ttyprot;
52 
53 int tp_senddata(int, const u_char *, int, int);
54 int tp_sendctl(int, u_int, u_int, u_char *);
55 int tp_getdata(int, ttyprot *);
56