#ifndef NTP_TTY_H
#define NTP_TTY_H
#if defined(HAVE_TERMIOS_H) || defined(HAVE_SYS_TERMIOS_H)
# define HAVE_TERMIOS
#elif defined(HAVE_TERMIO_H)
# define HAVE_SYSV_TTYS
#elif defined(HAVE_SGTTY_H)
# define HAVE_BSD_TTYS
#endif
#if !defined(VMS) && !defined(SYS_VXWORKS)
# if !defined(HAVE_SYSV_TTYS) \
&& !defined(HAVE_BSD_TTYS) \
&& !defined(HAVE_TERMIOS)
#include "ERROR: no tty type defined!"
# endif
#endif
#if defined(HAVE_BSD_TTYS)
#include <sgtty.h>
#define TTY struct sgttyb
#endif
#if defined(HAVE_SYSV_TTYS)
#include <termio.h>
#define TTY struct termio
#ifndef tcsetattr
#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
#endif
#ifndef TCSANOW
#define TCSANOW TCSETA
#endif
#ifndef TCIFLUSH
#define TCIFLUSH 0
#endif
#ifndef TCOFLUSH
#define TCOFLUSH 1
#endif
#ifndef TCIOFLUSH
#define TCIOFLUSH 2
#endif
#ifndef tcflush
#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
#endif
#endif
#if defined(HAVE_TERMIOS)
# if defined(HAVE_TERMIOS_H)
# ifdef TERMIOS_NEEDS__SVID3
# define _SVID3
# endif
# include <termios.h>
# ifdef TERMIOS_NEEDS__SVID3
# undef _SVID3
# endif
# elif defined(HAVE_SYS_TERMIOS_H)
# include <sys/termios.h>
# endif
# define TTY struct termios
#endif
#if defined(HAVE_SYS_MODEM_H)
#include <sys/modem.h>
#endif
#define LDISC_STD 0x000
#define LDISC_CLK 0x001
#define LDISC_CLKPPS 0x002
#define LDISC_ACTS 0x004
#define LDISC_CHU 0x008
#define LDISC_PPS 0x010
#define LDISC_RAW 0x020
#define LDISC_ECHO 0x040
#define LDISC_REMOTE 0x080
#define LDISC_7O1 0x100
#if !defined(SYS_VXWORKS) && !defined(SYS_WINNT)
# if defined(HAVE_TERMIOS) || defined(HAVE_SYSV_TTYS) || \
defined(HAVE_BSD_TTYS)
extern int ntp_tty_setup(int, u_int, u_int);
extern int ntp_tty_ioctl(int, u_int);
# endif
#endif
#endif