Commit | Line | Data |
---|---|---|
ea139302 PB |
1 | /* |
2 | * Copyright (c) 1989 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
836fe169 | 5 | * %sccs.include.redist.c% |
ea139302 | 6 | * |
970eb138 | 7 | * @(#)defs.h 5.7 (Berkeley) %G% |
ea139302 PB |
8 | */ |
9 | ||
10 | /* | |
11 | * Telnet server defines | |
12 | */ | |
13 | #include <sys/types.h> | |
14 | #include <sys/param.h> | |
15 | ||
16 | #ifndef BSD | |
17 | # define BSD 43 | |
18 | #endif | |
19 | ||
20 | #if BSD > 43 | |
21 | #define USE_TERMIO | |
22 | #endif | |
23 | ||
24 | #ifdef CRAY | |
25 | # define NEWINIT | |
26 | # define SYSV_TERMIO | |
27 | # define NO_GETTYTAB | |
28 | # define signal sigset | |
29 | #endif /* CRAY */ | |
30 | ||
31 | #ifdef SYSV_TERMIO | |
32 | # define USE_TERMIO | |
33 | #endif | |
34 | ||
35 | #include <sys/socket.h> | |
36 | #ifndef CRAY | |
37 | #include <sys/wait.h> | |
38 | #endif /* CRAY */ | |
39 | #include <sys/file.h> | |
40 | #include <sys/stat.h> | |
41 | #include <sys/time.h> | |
053fd49d | 42 | #include <sys/ioctl.h> |
ea139302 PB |
43 | |
44 | #include <netinet/in.h> | |
970eb138 MK |
45 | #include <netinet/in_systm.h> |
46 | #include <netinet/ip.h> | |
ea139302 PB |
47 | |
48 | #include <arpa/telnet.h> | |
49 | ||
50 | #include <stdio.h> | |
51 | #include <signal.h> | |
52 | #include <errno.h> | |
53 | #include <netdb.h> | |
54 | #include <syslog.h> | |
ed8f31c1 PB |
55 | #ifndef LOG_DAEMON |
56 | #define LOG_DAEMON 0 | |
57 | #endif | |
58 | #ifndef LOG_ODELAY | |
59 | #define LOG_ODELAY 0 | |
60 | #endif | |
ea139302 | 61 | #include <ctype.h> |
6ebcb998 | 62 | #include <string.h> |
ea139302 PB |
63 | |
64 | #ifndef USE_TERMIO | |
65 | #include <sgtty.h> | |
ed8f31c1 | 66 | typedef unsigned char cc_t; |
ea139302 PB |
67 | #else |
68 | # ifdef SYSV_TERMIO | |
69 | # include <termio.h> | |
70 | # else | |
71 | # include <termios.h> | |
72 | # endif | |
73 | #endif | |
74 | ||
75 | #ifdef CRAY | |
76 | #include <sys/fcntl.h> | |
ea139302 PB |
77 | # ifdef CRAY1 |
78 | # include <sys/pty.h> | |
79 | # ifndef FD_ZERO | |
80 | # include <sys/select.h> | |
81 | # endif /* FD_ZERO */ | |
82 | # endif /* CRAY1 */ | |
83 | ||
84 | #include <memory.h> | |
85 | #endif /* CRAY */ | |
86 | ||
87 | #if defined(TCSIG) || defined(TIOCPKT_IOCTL) | |
88 | # define LINEMODE | |
89 | # define KLUDGELINEMODE | |
90 | #endif | |
91 | ||
92 | #ifndef FD_SET | |
ed8f31c1 | 93 | #ifndef HAVE_fd_set |
ea139302 | 94 | typedef struct fd_set { int fds_bits[1]; } fd_set; |
ed8f31c1 | 95 | #endif |
ea139302 PB |
96 | |
97 | #define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n))) | |
98 | #define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n))) | |
99 | #define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n))) | |
100 | #define FD_ZERO(p) ((p)->fds_bits[0] = 0) | |
101 | #endif /* FD_SET */ | |
102 | ||
103 | #define OPT_NO 0 /* won't do this option */ | |
104 | #define OPT_YES 1 /* will do this option */ | |
105 | #define OPT_YES_BUT_ALWAYS_LOOK 2 | |
106 | #define OPT_NO_BUT_ALWAYS_LOOK 3 | |
107 | ||
108 | /* | |
109 | * I/O data buffers defines | |
110 | */ | |
111 | #define NETSLOP 64 | |
112 | #ifdef CRAY | |
113 | #undef BUFSIZ | |
114 | #define BUFSIZ 2048 | |
115 | #endif | |
116 | ||
117 | #define NIACCUM(c) { *netip++ = c; \ | |
118 | ncc++; \ | |
119 | } | |
120 | ||
121 | /* clock manipulations */ | |
122 | #define settimer(x) (clocks.x = ++clocks.system) | |
123 | #define sequenceIs(x,y) (clocks.x < clocks.y) | |
124 | ||
125 | /* | |
126 | * Linemode support states, in decreasing order of importance | |
127 | */ | |
128 | #define REAL_LINEMODE 0x02 | |
129 | #define KLUDGE_LINEMODE 0x01 | |
130 | #define NO_LINEMODE 0x00 | |
131 | ||
132 | /* | |
133 | * Structures of information for each special character function. | |
134 | */ | |
135 | typedef struct { | |
136 | unsigned char flag; /* the flags for this function */ | |
ed8f31c1 | 137 | cc_t val; /* the value of the special character */ |
ea139302 PB |
138 | } slcent, *Slcent; |
139 | ||
140 | typedef struct { | |
141 | slcent defset; /* the default settings */ | |
142 | slcent current; /* the current settings */ | |
ed8f31c1 | 143 | cc_t *sptr; /* a pointer to the char in */ |
ea139302 PB |
144 | /* system data structures */ |
145 | } slcfun, *Slcfun; |