1*38905Sborman /* 2*38905Sborman * Copyright (c) 1989 The Regents of the University of California. 3*38905Sborman * All rights reserved. 4*38905Sborman * 5*38905Sborman * Redistribution and use in source and binary forms are permitted 6*38905Sborman * provided that the above copyright notice and this paragraph are 7*38905Sborman * duplicated in all such forms and that any documentation, 8*38905Sborman * advertising materials, and other materials related to such 9*38905Sborman * distribution and use acknowledge that the software was developed 10*38905Sborman * by the University of California, Berkeley. The name of the 11*38905Sborman * University may not be used to endorse or promote products derived 12*38905Sborman * from this software without specific prior written permission. 13*38905Sborman * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*38905Sborman * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*38905Sborman * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16*38905Sborman * 17*38905Sborman * @(#)defs.h 5.1 (Berkeley) 09/01/89 18*38905Sborman */ 19*38905Sborman 20*38905Sborman /* 21*38905Sborman * Telnet server defines 22*38905Sborman */ 23*38905Sborman #include <sys/types.h> 24*38905Sborman #include <sys/param.h> 25*38905Sborman 26*38905Sborman #ifndef BSD 27*38905Sborman # define BSD 43 28*38905Sborman #endif 29*38905Sborman 30*38905Sborman #if BSD > 43 31*38905Sborman #define USE_TERMIO 32*38905Sborman #endif 33*38905Sborman 34*38905Sborman #ifdef CRAY 35*38905Sborman # define NEWINIT 36*38905Sborman # define SYSV_TERMIO 37*38905Sborman # define NO_GETTYTAB 38*38905Sborman # define signal sigset 39*38905Sborman #endif /* CRAY */ 40*38905Sborman 41*38905Sborman #ifdef SYSV_TERMIO 42*38905Sborman # define USE_TERMIO 43*38905Sborman #endif 44*38905Sborman 45*38905Sborman #include <sys/socket.h> 46*38905Sborman #ifndef CRAY 47*38905Sborman #include <sys/wait.h> 48*38905Sborman #endif /* CRAY */ 49*38905Sborman #include <sys/file.h> 50*38905Sborman #include <sys/stat.h> 51*38905Sborman #include <sys/time.h> 52*38905Sborman 53*38905Sborman #include <netinet/in.h> 54*38905Sborman 55*38905Sborman #include <arpa/telnet.h> 56*38905Sborman 57*38905Sborman #include <stdio.h> 58*38905Sborman #include <signal.h> 59*38905Sborman #include <errno.h> 60*38905Sborman #include <netdb.h> 61*38905Sborman #include <syslog.h> 62*38905Sborman #include <ctype.h> 63*38905Sborman #include <strings.h> 64*38905Sborman 65*38905Sborman #ifndef USE_TERMIO 66*38905Sborman #include <sgtty.h> 67*38905Sborman #else 68*38905Sborman # ifdef SYSV_TERMIO 69*38905Sborman # include <termio.h> 70*38905Sborman # else 71*38905Sborman # include <termios.h> 72*38905Sborman # endif 73*38905Sborman #endif 74*38905Sborman 75*38905Sborman #ifdef CRAY 76*38905Sborman #include <sys/fcntl.h> 77*38905Sborman #include <sys/ioctl.h> 78*38905Sborman # ifdef CRAY1 79*38905Sborman # include <sys/pty.h> 80*38905Sborman # ifndef FD_ZERO 81*38905Sborman # include <sys/select.h> 82*38905Sborman # endif /* FD_ZERO */ 83*38905Sborman # endif /* CRAY1 */ 84*38905Sborman 85*38905Sborman #include <memory.h> 86*38905Sborman #endif /* CRAY */ 87*38905Sborman 88*38905Sborman #if defined(TCSIG) || defined(TIOCPKT_IOCTL) 89*38905Sborman # define LINEMODE 90*38905Sborman # define KLUDGELINEMODE 91*38905Sborman #endif 92*38905Sborman 93*38905Sborman #ifndef FD_SET 94*38905Sborman typedef struct fd_set { int fds_bits[1]; } fd_set; 95*38905Sborman 96*38905Sborman #define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n))) 97*38905Sborman #define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n))) 98*38905Sborman #define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n))) 99*38905Sborman #define FD_ZERO(p) ((p)->fds_bits[0] = 0) 100*38905Sborman #endif /* FD_SET */ 101*38905Sborman 102*38905Sborman #define OPT_NO 0 /* won't do this option */ 103*38905Sborman #define OPT_YES 1 /* will do this option */ 104*38905Sborman #define OPT_YES_BUT_ALWAYS_LOOK 2 105*38905Sborman #define OPT_NO_BUT_ALWAYS_LOOK 3 106*38905Sborman 107*38905Sborman /* 108*38905Sborman * I/O data buffers defines 109*38905Sborman */ 110*38905Sborman #define NETSLOP 64 111*38905Sborman #ifdef CRAY 112*38905Sborman #undef BUFSIZ 113*38905Sborman #define BUFSIZ 2048 114*38905Sborman #endif 115*38905Sborman 116*38905Sborman #define NIACCUM(c) { *netip++ = c; \ 117*38905Sborman ncc++; \ 118*38905Sborman } 119*38905Sborman 120*38905Sborman /* clock manipulations */ 121*38905Sborman #define settimer(x) (clocks.x = ++clocks.system) 122*38905Sborman #define sequenceIs(x,y) (clocks.x < clocks.y) 123*38905Sborman 124*38905Sborman /* 125*38905Sborman * Linemode support states, in decreasing order of importance 126*38905Sborman */ 127*38905Sborman #define REAL_LINEMODE 0x02 128*38905Sborman #define KLUDGE_LINEMODE 0x01 129*38905Sborman #define NO_LINEMODE 0x00 130*38905Sborman 131*38905Sborman /* 132*38905Sborman * Structures of information for each special character function. 133*38905Sborman */ 134*38905Sborman typedef struct { 135*38905Sborman unsigned char flag; /* the flags for this function */ 136*38905Sborman unsigned char val; /* the value of the special character */ 137*38905Sborman } slcent, *Slcent; 138*38905Sborman 139*38905Sborman typedef struct { 140*38905Sborman slcent defset; /* the default settings */ 141*38905Sborman slcent current; /* the current settings */ 142*38905Sborman unsigned char *sptr; /* a pointer to the char in */ 143*38905Sborman /* system data structures */ 144*38905Sborman } slcfun, *Slcfun; 145