snoop.h revision 6453
1/*
2 * Copyright (c) 1995 Ugen J.S.Antsilevich
3 *
4 * Redistribution and use in source forms, with and without modification,
5 * are permitted provided that this entire comment appears intact.
6 *
7 * Redistribution in binary form may occur without any restrictions.
8 * Obviously, it would be nice if you gave credit where credit is due
9 * but requiring it would be too onerous.
10 *
11 * This software is provided ``AS IS'' without any warranties of any kind.
12 *
13 * Snoop stuff.
14 */
15
16#ifndef SNOOP_H
17#define SNOOP_H
18
19#define SNOOP_MINLEN		(4*1024)	/* This should be power of 2.
20						 * 4K tested to be the minimum
21						 * for which on normal tty
22						 * usage there is no need to
23						 * allocate more.
24						 */
25#define SNOOP_MAXLEN		(64*1024)	/* This one also,64K enough
26						 * If we grow more,something
27						 * really bad in this world..
28						 */
29
30/*
31 * This is the main snoop per-device
32 * structure...
33 */
34
35struct snoop {
36	int	snp_unit;		/* Pty unit number to snoop on */
37	int	snp_type;		/* Type same as st_type later  */
38	u_long 	snp_len,snp_base;	/* Buffer data len and base    */
39	u_long	snp_blen;		/* Overall buffer len	       */
40	char	*snp_buf;		/* Data buffer		       */
41	int 	snp_flags;		/* Flags place		       */
42#define SNOOP_NBIO		0x0001
43#define SNOOP_ASYNC		0x0002
44#define SNOOP_OPEN		0x0004
45#define SNOOP_RWAIT		0x0008
46#define SNOOP_OFLOW		0x0010
47#define SNOOP_DOWN		0x0020
48	struct selinfo	snp_sel;	/* Selection info	       */
49};
50
51
52
53/*
54 * This is structure to be passed
55 * to ioctl() so we can define different
56 * types of tty's..
57 */
58struct snptty {
59	int	st_unit;
60	int	st_type;
61#define ST_PTY		0	/* Regular Pty       */
62#define	ST_VTY		1	/* Vty for SysCons.. */
63#define ST_SIO		2	/* Serial lines	     */
64#define ST_MAXTYPE	2
65};
66
67/*
68 * Theese are snoop io controls
69 * SNPSTTY accepts 'struct snptty' as input.
70 * If ever type or  unit set to -1,snoop device
71 * detached from it's current tty.
72 */
73
74#define SNPSTTY       _IOW('T', 90, struct snptty)
75#define SNPGTTY       _IOR('T', 89, struct snptty)
76
77/*
78 * Theese values would be returned by FIONREAD ioctl
79 * instead of number of characters in buffer in case
80 * of specific errors.
81 */
82#define SNP_OFLOW		-1
83#define SNP_TTYCLOSE		-2
84#define SNP_DETACH		-3
85
86#endif
87
88