snoop.h revision 10624
1168404Spjd/* 2168404Spjd * Copyright (c) 1995 Ugen J.S.Antsilevich 3168404Spjd * 4168404Spjd * Redistribution and use in source forms, with and without modification, 5168404Spjd * are permitted provided that this entire comment appears intact. 6168404Spjd * 7168404Spjd * Redistribution in binary form may occur without any restrictions. 8168404Spjd * Obviously, it would be nice if you gave credit where credit is due 9168404Spjd * but requiring it would be too onerous. 10168404Spjd * 11168404Spjd * This software is provided ``AS IS'' without any warranties of any kind. 12168404Spjd * 13168404Spjd * Snoop stuff. 14168404Spjd */ 15168404Spjd 16168404Spjd#ifndef _SNOOP_H_ 17168404Spjd#define _SNOOP_H_ 18168404Spjd 19168404Spjd#define SNOOP_MINLEN (4*1024) /* This should be power of 2. 20168404Spjd * 4K tested to be the minimum 21168404Spjd * for which on normal tty 22168404Spjd * usage there is no need to 23219089Spjd * allocate more. 24249195Smm */ 25255750Sdelphij#define SNOOP_MAXLEN (64*1024) /* This one also,64K enough 26168404Spjd * If we grow more,something 27168404Spjd * really bad in this world.. 28168404Spjd */ 29168404Spjd 30168404Spjd/* 31255750Sdelphij * This is the main snoop per-device 32255750Sdelphij * structure... 33255750Sdelphij */ 34255750Sdelphij 35255750Sdelphijstruct snoop { 36168404Spjd dev_t snp_target; /* major/minor number of device*/ 37168404Spjd struct tty *snp_tty; /* tty device pointer */ 38168404Spjd u_long snp_len; /* buffer data length */ 39168404Spjd u_long snp_base; /* buffer data base */ 40255750Sdelphij u_long snp_blen; /* Overall buffer len */ 41168404Spjd caddr_t snp_buf; /* Data buffer */ 42168404Spjd int snp_flags; /* Flags place */ 43168404Spjd#define SNOOP_NBIO 0x0001 44168404Spjd#define SNOOP_ASYNC 0x0002 45219089Spjd#define SNOOP_OPEN 0x0004 46219089Spjd#define SNOOP_RWAIT 0x0008 47219089Spjd#define SNOOP_OFLOW 0x0010 48219089Spjd#define SNOOP_DOWN 0x0020 49219089Spjd struct selinfo snp_sel; /* Selection info */ 50219089Spjd}; 51219089Spjd 52219089Spjd/* 53168404Spjd * Theese are snoop io controls 54219089Spjd * SNPSTTY accepts 'struct snptty' as input. 55219089Spjd * If ever type or unit set to -1,snoop device 56219089Spjd * detached from it's current tty. 57219089Spjd */ 58219089Spjd 59219089Spjd#define SNPSTTY _IOW('T', 90, dev_t) 60219089Spjd#define SNPGTTY _IOR('T', 89, dev_t) 61219089Spjd 62219089Spjd/* 63219089Spjd * Theese values would be returned by FIONREAD ioctl 64219089Spjd * instead of number of characters in buffer in case 65219089Spjd * of specific errors. 66219089Spjd */ 67168404Spjd#define SNP_OFLOW -1 68168404Spjd#define SNP_TTYCLOSE -2 69168404Spjd#define SNP_DETACH -3 70251631Sdelphij 71168404Spjd#ifdef KERNEL 72168404Spjd/* XXX several wrong storage classes and types here. */ 73168404Spjdint snpclose __P((dev_t dev, int flags, int fmt, struct proc *p)); 74168404Spjdint snp_detach __P((struct snoop *snp)); 75168404Spjdint snpdown __P((struct snoop *snp)); 76168404Spjdint snpin __P((struct snoop *snp, char *buf, int n)); 77168404Spjdint snpinc __P((struct snoop *snp, char c)); 78168404Spjdint snpioctl __P((dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)); 79168404Spjdint snpopen __P((dev_t dev, int flag, int mode, struct proc *p)); 80168404Spjdint snpread __P((dev_t dev, struct uio *uio, int flag)); 81219089Spjdint snpselect __P((dev_t dev, int rw, struct proc *p)); 82219089Spjdint snpwrite __P((dev_t dev, struct uio *uio, int flag)); 83168404Spjd#endif /* KERNEL */ 84168404Spjd 85168404Spjd#endif /* _SNOOP_H_ */ 86168404Spjd