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