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*40242Sborman * @(#)defs.h 5.4 (Berkeley) 02/28/90 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> 5239503Sborman #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> 63*40242Sborman #ifndef LOG_DAEMON 64*40242Sborman #define LOG_DAEMON 0 65*40242Sborman #endif 66*40242Sborman #ifndef LOG_ODELAY 67*40242Sborman #define LOG_ODELAY 0 68*40242Sborman #endif 6938905Sborman #include <ctype.h> 7038905Sborman #include <strings.h> 7138905Sborman 7238905Sborman #ifndef USE_TERMIO 7338905Sborman #include <sgtty.h> 74*40242Sborman typedef unsigned char cc_t; 7538905Sborman #else 7638905Sborman # ifdef SYSV_TERMIO 7738905Sborman # include <termio.h> 7838905Sborman # else 7938905Sborman # include <termios.h> 8038905Sborman # endif 8138905Sborman #endif 8238905Sborman 8338905Sborman #ifdef CRAY 8438905Sborman #include <sys/fcntl.h> 8538905Sborman # ifdef CRAY1 8638905Sborman # include <sys/pty.h> 8738905Sborman # ifndef FD_ZERO 8838905Sborman # include <sys/select.h> 8938905Sborman # endif /* FD_ZERO */ 9038905Sborman # endif /* CRAY1 */ 9138905Sborman 9238905Sborman #include <memory.h> 9338905Sborman #endif /* CRAY */ 9438905Sborman 9538905Sborman #if defined(TCSIG) || defined(TIOCPKT_IOCTL) 9638905Sborman # define LINEMODE 9738905Sborman # define KLUDGELINEMODE 9838905Sborman #endif 9938905Sborman 10038905Sborman #ifndef FD_SET 101*40242Sborman #ifndef HAVE_fd_set 10238905Sborman typedef struct fd_set { int fds_bits[1]; } fd_set; 103*40242Sborman #endif 10438905Sborman 10538905Sborman #define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n))) 10638905Sborman #define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n))) 10738905Sborman #define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n))) 10838905Sborman #define FD_ZERO(p) ((p)->fds_bits[0] = 0) 10938905Sborman #endif /* FD_SET */ 11038905Sborman 11138905Sborman #define OPT_NO 0 /* won't do this option */ 11238905Sborman #define OPT_YES 1 /* will do this option */ 11338905Sborman #define OPT_YES_BUT_ALWAYS_LOOK 2 11438905Sborman #define OPT_NO_BUT_ALWAYS_LOOK 3 11538905Sborman 11638905Sborman /* 11738905Sborman * I/O data buffers defines 11838905Sborman */ 11938905Sborman #define NETSLOP 64 12038905Sborman #ifdef CRAY 12138905Sborman #undef BUFSIZ 12238905Sborman #define BUFSIZ 2048 12338905Sborman #endif 12438905Sborman 12538905Sborman #define NIACCUM(c) { *netip++ = c; \ 12638905Sborman ncc++; \ 12738905Sborman } 12838905Sborman 12938905Sborman /* clock manipulations */ 13038905Sborman #define settimer(x) (clocks.x = ++clocks.system) 13138905Sborman #define sequenceIs(x,y) (clocks.x < clocks.y) 13238905Sborman 13338905Sborman /* 13438905Sborman * Linemode support states, in decreasing order of importance 13538905Sborman */ 13638905Sborman #define REAL_LINEMODE 0x02 13738905Sborman #define KLUDGE_LINEMODE 0x01 13838905Sborman #define NO_LINEMODE 0x00 13938905Sborman 14038905Sborman /* 14138905Sborman * Structures of information for each special character function. 14238905Sborman */ 14338905Sborman typedef struct { 14438905Sborman unsigned char flag; /* the flags for this function */ 145*40242Sborman cc_t val; /* the value of the special character */ 14638905Sborman } slcent, *Slcent; 14738905Sborman 14838905Sborman typedef struct { 14938905Sborman slcent defset; /* the default settings */ 15038905Sborman slcent current; /* the current settings */ 151*40242Sborman cc_t *sptr; /* a pointer to the char in */ 15238905Sborman /* system data structures */ 15338905Sborman } slcfun, *Slcfun; 154