snoop.h revision 77106
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 * $FreeBSD: head/sys/sys/snoop.h 77106 2001-05-24 00:43:44Z dd $ 16 */ 17 18#ifndef _SYS_SNOOP_H_ 19#define _SYS_SNOOP_H_ 20 21#ifndef _KERNEL 22#include <sys/types.h> 23#endif 24#include <sys/ioccom.h> 25 26#ifdef _KERNEL 27#define SNOOP_MINLEN (4*1024) /* This should be power of 2. 28 * 4K tested to be the minimum 29 * for which on normal tty 30 * usage there is no need to 31 * allocate more. 32 */ 33#define SNOOP_MAXLEN (64*1024) /* This one also,64K enough 34 * If we grow more,something 35 * really bad in this world.. 36 */ 37 38/* 39 * This is the main snoop per-device 40 * structure... 41 */ 42 43struct snoop { 44 dev_t snp_target; /* major/minor number of device*/ 45 struct tty *snp_tty; /* tty device pointer */ 46 u_long snp_len; /* buffer data length */ 47 u_long snp_base; /* buffer data base */ 48 u_long snp_blen; /* Overall buffer len */ 49 caddr_t snp_buf; /* Data buffer */ 50 int snp_flags; /* Flags place */ 51#define SNOOP_ASYNC 0x0002 52#define SNOOP_OPEN 0x0004 53#define SNOOP_RWAIT 0x0008 54#define SNOOP_OFLOW 0x0010 55#define SNOOP_DOWN 0x0020 56 struct selinfo snp_sel; /* Selection info */ 57 int snp_olddisc; /* Old line discipline */ 58}; 59 60/* XXX several wrong storage classes and types here. */ 61int snpdown __P((struct snoop *snp)); 62int snpin __P((struct snoop *snp, char *buf, int n)); 63int snpinc __P((struct snoop *snp, char c)); 64#endif /* _KERNEL */ 65 66/* 67 * Theese are snoop io controls 68 * SNPSTTY accepts 'struct snptty' as input. 69 * If ever type or unit set to -1,snoop device 70 * detached from its current tty. 71 */ 72 73#define SNPSTTY _IOW('T', 90, dev_t) 74#define SNPGTTY _IOR('T', 89, dev_t) 75 76/* 77 * Theese values would be returned by FIONREAD ioctl 78 * instead of number of characters in buffer in case 79 * of specific errors. 80 */ 81#define SNP_OFLOW -1 82#define SNP_TTYCLOSE -2 83#define SNP_DETACH -3 84 85#endif /* !_SYS_SNOOP_H_ */ 86