11541Srgrimes/*-
21541Srgrimes * Copyright (c) 1982, 1986, 1990, 1993, 1994
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes * (c) UNIX System Laboratories, Inc.
51541Srgrimes * All or some portions of this file are derived from material licensed
61541Srgrimes * to the University of California by American Telephone and Telegraph
71541Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81541Srgrimes * the permission of UNIX System Laboratories, Inc.
91541Srgrimes *
101541Srgrimes * Redistribution and use in source and binary forms, with or without
111541Srgrimes * modification, are permitted provided that the following conditions
121541Srgrimes * are met:
131541Srgrimes * 1. Redistributions of source code must retain the above copyright
141541Srgrimes *    notice, this list of conditions and the following disclaimer.
151541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161541Srgrimes *    notice, this list of conditions and the following disclaimer in the
171541Srgrimes *    documentation and/or other materials provided with the distribution.
181541Srgrimes * 4. Neither the name of the University nor the names of its contributors
191541Srgrimes *    may be used to endorse or promote products derived from this software
201541Srgrimes *    without specific prior written permission.
211541Srgrimes *
221541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321541Srgrimes * SUCH DAMAGE.
331541Srgrimes *
341541Srgrimes *	@(#)ttycom.h	8.1 (Berkeley) 3/28/94
3550477Speter * $FreeBSD$
361541Srgrimes */
371541Srgrimes
381541Srgrimes#ifndef	_SYS_TTYCOM_H_
391541Srgrimes#define	_SYS_TTYCOM_H_
401541Srgrimes
411541Srgrimes#include <sys/ioccom.h>
421541Srgrimes
431541Srgrimes/*
441541Srgrimes * Tty ioctl's except for those supported only for backwards compatibility
451541Srgrimes * with the old tty driver.
461541Srgrimes */
471541Srgrimes
481541Srgrimes/*
491541Srgrimes * Window/terminal size structure.  This information is stored by the kernel
501541Srgrimes * in order to provide a consistent interface, but is not used by the kernel.
511541Srgrimes */
521541Srgrimesstruct winsize {
531541Srgrimes	unsigned short	ws_row;		/* rows, in characters */
541541Srgrimes	unsigned short	ws_col;		/* columns, in characters */
551541Srgrimes	unsigned short	ws_xpixel;	/* horizontal size, pixels */
561541Srgrimes	unsigned short	ws_ypixel;	/* vertical size, pixels */
571541Srgrimes};
581541Srgrimes
59125451Sbde						/* 0-2 compat */
60196884Sed						/* 3-7 unused */
611541Srgrimes						/* 8-10 compat */
62196884Sed						/* 11-12 unused */
631541Srgrimes#define	TIOCEXCL	 _IO('t', 13)		/* set exclusive use of tty */
641541Srgrimes#define	TIOCNXCL	 _IO('t', 14)		/* reset exclusive use of tty */
65154833Scognet#define	TIOCGPTN	_IOR('t', 15, int)	/* Get pts number. */
661541Srgrimes#define	TIOCFLUSH	_IOW('t', 16, int)	/* flush buffers */
671541Srgrimes						/* 17-18 compat */
681541Srgrimes#define	TIOCGETA	_IOR('t', 19, struct termios) /* get termios struct */
691541Srgrimes#define	TIOCSETA	_IOW('t', 20, struct termios) /* set termios struct */
701541Srgrimes#define	TIOCSETAW	_IOW('t', 21, struct termios) /* drain output, set */
711541Srgrimes#define	TIOCSETAF	_IOW('t', 22, struct termios) /* drn out, fls in, set */
72196884Sed						/* 23-25 unused */
731541Srgrimes#define	TIOCGETD	_IOR('t', 26, int)	/* get line discipline */
741541Srgrimes#define	TIOCSETD	_IOW('t', 27, int)	/* set line discipline */
75181905Sed#define	TIOCPTMASTER	 _IO('t', 28)		/* pts master validation */
76196884Sed						/* 29-85 unused */
77180560Sed#define	TIOCGDRAINWAIT	_IOR('t', 86, int)	/* get ttywait timeout */
78180560Sed#define	TIOCSDRAINWAIT	_IOW('t', 87, int)	/* set ttywait timeout */
79196884Sed						/* 88 unused */
80196884Sed						/* 89-91 conflicts: tun and tap */
81180560Sed#define	TIOCTIMESTAMP	_IOR('t', 89, struct timeval)	/* enable/get timestamp
82180560Sed						 * of last input event */
83180560Sed#define	TIOCMGDTRWAIT	_IOR('t', 90, int)	/* modem: get wait on close */
84180560Sed#define	TIOCMSDTRWAIT	_IOW('t', 91, int)	/* modem: set wait on close */
85196884Sed						/* 92-93 tun and tap */
86196884Sed						/* 94-97 conflicts: tun and tap */
87180560Sed#define	TIOCDRAIN	 _IO('t', 94)		/* wait till output drained */
88180560Sed#define	TIOCSIG		_IOWINT('t', 95)	/* pty: generate signal */
89180560Sed#define	TIOCEXT		_IOW('t', 96, int)	/* pty: external processing */
90180560Sed#define	TIOCSCTTY	 _IO('t', 97)		/* become controlling tty */
91180560Sed#define	TIOCCONS	_IOW('t', 98, int)	/* become virtual console */
92180560Sed#define	TIOCGSID	_IOR('t', 99, int)	/* get session id */
93196884Sed						/* 100 unused */
94180560Sed#define	TIOCSTAT	 _IO('t', 101)		/* simulate ^T status message */
95180560Sed#define	TIOCUCNTL	_IOW('t', 102, int)	/* pty: set/clr usr cntl mode */
96180560Sed#define		UIOCCMD(n)	_IO('u', n)	/* usr cntl op "n" */
97180560Sed#define	TIOCSWINSZ	_IOW('t', 103, struct winsize)	/* set window size */
98180560Sed#define	TIOCGWINSZ	_IOR('t', 104, struct winsize)	/* get window size */
99196884Sed						/* 105 unused */
1001541Srgrimes#define	TIOCMGET	_IOR('t', 106, int)	/* get all modem bits */
101125451Sbde#define		TIOCM_LE	0001		/* line enable */
102125451Sbde#define		TIOCM_DTR	0002		/* data terminal ready */
103125451Sbde#define		TIOCM_RTS	0004		/* request to send */
104125451Sbde#define		TIOCM_ST	0010		/* secondary transmit */
105125451Sbde#define		TIOCM_SR	0020		/* secondary receive */
106125451Sbde#define		TIOCM_CTS	0040		/* clear to send */
107131044Sphk#define		TIOCM_DCD	0100		/* data carrier detect */
108231095Sed#define		TIOCM_RI	0200		/* ring indicate */
109125451Sbde#define		TIOCM_DSR	0400		/* data set ready */
110131044Sphk#define		TIOCM_CD	TIOCM_DCD
111131044Sphk#define		TIOCM_CAR	TIOCM_DCD
112131044Sphk#define		TIOCM_RNG	TIOCM_RI
113180560Sed#define	TIOCMBIC	_IOW('t', 107, int)	/* bic modem bits */
114180560Sed#define	TIOCMBIS	_IOW('t', 108, int)	/* bis modem bits */
115180560Sed#define	TIOCMSET	_IOW('t', 109, int)	/* set all modem bits */
116180560Sed#define	TIOCSTART	 _IO('t', 110)		/* start output, like ^Q */
117180560Sed#define	TIOCSTOP	 _IO('t', 111)		/* stop output, like ^S */
118180560Sed#define	TIOCPKT		_IOW('t', 112, int)	/* pty: set/clear packet mode */
119180560Sed#define		TIOCPKT_DATA		0x00	/* data packet */
120180560Sed#define		TIOCPKT_FLUSHREAD	0x01	/* flush packet */
121180560Sed#define		TIOCPKT_FLUSHWRITE	0x02	/* flush packet */
122180560Sed#define		TIOCPKT_STOP		0x04	/* stop output */
123180560Sed#define		TIOCPKT_START		0x08	/* start output */
124180560Sed#define		TIOCPKT_NOSTOP		0x10	/* no more ^S, ^Q */
125180560Sed#define		TIOCPKT_DOSTOP		0x20	/* now do ^S ^Q */
126180560Sed#define		TIOCPKT_IOCTL		0x40	/* state change of pty driver */
127180560Sed#define	TIOCNOTTY	 _IO('t', 113)		/* void tty association */
128180560Sed#define	TIOCSTI		_IOW('t', 114, char)	/* simulate terminal input */
129180560Sed#define	TIOCOUTQ	_IOR('t', 115, int)	/* output queue size */
130180560Sed						/* 116-117 compat */
131180560Sed#define	TIOCSPGRP	_IOW('t', 118, int)	/* set pgrp of tty */
132180560Sed#define	TIOCGPGRP	_IOR('t', 119, int)	/* get pgrp of tty */
133180560Sed#define	TIOCCDTR	 _IO('t', 120)		/* clear data terminal ready */
134180560Sed#define	TIOCSDTR	 _IO('t', 121)		/* set data terminal ready */
135180560Sed#define	TIOCCBRK	 _IO('t', 122)		/* clear break bit */
136180560Sed#define	TIOCSBRK	 _IO('t', 123)		/* set break bit */
137180560Sed						/* 124-127 compat */
1381541Srgrimes
1391541Srgrimes#define	TTYDISC		0		/* termios tty line discipline */
1401541Srgrimes#define	SLIPDISC	4		/* serial IP discipline */
14116429Sbde#define	PPPDISC		5		/* PPP discipline */
14252441Sjulian#define	NETGRAPHDISC	6		/* Netgraph tty node discipline */
143129079Semax#define	H4DISC		7		/* Netgraph Bluetooth H4 discipline */
1441541Srgrimes
1451541Srgrimes#endif /* !_SYS_TTYCOM_H_ */
146