1*6dc39e21Ssf /* $OpenBSD: tty_conf.c,v 1.23 2015/12/22 20:31:51 sf Exp $ */
22e7fd52cSderaadt /* $NetBSD: tty_conf.c,v 1.18 1996/05/19 17:17:55 jonathan Exp $ */
3df930be7Sderaadt
4df930be7Sderaadt /*-
5df930be7Sderaadt * Copyright (c) 1982, 1986, 1991, 1993
6df930be7Sderaadt * The Regents of the University of California. All rights reserved.
7df930be7Sderaadt * (c) UNIX System Laboratories, Inc.
8df930be7Sderaadt * All or some portions of this file are derived from material licensed
9df930be7Sderaadt * to the University of California by American Telephone and Telegraph
10df930be7Sderaadt * Co. or Unix System Laboratories, Inc. and are reproduced herein with
11df930be7Sderaadt * the permission of UNIX System Laboratories, Inc.
12df930be7Sderaadt *
13df930be7Sderaadt * Redistribution and use in source and binary forms, with or without
14df930be7Sderaadt * modification, are permitted provided that the following conditions
15df930be7Sderaadt * are met:
16df930be7Sderaadt * 1. Redistributions of source code must retain the above copyright
17df930be7Sderaadt * notice, this list of conditions and the following disclaimer.
18df930be7Sderaadt * 2. Redistributions in binary form must reproduce the above copyright
19df930be7Sderaadt * notice, this list of conditions and the following disclaimer in the
20df930be7Sderaadt * documentation and/or other materials provided with the distribution.
2129295d1cSmillert * 3. Neither the name of the University nor the names of its contributors
22df930be7Sderaadt * may be used to endorse or promote products derived from this software
23df930be7Sderaadt * without specific prior written permission.
24df930be7Sderaadt *
25df930be7Sderaadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26df930be7Sderaadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27df930be7Sderaadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28df930be7Sderaadt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29df930be7Sderaadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30df930be7Sderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31df930be7Sderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32df930be7Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33df930be7Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34df930be7Sderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35df930be7Sderaadt * SUCH DAMAGE.
36df930be7Sderaadt *
37df930be7Sderaadt * @(#)tty_conf.c 8.4 (Berkeley) 1/21/94
38df930be7Sderaadt */
39df930be7Sderaadt
40df930be7Sderaadt #include <sys/param.h>
41df930be7Sderaadt #include <sys/systm.h>
42df930be7Sderaadt #include <sys/tty.h>
43df930be7Sderaadt #include <sys/conf.h>
44df930be7Sderaadt
45*6dc39e21Ssf #include "ppp.h"
46*6dc39e21Ssf #include "nmea.h"
47*6dc39e21Ssf #include "msts.h"
48*6dc39e21Ssf #include "endrun.h"
49*6dc39e21Ssf
5079f6c33aStedu #define ttynodisc ((int (*)(dev_t, struct tty *, struct proc *))enodev)
5179f6c33aStedu #define ttyerrclose ((int (*)(struct tty *, int flags, struct proc *))enodev)
52c4071fd1Smillert #define ttyerrio ((int (*)(struct tty *, struct uio *, int))enodev)
53c4071fd1Smillert #define ttyerrinput ((int (*)(int c, struct tty *))enodev)
54c4071fd1Smillert #define ttyerrstart ((int (*)(struct tty *))enodev)
55df930be7Sderaadt
56df930be7Sderaadt struct linesw linesw[] =
57df930be7Sderaadt {
58df930be7Sderaadt { ttyopen, ttylclose, ttread, ttwrite, nullioctl,
59df930be7Sderaadt ttyinput, ttstart, ttymodem }, /* 0- termios */
60df930be7Sderaadt
61df930be7Sderaadt { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
62df930be7Sderaadt ttyerrinput, ttyerrstart, nullmodem }, /* 1- defunct */
63df930be7Sderaadt
643d8d03f3Snaddy /* 2- old NTTYDISC (defunct) */
653d8d03f3Snaddy { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
663d8d03f3Snaddy ttyerrinput, ttyerrstart, nullmodem },
67df930be7Sderaadt
68c1582b1dSmbalmer /* 3- TABLDISC (defunct) */
69df930be7Sderaadt { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
70df930be7Sderaadt ttyerrinput, ttyerrstart, nullmodem },
71df930be7Sderaadt
729e59d828Smpi /* 4- SLIPDISC (defunct) */
73df930be7Sderaadt { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
74df930be7Sderaadt ttyerrinput, ttyerrstart, nullmodem },
75df930be7Sderaadt
76df930be7Sderaadt #if NPPP > 0
77df930be7Sderaadt { pppopen, pppclose, pppread, pppwrite, ppptioctl,
78df930be7Sderaadt pppinput, pppstart, ttymodem }, /* 5- PPPDISC */
79df930be7Sderaadt #else
80df930be7Sderaadt { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
81df930be7Sderaadt ttyerrinput, ttyerrstart, nullmodem },
82df930be7Sderaadt #endif
832e7fd52cSderaadt
84b37a991bSjsg /* 6- STRIPDISC (defunct) */
852e7fd52cSderaadt { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
862e7fd52cSderaadt ttyerrinput, ttyerrstart, nullmodem },
87cb6f9c50Smbalmer
88cb6f9c50Smbalmer #if NNMEA > 0
89cb6f9c50Smbalmer { nmeaopen, nmeaclose, ttread, ttwrite, nullioctl,
90cb6f9c50Smbalmer nmeainput, ttstart, ttymodem }, /* 7- NMEADISC */
91cb6f9c50Smbalmer #else
92cb6f9c50Smbalmer { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
93cb6f9c50Smbalmer ttyerrinput, ttyerrstart, nullmodem },
94cb6f9c50Smbalmer #endif
9597189cdcSmbalmer
9697189cdcSmbalmer #if NMSTS > 0
9797189cdcSmbalmer { mstsopen, mstsclose, ttread, ttwrite, nullioctl,
9897189cdcSmbalmer mstsinput, ttstart, ttymodem }, /* 8- MSTSDISC */
9997189cdcSmbalmer #else
10097189cdcSmbalmer { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
10197189cdcSmbalmer ttyerrinput, ttyerrstart, nullmodem },
10297189cdcSmbalmer #endif
10361406af6Sstevesk
10461406af6Sstevesk #if NENDRUN > 0
10561406af6Sstevesk { endrunopen, endrunclose, ttread, ttwrite, nullioctl,
10661406af6Sstevesk endruninput, ttstart, ttymodem }, /* 9- ENDRUNDISC */
10761406af6Sstevesk #else
10861406af6Sstevesk { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl,
10961406af6Sstevesk ttyerrinput, ttyerrstart, nullmodem },
11061406af6Sstevesk #endif
111df930be7Sderaadt };
112df930be7Sderaadt
113df930be7Sderaadt int nlinesw = sizeof (linesw) / sizeof (linesw[0]);
114df930be7Sderaadt
115df930be7Sderaadt /*
116df930be7Sderaadt * Do nothing specific version of line
117df930be7Sderaadt * discipline specific ioctl command.
118df930be7Sderaadt */
1195ac46f4aSniklas int
nullioctl(struct tty * tp,u_long cmd,char * data,int flags,struct proc * p)12045c81e76Sjsg nullioctl(struct tty *tp, u_long cmd, char *data, int flags, struct proc *p)
121df930be7Sderaadt {
122df930be7Sderaadt return (-1);
123df930be7Sderaadt }
124