1/* $OpenBSD: ttycom.h,v 1.17 2018/06/16 13:55:03 deraadt Exp $ */ 2/* $NetBSD: ttycom.h,v 1.4 1996/05/19 17:17:53 jonathan Exp $ */ 3 4/*- 5 * Copyright (c) 1982, 1986, 1990, 1993, 1994 6 * The Regents of the University of California. All rights reserved. 7 * (c) UNIX System Laboratories, Inc. 8 * All or some portions of this file are derived from material licensed 9 * to the University of California by American Telephone and Telegraph 10 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 11 * the permission of UNIX System Laboratories, Inc. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. Neither the name of the University nor the names of its contributors 22 * may be used to endorse or promote products derived from this software 23 * without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * @(#)ttycom.h 8.1 (Berkeley) 3/28/94 38 */ 39 40#ifndef _SYS_TTYCOM_H_ 41#define _SYS_TTYCOM_H_ 42 43#include <sys/ioccom.h> 44 45/* Tty ioctl's. */ 46 47/* 48 * Window/terminal size structure. This information is stored by the kernel 49 * in order to provide a consistent interface, but is not used by the kernel. 50 */ 51struct winsize { 52 unsigned short ws_row; /* rows, in characters */ 53 unsigned short ws_col; /* columns, in characters */ 54 unsigned short ws_xpixel; /* horizontal size, pixels */ 55 unsigned short ws_ypixel; /* vertical size, pixels */ 56}; 57 58struct tstamps { 59 int ts_set; /* TIOCM_CAR and/or TIOCM_CTS */ 60 int ts_clr; 61}; 62 63#define TIOCM_LE 0001 /* line enable */ 64#define TIOCM_DTR 0002 /* data terminal ready */ 65#define TIOCM_RTS 0004 /* request to send */ 66#define TIOCM_ST 0010 /* secondary transmit */ 67#define TIOCM_SR 0020 /* secondary receive */ 68#define TIOCM_CTS 0040 /* clear to send */ 69#define TIOCM_CAR 0100 /* carrier detect */ 70#define TIOCM_CD TIOCM_CAR 71#define TIOCM_RNG 0200 /* ring */ 72#define TIOCM_RI TIOCM_RNG 73#define TIOCM_DSR 0400 /* data set ready */ 74 /* 8-10 compat */ 75#define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ 76#define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ 77 /* 15 unused */ 78#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */ 79 /* 17-18 compat */ 80#define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */ 81#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ 82#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ 83#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ 84#define TIOCGETD _IOR('t', 26, int) /* get line discipline */ 85#define TIOCSETD _IOW('t', 27, int) /* set line discipline */ 86#define TIOCSETVERAUTH _IOW('t', 28, int) /* set verified auth */ 87#define TIOCCLRVERAUTH _IO('t', 29) /* clear verified auth */ 88#define TIOCCHKVERAUTH _IO('t', 30) /* check verified auth */ 89 /* 127-124 compat */ 90#define TIOCSBRK _IO('t', 123) /* set break bit */ 91#define TIOCCBRK _IO('t', 122) /* clear break bit */ 92#define TIOCSDTR _IO('t', 121) /* set data terminal ready */ 93#define TIOCCDTR _IO('t', 120) /* clear data terminal ready */ 94#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ 95#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ 96 /* 117-116 compat */ 97#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ 98#define TIOCNOTTY _IO('t', 113) /* void tty association */ 99#define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ 100#define TIOCPKT_DATA 0x00 /* data packet */ 101#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ 102#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ 103#define TIOCPKT_STOP 0x04 /* stop output */ 104#define TIOCPKT_START 0x08 /* start output */ 105#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ 106#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ 107#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ 108#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ 109#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ 110#define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ 111#define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */ 112#define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */ 113#define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ 114#define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */ 115#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ 116#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ 117#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ 118#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ 119#define TIOCUCNTL_SBRK (TIOCSBRK & 0xff)/* set break bit, usr ctnl */ 120#define TIOCUCNTL_CBRK (TIOCCBRK & 0xff)/* clear break bit, usr ctnl */ 121#define TIOCSTAT _IO('t', 101) /* generate status message */ 122#define TIOCGSID _IOR('t', 99, int) /* get sid of tty */ 123#define TIOCCONS _IOW('t', 98, int) /* become virtual console */ 124#define TIOCSCTTY _IO('t', 97) /* become controlling tty */ 125#define TIOCEXT _IOW('t', 96, int) /* pty: external processing */ 126#define TIOCSIG _IOW('t', 95, int) /* pty: generate signal */ 127#define TIOCDRAIN _IO('t', 94) /* wait till output drained */ 128#define TIOCGFLAGS _IOR('t', 93, int) /* get device flags */ 129#define TIOCSFLAGS _IOW('t', 92, int) /* set device flags */ 130#define TIOCFLAG_SOFTCAR 0x01 /* ignore hardware carrier */ 131#define TIOCFLAG_CLOCAL 0x02 /* set clocal on open */ 132#define TIOCFLAG_CRTSCTS 0x04 /* set crtscts on open */ 133#define TIOCFLAG_MDMBUF 0x08 /* set mdmbuf on open */ 134#define TIOCFLAG_PPS 0x10 /* call hardpps on carrier up */ 135#define TIOCGTSTAMP _IOR('t', 91, struct timeval) /* get timestamp */ 136#define TIOCSTSTAMP _IOW('t', 90, struct tstamps) /* timestamp reasons */ 137 138/* Backwards compatibility */ 139#define TIOCMODG TIOCMGET 140#define TIOCMODS TIOCMSET 141 142#define TTYDISC 0 /* termios tty line discipline */ 143#define TABLDISC 3 /* tablet discipline */ 144#define SLIPDISC 4 /* serial IP discipline */ 145#define PPPDISC 5 /* ppp discipline */ 146#define STRIPDISC 6 /* metricom wireless IP discipline */ 147#define NMEADISC 7 /* NMEA0183 discipline */ 148#define MSTSDISC 8 /* Meinberg time string discipline */ 149#define ENDRUNDISC 9 /* EndRun time format discipline */ 150 151#endif /* !_SYS_TTYCOM_H_ */ 152