xref: /csrg-svn/libexec/telnetd/defs.h (revision 42673)
138905Sborman /*
238905Sborman  * Copyright (c) 1989 The Regents of the University of California.
338905Sborman  * All rights reserved.
438905Sborman  *
5*42673Sbostic  * %sccs.include.redist.c%
638905Sborman  *
7*42673Sbostic  *	@(#)defs.h	5.6 (Berkeley) 06/01/90
838905Sborman  */
938905Sborman 
1038905Sborman /*
1138905Sborman  * Telnet server defines
1238905Sborman  */
1338905Sborman #include <sys/types.h>
1438905Sborman #include <sys/param.h>
1538905Sborman 
1638905Sborman #ifndef	BSD
1738905Sborman # define	BSD 43
1838905Sborman #endif
1938905Sborman 
2038905Sborman #if BSD > 43
2138905Sborman #define	USE_TERMIO
2238905Sborman #endif
2338905Sborman 
2438905Sborman #ifdef	CRAY
2538905Sborman # define	NEWINIT
2638905Sborman # define	SYSV_TERMIO
2738905Sborman # define	NO_GETTYTAB
2838905Sborman # define	signal sigset
2938905Sborman #endif	/* CRAY */
3038905Sborman 
3138905Sborman #ifdef	SYSV_TERMIO
3238905Sborman # define	USE_TERMIO
3338905Sborman #endif
3438905Sborman 
3538905Sborman #include <sys/socket.h>
3638905Sborman #ifndef	CRAY
3738905Sborman #include <sys/wait.h>
3838905Sborman #endif	/* CRAY */
3938905Sborman #include <sys/file.h>
4038905Sborman #include <sys/stat.h>
4138905Sborman #include <sys/time.h>
4239503Sborman #include <sys/ioctl.h>
4338905Sborman 
4438905Sborman #include <netinet/in.h>
4538905Sborman 
4638905Sborman #include <arpa/telnet.h>
4738905Sborman 
4838905Sborman #include <stdio.h>
4938905Sborman #include <signal.h>
5038905Sborman #include <errno.h>
5138905Sborman #include <netdb.h>
5238905Sborman #include <syslog.h>
5340242Sborman #ifndef	LOG_DAEMON
5440242Sborman #define	LOG_DAEMON	0
5540242Sborman #endif
5640242Sborman #ifndef	LOG_ODELAY
5740242Sborman #define	LOG_ODELAY	0
5840242Sborman #endif
5938905Sborman #include <ctype.h>
6042029Sbostic #include <string.h>
6138905Sborman 
6238905Sborman #ifndef	USE_TERMIO
6338905Sborman #include <sgtty.h>
6440242Sborman typedef unsigned char cc_t;
6538905Sborman #else
6638905Sborman # ifdef	SYSV_TERMIO
6738905Sborman # include <termio.h>
6838905Sborman # else
6938905Sborman # include <termios.h>
7038905Sborman # endif
7138905Sborman #endif
7238905Sborman 
7338905Sborman #ifdef	CRAY
7438905Sborman #include <sys/fcntl.h>
7538905Sborman # ifdef	CRAY1
7638905Sborman # include <sys/pty.h>
7738905Sborman #  ifndef FD_ZERO
7838905Sborman # include <sys/select.h>
7938905Sborman #  endif /* FD_ZERO */
8038905Sborman # endif	/* CRAY1 */
8138905Sborman 
8238905Sborman #include <memory.h>
8338905Sborman #endif	/* CRAY */
8438905Sborman 
8538905Sborman #if	defined(TCSIG) || defined(TIOCPKT_IOCTL)
8638905Sborman # define	LINEMODE
8738905Sborman # define	KLUDGELINEMODE
8838905Sborman #endif
8938905Sborman 
9038905Sborman #ifndef	FD_SET
9140242Sborman #ifndef	HAVE_fd_set
9238905Sborman typedef struct fd_set { int fds_bits[1]; } fd_set;
9340242Sborman #endif
9438905Sborman 
9538905Sborman #define	FD_SET(n, p)	((p)->fds_bits[0] |= (1<<(n)))
9638905Sborman #define	FD_CLR(n, p)	((p)->fds_bits[0] &= ~(1<<(n)))
9738905Sborman #define	FD_ISSET(n, p)	((p)->fds_bits[0] & (1<<(n)))
9838905Sborman #define FD_ZERO(p)	((p)->fds_bits[0] = 0)
9938905Sborman #endif	/* FD_SET */
10038905Sborman 
10138905Sborman #define	OPT_NO			0		/* won't do this option */
10238905Sborman #define	OPT_YES			1		/* will do this option */
10338905Sborman #define	OPT_YES_BUT_ALWAYS_LOOK	2
10438905Sborman #define	OPT_NO_BUT_ALWAYS_LOOK	3
10538905Sborman 
10638905Sborman /*
10738905Sborman  * I/O data buffers defines
10838905Sborman  */
10938905Sborman #define	NETSLOP	64
11038905Sborman #ifdef CRAY
11138905Sborman #undef BUFSIZ
11238905Sborman #define BUFSIZ  2048
11338905Sborman #endif
11438905Sborman 
11538905Sborman #define	NIACCUM(c)	{   *netip++ = c; \
11638905Sborman 			    ncc++; \
11738905Sborman 			}
11838905Sborman 
11938905Sborman /* clock manipulations */
12038905Sborman #define	settimer(x)	(clocks.x = ++clocks.system)
12138905Sborman #define	sequenceIs(x,y)	(clocks.x < clocks.y)
12238905Sborman 
12338905Sborman /*
12438905Sborman  * Linemode support states, in decreasing order of importance
12538905Sborman  */
12638905Sborman #define REAL_LINEMODE	0x02
12738905Sborman #define KLUDGE_LINEMODE	0x01
12838905Sborman #define NO_LINEMODE	0x00
12938905Sborman 
13038905Sborman /*
13138905Sborman  * Structures of information for each special character function.
13238905Sborman  */
13338905Sborman typedef struct {
13438905Sborman 	unsigned char	flag;		/* the flags for this function */
13540242Sborman 	cc_t		val;		/* the value of the special character */
13638905Sborman } slcent, *Slcent;
13738905Sborman 
13838905Sborman typedef struct {
13938905Sborman 	slcent		defset;		/* the default settings */
14038905Sborman 	slcent		current;	/* the current settings */
14140242Sborman 	cc_t		*sptr;		/* a pointer to the char in */
14238905Sborman 					/* system data structures */
14338905Sborman } slcfun, *Slcfun;
144