aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/snoop.h
blob: 3790b0006a67e700740ae3e3a21fed1d601bd635 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * Copyright (c) 1995 Ugen J.S.Antsilevich
 *
 * Redistribution and use in source forms, with and without modification,
 * are permitted provided that this entire comment appears intact.
 *
 * Redistribution in binary form may occur without any restrictions.
 * Obviously, it would be nice if you gave credit where credit is due
 * but requiring it would be too onerous.
 *
 * This software is provided ``AS IS'' without any warranties of any kind.
 *
 * Snoop stuff.
 */

#ifndef SNOOP_H
#define SNOOP_H		

#define SNOOP_MINLEN		(4*1024)	/* This should be power of 2.
						 * 4K tested to be the minimum
						 * for which on normal tty
						 * usage there is no need to
						 * allocate more.
						 */
#define SNOOP_MAXLEN		(64*1024)	/* This one also,64K enough 
						 * If we grow more,something
						 * really bad in this world..
						 */

/*
 * This is the main snoop per-device 
 * structure...
 */

struct snoop {
	int	snp_unit;		/* Pty unit number to snoop on */
	int	snp_type;		/* Type same as st_type later  */
	u_long 	snp_len,snp_base;	/* Buffer data len and base    */
	u_long	snp_blen;		/* Overall buffer len	       */
	char	*snp_buf;		/* Data buffer		       */
	int 	snp_flags;		/* Flags place		       */
#define SNOOP_NBIO		0x0001
#define SNOOP_ASYNC		0x0002
#define SNOOP_OPEN		0x0004
#define SNOOP_RWAIT		0x0008
#define SNOOP_OFLOW		0x0010
#define SNOOP_DOWN		0x0020
	struct selinfo	snp_sel;	/* Selection info	       */
};



/*
 * This is structure to be passed
 * to ioctl() so we can define different
 * types of tty's..
 */
struct snptty {
	int	st_unit;
	int	st_type;
#define ST_PTY		0	/* Regular Pty       */
#define	ST_VTY		1	/* Vty for SysCons.. */
#define ST_SIO		2	/* Serial lines	     */
#define ST_MAXTYPE	2
};

/*
 * Theese are snoop io controls
 * SNPSTTY accepts 'struct snptty' as input.
 * If ever type or  unit set to -1,snoop device
 * detached from it's current tty.
 */

#define SNPSTTY       _IOW('T', 90, struct snptty)
#define SNPGTTY       _IOR('T', 89, struct snptty)

/*
 * Theese values would be returned by FIONREAD ioctl
 * instead of number of characters in buffer in case
 * of specific errors.
 */
#define SNP_OFLOW		-1
#define SNP_TTYCLOSE		-2
#define SNP_DETACH		-3

#endif