2 * ntp_tty.h - header file for serial lines handling
8 * use only one tty model - no use in initialising
10 * HAVE_TERMIOS is preferred over HAVE_SYSV_TTYS over HAVE_BSD_TTYS
13 #if defined(HAVE_TERMIOS_H) || defined(HAVE_SYS_TERMIOS_H)
15 #elif defined(HAVE_TERMIO_H)
16 # define HAVE_SYSV_TTYS
17 #elif defined(HAVE_SGTTY_H)
18 # define HAVE_BSD_TTYS
21 #if !defined(VMS) && !defined(SYS_VXWORKS)
22 # if !defined(HAVE_SYSV_TTYS) \
23 && !defined(HAVE_BSD_TTYS) \
24 && !defined(HAVE_TERMIOS)
25 #include "ERROR: no tty type defined!"
27 #endif /* !VMS && !SYS_VXWORKS*/
29 #if defined(HAVE_BSD_TTYS)
31 #define TTY struct sgttyb
32 #endif /* HAVE_BSD_TTYS */
34 #if defined(HAVE_SYSV_TTYS)
36 #define TTY struct termio
38 #define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
41 #define TCSANOW TCSETA
53 #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
55 #endif /* HAVE_SYSV_TTYS */
57 #if defined(HAVE_TERMIOS)
58 # if defined(HAVE_TERMIOS_H)
59 # ifdef TERMIOS_NEEDS__SVID3
63 # ifdef TERMIOS_NEEDS__SVID3
66 # elif defined(HAVE_SYS_TERMIOS_H)
67 # include <sys/termios.h>
69 # define TTY struct termios
72 #if defined(HAVE_SYS_MODEM_H)
73 #include <sys/modem.h>
77 * Line discipline flags. The depredated ones required line discipline
78 * or streams modules to be installed/loaded in the kernel and are now
79 * ignored. Leave the LDISC_CLK and other deprecated symbols defined
80 * until 2013 or 2014 to avoid complicating the use of newer drivers on
81 * older ntpd, which is often as easy as dropping in the refclock *.c.
83 #define LDISC_STD 0x000 /* standard */
84 #define LDISC_CLK 0x001 /* depredated tty_clk \n */
85 #define LDISC_CLKPPS 0x002 /* depredated tty_clk \377 */
86 #define LDISC_ACTS 0x004 /* depredated tty_clk #* */
87 #define LDISC_CHU 0x008 /* depredated */
88 #define LDISC_PPS 0x010 /* depredated */
89 #define LDISC_RAW 0x020 /* raw binary */
90 #define LDISC_ECHO 0x040 /* enable echo */
91 #define LDISC_REMOTE 0x080 /* remote mode */
92 #define LDISC_7O1 0x100 /* 7-bit, odd parity for Z3801A */
94 /* function prototypes for ntp_tty.c */
95 #if !defined(SYS_VXWORKS) && !defined(SYS_WINNT)
96 # if defined(HAVE_TERMIOS) || defined(HAVE_SYSV_TTYS) || \
97 defined(HAVE_BSD_TTYS)
98 extern int ntp_tty_setup(int, u_int, u_int);
99 extern int ntp_tty_ioctl(int, u_int);
103 #endif /* NTP_TTY_H */