xref: /csrg-svn/libexec/telnetd/defs.h (revision 39503)
138905Sborman /*
238905Sborman  * Copyright (c) 1989 The Regents of the University of California.
338905Sborman  * All rights reserved.
438905Sborman  *
538905Sborman  * Redistribution and use in source and binary forms are permitted
638905Sborman  * provided that the above copyright notice and this paragraph are
738905Sborman  * duplicated in all such forms and that any documentation,
838905Sborman  * advertising materials, and other materials related to such
938905Sborman  * distribution and use acknowledge that the software was developed
1038905Sborman  * by the University of California, Berkeley.  The name of the
1138905Sborman  * University may not be used to endorse or promote products derived
1238905Sborman  * from this software without specific prior written permission.
1338905Sborman  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1438905Sborman  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1538905Sborman  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1638905Sborman  *
17*39503Sborman  *	@(#)defs.h	5.3 (Berkeley) 11/10/89
1838905Sborman  */
1938905Sborman 
2038905Sborman /*
2138905Sborman  * Telnet server defines
2238905Sborman  */
2338905Sborman #include <sys/types.h>
2438905Sborman #include <sys/param.h>
2538905Sborman 
2638905Sborman #ifndef	BSD
2738905Sborman # define	BSD 43
2838905Sborman #endif
2938905Sborman 
3038905Sborman #if BSD > 43
3138905Sborman #define	USE_TERMIO
3238905Sborman #endif
3338905Sborman 
3438905Sborman #ifdef	CRAY
3538905Sborman # define	NEWINIT
3638905Sborman # define	SYSV_TERMIO
3738905Sborman # define	NO_GETTYTAB
3838905Sborman # define	signal sigset
3938905Sborman #endif	/* CRAY */
4038905Sborman 
4138905Sborman #ifdef	SYSV_TERMIO
4238905Sborman # define	USE_TERMIO
4338905Sborman #endif
4438905Sborman 
4538905Sborman #include <sys/socket.h>
4638905Sborman #ifndef	CRAY
4738905Sborman #include <sys/wait.h>
4838905Sborman #endif	/* CRAY */
4938905Sborman #include <sys/file.h>
5038905Sborman #include <sys/stat.h>
5138905Sborman #include <sys/time.h>
52*39503Sborman #include <sys/ioctl.h>
5338905Sborman 
5438905Sborman #include <netinet/in.h>
5538905Sborman 
5638905Sborman #include <arpa/telnet.h>
5738905Sborman 
5838905Sborman #include <stdio.h>
5938905Sborman #include <signal.h>
6038905Sborman #include <errno.h>
6138905Sborman #include <netdb.h>
6238905Sborman #include <syslog.h>
6338905Sborman #include <ctype.h>
6438905Sborman #include <strings.h>
6538905Sborman 
6638905Sborman #ifndef	USE_TERMIO
6738905Sborman #include <sgtty.h>
6838905Sborman #else
6938905Sborman # ifdef	SYSV_TERMIO
7038905Sborman # include <termio.h>
7138905Sborman # else
7238905Sborman # include <termios.h>
7338905Sborman # endif
7438905Sborman #endif
7538905Sborman 
7638905Sborman #ifdef	CRAY
7738905Sborman #include <sys/fcntl.h>
7838905Sborman # ifdef	CRAY1
7938905Sborman # include <sys/pty.h>
8038905Sborman #  ifndef FD_ZERO
8138905Sborman # include <sys/select.h>
8238905Sborman #  endif /* FD_ZERO */
8338905Sborman # endif	/* CRAY1 */
8438905Sborman 
8538905Sborman #include <memory.h>
8638905Sborman #endif	/* CRAY */
8738905Sborman 
8838905Sborman #if	defined(TCSIG) || defined(TIOCPKT_IOCTL)
8938905Sborman # define	LINEMODE
9038905Sborman # define	KLUDGELINEMODE
9138905Sborman #endif
9238905Sborman 
9338905Sborman #ifndef	FD_SET
9438905Sborman typedef struct fd_set { int fds_bits[1]; } fd_set;
9538905Sborman 
9638905Sborman #define	FD_SET(n, p)	((p)->fds_bits[0] |= (1<<(n)))
9738905Sborman #define	FD_CLR(n, p)	((p)->fds_bits[0] &= ~(1<<(n)))
9838905Sborman #define	FD_ISSET(n, p)	((p)->fds_bits[0] & (1<<(n)))
9938905Sborman #define FD_ZERO(p)	((p)->fds_bits[0] = 0)
10038905Sborman #endif	/* FD_SET */
10138905Sborman 
10238905Sborman #define	OPT_NO			0		/* won't do this option */
10338905Sborman #define	OPT_YES			1		/* will do this option */
10438905Sborman #define	OPT_YES_BUT_ALWAYS_LOOK	2
10538905Sborman #define	OPT_NO_BUT_ALWAYS_LOOK	3
10638905Sborman 
10738905Sborman /*
10838905Sborman  * I/O data buffers defines
10938905Sborman  */
11038905Sborman #define	NETSLOP	64
11138905Sborman #ifdef CRAY
11238905Sborman #undef BUFSIZ
11338905Sborman #define BUFSIZ  2048
11438905Sborman #endif
11538905Sborman 
11638905Sborman #define	NIACCUM(c)	{   *netip++ = c; \
11738905Sborman 			    ncc++; \
11838905Sborman 			}
11938905Sborman 
12038905Sborman /* clock manipulations */
12138905Sborman #define	settimer(x)	(clocks.x = ++clocks.system)
12238905Sborman #define	sequenceIs(x,y)	(clocks.x < clocks.y)
12338905Sborman 
12438905Sborman /*
12538905Sborman  * Linemode support states, in decreasing order of importance
12638905Sborman  */
12738905Sborman #define REAL_LINEMODE	0x02
12838905Sborman #define KLUDGE_LINEMODE	0x01
12938905Sborman #define NO_LINEMODE	0x00
13038905Sborman 
13138905Sborman /*
13238905Sborman  * Structures of information for each special character function.
13338905Sborman  */
13438905Sborman typedef struct {
13538905Sborman 	unsigned char	flag;		/* the flags for this function */
13638905Sborman 	unsigned char	val;		/* the value of the special character */
13738905Sborman } slcent, *Slcent;
13838905Sborman 
13938905Sborman typedef struct {
14038905Sborman 	slcent		defset;		/* the default settings */
14138905Sborman 	slcent		current;	/* the current settings */
14238905Sborman 	unsigned char	*sptr;		/* a pointer to the char in */
14338905Sborman 					/* system data structures */
14438905Sborman } slcfun, *Slcfun;
145