xref: /freebsd/contrib/ntp/include/ntp_tty.h (revision 8ab2f5ecc596131f6ca790d6ae35540c06ed7985)
1 /*
2  * ntp_tty.h - header file for serial lines handling
3  */
4 
5 #ifndef NTP_TTY_H
6 #define NTP_TTY_H
7 
8 #if defined(HAVE_BSD_TTYS)
9 #include <sgtty.h>
10 #define TTY	struct sgttyb
11 #endif /* HAVE_BSD_TTYS */
12 
13 #if defined(HAVE_SYSV_TTYS)
14 #include <termio.h>
15 #define TTY	struct termio
16 #ifndef tcsetattr
17 #define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
18 #endif
19 #ifndef TCSANOW
20 #define TCSANOW	TCSETA
21 #endif
22 #ifndef TCIFLUSH
23 #define TCIFLUSH 0
24 #endif
25 #ifndef TCOFLUSH
26 #define TCOFLUSH 1
27 #endif
28 #ifndef TCIOFLUSH
29 #define TCIOFLUSH 2
30 #endif
31 #ifndef tcflush
32 #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
33 #endif
34 #endif /* HAVE_SYSV_TTYS */
35 
36 #if defined(HAVE_TERMIOS)
37 # ifdef TERMIOS_NEEDS__SVID3
38 #  define _SVID3
39 # endif
40 # include <termios.h>
41 # ifdef TERMIOS_NEEDS__SVID3
42 #  undef _SVID3
43 # endif
44 #define TTY	struct termios
45 #endif
46 
47 #if defined(HAVE_SYS_MODEM_H)
48 #include <sys/modem.h>
49 #endif
50 
51 #if !defined(SYSV_TTYS) && !defined(STREAM) & !defined(BSD_TTYS)
52 #define BSD_TTYS
53 #endif /* SYSV_TTYS STREAM BSD_TTYS */
54 
55 /*
56  * Line discipline flags. These require line discipline or streams
57  * modules to be installed/loaded in the kernel. If specified, but not
58  * installed, the code runs as if unspecified.
59  */
60 #define LDISC_STD	0x0	/* standard */
61 #define LDISC_CLK	0x1	/* tty_clk \n intercept */
62 #define LDISC_CLKPPS	0x2	/* tty_clk \377 intercept */
63 #define LDISC_ACTS	0x4	/* tty_clk #* intercept */
64 #define LDISC_CHU	0x8	/* depredated */
65 #define LDISC_PPS	0x10	/* ppsclock, ppsapi */
66 #define LDISC_RAW	0x20	/* raw binary */
67 
68 #endif /* NTP_TTY_H */
69